dp-eh600热敏打印机(adafruit)的驱动程序。
thermalprinter的Python项目详细描述
管理dp-eh600热敏打印机的python模块(由adafruit销售)。
- python 3+仅与pep8兼容;
- 这是本技术手册的一个干净的后续操作,只需几个助手即可;
- 还有一个complete, and beautiful, documentation:)
- 还有几个有用的recipes;
- contibutors欢迎使用,请检查developer guide!
安装
简单到:
python3 -m pip install --upgrade --user thermalprinter
用法
一个例子胜过千言万语:
fromPILimportImagefromThermalPrinterimport*withThermalPrinter(port='/dev/ttyAMA0')asprinter:# Pictureprinter.image(Image.open('gnu.png'))# Bar codesprinter.barcode_height(80)printer.barcode_position(BarCodePosition.BELOW)printer.barcode_width(3)printer.barcode('012345678901',BarCode.EAN13)# Stylesprinter.out('Bold',bold=True)printer.out('Double height',double_height=True)printer.out('Double width',double_width=True)printer.out('Inverse',inverse=True)printer.out('Rotate 90°',rotate=True,codepage=CodePage.ISO_8859_1)printer.out('Strike',strike=True)printer.out('Underline',underline=1)printer.out('Upside down',upside_down=True)# Chinese (almost all alphabets exist)printer.out('现代汉语通用字表',chinese=True,chinese_format=Chinese.UTF_8)# Greek (excepted the ΐ character)printer.out('Στην υγειά μας!',codepage=CodePage.CP737)# Accentsprinter.out('Voilà !',justify='C',strike=True,underline=2,codepage=CodePage.ISO_8859_1)# Line feedsprinter.feed(2)