Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Print barcodes on a zebra printer
import sys
# needs pip install zebra
from zebra import zebra
# Replace the string below.
# You can get valid names from zebra().getqueues()
printer_name = "Zebra_Technologies_ZTC_GC420d__EPL__2"
z = zebra(printer_name)
# Assumes a 1" W x 3" H label mounted at the center
# of a 4 x 6 label printer
z.setup(
direct_thermal=False,
label_height=(600, 12),
label_width=800
)
template = """^XA
^FO400,165^BY4,2,4^B3R,N,55,Y,N^FD%s^FS
^XZ"""
def print_barcode(barcode):
z.output(template % barcode)
if __name__ == '__main__':
print_barcode('F3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.