Search code examples
barcodezpl

Why do i get a wrong barcode for my EAN using ZPL


i have a question regarding printing EAN Barcodes with ZPL. Why do the Barcode and my given EAN dont match?

I have following ZPL code to generate the Barcode.

^XA^PQ1,0,0,N^FO50,20^BY^BEN,140,Y,N^FD4250164837159^FS^XZ

The result of this is following:

enter image description here

Can please someone help me with this. I am close to giving up on this.

Thank you!

Faby


Solution

  • I'm not sure calling '^BY' with no values is doing any good, and '^PQ' is set to the default values making it redundant. But regardless, you're passing too many digits in '^FD'. Zebra wants to add it's own checksum:

    Field data ( ^FD ) is limited to exactly 12 characters. ZPL II
    automatically truncates or pads on the left with zeros to achieve the 
    required number of characters
    

    See p101 of the Zebra Programming Guide for details. If you need to encode the 9 (which is not the correct checksum) then you should look at EAN14(or GTIN14).