5 Replies Latest reply on Apr 7, 2009 1:33 AM by Bernd Alheit

    Save a file

      I am using v9. I have a form that I open at each use. When I complete the form there is one field that has data that would be the same as an invoice number. Now when I hit the save as button, is there a script that would save the doc as the number in the particular filed?

      Invoice #: 08-123456 is the field and I would like to save this particular doc as 08-123456 when I hit the save as button.

      Thanks in advance for any help!
        • 1. Re: Save a file
          George_Johnson MVP & Adobe Community Professional
          Look at the doc.saveAs JavaScript method. But you'd have to set up a custom toolbar button, a custom menu item, or a button on the form. The code that includes the saveAs statement would have to be in a folder-level JavaScript file. See the Acrobat JavaScript reference for more information, and the trusted function documentation in particular.

          George
          • 2. Re: Save a file
            Matt_Crook Level 1

            Hi

             

            I am trying to accomplish the same thing. Could anyone provide a bit more info about setting up the save as javascript

             

            Thanks in advance

            • 3. Re: Save a file
              gkaiseril MVP & Adobe Community Professional

              This procedure has a number of security resstrictions that require the use of a trusted JavaScript funciton in a document level folder.

               

              You will have to build the file path name

               

               

               

               

              // get the field name

              var sFileName = this.getField('sFieldName').value;

              // only save if the value for the field is not empty

              if (sFileName != '')

              this.saveAs("/c/customer/invoices/" + sFileName + ".pdf");

              • 4. Re: Save a file
                Matt_Crook Level 1

                Thanks GKaiseril

                 

                I am totally new to all this. I want to be able to press a button on my form and make the save as window pop up with the filename already in there (this would be colleted from a field called 'filename')

                 

                I can create a button to go to save as by adding javascript to it, bu thave no idea where to place the code to make it collect the filename. I don't have to have the 'save as' go to a specific folder, but this would be great if it's not too hard to do.

                 

                If you could help me that would be great, but I'm not sure how simple a task it is.

                 

                 

                I am guessing I need something similar to the below

                 

                app.execMenuItem("SaveAs");
                var sFileName = this.getField('filename').value;

                 

                Thanks again

                 

                Matt

                • 5. Re: Save a file
                  Bernd Alheit Adobe Community Professional & MVP

                  I want to be able to press a button on my form and make the save as window pop up with the filename already in there (this would be colleted from a field called 'filename')

                  Not possible.