import Image from PIL, or Pillow
This commit is contained in:
parent
442e523956
commit
b68b3dc6c0
|
@ -6,11 +6,11 @@
|
||||||
@license: GPL
|
@license: GPL
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import Image
|
|
||||||
import qrcode
|
import qrcode
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import operator
|
import operator
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
from constants import *
|
from constants import *
|
||||||
from exceptions import *
|
from exceptions import *
|
||||||
|
@ -37,7 +37,7 @@ class Escpos:
|
||||||
i = 0
|
i = 0
|
||||||
cont = 0
|
cont = 0
|
||||||
buffer = ""
|
buffer = ""
|
||||||
|
|
||||||
self._raw(S_RASTER_N)
|
self._raw(S_RASTER_N)
|
||||||
buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1], 0)
|
buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1], 0)
|
||||||
self._raw(buffer.decode('hex'))
|
self._raw(buffer.decode('hex'))
|
||||||
|
@ -135,7 +135,7 @@ class Escpos:
|
||||||
break
|
break
|
||||||
elif im_color > (255 * 3 / pattern_len * pattern_len) and im_color <= (255 * 3):
|
elif im_color > (255 * 3 / pattern_len * pattern_len) and im_color <= (255 * 3):
|
||||||
pix_line += im_pattern[-1]
|
pix_line += im_pattern[-1]
|
||||||
break
|
break
|
||||||
pix_line += im_right
|
pix_line += im_right
|
||||||
img_size[0] += im_border[1]
|
img_size[0] += im_border[1]
|
||||||
|
|
||||||
|
@ -177,9 +177,9 @@ class Escpos:
|
||||||
self._raw(BARCODE_TXT_BTH)
|
self._raw(BARCODE_TXT_BTH)
|
||||||
elif pos.upper() == "ABOVE":
|
elif pos.upper() == "ABOVE":
|
||||||
self._raw(BARCODE_TXT_ABV)
|
self._raw(BARCODE_TXT_ABV)
|
||||||
else: # DEFAULT POSITION: BELOW
|
else: # DEFAULT POSITION: BELOW
|
||||||
self._raw(BARCODE_TXT_BLW)
|
self._raw(BARCODE_TXT_BLW)
|
||||||
# Type
|
# Type
|
||||||
if bc.upper() == "UPC-A":
|
if bc.upper() == "UPC-A":
|
||||||
self._raw(BARCODE_UPC_A)
|
self._raw(BARCODE_UPC_A)
|
||||||
elif bc.upper() == "UPC-E":
|
elif bc.upper() == "UPC-E":
|
||||||
|
@ -202,7 +202,7 @@ class Escpos:
|
||||||
else:
|
else:
|
||||||
raise exception.BarcodeCodeError()
|
raise exception.BarcodeCodeError()
|
||||||
|
|
||||||
|
|
||||||
def text(self, txt):
|
def text(self, txt):
|
||||||
""" Print alpha-numeric text """
|
""" Print alpha-numeric text """
|
||||||
if txt:
|
if txt:
|
||||||
|
|
Loading…
Reference in New Issue