From 2c90435818e9a0e638709a1d45670b83fd8f5b3a Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 00:21:40 +0200 Subject: [PATCH 1/9] disable system packages on rtd --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 48949cd6..9faa67b2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -25,4 +25,4 @@ python: - requirements: doc/requirements.txt - method: pip path: . - system_packages: true + system_packages: false From 98c53cb2564e51479a7f07ce463f80463bb0e2f3 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 00:28:18 +0200 Subject: [PATCH 2/9] install pycups on rtd --- doc/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/requirements.txt b/doc/requirements.txt index 823892fb..25808d4c 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -11,3 +11,4 @@ python-barcode>=0.11.0,<1 importlib-metadata importlib_resources sphinxcontrib.datatemplates +pycups From 00ca32372f8aafeee72f9a23555f9c085f4b6227 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 00:33:14 +0200 Subject: [PATCH 3/9] enable cups binding in documentation --- src/escpos/printer.py | 6 +++--- tox.ini | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/escpos/printer.py b/src/escpos/printer.py index f2fbe6ef..d8342c0c 100644 --- a/src/escpos/printer.py +++ b/src/escpos/printer.py @@ -440,9 +440,9 @@ class CupsPrinter(Escpos): """Simple CUPS printer connector. .. note:: - Requires _pycups_ which in turn needs the cups development library package: - - Ubuntu/Debian: _libcups2-dev_ - - OpenSuse/Fedora: _cups-devel_ + Requires ``pycups`` which in turn needs the cups development library package: + - Ubuntu/Debian: ``libcups2-dev`` + - OpenSuse/Fedora: ``cups-devel`` """ def __init__(self, printer_name=None, *args, **kwargs): diff --git a/tox.ini b/tox.ini index 97849d07..cfd319d1 100644 --- a/tox.ini +++ b/tox.ini @@ -34,6 +34,7 @@ deps = sphinx>=3.0.0 sphinxcontrib-spelling>=7.2.0 sphinxcontrib.datatemplates sphinx_rtd_theme + pycups commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:flake8] From d855f28a692837a6e65cc1247c54f3f630c7ac78 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 00:35:24 +0200 Subject: [PATCH 4/9] document CupsPrinter --- doc/user/printers.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/user/printers.rst b/doc/user/printers.rst index 0918ccca..051ef3b8 100644 --- a/doc/user/printers.rst +++ b/doc/user/printers.rst @@ -82,7 +82,10 @@ Supports both local and remote CUPS printers and servers. The printer must be properly configured in CUPS administration. The connector generates a print job that is added to the CUPS queue. -.. todo:: fix import in documentation +.. autoclass:: escpos.printer.CupsPrinter + :members: + :member-order: bysource + :noindex: LP ---- From b3445b2c6f5bdb0d7b809927456845b0ffdee0e1 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 00:38:25 +0200 Subject: [PATCH 5/9] fix formatting --- src/escpos/printer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/escpos/printer.py b/src/escpos/printer.py index d8342c0c..913176cd 100644 --- a/src/escpos/printer.py +++ b/src/escpos/printer.py @@ -440,9 +440,11 @@ class CupsPrinter(Escpos): """Simple CUPS printer connector. .. note:: - Requires ``pycups`` which in turn needs the cups development library package: + + Requires ``pycups`` which in turn needs the cups development library package: - Ubuntu/Debian: ``libcups2-dev`` - OpenSuse/Fedora: ``cups-devel`` + """ def __init__(self, printer_name=None, *args, **kwargs): From aacc392c9a9f999a5dc543cf787211bc77c94bc0 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 01:03:02 +0200 Subject: [PATCH 6/9] revise methods and installation --- doc/user/installation.rst | 17 +++++++++++------ doc/user/methods.rst | 6 +++--- src/escpos/constants.py | 8 ++++++-- src/escpos/escpos.py | 35 +++++++++++++++++++++++------------ 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/doc/user/installation.rst b/doc/user/installation.rst index 6b3b8f84..1d5b48eb 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -1,24 +1,29 @@ Installation ============ -:Last Reviewed: 2016-07-23 +:Last Reviewed: 2023-08-10 Installation with PIP --------------------- -Installation should be rather straight-forward. python-escpos is on PyPi, so you can simply enter: +Installation should be rather straight-forward. python-escpos is on PyPi, +so you can simply enter: :: pip install python-escpos -This should install all necessary dependencies. Apart from that python-escpos should also be -available as a Debian package. If you want to always benefit from the newest stable releases you should probably -install from PyPi. +This should install all necessary dependencies. Apart from that +python-escpos is for some versions also available as a Debian package. +If you want to always benefit from the newest stable releases you should +always install from PyPi. +If you use the ``--pre`` parameter for ``pip``, you will get the latest +pre-release. Setup udev for USB-Printers --------------------------- 1. Get the *Product ID* and *Vendor ID* from the lsusb command - ``# lsusb Bus 002 Device 001: ID 1a2b:1a2b Device name`` + ``# lsusb Bus 002 Device 001: ID 1a2b:1a2b Device name``. + (Or whichever way your system supplies to get the PID and VID.) 2. Create a udev rule to let users belonging to *dialout* group use the printer. You can create the file diff --git a/doc/user/methods.rst b/doc/user/methods.rst index e9cb34aa..15fbfa6e 100644 --- a/doc/user/methods.rst +++ b/doc/user/methods.rst @@ -1,13 +1,13 @@ Methods ======= -:Last Reviewed: 2017-01-25 +:Last Reviewed: 2023-08-10 Escpos class ------------ -The core part of this libraries API is the Escpos class. -You use it by instantiating a :doc:`printer ` which is a child of Escpos. +The core part of the API of this library is the Escpos class. +You use it by instantiating a :doc:`printer ` which is a child of Escpos. The following methods are available: .. autoclass:: escpos.escpos.Escpos diff --git a/src/escpos/constants.py b/src/escpos/constants.py index dc2704fc..803d9b4d 100644 --- a/src/escpos/constants.py +++ b/src/escpos/constants.py @@ -45,6 +45,8 @@ _CASH_DRAWER = ( lambda m, t1="", t2="": ESC + b"p" + m + six.int2byte(t1) + six.int2byte(t2) ) + +#: decimal cash drawer kick sequence CD_KICK_DEC_SEQUENCE = ( lambda esc, p, m, t1=50, t2=50: six.int2byte(esc) + six.int2byte(p) @@ -52,8 +54,10 @@ + six.int2byte(t1) + six.int2byte(t2) ) -CD_KICK_2 = _CASH_DRAWER(b"\x00", 50, 50) # Sends a pulse to pin 2 [] -CD_KICK_5 = _CASH_DRAWER(b"\x01", 50, 50) # Sends a pulse to pin 5 [] +#: Sends a pulse to pin 2 [] +CD_KICK_2 = _CASH_DRAWER(b"\x00", 50, 50) +#: Sends a pulse to pin 5 [] +CD_KICK_5 = _CASH_DRAWER(b"\x01", 50, 50) # Paper Cutter _CUT_PAPER = lambda m: GS + b"V" + m diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index 136e860b..9b46011c 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -1021,8 +1021,11 @@ def cut(self, mode="FULL", feed=True): def cashdraw(self, pin): """Send pulse to kick the cash drawer - Kick cash drawer on pin 2 or pin 5 according to default parameter. - For non default parameter send a decimal sequence i.e. [27,112,48] or [27,112,0,25,255] + Kick cash drawer on pin 2 (:py:const:`~escpos.constants.CD_KICK_2`) + or pin 5 (:py:const:`~escpos.constants.CD_KICK_5`) + according to the default parameters. + For non default parameters send a decimal sequence i.e. + [27,112,48] or [27,112,0,25,255]. :param pin: pin number, 2 or 5 or list of decimals :raises: :py:exc:`~escpos.exceptions.CashDrawerError` @@ -1094,7 +1097,7 @@ def hw(self, hw): def print_and_feed(self, n=1): """Print data in print buffer and feed *n* lines - if n not in range (0, 255) then ValueError will be raised + If n not in range (0, 255) then a ValueError will be raised. :param n: number of n to feed. 0 <= n <= 255. default: 1 :raises ValueError: if not 0 <= n <= 255 @@ -1144,17 +1147,24 @@ def control(self, ctl, count=5, tab_size=8): def panel_buttons(self, enable=True): """Controls the panel buttons on the printer (e.g. FEED) - When enable is set to False the panel buttons on the printer will be disabled. Calling the method with - enable=True or without argument will enable the panel buttons. + When enable is set to False the panel buttons on the printer + will be disabled. + Calling the method with `enable=True` or without argument + will enable the panel buttons. - If panel buttons are enabled, the function of the panel button, such as feeding, will be executed upon pressing - the button. If the panel buttons are disabled, pressing them will not have any effect. + If panel buttons are enabled, the function of the panel button, + such as feeding, will be executed upon pressing the button. + If the panel buttons are disabled, pressing them will not have + any effect. - This command is effective until the printer is initialized, reset or power-cycled. The default is enabled panel - buttons. + This command is effective until the printer is initialized, + resetted or power-cycled. + The default is enabled panel buttons. - Some panel buttons will always work, especially when printer is opened. See for more information the manual - of your printer and the escpos-command-reference. + Some panel buttons will always work, especially when the + printer is opened. + See for more information the manual of your printer and + the escpos-command-reference. :param enable: controls the panel buttons :rtype: None @@ -1166,7 +1176,8 @@ def panel_buttons(self, enable=True): def query_status(self, mode): """ - Queries the printer for its status, and returns an array of integers containing it. + Queries the printer for its status, and returns an array + of integers containing it. :param mode: Integer that sets the status mode queried to the printer. - RT_STATUS_ONLINE: Printer status. From bfabd484b9af3438b45c3874558518494c017153 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 01:11:09 +0200 Subject: [PATCH 7/9] revise user/printers --- doc/user/printers.rst | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/doc/user/printers.rst b/doc/user/printers.rst index 051ef3b8..36ef3a85 100644 --- a/doc/user/printers.rst +++ b/doc/user/printers.rst @@ -1,15 +1,18 @@ Printers ======== -:Last Reviewed: 2022-11-25 +:Last Reviewed: 2023-08-10 -As of now there are 7 different type of printer implementations. +As of now there are 8 different types of printer implementations. USB --- The USB-class uses pyusb and libusb to communicate with USB-based -printers. Note that this driver is not suited for USB-to-Serial-adapters -and similiar devices, but only for those implementing native USB. +printers. + +.. note:: + This driver is not suited for USB-to-Serial-adapters + and similiar devices, but only for those implementing native USB. .. autoclass:: escpos.printer.Usb :members: @@ -44,20 +47,24 @@ This driver is based on the socket class. Troubleshooting ^^^^^^^^^^^^^^^ -Problems with a network-attached printer can have numerous causes. Make sure that your device has a proper IP address. -Often you can check the IP address by triggering the self-test of the device. As a next step try to send text -manually to the device. You could use for example: +Problems with a network-attached printer can have numerous causes. +Make sure that your device has a proper IP address. +Often you can check the IP address by triggering the self-test of the device. +As a next step try to send text manually to the device. +You could use for example: :: echo "OK\n" | nc IPADDRESS 9100 # the port number is often 9100 -As a last resort try to reset the interface of the printer. This should be described in its manual. +As a last resort try to reset the interface of the printer. +This should be described in its manual. File ---- -This printer "prints" just into a file-handle. Especially on \*nix-systems this comes very handy. +This printer "prints" just into a file-handle. +Especially on \*nix-systems this comes very handy. .. autoclass:: escpos.printer.File :members: @@ -67,8 +74,8 @@ This printer "prints" just into a file-handle. Especially on \*nix-systems this Dummy ----- -The Dummy-printer is mainly for testing- and debugging-purposes. It stores -all of the "output" as raw ESC/POS in a string and returns that. +The Dummy-printer is mainly for testing- and debugging-purposes. +It stores all of the "output" as raw ESC/POS in a string and returns that. .. autoclass:: escpos.printer.Dummy :members: @@ -94,10 +101,19 @@ Supports local and remote CUPS printers. The printer must be properly configured in CUPS administration. The connector spawns a new sub-process where the command lp is executed. -No dependencies required, but somehow the print queue will affect some print job such as barcode. +No dependencies required, but somehow the print queue will affect some +print job such as barcode. .. autoclass:: escpos.printer.LP :members: :special-members: :member-order: bysource :noindex: + +Win32Raw +-------- +This driver uses a native WIN32 interface of Windows in order to print. +Please refer to the code for documentation as this driver is currently +not included in the documentation build. + +.. todo:: Include Win32Raw in documentation build From 58b50b17363886840f69fea456269a471ede87a2 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 01:17:35 +0200 Subject: [PATCH 8/9] revise raspi section --- doc/user/installation.rst | 2 ++ doc/user/raspi.rst | 41 +++++++++++++-------------------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/doc/user/installation.rst b/doc/user/installation.rst index 1d5b48eb..afb8cc8c 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -1,3 +1,5 @@ +.. _user_installation: + Installation ============ diff --git a/doc/user/raspi.rst b/doc/user/raspi.rst index 9ec8bf9d..7ddf600d 100644 --- a/doc/user/raspi.rst +++ b/doc/user/raspi.rst @@ -1,41 +1,26 @@ Raspberry Pi ============ -:Last Reviewed: 2017-01-05 +:Last Reviewed: 2023-08-10 -This instructions were tested on Raspbian Jessie. - -.. warning:: You should **never** directly connect an printer with RS232-interface (serial port) directly to - a Raspberry PI or similar interface (e.g. those simple USB-sticks without encasing). Those interfaces are - based on 5V- or 3,3V-logic (the latter in the case of Raspberry PI). Classical RS232 uses 12V-logic and would - **thus destroy your interface**. Connect both systems with an appropriate *level shifter*. - -Dependencies ------------- -First, install the packages available on Raspbian. - -:: - - sudo apt-get install python3 python3-setuptools python3-pip libjpeg8-dev +.. warning:: You should **never** directly connect an printer with RS232-interface + (serial port) directly to a Raspberry PI or similar interface + (e.g. those simple USB-sticks without encasing). + Those interfaces are based on 5V- or 3,3V-logic + (the latter in the case of Raspberry PI). + Classical RS232 uses 12V-logic and would **thus destroy your interface**. + Connect both systems with an appropriate *level shifter*. Installation ------------ -You can install by using pip3. - -:: - - sudo pip3 install --upgrade pip - sudo pip3 install python-escpos +The installation should be performed as described in :ref:`user_installation`. Run --- -You need sudo and python3 to run your program. - -:: - - sudo python3 your-program.py +You can run this software as on any other Linux system. -Now you can attach your printer and and test it with the example code in the project's set of examples. -You can find that in the `project-repository `__. +Attach your printer and test it with the example code in the project's set of examples. +You can find that in the +`project-repository `__. For more details on this check the :doc:`installation-manual `. From 9a7ac83f898daa9c5e69e43fbbcfd0952c6cea48 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Thu, 10 Aug 2023 01:32:23 +0200 Subject: [PATCH 9/9] further revise --- CONTRIBUTING.rst | 64 +++++++++++++------- doc/dev/release-process.rst | 2 + doc/dev/todo.rst | 2 + doc/printer_profiles/available-encodings.rst | 7 ++- doc/printer_profiles/available-profiles.rst | 3 +- doc/printer_profiles/capabilities.rst | 2 +- doc/user/barcode.rst | 29 ++++++--- doc/user/usage.rst | 2 +- 8 files changed, 76 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0df6e306..2caabcd1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,23 +1,32 @@ Contributing ============ -This project is open to any kind of contribution. You can help with improving the documentation, adding fixes to the -code, providing test cases in code or as a description or just spreading the word. Please feel free to create an -issue or pull request. -In order to reduce the amount of work for everyone please try to adhere to good practice. +:Last Reviewed: 2023-08-10 -The pull requests and issues will be prefilled with templates. Please fill in your information where applicable. +This project is open to any kind of contribution. +You can help with improving the documentation, adding fixes to the +code, providing test cases in code or as a description or just +spreading the word. +Please feel free to create an issue or pull request. +In order to reduce the amount of work for everyone please try +to adhere to good practice. -This project uses `semantic versioning `_ and tries to adhere to the proposed rules as -well as possible. +The pull requests and issues will be prefilled with templates. +Please fill in your information where applicable. + +This project uses `semantic versioning `_ +and tries to adhere to the proposed rules as well as possible. Author-list ----------- -This project keeps a list of authors. This can be auto-generated by calling `./doc/generate-authors.sh`. -When contributing the first time, please include a commit with the output of this script in place. +This project keeps a list of authors. +This can be auto-generated by calling `./doc/generate-authors.sh`. +When contributing the first time, please include a commit with +the output of this script in place. -When you change your username or mail-address, please also update the `.mailmap` and the authors-list. +When you change your username or mail-address, please also +update the `.mailmap` and the authors-list. You can find a good documentation on the mapping-feature in the `documentation of git-shortlog `_. @@ -33,31 +42,42 @@ Please format your contributions with black, otherwise they will be rejected. GIT ^^^ -The master-branch contains the main development of the project. A release to PyPi is marked with a tag -corresponding to the version. Issues are closed when they have been resolved by merging into the master-branch. -When you have a change to make, begin by creating a new branch from the HEAD of `python-escpos/master`. +The master-branch contains the main development of the project. +A release to PyPi is marked with a tag corresponding to the version. +Issues are closed when they have been resolved by merging +into the master-branch. +When you have a change to make, begin by creating a new branch +from the HEAD of `python-escpos/master`. -Please try to group your commits into logical units. If you need to tidy up your branch, you can make use of a -git feature called an 'interactive rebase' before making a pull request. A small, self-contained change-set is -easier to review, and improves the chance of your code being merged. -Please also make sure that before creating your PR, your branch is rebased on a recent commit or you merged a recent -commit into your branch. This way you can ensure that your PR is without merge conflicts. +Please try to group your commits into logical units. +If you need to tidy up your branch, you can make use of a +git feature called an 'interactive rebase' before making a pull request. +A small, self-contained change-set is easier to review, and +improves the chance of your code being merged. +Please also make sure that before creating your PR, your branch +is rebased on a recent commit or you merged a recent +commit into your branch. +This way you can ensure that your PR is without merge conflicts. Docstrings ^^^^^^^^^^ This project tries to have a good documentation. -Please add a docstring to every method and class. Have a look at existing methods and classes for the style. +Please add a docstring to every method and class. +Have a look at existing methods and classes for the style. We use basically standard rst-docstrings for Sphinx. Test ^^^^ -Try to write tests whenever possible. Our goal for the future is 100% coverage. -You can copy the structure from other testcases. Please remember to adapt the docstrings. +Try to write tests whenever possible. +Our goal for the future is 100% coverage. +You can copy the structure from other testcases. +Please remember to adapt the docstrings. Further reading ^^^^^^^^^^^^^^^ For further best practices and hints on contributing please see the -`contribution-guide `_. Should there be any contradictions between this guide +`contribution-guide `_. +Should there be any contradictions between this guide and the linked one, please stick to this text. Aside from that feel free to create an issue or write an email if anything is unclear. diff --git a/doc/dev/release-process.rst b/doc/dev/release-process.rst index 6f26bea6..d392a6ce 100644 --- a/doc/dev/release-process.rst +++ b/doc/dev/release-process.rst @@ -1,6 +1,8 @@ Release process =============== +:Last Reviewed: 2023-08-10 + * Update authors file * Update changelog * Set annotated tag for release and push to public github diff --git a/doc/dev/todo.rst b/doc/dev/todo.rst index eb32e97f..e37b82e5 100644 --- a/doc/dev/todo.rst +++ b/doc/dev/todo.rst @@ -1,6 +1,8 @@ TODO ==== +:Last Reviewed: 2023-08-10 + Open points and issues of the project are tracked in the GitHub issues. Some annotations still remain in the code and should be moved over time into the issue tracker. diff --git a/doc/printer_profiles/available-encodings.rst b/doc/printer_profiles/available-encodings.rst index 2133d603..02292637 100644 --- a/doc/printer_profiles/available-encodings.rst +++ b/doc/printer_profiles/available-encodings.rst @@ -1,6 +1,11 @@ Available Encodings ------------------- -:Last Reviewed: 2023-07-29 +:Last Reviewed: 2023-08-10 + +If you find any issues with the described encodings, +please open an issue in the +`ESC/POS printer database `_. +The data shown here is directly taken from there. .. datatemplate:json:: ../../capabilities-data/dist/capabilities.json :template: capabilities-template-encoding.jinja \ No newline at end of file diff --git a/doc/printer_profiles/available-profiles.rst b/doc/printer_profiles/available-profiles.rst index d1793847..66e686c1 100644 --- a/doc/printer_profiles/available-profiles.rst +++ b/doc/printer_profiles/available-profiles.rst @@ -2,7 +2,7 @@ Available Profiles ------------------ -:Last Reviewed: 2023-07-29 +:Last Reviewed: 2023-08-10 The following list describes which printer profiles are available in this release. @@ -12,6 +12,7 @@ that this printer actually can be controlled by this library. If you find any issues with the described capabilities, please open an issue in the `ESC/POS printer database `_. +The data shown here is directly taken from there. .. datatemplate:json:: ../../capabilities-data/dist/capabilities.json :template: capabilities-template.jinja diff --git a/doc/printer_profiles/capabilities.rst b/doc/printer_profiles/capabilities.rst index 13c95f1d..d571693b 100644 --- a/doc/printer_profiles/capabilities.rst +++ b/doc/printer_profiles/capabilities.rst @@ -2,7 +2,7 @@ Capabilities ------------ -:Last Reviewed: 2023-07-29 +:Last Reviewed: 2023-08-10 Since the used command set often differs between printers, a model for supporting different printers is implemented. diff --git a/doc/user/barcode.rst b/doc/user/barcode.rst index bd84cbc4..129e3c4f 100644 --- a/doc/user/barcode.rst +++ b/doc/user/barcode.rst @@ -1,19 +1,29 @@ Printing Barcodes ----------------- -:Last Reviewed: 2023-05-16 +:Last Reviewed: 2023-08-10 Many printers implement barcode printing natively. -This hardware renderered barcodes are fast but the supported formats are limited by the printer itself and different between models. -However, almost all printers support printing images, so barcode renderization can be performed externally by software and then sent to the printer as an image. -As a drawback, this operation is much slower and the user needs to know and choose the image implementation method supported by the printer's commandset. +This hardware renderered barcodes are fast but the supported +formats are limited by the printer itself and different between models. +However, almost all printers support printing images, so barcode +rendering can be performed externally by software and then sent +to the printer as an image. +As a drawback, this operation is much slower and the user needs +to know and choose the image implementation method supported by +the printer's commandset. barcode-method ~~~~~~~~~~~~~~ -Since version 3.0, the ``barcode`` method unifies the previous ``barcode`` (hardware) and ``soft_barcode`` (software) methods. -It is able to choose automatically the best printer implementation for barcode printing based on the capabilities of the printer and the type of barcode desired. -To achieve this, it relies on the information contained in the escpos-printer-db profiles. -The chosen profile needs to match the capabilities of the printer as closely as possible. +Since version 3.0, the ``barcode`` method unifies the previous +``barcode`` (hardware) and ``soft_barcode`` (software) methods. +It is able to choose automatically the best printer implementation +for barcode printing based on the capabilities of the printer +and the type of barcode desired. +To achieve this, it relies on the information contained in the +escpos-printer-db profiles. +The chosen profile needs to match the capabilities of the printer +as closely as possible. .. py:currentmodule:: escpos.escpos @@ -33,4 +43,5 @@ For alphanumeric CODE128 you have to preface your payload with `{B`. # print CODE128 012ABCDabcd p.barcode("{B012ABCDabcd", "CODE128", function_type="B") -A very good description on CODE128 is also on `Wikipedia `_. +A very good description on CODE128 is also on +`Wikipedia `_. diff --git a/doc/user/usage.rst b/doc/user/usage.rst index 3a56d5bf..eaaccd7d 100644 --- a/doc/user/usage.rst +++ b/doc/user/usage.rst @@ -1,7 +1,7 @@ Usage ===== -:Last Reviewed: 2017-06-10 +:Last Reviewed: 2023-08-10 Define your printer -------------------