{"id":23817828,"url":"https://github.com/lsongdev/python-escpos","last_synced_at":"2025-09-07T00:32:43.207Z","repository":{"id":15806201,"uuid":"18545712","full_name":"lsongdev/python-escpos","owner":"lsongdev","description":"Python library to manipulate ESC/POS Printers.","archived":false,"fork":false,"pushed_at":"2016-12-21T16:11:58.000Z","size":30,"stargazers_count":9,"open_issues_count":1,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-06T07:52:32.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://code.google.com/p/python-escpos/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsongdev.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-08T04:49:12.000Z","updated_at":"2025-08-11T19:09:53.000Z","dependencies_parsed_at":"2022-09-22T01:42:17.460Z","dependency_job_id":null,"html_url":"https://github.com/lsongdev/python-escpos","commit_stats":null,"previous_names":["lsongdev/python-escpos","song940/python-escpos"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lsongdev/python-escpos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fpython-escpos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fpython-escpos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fpython-escpos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fpython-escpos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsongdev","download_url":"https://codeload.github.com/lsongdev/python-escpos/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fpython-escpos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273983013,"owners_count":25202092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T05:48:51.047Z","updated_at":"2025-09-07T00:32:42.950Z","avatar_url":"https://github.com/lsongdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ESCPOS\n======\n\n## Description\n\nPython ESC/POS is a library which lets the user have access to all those printers handled by ESC/POS commands, as defined by Epson, from a Python application.\n\nThe standard usage is send raw text to the printer, but in also helps the user to enhance the experience with those printers by facilitating the bar code printing in many different standards,as well as manipulating images so they can be printed as brand logo or any other usage images migh have.\n\nText can be justified and fonts can be changed by size, type and weight.\n\nAlso, this module handles some hardware functionalities like, cut paper, cash drawer kicking, printer reset, carriage return and others concerned to the carriage alignment.\n\n## Dependencies\n\nIn order to start getting access to your printer, you must ensure\nyou have previously installed the following python modules:\n\n  * pyusb (python-usb)\n  * PIL (Python Image Library)\n\n\n\n------------------------------------------------------------------\n## Define your printer\n\n### USB printer\n\nBefore start creating your Python ESC/POS printer instance, you must see at your system for the printer parameters. This is done with the 'lsusb' command.\n\nFirst run the command to look for the \"Vendor ID\" and \"Product ID\", then write down the values, these values are displayed just before the name of the device with the following format:\n\n\txxxx:xxxx\n\nExample:\n\n\t# lsusb\n\tBus 002 Device 001: ID 04b8:0202 Epson ...\n\nWrite down the the values in question, then issue the following command so you can get the \t\"Interface\" number and \"End Point\"\n\n\t# lsusb -vvv -d xxxx:xxxx | grep iInterface\n    \tiInterface              0\n\t# lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT\n      \tbEndpointAddress     0x01  EP 1 OUT\n      \t\nThe first command will yields the \"Interface\" number that must be handy to have and the second yields the \"Output Endpoint\" address.\n\n#### USB Printer initialization\n\n\tEpson = printer.Usb(0x04b8,0x0202)\n\n#### USB Printer initialization - custom\n\nBy default the \"Interface\" number is \"0\" and the \"Output Endpoint\" address is \"0x01\", if you \nhave other values then you can define with your instance. So, assuming that we have another printer where in_ep is on 0x81 and out_ep=0x02, then the printer definition should looks like:\n\n\tGeneric = printer.Usb(0x1a2b,0x1a2b,0,0x81,0x02)\n\t\n### Network printer\n\nYou only need the IP of your printer, either because it is getting its IP by DHCP or you set it manually. Network Printer initialization\n\n\tEpson = printer.Network(\"192.168.1.99\")\n\t\n### Serial printer\n\nMust of the default values set by the DIP switches for the serial printers, have been set as default on the serial printer class, so the only thing you need to know is which serial port the printer is hooked up. Serial printer initialization\n\n\tEpson = printer.Serial(\"/dev/tty0\")\n\n## Define your instance\n\nThe following example demonstrate how to initialize the Epson TM-TI88IV on USB interface\n\n\tfrom escpos import *\n\t\"\"\" Seiko Epson Corp. Receipt Printer M129 Definitions (EPSON TM-T88IV) \"\"\"\n\tEpson = printer.Usb(0x04b8,0x0202)\t\n\t# Print text\n\tEpson.text(\"Hello World\\n\")\t\n\t# Print image\n\tEpson.image(\"logo.gif\")\t\n\t# Print QR Code\n\tEpson.qr(\"You can readme from your smartphone\")\n\t# Print barcode\n\tEpson.barcode('1324354657687','EAN13',64,2,'','')\n\t# Cut paper\n\tEpson.cut()\n\n## Links\n\nPlease visit project homepage at: \u003chttp://repo.bashlinux.com/projects/escpos.html\u003e\n\nManuel F Martinez \u003cmanpaz@bashlinux.com\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsongdev%2Fpython-escpos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsongdev%2Fpython-escpos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsongdev%2Fpython-escpos/lists"}