Search code examples
javascriptpdfprintingacrobat

Send file to Network Printer by Javascript - Acrobat DC


I have a trusted function that saves a file to my network printer. But it doesnt work, I get this error: "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." This is my code:

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();
});

Solution

  • Ok, I found the solution. In windows map the "\\out\spool\print\Xerox\" to a new network Drive. In my case I mapped it to X: so the code becomes:

    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();
    });