I have a Star TSP600 thermal receipt printer attached to my macbook via usb. The drivers are installed, and I can print to it using the normal Mac print dialog.
How I can construct a program to send text to the printer? Is there a guide to basic printing interfaces? I generally work in Python, and I'd be willing to learn another language if it's appropriate for the task. Just looking for the basic "Hello World" example to get off the ground.
For most USB printers, all you have to do is update your software and then connect the printer to your Mac. macOS automatically detects the printer and downloads any necessary software.
system("lpr -P printer_name file_name. txt") Where "printer_name" represents the name of the printer and "file_name. txt" is the name of the file that will be printed.
Take a look at the CUPS command line options.
Then you could use popen to send text to the printer.
#!/usr/bin/env python
import popen2
popen2.popen4("lpr -P [printer] " + output_file)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With