Categories
Brainwaves

PinePhone Printing Receipts (pt. 2)

Another way to print on a POS Printer on Linux is to use the python_escpos library. It requires programming, but if you really want to get a lower level access to the printer, this is a nice solution.

All you need is to connect the printer over USB, find out the vendor and product ID via lsusb, create a short python script using the escpos library and you can print text, images, barcodes, whatever!

This is the code I used for my Sewoo SLK-TS400 printer, identified as “0525:a700 Netchip Technology, Inc. POS PRINTER”:

from escpos.printer import Usb

p = Usb(0x0525, 0xa700)
p.text("Hello World\n")
p.barcode('1324354657687', 'EAN13', 64, 2, '', '')
p.cut()

Easy! Time to build a “Today’s News Headlines” service. Or maybe a “Error logs needing your attention” syslog service?

Leave a Reply

Your email address will not be published. Required fields are marked *