python-escpos/examples/qr_code.py
Romain Porte dd2ec55bb3 First attempt at centering images and QRs
This was tested on ZJ-5890 with success. By default centering is
deactivated for backward compatibility. Trying to center a QR code in
native mode will raise an exception as we do not know ATM if the native
rendering is centered by default or not.
2017-08-13 11:31:25 +02:00

20 lines
324 B
Python

import sys
from escpos.printer import Usb
def usage():
print("usage: qr_code.py <content>")
if __name__ == '__main__':
if len(sys.argv) != 2:
usage()
sys.exit(1)
content = sys.argv[1]
# Adapt to your needs
p = Usb(0x0416, 0x5011, profile="POS-5890")
p.qr(content, center=True)