5 Replies Latest reply on Jan 12, 2017 4:27 AM by try67

    Saving PDF Form with Filename picked from the form fields

    rakeshk21205956 Level 1

      I want to save my PDF form with a filename which will be picked from one of the form fields. I don't want path to be prefixed.. that may choosed by the user in the traditional way.. i only want the filename to be automatically there in the SAVE As dialog box from one of the form fields.


      I got some of script from internet but none of them work for me.


      // get the value of the form field

      var text1Value = this.getField("Text1").value;


      // make a file name from the field value

      var newFileName = text1Value + ".pdf";


      // get the path where the file is currently located

      var filePath = this.path.replace(this.documentFileName);


      // create the new full path

      var newFullFilePath = filePath + newFileName;


      try {

      this.saveAs(newFullFilePath); // Only this will not work from a button...

      } catch (e) {

      app.alert("Error! Could not save as: " + newFullFilePath);