Mac: Print a PDF directly to a printer

LPR is the unix based printing built into the Mac. You can get a list of your available printers at http://localhost:631/printers .  When passing in a printer name, make sure you use the name listed on the left (the one without spaces).

var jobName = "print.pdf"
var printerName = arguments[0]
var printQuantity = arguments[1]
var printerTray = arguments[2]

//print out to PDF 
currentcontroller.print(true,false,plugins.pdf_output.getPDFPrinter(jobName));

//send the PDF to the printer 
application.executeProgram( '/usr/bin/lpr', "-T", jobName, "-P", printerName, "-#" , printQuantity, "-o", "media=" + printerTray, jobName ); 

Comments

Post new comment