python-escpos/examples/qr_code.py
Romain Porte b648cfd67f First attempt at centering images and QRs (#250)
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.

* Added basic tests for center feature

* Check image size before centering
2017-08-31 09:25:35 +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)