Added density support
This commit is contained in:
parent
2b37185003
commit
34f562d64a
|
@ -18,5 +18,6 @@ CHANGELOG
|
||||||
- Added exception for PIL import
|
- Added exception for PIL import
|
||||||
|
|
||||||
* 2014-05-20 - Version 1.0.4
|
* 2014-05-20 - Version 1.0.4
|
||||||
|
- Issue #20: Added Density support (Sent by thomas.erbacher@ragapack.de)
|
||||||
- Added charcode tables
|
- Added charcode tables
|
||||||
- Fixed Horizontal Tab
|
- Fixed Horizontal Tab
|
||||||
|
|
|
@ -73,3 +73,13 @@ S_RASTER_N = '\x1d\x76\x30\x00' # Set raster image normal size
|
||||||
S_RASTER_2W = '\x1d\x76\x30\x01' # Set raster image double width
|
S_RASTER_2W = '\x1d\x76\x30\x01' # Set raster image double width
|
||||||
S_RASTER_2H = '\x1d\x76\x30\x02' # Set raster image double height
|
S_RASTER_2H = '\x1d\x76\x30\x02' # Set raster image double height
|
||||||
S_RASTER_Q = '\x1d\x76\x30\x03' # Set raster image quadruple
|
S_RASTER_Q = '\x1d\x76\x30\x03' # Set raster image quadruple
|
||||||
|
# Printing Density
|
||||||
|
PD_N50 = '\x1d\x7c\x00' # Printing Density -50%
|
||||||
|
PD_N37 = '\x1d\x7c\x01' # Printing Density -37.5%
|
||||||
|
PD_N25 = '\x1d\x7c\x02' # Printing Density -25%
|
||||||
|
PD_N12 = '\x1d\x7c\x03' # Printing Density -12.5%
|
||||||
|
PD_0 = '\x1d\x7c\x04' # Printing Density 0%
|
||||||
|
PD_P50 = '\x1d\x7c\x08' # Printing Density +50%
|
||||||
|
PD_P37 = '\x1d\x7c\x07' # Printing Density +37.5%
|
||||||
|
PD_P25 = '\x1d\x7c\x06' # Printing Density +25%
|
||||||
|
PD_P12 = '\x1d\x7c\x05' # Printing Density +12.5%
|
||||||
|
|
|
@ -230,7 +230,7 @@ class Escpos:
|
||||||
raise TextError()
|
raise TextError()
|
||||||
|
|
||||||
|
|
||||||
def set(self, align='left', font='a', type='normal', width=1, height=1):
|
def set(self, align='left', font='a', type='normal', width=1, height=1, density=9):
|
||||||
""" Set text properties """
|
""" Set text properties """
|
||||||
# Width
|
# Width
|
||||||
if height == 2 and width == 2:
|
if height == 2 and width == 2:
|
||||||
|
@ -276,6 +276,27 @@ class Escpos:
|
||||||
self._raw(TXT_ALIGN_RT)
|
self._raw(TXT_ALIGN_RT)
|
||||||
elif align.upper() == "LEFT":
|
elif align.upper() == "LEFT":
|
||||||
self._raw(TXT_ALIGN_LT)
|
self._raw(TXT_ALIGN_LT)
|
||||||
|
# Density
|
||||||
|
if density == 0:
|
||||||
|
self._raw(PD_N50)
|
||||||
|
elif density == 1:
|
||||||
|
self._raw(PD_N37)
|
||||||
|
elif density == 2:
|
||||||
|
self._raw(PD_N25)
|
||||||
|
elif density == 3:
|
||||||
|
self._raw(PD_N12)
|
||||||
|
elif density == 4:
|
||||||
|
self._raw(PD_0)
|
||||||
|
elif density == 5:
|
||||||
|
self._raw(PD_P12)
|
||||||
|
elif density == 6:
|
||||||
|
self._raw(PD_P25)
|
||||||
|
elif density == 7:
|
||||||
|
self._raw(PD_P37)
|
||||||
|
elif density == 8:
|
||||||
|
self._raw(PD_P50)
|
||||||
|
else:# DEFAULT: DOES NOTHING
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def cut(self, mode=''):
|
def cut(self, mode=''):
|
||||||
|
|
Loading…
Reference in New Issue