简体   繁体   English

如何使用 Star TSP 650 II 打印收据?

[英]how do you print a receipt using Star TSP 650 II?

Does anyone know a beginner friendly tutorial for Star TSP 650II (using parallel port) to print something from django/python?有谁知道 Star TSP 650II(使用并行端口)从 django/python 打印一些东西的初学者友好教程?

I can't seem to figure out how it works.我似乎无法弄清楚它是如何工作的。

It's not an easy one, as the Star TSP printers accept 'Star graphic mode commands' - You can see the full commandset here:这并不容易,因为 Star TSP 打印机接受“Star 图形模式命令”——您可以在此处查看完整的命令集:

http://www.starasia.com/Download/Manual/star_graphic_cm_en.pdf http://www.starasia.com/Download/Manual/star_graphic_cm_en.pdf

I spent some time creating a python module - StarTSPImage , which will take a PIL image in Python, and then convert to the right raster/binary data that the printer is expecting.我花了一些时间创建了一个 python 模块 - StarTSPImage ,它将在 Python 中获取 PIL 图像,然后转换为打印机期望的正确光栅/二进制数据。 Using the module can print an image with the following:使用该模块可以打印具有以下内容的图像:

 import StarTSPImage raster = StarTSPImage.imageFileToRaster('file.bmp', cut=True)) printer = open('/dev/usb/lp0', 'wb') printer.write(raster)

I have used imgkit to generate an image from HTML in the past and used that for reciepts.我过去曾使用 imgkit 从 HTML 生成图像并将其用于收据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM