Page 1 of 1

Silently printing a PDF

PostPosted: Sun May 02, 2004 10:12 am
by idoctor
I have used this method to silently print to acrobat reader. It prints the document with no user input. The method first writes a pdf stored in the database to a temporary file on the hardrive. Acrobat_location is the location of the .exe for acrobat reader and globals.Printer_Default is the name of the printer where you want to send the job.

// This will write the docuement to a temporary file
var tempFile = application.createTempFile('myFile','.pdf');
application.writeFile(tempFile,MediaFieldContainingthePDF);
// This silently prints the document
application.executeProgramInBackground('\"'+Acrobat_location+'\"', '/p', '/h', '/t',
'\"'+tempFile+'\"', globals.Printer_Default);

Thank Jan Block

John McCann