Open GoogleCodeExporter opened 9 years ago
Thank you syncman1x.
Hopefully your changes will be added to the new release this weekend.
Once again, thank you for your contribution.
Original comment by manpaz
on 2 Jan 2014 at 8:17
Your welcome.
----
This comment is not directly related to Issue #18:
I am describing a possible extension, which I intend to resubmit later as a new
issue.
Here is an experiment, for people who have a combination thermal & slip
printer. The paper type can be selected:
HW_PRINT_ROLL = '\x1B\x63\x30\x03' # 80mm roll, thermal
HW_PRINT_SLIP = '\x1B\x63\x30\x04' # Slip / Cheque, dot matrix
Common settings, like the type face and character geometry, can be set on the
dot matrix slip printer, the same way as done for the thermal engine.
E.paper('slip')
E.set('left','A','B',1,2)
If anyone tests this, please be mindful of both the logical and physical length
of your slip. My printer seems not to sense the end of a narrow slip. It is
okay with an A4 sheet.
PAPER_SLIP_OUT = '\x1B\x4B\xC0' # Eject slip or cheque
The method I use to eject is a slip-reverse command. It reverses the feed
direction on a flat paper path TM-H5000II, and feeds a slip out forward on the
TM-H6000.
E.cut('slip')
Always return to the roll paper type when finished.
E.paper('roll')
% hg diff
diff -r 849dabb63ce0 escpos/constants.py
--- a/escpos/constants.py Thu May 30 08:56:33 2013 -0700
+++ b/escpos/constants.py Sat Jan 18 15:14:30 2014 +1100
@@ -10,16 +10,21 @@
HW_INIT = '\x1b\x40' # Clear data in buffer and reset modes
HW_SELECT = '\x1b\x3d\x01' # Printer select
HW_RESET = '\x1b\x3f\x0a\x00' # Reset printer hardware
+# Printer paper
+HW_PRINT_ROLL = '\x1B\x63\x30\x03' # 80mm roll, thermal
+HW_PRINT_SLIP = '\x1B\x63\x30\x04' # Slip / Cheque, dot matrix
# Cash Drawer
CD_KICK_2 = '\x1b\x70\x00' # Sends a pulse to pin 2 []
CD_KICK_5 = '\x1b\x70\x01' # Sends a pulse to pin 5 []
# Paper
PAPER_FULL_CUT = '\x1d\x56\x00' # Full cut paper
PAPER_PART_CUT = '\x1d\x56\x01' # Partial cut paper
+PAPER_SLIP_OUT = '\x1B\x4B\xC0' # Eject slip or cheque
# Text format
TXT_NORMAL = '\x1b\x21\x00' # Normal text
TXT_2HEIGHT = '\x1b\x21\x10' # Double height text
TXT_2WIDTH = '\x1b\x21\x20' # Double width text
+TXT_4SQUARE = '\x1b\x21\x30' # Quad area text
TXT_UNDERL_OFF = '\x1b\x2d\x00' # Underline font OFF
TXT_UNDERL_ON = '\x1b\x2d\x01' # Underline font 1-dot ON
TXT_UNDERL2_ON = '\x1b\x2d\x02' # Underline font 2-dot ON
diff -r 849dabb63ce0 escpos/escpos.py
--- a/escpos/escpos.py Thu May 30 08:56:33 2013 -0700
+++ b/escpos/escpos.py Sat Jan 18 15:14:30 2014 +1100
@@ -189,8 +189,8 @@
self._raw(TXT_NORMAL)
self._raw(TXT_2HEIGHT)
elif height == 2 and width == 2:
- self._raw(TXT_2WIDTH)
- self._raw(TXT_2HEIGHT)
+ self._raw(TXT_NORMAL)
+ self._raw(TXT_4SQUARE)
else: # DEFAULT SIZE: NORMAL
self._raw(TXT_NORMAL)
# Type
@@ -203,7 +203,6 @@
elif type.upper() == "U2":
self._raw(TXT_BOLD_OFF)
self._raw(TXT_UNDERL2_ON)
- self._raw(TXT_ITALIC_OFF)
elif type.upper() == "BU":
self._raw(TXT_BOLD_ON)
self._raw(TXT_UNDERL_ON)
@@ -227,6 +226,15 @@
self._raw(TXT_ALIGN_LT)
+ def paper(self, type='ROLL'):
+ if type.upper() == '':
+ self._raw(HW_PRINT_ROLL)
+ elif type.upper() == 'ROLL':
+ self._raw(HW_PRINT_ROLL)
+ elif type.upper() == 'SLIP':
+ self._raw(HW_PRINT_SLIP)
+
+
def cut(self, mode=''):
""" Cut paper """
# Fix the size between last line and cut
@@ -234,6 +242,10 @@
self._raw("\n\n\n\n\n\n")
if mode.upper() == "PART":
self._raw(PAPER_PART_CUT)
+ if mode.upper() == "FULL":
+ self._raw(PAPER_FULL_CUT)
+ if mode.upper() == "PART":
+ self._raw(PAPER_SLIP_OUT)
else: # DEFAULT MODE: FULL CUT
self._raw(PAPER_FULL_CUT)
Original comment by syncma...@gmail.com
on 18 Jan 2014 at 4:54
Original issue reported on code.google.com by
syncma...@gmail.com
on 10 Dec 2013 at 4:03Attachments: