# 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](https://reference.epson-biz.com/modules/ref_epos_print_xml_en/index.php?vid=ref_epos_print_xml_en_devicespecifications_supportedelementslist) to see which elements are supported.
## Instaling
```
pip install ePos-Print-XML
```
## Example
```python
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
Raw data
{
"_id": null,
"home_page": "",
"name": "ePos-Print-XML",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "epos,printing,receipt,thermoprinter,voucher printer",
"author": "Merten Fermont",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/20/a4/75f7738ace49d0d416454f848521498fcfcb242c4de1fab246c5c87e930c/epos_print_xml-0.3.tar.gz",
"platform": null,
"description": "# py-epos-print-xml\nPython library to communicate with Epson thermal printers via ePos-Print XML.\nThis 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.\nDepending on the printer model, some elements are not supported. Check your manual or the [Epson reference](https://reference.epson-biz.com/modules/ref_epos_print_xml_en/index.php?vid=ref_epos_print_xml_en_devicespecifications_supportedelementslist) to see which elements are supported.\n\n## Instaling\n```\npip install ePos-Print-XML\n```\n\n## Example\n\n```python\nfrom epos.printer import Printer\nfrom epos.document import EposDocument\nfrom epos.elements import Text, Feed, Barcode\nfrom epos.constants import Align\n\n# Create a new printer object with 10.0.0.12 as ip\nprinter = Printer('10.0.0.12')\n# Check if we can connect to the printer with no errors, otherwise exit\nif not printer.printer_ready():\n exit()\n\n# Create a new EposDocument object\n# This will contain all the individual elements\ndoc = EposDocument()\n\n# Add an element directly to the body of the document\ndoc.add_body(Text('This is example text!\\n'))\ndoc.add_body(Feed()) # Another way to add a newline\n\n# It's also possible to first create the text object and then change the properties\nt = Text('Some special text :O\\n')\nt.bold = True\nt.align = Align.CENTER\ndoc.add_body(t)\n\n# Add 2 empty lines\ndoc.add_body(Feed(2))\n\n# Add a barcode\ndoc.add_body(Barcode(BarcodeType.CODE39, 'text in barcode'))\n\n# Send the whole document to the printer\n# This will automatially send a Cut at the end of the document body\nr = printer.print(doc)\n\n# The print method returns a response element\n# Here we can check if the printing was succesfull\nif r.success:\n print('The printing was successfull!')\nelse:\n print(f'Printing failed. Error: {r.code}')\n```\n\n\n## Documentation\nTech reference of all the xml elements by Epson: https://reference.epson-biz.com/modules/ref_epos_print_xml_en/index.php?content_id=1\n",
"bugtrack_url": null,
"license": "",
"summary": "Library to communicate with Epson thermal printers via ePOS-Print XML protocol",
"version": "0.3",
"project_urls": {
"Bug Tracker": "https://github.com/MertenF/epos-print-xml/issues",
"Homepage": "https://github.com/MertenF/epos-print-xml"
},
"split_keywords": [
"epos",
"printing",
"receipt",
"thermoprinter",
"voucher printer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a41e3463623ce4d90fb78e53f4bb085354fba7415a65cd3f6a8a65dfce7a70e0",
"md5": "01a37c9791647698c8021c456ca374a0",
"sha256": "8e78662df283769824d006e8e953fc894bde65c5254d62a88df78b62e0024ac8"
},
"downloads": -1,
"filename": "epos_print_xml-0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "01a37c9791647698c8021c456ca374a0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10645,
"upload_time": "2023-07-24T19:17:00",
"upload_time_iso_8601": "2023-07-24T19:17:00.018914Z",
"url": "https://files.pythonhosted.org/packages/a4/1e/3463623ce4d90fb78e53f4bb085354fba7415a65cd3f6a8a65dfce7a70e0/epos_print_xml-0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20a475f7738ace49d0d416454f848521498fcfcb242c4de1fab246c5c87e930c",
"md5": "544668ba654c3149520da5997732e5b2",
"sha256": "b3db55720ffdfb4e406ac91cac5e507e27327ffb32bf011594535580006d90e6"
},
"downloads": -1,
"filename": "epos_print_xml-0.3.tar.gz",
"has_sig": false,
"md5_digest": "544668ba654c3149520da5997732e5b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 11131,
"upload_time": "2023-07-24T19:17:02",
"upload_time_iso_8601": "2023-07-24T19:17:02.898263Z",
"url": "https://files.pythonhosted.org/packages/20/a4/75f7738ace49d0d416454f848521498fcfcb242c4de1fab246c5c87e930c/epos_print_xml-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-24 19:17:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MertenF",
"github_project": "epos-print-xml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "epos-print-xml"
}