1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-09-13 09:09:58 +00:00

Add inverted printing to set method

This commit is contained in:
Dean Rispin
2016-02-29 10:04:00 -08:00
parent b7c6edc9e1
commit 58c7c33fe9
3 changed files with 11 additions and 3 deletions

View File

@@ -64,6 +64,8 @@ TXT_FONT_B = ESC + '\x4d\x01' # Font type B
TXT_ALIGN_LT = ESC + '\x61\x00' # Left justification
TXT_ALIGN_CT = ESC + '\x61\x01' # Centering
TXT_ALIGN_RT = ESC + '\x61\x02' # Right justification
TXT_INVERT_ON = GS + '\x42\x01' # Inverse Printing ON
TXT_INVERT_OFF = GS + '\x42\x00' # Inverse Printing OFF
# Char code table
CHARCODE_PC437 = ESC + '\x74\x00' # USA: Standard Europe

View File

@@ -451,7 +451,7 @@ class Escpos(object):
colCount = self.columns if columns is None else columns
self.text(textwrap.fill(txt, colCount))
def set(self, align='left', font='a', text_type='normal', width=1, height=1, density=9):
def set(self, align='left', font='a', text_type='normal', width=1, height=1, density=9, invert=False):
""" Set text properties by sending them to the printer
:param align: horizontal position for text, possible values are:
@@ -541,6 +541,11 @@ class Escpos(object):
self._raw(PD_P50)
else: # DEFAULT: DOES NOTHING
pass
# Invert Printing
if invert == True:
self._raw(TXT_INVERT_ON)
else:
self._raw(TXT_INVERT_OFF)
def cut(self, mode=''):
""" Cut paper.