0

In MacOS, I'm using python to write PDF Service Workflows, and after processing the incoming PDF (manipulating it with PyObjC Quartz APIs), I want to send it back to the print queue and get it printed without any user effort.

Is it possible to send a Graphics Context or PDFKit data directly to the printer?

benwiggy
  • 1,440
  • 17
  • 35

2 Answers2

1

If you're using python via the command line, this sounds like a job for the Line Printer Remote lpr command line tool.

As in lpr filename.pdf or lpr -P printername filename.pdf.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
1

You can use the Core Printing APIs. You can use PMPrinterPrintWithProvider() for the all-in-one approach, or the functions under Print Loop Functions to drive the print loop manually.

I don't know off-hand if those functions are available via the PyObjC bridge.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154