{
"info": {
"author": "Ben Mather",
"author_email": "bwhmather@bwhmather.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Printing",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Hardware :: Hardware Drivers"
],
"description": "Python Linemode Printing\n========================\n\n|build-status| |coverage|\n\nPython library for communicating with line-mode thermal printers.\nCurrently works only with printers that support the star line mode protocol but adding support for other similar printers should be possible.\n\nAlso provides a module for compiling an xml description of a page to a list of commands.\n\nDeveloped at `Newman Online Ltd`_ and open sourced with permission.\n\nExamples\n--------\n\nBasic, without template system:\n\n.. code:: python\n\n from linemode import open_printer\n\n printer = open_printer('star+lpt:///dev/usb/lp0')\n\n printer.run_commands([\n ('fontsize-large'),\n ('select-bold'),\n ('write', \"Hello world\\n\"),\n ('cut-through'),\n ])\n\nRunning templates:\n\n.. code:: python\n\n from linemode import open_printer\n from linemode.renderers import xml\n\n printer = open_printer('star+lpt:///dev/usb/lp0')\n\n printer.run_commands(xml.render(\"\"\"\n \n \n Hello world\n \n \n \"\"\"))\n\nWith jinja:\n\n.. code:: python\n\n from jinja2 import Template\n\n from linemode import open_printer\n from linemode.renderers import xml\n\n printer = open_printer('star+lpt:///dev/usb/lp0')\n\n # jinja2 template\n template = \"\"\"\n \n {% for potatoes in [1, 2, 3, 4] %}\n \n {{ potatoes }} potato\n \n {% endfor %}\n \n \"\"\"\n # line mode printer document\n document = Template(template).render()\n\n # iterator of generic printer instructions\n commands = xml.render(document)\n\n # printer specific compiled representation\n program = printer.compile(commands)\n\n printer.execute(program)\n\nCommand Language\n----------------\n\nPrinter drivers accept an iterable of command tuples.\nTuples should contain a command name followed by any number of primitive arguments.\nFor convenience, a tuple containing just a command name can be replaced with the command name.\n\nThe following commands are supported:\n\n``reset``\n Reset everything to it's initial state.\n\n``select-bold``/``cancel-bold``\n Toggle printing bold text.\n\n``select-highlight``/``cancel-highlight``\n Toggle printing white on black instead of black on white.\n\n``fontsize-small``/``fontsize-medium``/``fontsize-large``\n Set the line height for the current line and all following lines.\n If not sent at the beginning of a new line then behaviour is undefined.\n Characters should remain the same width.\n\n Default: ``fontsize-small``\n\n``write ``\n Print the contents of a unicode string.\n If any characters are unsupported, they will be replaced with '?'.\n\n``barcode