10 Replies Latest reply on Feb 24, 2016 10:15 AM by gmailJerald

    Unable to save a pdf with Acrobat Javascript.

    gmailJerald Level 1

      I am currently attempting to place a button on an Acrobat Pro XI document that saves the file to a specified location.  I am using the information I found on Thom Parker's article "How to Save a PDF with Acrobat JavaScript".  https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript .


      I have a file titled "mySaveAs.js" saved in the C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts folder which contains:


      var mySaveAs = app.trustedFunction(
            cPath = cPath.replace("/C/Users/me/Desktop/destinationfolder/");
               oDoc.saveAs(cPath + cFlName);
               app.alert("Error During Save");


      The button on the document runs the following javascript on the Mouse Up event:


      if(typeof(mySaveAs) == "function"){
      }else{app.alert("Something is wrong.");}


      When I click the button I get a "Warning: JavaScript Window" that specifies an "Error During Save".  I have checked the "Show console on errors and messages" box under preferences, but the only message I receive is the "Warning ..." window. 


      The purpose of the button on the Acrobat document is to force the user to save the document to a specified location.  The only fields on the document are two digital signature fields, which may or may not be completed prior to the save.


      Thank you,