This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

escpos-xml is a library to parse XML defined receipt and print it on ESC/POS Printer using python-escpos library.

The module contains a RELAX NG schema for the XML: \(escpos_xml/escpos.rng\). The syntax is quite similar to HTML.

Example:

>>> import os
>>> from io import BytesIO, open
>>> from escpos.printer import Usb
>>> from escpos_xml import parse
>>> xml = BytesIO('''
... <receipt width="48">
...     <h1>Receipt!</h1>
...     <ul>
...         <li>
...             <span align="left" width="22">Product</span>
...             <span align="right" width="24">0.15€</span>
...         </li>
...     </ul>
...     <hr/>
...     <p size="2h">
...         <span align="left" width="24">TOTAL</span>
...         <span align="right" width="24">0.15€</span>
...     </p>
...     <barcode encoding='ean13'>
...         5449000000996
...     </barcode>
...     <cashdraw pin="2"/>
...     <cut/>
... </receipt>''')
>>> printer = Usb(0x0483, 0x5743)
>>> parse(printer, xml)
>>> parse(printer,
...      open(os.path.join('escpos_xml', 'tests', 'image.xml'), 'rb'))

Documenation:

Root

The root element is \(receipt\) with the optional attribute \(width\) which is the number of character in a line.

In-lines:

The tags for in-line elements are: \(bold\), \(b\) and \(span\). The attribute available are: \(bold\), \(underline\), \(size\), \(font\), \(inverted\) and \(color\). The \(span\) element can have also the attributes \(align\) and \(width\).

Blocks:

The tags for block element are: \(p\), \(h(1-5)\) and \(hr\). The attributes are the same as the in-line elements with in addition the \(align\) which could be \(left\), \(right\) or \(center\).

Lists:

It is possible to have ordered or unordered lists with the elements \(ol\) and \(ul\). The type of bullet is defined by the attribute \(type\). For ordered list, the start number can be specify with the \(start\) attribute. Each item is defined by an element \(li\) which has the same attributes as the in-line elements.

The list can be nested.

Barcode:

The \(barcode\) element print the code using the \(encoding\) attribute as format. Other attributes are: \(width\), \(height\), \(position\) and \(font\).

Image:

The \(img\) element print the image defined by the \(src\) attribute using a base64 data-url format. Example:

<img src="data:image/png;base64,AAABAAMAEBAAAAEAIABoBAAANgAAAC..."/>

Operations:

Some operations are available: \(cut\), \(partialcut\) and \(cashdraw\). The \(cashdraw\) element requires a \(pin\) attribute.

Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python-escpos-xml-0.1.0.tar.gz (28.0 kB) Copy SHA256 Checksum SHA256 Source Feb 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting