ZPL-Zebra Programming Language is used for communicating with Zebra Printers. They are mostly used for RFID and Bar-code printing. As ever, I wanted a bit more control over how my ZPL printer worked and had to get working.
The easiest technique is of course Python. And this is how I did it.
First get the Zebra package from Pypi
pypi.python.org/pypi/zebra/#downloads
Installation is simple. From commandline navigate to the folder containing setup.py and then enter
python setup.py install [Windows Only]
I presume you've installed all necessary drivers. If you are using Win 7, Windows would have automatically installed them for you. If you're on Linux, you'd need a CUPS driver. Just look at the documentation.
Example Program:
###START OF CODE###
#ZPL commands to be sent to your Printer
label="""
^XA
^FO10,10
^A0,40,40
^FD
Hello World
^FS
^XZ
"""
#End of ZPL commands to print Hello World
from zebra import zebra
z=zebra
z.getqueues #This will return a list of printers installed on your computer.
z.setqueues('ZDesigner_ZPL_200') #Set the default printer to your new ZPL printer
z.output(label) #Have fun sending data to your printer.It's as easy as it can get. :)
####END OF CODE####
Reference:
http://bytes.com/topic/python/answers/24160-zebra-printing-language
http://pypi.python.org/pypi/zebra/
The easiest technique is of course Python. And this is how I did it.
First get the Zebra package from Pypi
pypi.python.org/pypi/zebra/#downloads
Installation is simple. From commandline navigate to the folder containing setup.py and then enter
python setup.py install [Windows Only]
I presume you've installed all necessary drivers. If you are using Win 7, Windows would have automatically installed them for you. If you're on Linux, you'd need a CUPS driver. Just look at the documentation.
Example Program:
###START OF CODE###
#ZPL commands to be sent to your Printer
label="""
^XA
^FO10,10
^A0,40,40
^FD
Hello World
^FS
^XZ
"""
#End of ZPL commands to print Hello World
from zebra import zebra
z=zebra
z.getqueues #This will return a list of printers installed on your computer.
z.setqueues('ZDesigner_ZPL_200') #Set the default printer to your new ZPL printer
z.output(label) #Have fun sending data to your printer.It's as easy as it can get. :)
####END OF CODE####
Reference:
http://bytes.com/topic/python/answers/24160-zebra-printing-language
http://pypi.python.org/pypi/zebra/
3 comments:
Attention, Error in script :
from zebra import zebra
z = zebra()
print 'Printer queues found:',z.getqueues()
z.getqueues
z.setqueue('Zebra_Printer')
z.output(label)
It's better !!
it's for using EPL2 ... not ZPL !
it's for using EPL2 ... not ZPL
Post a Comment