Copy link to clipboard
Copied
A client requires that any opened PDF file in Acrobat reader to be printed automatically at the default printer.
I found a script that can do that, but it seems that Adobe Reader DC (last version) does not execute it, even though the sprint is in the app javascript folder C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\Javascripts\
the script is here:
```/*
* trustedPrint function: Exercise the print function in the privileged context
*
* @Param doc The Doc object of the target document
* @Param pparam The PrintParams object containing print settings
*/
trustedPrint = app.trustedFunction(
function(doc, pparams) {
app.beginPriv();
doc.print(pparams);
app.endPriv();
}
);
/**
* Main function: Print silently if requested
*
* @Param theDoc The event target of executing the menu item of this sample.
*/
function JSPrintExt(theDoc,printerName,silent) {
// get the printParams object of the default printer
var pp = theDoc.getPrintParams();
if (silent) {
// print all pages silently.
pp.interactive = pp.constants.interactionLevel.silent;
}
for (var i=0; i<app.printerNames.length; i++) {
if (app.printerNames[i].toLowerCase().indexOf(printerName) > -1) {
pp.printerName=app.printerNames[i];
}
}
// Print to the default printer without invoking the print dialog
trustedPrint(theDoc, pp);
}```
Copy link to clipboard
Copied
What code do you add to the PDF, and where do you put it?
What messages do you get in the JavaScript console?