Script to generate barcodes?
Recent RSS
Script to generate barcodes?
From:  Graham van de Ruit
Date:  29. March 2011, 12:03

Hi there

Does anyone know if there are any Scriptographer scripts for generating barcodes, or how one would create one?

I work in book design and regularly need to generate barcodes from ISBN numbers (EAN-JAN-13). I have some scripting experience and would be happy to try to create my own script and share it, but I'm not sure where to find out about barcoding specifically.

I'd appreciate any advice!


Re: Script to generate barcodes?
From:  cindy
Date:  6. August 2013, 10:25

as for this question, I'd like to share with you guys this online barcode generator

Re: Script to generate barcodes?
From:  chanage70
Date:  13. August 2013, 09:40

I have used this free trial ISBN barcode generator. You can find sample code to create the barcode there. Here is the sample code:
using System;
using System.Collections.Generic;
using System.Text;
using OnBarcode.Barcode;
using System.Drawing.Imaging;
using System.Drawing;

Linear barcode = new Linear();

// ISBN Barcode Basic Settings
barcode.Type = BarcodeType.ISBN;

ISBN Valid data char set:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits)

ISBN Valid data length: 12 digits only, starting with "978" or "979" only
barcode.Data = "978730216365";

// for ISBN with supplement data (2 or 5 digits)
barcode.SupData = "12";
// supplement bar height vs bar height ratio
barcode.SupHeight = 0.8f;
// space between barcode and supplement barcode (in pixel)
barcode.SupSpace = 15;

// Barcode Size Related Settings
barcode.UOM = UnitOfMeasure.PIXEL;
barcode.X = 1;
barcode.Y = 80;
barcode.LeftMargin = 20;
barcode.RightMargin = 20;
barcode.TopMargin = 0;
barcode.BottomMargin = 0;
barcode.Resolution = 96;
barcode.Rotate = Rotate.Rotate0;

// Barcode Text Settings
barcode.ShowText = true;
barcode.TextFont = new Font("Arial", 9f, FontStyle.Regular);
barcode.TextMargin = 6;

// Image format setting
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif;

For more info, you can read this barcode creation guide.

Re: Script to generate barcodes?
From:  lifemore
Date:  16. August 2013, 04:23

here is a tutorial about how to generate ISBN barcodes. i'd like to share with you. take a look at the barcode maker.

Re: Script to generate barcodes?
From:  cindy313
Date:  20. August 2013, 09:55

in which platform you wanna generate ISBN barcode in ? well,i've ever used ISBN barcode generator in demo code ,you may have a look
and besides,

Re: Script to generate barcodes?
From:  arron lee
Date:  22. September 2013, 09:28

I have only tried to generate ISBN barcode using VB.NET before. And npw I am looking for a fine tool to help me deal with reading ISBN barcode using C#.NET. Any help will be appreciated. Thanks in advance.

Best regards,

Re: Script to generate barcodes?
From:  mariah313
Date:  22. September 2013, 09:35

or you may check this ISBN barcode in winformsor another example about ISBN in crystal report

Re: Script to generate barcodes?
From:  hongdida
Date:  27. May 2014, 11:50
Re: Script to generate barcodes?
From:  andyadams
Date:  9. February 2015, 09:32

According to that you work in book design,you may use isbn barcode generator to generate isbn barcode.
Here is a simple PHP script for generating barocdes:

//For displaying barcodes

//Arguments are:
//  code    Number you want outputted as a barcode

//You can use this script in two ways:
//  From a webpage/PHP script   <img src='/images/barcode.php?code=12345'/>
//  Directly in your web browser

//Outputs the code as a barcode, surrounded by an asterisk (as per standard)
//Will only output numbers, text will appear as gaps
//Image width is dynamic, depending on how much data there is

//Get the barcode font (called 'free3of9') from here

header("Content-type: image/png");
$file = "images/barcode.png"; // path to base png image
$im = imagecreatefrompng($file); // open the blank image
$string = $_GET['code']; // get the code from URL
imagealphablending($im, true); // set alpha blending on
imagesavealpha($im, true); // save alphablending setting (important)

$black = imagecolorallocate($im, 0, 0, 0); // colour of barcode

$font_height=40; // barcode font size. anything smaller and it will appear jumbled and will not be able to be read by scanners

$newwidth=((strlen($string)*20)+41); // allocate width of barcode. each character is 20px across, plus add in the asterisk's
$thumb = imagecreatetruecolor($newwidth, 40); // generate a new image with correct dimensions

imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, 40, 10, 10); // copy image to thumb
imagettftext($thumb, $font_height, 0, 1, 40, $black, 'c:windowsfontsfree3of9.ttf', '*'.$string.'*'); // add text to image

//show the image
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Variator 08.01.12