如何解决Acrobat Reader DC 使用 javascript
客户要求在默认打印机上自动打印在 Acrobat 阅读器中打开的任何 PDF 文件。
我找到了一个可以做到这一点的脚本,但似乎 Adobe Reader DC(最新版本)不会执行它,即使 sprint 位于应用程序 javascript 文件夹 C:\Program Files (x86)\Adobe\Acrobat Reader DC\阅读器\Javascripts
脚本在这里:
* 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);
}```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。