简体   繁体   中英

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?

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:

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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