{ "info": { "author": "Shantanu Bhadoria", "author_email": "shantanu@cpan.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Office/Business :: Financial :: Point-Of-Sale", "Topic :: Printing", "Topic :: Utilities" ], "description": "Python Printer ESCPOS\r\n=====================\r\n\r\n\r\n.. image:: https://img.shields.io/badge/status-production-blue.svg\r\n\r\n.. image:: https://img.shields.io/badge/python%20version-2.7-blue.svg\r\n\r\n.. image:: https://img.shields.io/github/license/mashape/apistatus.svg\r\n\r\nDocumentation\r\n=============\r\n\r\nIf you are just starting up with POS RECEIPT Printers, you must first refer to http://pythonhosted.org/python-printer-escpos/ to get started.\r\n\r\npython-printer-escpos provides four different types of printer connections to talk to a ESCPOS printer.\r\n\r\nInstallation\r\n============\r\n\r\nGet some prerequisites first for image printing etc.\r\n::\r\n\r\n pip install Pillow\r\n\r\nInstall python-printer-escpos\r\n::\r\n\r\n pip install python-printer-escpos\r\n\r\nCreating printer objects\r\n========================\r\n\r\nUSB Printer\r\n***********\r\n\r\nIf your printer is connected by a USB interface use this connection mode\r\n\r\n.. code:: python\r\n\r\n from escpos.connections import getUSBPrinter\r\n\r\n\r\n printer = getUSBPrinter()(idVendor=0x1504,\r\n idProduct=0x0006\r\n inputEndPoint=0x82,\r\n outputEndPoint=0x01) # Create the printer object with the connection params\r\n\r\n printer.text(\"Hello World\")\r\n printer.lf()\r\n\r\nNetwork Printer\r\n***************\r\n\r\nIf your printer is on a network use this connection mode. 9100 is the most common port number for receipt printers. However you must check your printer manual to get the correct port number for your printer.\r\n\r\nSynposis\r\n''''''''\r\n\r\n.. code:: python\r\n\r\n from escpos.connections import getNetworkPrinter\r\n\r\n\r\n printer = getNetworkPrinter()(host='192.168.0.20', port=9100)\r\n\r\n printer.text(\"Hello World\")\r\n printer.lf()\r\n\r\nSerial Printer\r\n**************\r\n\r\nYou printer may also be connected over a RS232 serial interface. You must get the correct baudrate for your printer for a serial connection.\r\n\r\nSynposis\r\n''''''''\r\n\r\n.. code:: python\r\n\r\n from escpos.connections import getSerialPrinter\r\n\r\n\r\n printer = getSerialPrinter()(dev='/dev/ttyS0',\r\n baudrate=9600)\r\n\r\n printer.text(\"Hello World\")\r\n printer.lf()\r\n\r\nDevice File Printer\r\n*******************\r\n\r\nIf you are unable to figure out how to use the other connection modes, you can try printing directly to the printer device file. This works in most use cases, however you will not be able to use the read device status functionality in this mode.\r\n\r\nSynposis\r\n''''''''\r\n\r\n.. code:: python\r\n\r\n from escpos.connections import getFilePrinter\r\n\r\n\r\n printer = getFilePrinter()(dev='/dev/ttys2')\r\n\r\n printer.text(\"Hello World\")\r\n printer.lf()\r\n\r\nExamples\r\n========\r\n\r\nPrinting Hello World\r\n********************\r\n\r\n.. code:: python\r\n\r\n printer.text(\"Hello World\")\r\n printer.lf()\r\n\r\n\r\nPrinting a image\r\n****************\r\n\r\nPrints a image to the printer( max width: 512px, max height: 255px)\r\n\r\n.. code:: python\r\n\r\n printer.image('/home/shantanu/companylogo.gif')\r\n\r\nPrint QR Code\r\n*************\r\n\r\nPrint QR Codes to your printer. The example also includes a method for printing Wifi QR Codes to your printer.\r\n\r\n.. code:: python\r\n\r\n printer.qr('My name is Shantanu Bhadoria')\r\n printer.qr('WIFI:T:WPA;S:ShantanusWifi;P:wifipasswordhere;;') # Create a QR code for connecting to a Wifi\r\n printer.lf()\r\n\r\nPrint a barcode\r\n***************\r\n\r\nPrint a barcode in one of the available formats to the printer. You may also specify HRI text position above or below the barcode.\r\n\r\n.. code:: python\r\n\r\n printer.barcode(text='Shantanu', textPosition='below', font='b', height=100, width=2, system='CODE93')\r\n printer.lf()\r\n\r\nAligning Printouts\r\n******************\r\n\r\nSet text alignment for your text.\r\n\r\n.. code:: python\r\n\r\n printer.align('center')\r\n printer.text('This text is center aligned')\r\n printer.align('right')\r\n printer.text('This text is right aligned')\r\n\r\nPrint in bold\r\n*************\r\n\r\nprint text in bold font\r\n\r\n.. code:: python\r\n\r\n printer.bold()\r\n printer.text('This text is bold text')\r\n printer.lf()\r\n printer.bold(False)\r\n printer.text('This text is not bold')\r\n printer.lf()\r\n\r\nChanging char spacing\r\n*********************\r\n\r\nSet spacing between each letter in printout.\r\n\r\n.. code:: python\r\n\r\n printer.charSpacing(1)\r\n printer.text('This text has normal right char spacing')\r\n printer.lf()\r\n printer.charSpacing(5)\r\n printer.text('This text has 5 right char spacing')\r\n printer.lf()\r\n\r\nChanging print color(only on some models)\r\n*****************************************\r\n\r\nThis function is supported in some printers, particularly dot matrix receipt printers with two color ribbons.\r\n\r\n.. code:: python\r\n\r\n printer.color()\r\n printer.text('This text is in primary color')\r\n printer.lf()\r\n printer.color(1)\r\n printer.text('This text is in color 1')\r\n printer.lf()\r\n\r\nChange font height\r\n******************\r\n\r\nSet font height.\r\n\r\n.. code:: python\r\n\r\n printer.doubleHeight()\r\n printer.text('This text is double height text')\r\n printer.lf()\r\n printer.doubleHeight(False)\r\n printer.text('This text is not double height')\r\n printer.lf()\r\n\r\nChange font to double width\r\n***************************\r\n\r\nSet font width.\r\n\r\n.. code:: python\r\n\r\n printer.doubleWidth()\r\n printer.text('This text is double width text')\r\n printer.lf()\r\n printer.doubleWidth(False)\r\n printer.text('This text is not double width')\r\n printer.lf()\r\n\r\nSwitching font\r\n**************\r\n\r\nSwitch between printer fonts. Limited fonts are supported, mostly just 'a' or 'b'\r\n\r\n.. code:: python\r\n\r\n printer.font('b')\r\n printer.text('This text is in font b')\r\n printer.lf()\r\n printer.font('a')\r\n printer.text('This text is in font a')\r\n printer.lf()\r\n\r\nInvert text(black on white to white on black)\r\n*********************************************\r\n\r\nInvert printing so it prints in white over a black background.\r\n\r\n.. code:: python\r\n\r\n printer.invert()\r\n printer.text('This text is in inverted colors')\r\n printer.lf()\r\n printer.invert(False)\r\n printer.text('This text is not in inverted colors')\r\n printer.lf()\r\n\r\nSet left margin\r\n***************\r\n\r\nSet left margin.\r\n\r\n.. code:: python\r\n\r\n printer.leftMargin(30)\r\n printer.text('This text has left Margin of 30')\r\n printer.lf()\r\n\r\nSet line spacing\r\n****************\r\n\r\nSet spacing between lines.\r\n\r\n.. code:: python\r\n\r\n printer.lineSpacing()\r\n printer.text('This text has 1/6 inch line spacing')\r\n printer.lf()\r\n printer.lineSpacing(5)\r\n printer.text('This text has 5/60 inch line spacing')\r\n printer.lf()\r\n\r\nSet print area width\r\n********************\r\n\r\nSet width of printable area.\r\n\r\n.. code:: python\r\n\r\n printer.printAreaWidth(200)\r\n printer.text('Set print area width to 200')\r\n printer.lf()\r\n printer.text('1234567890123456789012345678901234567890123456789012345678901234567890')\r\n printer.printAreaWidth()\r\n printer.lf()\r\n\r\nRotate text 90 degrees\r\n**********************\r\n\r\nRotate all text 90 degrees\r\n\r\n.. code:: python\r\n\r\n printer.rotate90(100)\r\n printer.text('This text is rotated 90 degrees')\r\n\r\nSet tab positions\r\n*****************\r\n\r\nSet tab positions. This is useful in combination with tab() for printing out receipts with plus, quantities and prices.\r\n\r\n.. code:: python\r\n\r\n printer.tabPositions([3, 32])\r\n for plu in plus:\r\n printer.text(plu.quantity)\r\n printer.tab()\r\n printer.text(' x ' + plu.name)\r\n printer.tab()\r\n printer.text('$' + plu.price)\r\n\r\n \"\"\"\r\n 2 x Guinness $12.00\r\n 3 x Margharita Pizza $45.00\r\n 10 x Coke $25.00\r\n 2 x Tandoori Chicken $40.00\r\n \"\"\"\r\n\r\nUnderline\r\n*********\r\n\r\nUnderline text.\r\n\r\n.. code:: python\r\n\r\n printer.underline()\r\n printer.text('This text is underlined text')\r\n printer.lf()\r\n printer.underline(True,True)\r\n printer.text('This text is double dot width underlined text')\r\n printer.lf()\r\n printer.underline(False)\r\n printer.text('This text is not underlined')\r\n printer.lf()\r\n\r\nPrint upside down\r\n*****************\r\n\r\nPrint text in upside down mode.\r\n\r\n.. code:: python\r\n\r\n printer.upsideDown()\r\n printer.text('This text is upside down')\r\n printer.lf()\r\n printer.upsideDown(False)\r\n printer.text('This text is not upside down')\r\n printer.lf()\r\n\r\nSet horizontal position\r\n***********************\r\n\r\nSet horizontal printing position.\r\n\r\n.. code:: python\r\n\r\n printer.horizontalPosition(100)\r\n printer.text('This text starts at 1/6inches from left margin')\r\n\r\nCut paper\r\n*********\r\n\r\nCut the paper using the paper cutter(Only for models with cutter)\r\n\r\n.. code:: python\r\n\r\n printer.cutPaper()\r\n\r\nOpen cash drawer\r\n****************\r\n\r\nSends a electric pulse on close contact interface. Usually connected to a cash drawer for opening the drawer.\r\n\r\n.. code:: python\r\n\r\n printer.drawerKickPulse()\r\n\r\nTo run the commands first you must create a printer object as explained in the previous section", "description_content_type": null, "docs_url": "https://pythonhosted.org/python-printer-escpos/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shantanubhadoria/python-printer-escpos", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "python-printer-escpos", "package_url": "https://pypi.org/project/python-printer-escpos/", "platform": "Any", "project_url": "https://pypi.org/project/python-printer-escpos/", "project_urls": { "Homepage": "https://github.com/shantanubhadoria/python-printer-escpos" }, "release_url": "https://pypi.org/project/python-printer-escpos/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "Python interface for ESCPOS Printers", "version": "0.0.3" }, "last_serial": 2140472, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "97319516bb80034d4a833618b9c0586d", "sha256": "ee38ae8db8243d6e7992f4bd7a2bbc12c812adbb029584989a7de720f480a46f" }, "downloads": -1, "filename": "python-printer-escpos-0.0.1.tar.gz", "has_sig": false, "md5_digest": "97319516bb80034d4a833618b9c0586d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12232, "upload_time": "2016-04-21T05:23:38", "url": "https://files.pythonhosted.org/packages/3d/df/96f3a0e44e796902126e130d73d6e12620b4e73baf4bb8efce8e068d97fc/python-printer-escpos-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "ae0f8020a81265728611bc90970ef945", "sha256": "19dfb12892cd55a973e4ea6a127816d17b9e3f0079e156bddbba768b078d60a7" }, "downloads": -1, "filename": "python_printer_escpos-0.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "ae0f8020a81265728611bc90970ef945", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 14384, "upload_time": "2016-05-09T04:34:36", "url": "https://files.pythonhosted.org/packages/6f/ea/d37e531457682ada7b6e17935862fbb6fded6caf15d4b8401eb43dcd8c9f/python_printer_escpos-0.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f92728e84f3c8eec69a74c12514b90fa", "sha256": "3255f849a1632310c9bb5889af3ee551b8c55aa98ebddde455e608a2a3b71bb5" }, "downloads": -1, "filename": "python-printer-escpos-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f92728e84f3c8eec69a74c12514b90fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12247, "upload_time": "2016-05-09T04:34:27", "url": "https://files.pythonhosted.org/packages/3d/4b/5d301ec54ecddbfa36166b00aa2e9e4c899ee7c9bed6c84a0d9ada3285ce/python-printer-escpos-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "15d9420610aa51fe78b71d7b6c0031e1", "sha256": "70bf483a149315745cc6b02df684bc3aea0c3defa3c79fff571fa0b59491bd9f" }, "downloads": -1, "filename": "python-printer-escpos-0.0.3.tar.gz", "has_sig": false, "md5_digest": "15d9420610aa51fe78b71d7b6c0031e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12061, "upload_time": "2016-05-23T02:28:27", "url": "https://files.pythonhosted.org/packages/f6/e9/9be83bef5cb72ddf0000820f56f75fea85efaef30768f5e858aadf63b512/python-printer-escpos-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15d9420610aa51fe78b71d7b6c0031e1", "sha256": "70bf483a149315745cc6b02df684bc3aea0c3defa3c79fff571fa0b59491bd9f" }, "downloads": -1, "filename": "python-printer-escpos-0.0.3.tar.gz", "has_sig": false, "md5_digest": "15d9420610aa51fe78b71d7b6c0031e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12061, "upload_time": "2016-05-23T02:28:27", "url": "https://files.pythonhosted.org/packages/f6/e9/9be83bef5cb72ddf0000820f56f75fea85efaef30768f5e858aadf63b512/python-printer-escpos-0.0.3.tar.gz" } ] }