MacOS – How to choose printer from command line or from a Python application

command linemacospdfpreviewprinting

I am currently developing an application in Python that will run on Macs and will need to print PDF files. In the past I have managed to send PDF files to printer automatically by using some commands in a Bash script. However, I never found a way to specify one printer, it would always send it right into the currently selected printer (usually the last used one).

Does anyone know if there any way to launch the Preview application from command line, or any other way to preview and choose printers before actually printing?

Best Answer

  • lpstat shows all printers known to the system
  • lpr -P NAME prints to printer NAME