py-epos-print-xml
Python library to communicate with Epson thermal printers via ePos-Print XML. This makes it easy and intuitive to create print orders for ePos-Print XML compatible printers, like the Epson TM-T20, TM-m30 and TM-m50 series. Depending on the printer model, some elements are not supported. Check your manual or the Epson reference to see which elements are supported.
Instaling
pip install ePos-Print-XML
Example
from epos.printer import Printer
from epos.document import EposDocument
from epos.elements import Text, Feed, Barcode
from epos.constants import Align
# Create a new printer object with 10.0.0.12 as ip
printer = Printer('10.0.0.12')
# Check if we can connect to the printer with no errors, otherwise exit
if not printer.printer_ready():
exit()
# Create a new EposDocument object
# This will contain all the individual elements
doc = EposDocument()
# Add an element directly to the body of the document
doc.add_body(Text('This is example text!\n'))
doc.add_body(Feed()) # Another way to add a newline
# It's also possible to first create the text object and then change the properties
t = Text('Some special text :O\n')
t.bold = True
t.align = Align.CENTER
doc.add_body(t)
# Add 2 empty lines
doc.add_body(Feed(2))
# Add a barcode
doc.add_body(Barcode(BarcodeType.CODE39, 'text in barcode'))
# Send the whole document to the printer
# This will automatially send a Cut at the end of the document body
r = printer.print(doc)
# The print method returns a response element
# Here we can check if the printing was succesfull
if r.success:
print('The printing was successfull!')
else:
print(f'Printing failed. Error: {r.code}')
Documentation
Tech reference of all the xml elements by Epson: https://reference.epson-biz.com/modules/ref_epos_print_xml_en/index.php?content_id=1
Release files for ePos-Print-XML 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| epos_print_xml-0.3.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| epos_print_xml-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / epos_print_xml-0.3.tar.gz
| Download URL | epos_print_xml-0.3.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3db55720ffdfb4e406ac91cac5e507e27327ffb32bf011594535580006d90e6
|
|
BLAKE2b-256 checksum How to use checksums |
20a475f7738ace49d0d416454f848521498fcfcb242c4de1fab246c5c87e930c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|
Release files / epos_print_xml-0.3-py3-none-any.whl
| Download URL | epos_print_xml-0.3-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e78662df283769824d006e8e953fc894bde65c5254d62a88df78b62e0024ac8
|
|
BLAKE2b-256 checksum How to use checksums |
a41e3463623ce4d90fb78e53f4bb085354fba7415a65cd3f6a8a65dfce7a70e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|