BARCODE Generator Description
This 1D- and 2D barcode generator enriches many Linux or UNIX* application with the capability of printing many different 1D and 2D barcodes. You can find a PDF example here.
Basic requirement is the use of laser printers, "talking" PCL* 5e like HP-LJ4* etc. This tool offers an affordable and easy way of printing barcodes without adding any physical components. It trades standard input (stdin) as printable data and scans it for special barcode command sequences. While this special sequence does not appear in the input stream, data is copied to standard output (stdout) without any modification. Once BARCODE recognizes the command sequence, an appropriate barcode is generated and inserted into the output stream in form of PCL*- commands. For printing a barcode on UNIX* (or Linux*) platforms, just replace the original print command with a shell script, containing the following line:
cat $1 | barcode [-# <registration id>] | lpr -o raw
Without paramter -# , data and text will be scrambled from time to time (demo mode).
The following command syntax will then be interpreted as a barcode command:
!R! BARCODE <mode>,"<text>","<data>",<x>,<y>,<width>,<height>,<rotation>,<options>;EXIT;
- <mode> Barcode symbology; supported values:
0 for "Interleaved 2 of 5 ",
1 for "Code 39", "Code 39 extended"
2 for "Code 128" or "GS1-128" (EAN 128)
3 for "Codabar",
4 for "MSI",
5 for "GTIN-13 / EAN-13"
6 for "GTIN-12 / UPC-12"
2D symbologies (PCL5 mode only):
128 for "QR Code"
129 for "Datamatrix"
- "<text>" Human readable text, that will be printed on top of or below the bars. Character density (CPI) will be adjusted depending on bar code width. BARCODE uses character set 'ISO 8859-1 Latin 1 / ECMA1' and style 'Courier'. If necessary, text height may be reduced by adding some spaces on both sides of <text>.
Note: For some reasons, at least one character (e.g. space) must be supplied, otherwise the command will not be recognized!
- "<data>" Data sequence to be drawn as a barcode. If necessary (mode dependent), <data> will be automatically zero-prefixed
(Note: 'interleaved 2 of 5' barcodes always need an even number of data elements, including check character).
- <x> Horizontal offset, given in mm relative to the actual cursor position and with respect to the upper left corner of a imaginary barcode bounding box (viewed in scanning direction). Negative values will result in left shifted, positive values in right shifted output.
- <y> Vertical offset, given in mm relative to the actual cursor position and with respect to the upper left corner of a imaginary barcode bounding box (viewed in scanning direction). Negative values will result in up shifted, positive values in down shifted output.
- <width> Barcode width, given in mm (viewed in scanning direction). 2D symbologies only: Height and width in mm
- <height> (1D symbologies only) Barcode height, given in mm.
- <rotation> (1D symbologies only): 0 = Horizontally oriented barcode. 1 = 90 degrees counter-clockwise rotated barcode.
- <options> Options must be build by the sum of:
Printer language:1D symbologies:
0 = (default) PCL5 (HP LJ compatible)
+1024 = ESC/P (Epson dot matrix compatible)
0 = (default) No checksum will be generated (if checksum is not obligatory).
+1 = Checksum bars will be generated and printed, based on barcode data. Of course, the mode specific checksum algorithm will be used.
+2 = Human readable text <text> will not be drawn above, but below the bars.
+3 = +1 +2
+4 = Human readable text is the same as barcode data <data> (<text> will be ignored).
+5 = +1 +4
+6 = +2 +4
+7 = +1 +2 +4
2D symbologies (QR code only):
0 = (default) Error correction Level L
+1 = Error correction Level M
+2 = Error correction Level Q
+3 = Error correction Level H
+8 = Mode 8 bit (mandatory!)
Printing density (DPI) for dot matrix printers may be adjusted by adding one of the following values:
|+16||120||8||Doppelte Dichte, hohe Geschwindigkeit|
For example: Dot matrix printing (+1024) a barcode with checksum (+1) and density 360 DPI (+160) will need an option value of 1185.
Sample inline call sequence:
This demotext will be followed by a QR Code.
!R! BARCODE 128, " ", "I'm a 50mmm width QR-Code in 8-bit mode and error correction M (options=1+8=9)", -40, 20, 50, 0, 0, 9; EXIT;