Using gnubarcode to generate a GS1-128 barcode

Written by James McDonald

March 8, 2015

Tried using the Code 128 options but couldn’t get the right out put

The trick I found is to use Code 128 raw mode. The caveat is it won’t format a nice human readable text label for the barcode you will have to add that your self later (perhaps hack the postscript).

This is what I’m encoding: (02)19311579000413(15)160408(10)054801(37)48

Example of echoing data into barcode from command line

# to printer
echo '105 102 02 19 31 15 79 00 04 13 15 16 04 08 10 05 48 01 102 37 48' \
| barcode -n -e128raw -umm -g 120x32+8+8 | lpr

# to ps file
echo '105 102 02 19 31 15 79 00 04 13 15 16 04 08 10 05 48 01 102 37 48' \
| barcode -n -o xx.ps -e128raw -umm -g 120x32+8+8

The above means

105 Code 128 Character Set C Start Character (for double density number encoding)

102 FNC1 character this identifies the barcode as GS1-128

Code 128 Code C encodes two digits for each symbol so you group them in twos. If you for example specified a single digit on its own say 4 it would then be encoded as 04

Note the embedded FNC1 (102) after the (10)0534801 denoting the end of a variable length field

gnubarcode_GS1-128

 

Another example of alphabetical text in a barcode using Code 128 Character Set B

echo '104 102 57 79 85 0  65 82 69 0 66 69 65 85 84 73 70 85 76' \
| barcode -n -e128raw -o yab.ps -umm -g 120x32+8+8

yab

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...