Ensure QR codes have a border large enough
(The QR code spec requires a border at least 4*box_size thick but we can't just set border=16 because that results in a QR code more than 255px tall and I'm not yet ready to use fullimage() as a backend for it) This fix was originally commited by Stephan Sokolow on 2014-05-22
This commit is contained in:
parent
662aa30f4b
commit
cbc9c3b341
16
examples/qr_code.py
Normal file
16
examples/qr_code.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from escpos.printer import Usb
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
# Adapt to your needs
|
||||||
|
p = Usb(0x0416, 0x5011, profile="POS-5890")
|
||||||
|
|
||||||
|
# Some software barcodes
|
||||||
|
p.set(align='left')
|
||||||
|
|
||||||
|
p.text("hello\n")
|
||||||
|
|
||||||
|
p.qr("https://github.com/python-escpos/python-escpos")
|
||||||
|
|
||||||
|
p.text("world\n")
|
@ -203,7 +203,10 @@ class Escpos(object):
|
|||||||
qr_img = qr_code.make_image()
|
qr_img = qr_code.make_image()
|
||||||
im = qr_img._img.convert("RGB")
|
im = qr_img._img.convert("RGB")
|
||||||
# Convert the RGB image in printable image
|
# Convert the RGB image in printable image
|
||||||
|
self.text('\n')
|
||||||
self.image(im)
|
self.image(im)
|
||||||
|
self.text('\n')
|
||||||
|
self.text('\n')
|
||||||
return
|
return
|
||||||
# Native 2D code printing
|
# Native 2D code printing
|
||||||
cn = b'1' # Code type for QR code
|
cn = b'1' # Code type for QR code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user