通过 Javascript 将文件发送到网络打印机 - Acrobat DC

Send file to Network Printer by Javascript - Acrobat DC

我有一个受信任的功能,可以将文件保存到我的网络打印机。但它不起作用,我收到此错误:"The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder." 这是我的代码:

var xerox = app.trustedFunction( function()
{
app.beginPriv();
var xeroxPath = "\\out\spool\print\Xerox\";
this.saveAs(xeroxPath + this.documentFileName);
app.alert("PDF is sent to the printer",3)
app.endPriv();
});

好的,我找到了解决方案。在 windows 中将“\\out\spool\print\Xerox\”映射到一个新的网络驱动器。在我的例子中,我将它映射到 X: 所以代码变成:

var xerox = app.trustedFunction( function()
{ app.beginPriv();
var xeroxPath = "x:\";
this.saveAs(xeroxPath + this.documentFileName);
app.alert("PDF is sent to the printer",3)
app.endPriv();
});