3 Replies Latest reply on Oct 11, 2009 8:37 AM by gkaiseril

    Need Help With The 'this.closeDoc' Command

    Jim MacD Level 1

      Is there a way to save (or is there a work around available) that can be used to save data in a pdf when using the ‘this.closeDoc()’ command? The 'disclosed' property of the called PDF (in this case: PFSL-18. 06.96.pdf) is set to 'true'.

       

      What I want to do with the code below is to prompt the user to (YES) Save and Close the pdf, or (NO) Reset (clear) the form, before saving and closing the pdf. Currently, on YES, the pdf closes but does not save data, and on NO does not reset and save the cleared pdf before closing. I’m assuming the Doc.saveAs command should be inserted just above the lines ‘this.closeDoc….’ but am not sure how it should be written.

       

      {

      var cMsg = "Do you want to save changes to ‘PFSL-18, 06.96.pdf’ before closing?";

      var nRtn = app.alert(cMsg,1,3,"PFSL-18");

      //Yes

      if(nRtn==4)

      {

      this.closeDoc("../Mutual Fund Forms/PFSL-18, 06.96.pdf", this);

      }

      else

      //No

      {

      this.resetForm();

      this.closeDoc("../Mutual Fund Forms/PFSL-18, 06.96.pdf", this);

      }

      }

        • 1. Re: Need Help With The 'this.closeDoc' Command
          try67 MVP & Adobe Community Professional

          The parameters you're providing to closeDoc are not valid. It only takes a single parameter, bNoSave, which is a boolean that specifies if the document should not be saved.

          The default is false, meaning the user is prompted to save the file if it has been changed.

          • 2. Re: Need Help With The 'this.closeDoc' Command
            Jim MacD Level 1

            I searched for 'bNoClose' and found little information on it. Would you be so kind to midify my sample with the 'bNoClose' command?

            • 3. Re: Need Help With The 'this.closeDoc' Command
              gkaiseril MVP & Adobe Community Professional

              From the Acrobat JS API Reference:

                

              Parameters

               

               

               

               

               

               

              bNoSave

               

              (optional) A Boolean value indicating whether to close the document without saving:

               

              If false (the default), the user is prompted to save the document if it has been modified.

               

              If true, the document is closed without prompting the user and without saving, even if the document has been modified. Be careful in using this feature because it can cause data loss without user approval.


              There is only parameter for the 'closeDoc' method.

               

              The Acrobat JS API Reference is a free download from the Acrobat Developer area of their web site