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

Fix tabs behaviour (#238)

The changes done in this commit should help with the open issues:
#5, #27 and #161.
The old implementation lacked the NUL char at the end of the command, as
defined on the Epson ESC/POS Reference Guide (see
https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=53
). Also, the horizontal tab control character (CTL_HT) shouldn't be
there.

This implementation allows setting up to 32 tabs with a given tab width.
Both values are checked to be in the valid ranges defined on the guide.
Also, the TabPosError exception text has been rewritten to define the
stated above.
This commit is contained in:
csoft2k
2017-07-26 10:01:08 +02:00
committed by Patrick Kanzler
parent 9e47ff2505
commit 82c67aa646
2 changed files with 13 additions and 8 deletions

View File

@@ -150,7 +150,8 @@ class CashDrawerError(Error):
class TabPosError(Error):
""" Valid tab positions must be in the range 0 to 16.
""" Valid tab positions must be set by using from 1 to 32 tabs, and between 1 and 255 tab size values.
Both values multiplied must not exceed 255, since it is the maximum tab value.
This exception is raised by :py:meth:`escpos.escpos.Escpos.control`.
The returncode for this exception is `70`.