Created
May 8, 2019 09:59
-
-
Save gunjanpatel/eebdd929c5452ca4a01fa0e9197bcc07 to your computer and use it in GitHub Desktop.
Print script for zebra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import socket, sys | |
PRINTER_IP = '10.1.11.121' | |
PORT = 9100 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((PRINTER_IP, PORT)) | |
zpl = '' | |
zpl += '^XA' | |
zpl += '^FO0,15^ADN,10,5^FD^FS' | |
zpl += '^FO0,50^ADN,38,22^FDYuval Patel^FS' | |
zpl += '^FO0,100^ADN,20,12^FD^FS' | |
zpl += '^FO0,140^ADN,8,5^FD^FS' | |
zpl += '^XZ' | |
total = int((sys.argv[1:] or [1])[0]) | |
for x in range(total): | |
s.send(bytes(zpl)) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment