Print barcode with Zebra printer using Python

Harshit Agarwal picture Harshit Agarwal · Apr 10, 2015 · Viewed 10k times · Source

I am able to print a label using the below code with a Zebra printer but I am not able to print a barcode.

I also tried ^B140,10,0,PL,5,5,5,N,"12-34567-890123"and inserted it after ^XA to print the barcode, but I was not successful:

label = """
^XA

^FO140,15
^A0,40,40
^FD
Total Weight : 50 KG
^FS

^FO140,60
^A0,40,40
^FD
shipment_count: 34
^FS

^FO140,105
^A0,40,40
^FD
HUB: DEL
^FS


^XZ
"""


from zebra import zebra
z = zebra('zebra_test')
z.output(label)

Please help me to print a barcode for the Zebra label printer using Python and EPL.

Answer

Jonathan Hunt picture Jonathan Hunt · May 1, 2015

The label you are sending is in ZPL format, not EPL. The way that package is structured, it only works with EPL2 commands.

You can find the EPL2 progamming manual here: https://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf