跳转到主要内容

DP-EH600热敏打印机(AdaFruit)的驱动程序。

项目描述

https://travis-ci.org/BoboTiG/thermalprinter.svg?branch=master

用于管理DP-EH600热敏打印机(由AdaFruit销售的)的Python模块。

  • 仅支持Python 3+ 且遵守PEP8标准;

  • 这是一个对技术手册的清晰跟随,只有少数辅助工具;

  • 并提供了一份完整且美观的文档 :);

  • 还有几个有用的食谱

  • 欢迎贡献者,请查看开发者指南

安装

就像这样简单

python3 -m pip install --upgrade --user thermalprinter

用法

实例胜过千言万语

from PIL import Image
from ThermalPrinter import *

with ThermalPrinter(port='/dev/ttyAMA0') as printer:
    # Picture
    printer.image(Image.open('gnu.png'))

    # Bar codes
    printer.barcode_height(80)
    printer.barcode_position(BarCodePosition.BELOW)
    printer.barcode_width(3)
    printer.barcode('012345678901', BarCode.EAN13)

    # Styles
    printer.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)

    # Accents
    printer.out('Voilà !', justify='C', strike=True,
                underline=2, codepage=CodePage.ISO_8859_1)

    # Line feeds
    printer.feed(2)

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码发行版

thermalprinter-0.2.0.tar.gz (25.3 kB 查看哈希值)

上传时间 源代码

构建版本

thermalprinter-0.2.0-py2.py3-none-any.whl (26.2 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者