Search code examples
barcodezebra-printerszplzpl-ii

ZPL print barcode with extra text above


I am developing an application that prints labels using Zebra GK420t printer. I successfully could print Barcode with the text value in the bottom of the Barcode.

However, I was not be able to print extra text above the Barcode.

I am using this command

^XA
^FO20,20^BY2
^BCN,100,Y,N,N
^FDvar^FS
^XZ

[Translated to ZPL from program code]

Which, if var is 'abc123', prints the Barcode with abc123 underneath.

Q: How can for example can I print my name above the Barcode???


Solution

  • If you mean "abc123 above the barcode" then change ^BCN,100,Y,N,N to ^BCN,100,Y,Y,N.

    If you mean "Print 'Nabeel' above the barcode" then insert

    ^CFD^FDNabeel^FS
    ^FO20,50
    

    After the ^FO20,20 line.

    This would select internal font "D" (CFD) and print "Nabeel" at offset 20,20 (the preceding (^FO)) then set the position of the barcode to 20,50 since 20,20 is really close to top-left of the label.

    I'll presume you know how to modify your program code.