I am trying to print a Code 128 barcode on a label using the following the piece of ZPL with a Zebra ZP 450 printer:
^BY3^BCN,112,N^FO090,660^FD>;>89102100^FS
I'm expecting the barcode to scan as "9102100". However, when I scan the printed barcode, it reads as "910210" -- cutting off the final digit.
If I change the last digit, it is still cut off. But if I add more digits onto the end, e.g. "9102100357", the barcode correctly reads as "9102100357".
Why am I "losing" a digit in this particular case?
The >;
inside of your ^FD
block is telling the code 128 barcode to go into a subset (subset C in this case) which forces the data in the barcode to be numeric pairs (00 - 99). Any data that is not supplied in numeric pairs is ignored. If you put a letter in there, it will ignore that pair. In your case 9102100
has an odd number of numbers, so it ignores the last one. If for example, you add another 0
, it will put all the letters in the barcode.
The ;>
which puts the barcode in Subset C is not the default. Subset B or :>
is the default which will allow any character to be encoded in the barcode. So you can replace the ;>
with :>
, or just remove the ;>
entirely, and it will print out properly.
Check out the ^BC
documentation in the ZPL programming manual for more information about Code 128 subsets and data validation