Search code examples
printinglabelbarcodezebra-printerszpl

Fitting a ZPL 128 barcode on a 2 inch wide Zebra printer label


With a Zebra printer at 203 dpi and 2 inch wide labels, I am unable to fit the 128 barcode correctly.

^XA
^DFR:g7-1x1-sn.zpl^FS
^FXuuid:d76fd680-3c6c-4a3b-9acb-baf585c6f677
^FXdensity:12
^FX-Options_S-{"density": 12, "width": 3, "height": 1.5}-E_Options-
~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR3,3~SD17^JUS^LRN^CI0^XZ
^XA
^MMT
^PW406
^LL0300
^LS0
^FT30,30^AAN,18,6^FH\^FDReq #: 0000123^FS
^FT30,55^AAN,18,6^FH\^FDAcct #: 987654321^FS
^FT30,80^AAN,18,6^FH\^FDLastName, FirstName^FS
^BY1
^FT30,160^BCN,50,Y,N,N
^FT30,170^AAN,18,6^FD9751378600002570^FS
^XZ

With ^BY1 the barcode fits but is too tight for some readers to read.

enter image description here

With ^BY2 the barcode prints better but the end gets cut off.

enter image description here

If someone can help with this, would be greatly appreciated.


Solution

  • Your best bet is to specify automatic encoding mode (parameter m in the reference manual). Code128 has a high density numeric mode that encodes two digits for each codeword and will be selected by the ZPL encoder when it sees a string of digits.

    This is your example with automatic mode and ^BY2:

    ^XA
    ^MMT
    ^PW406
    ^LL0300
    ^LS0
    ^FT30,30^AAN,18,6^FH\^FDReq #: 0000123^FS
    ^FT30,55^AAN,18,6^FH\^FDAcct #: 987654321^FS
    ^FT30,80^AAN,18,6^FH\^FDLastName, FirstName^FS
    ^BY2
    ^FT30,160^BCN,50,Y,N,N,A
    ^FT30,170^AAN,18,6^FD9751378600002570^FS
    ^XZ