Printing to a USB printer with Python on Mac

I have a Star TSP600 thermal imaging case attached to my macbook via usb. The drivers are installed, and I can print them using the regular Mac print dialog.

How can I create a program to send text to a printer? Is there a guide to the basic printing interfaces? I generally work in Python, and I would like to learn another language if it is suitable for this task. Just look for the basic Hello World example to go crazy.

+6
printing usb macos
source share
1 answer

Check out the CUPS command line options .

Then you can use popen to send text to the printer.

#!/usr/bin/env python import popen2 popen2.popen4("lpr -P [printer] " + output_file) 
+5
source share

All Articles