These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

save as button on my form with path and new file name

madpco
Registered: Mar 30 2010
Posts: 3

Hi Everyone, I just purchased acrobat9 to make fill in forms. I have No experience with JS but up to now i've been having good success by copy/pasting stuff I found here on the forums. I have now spent at least 7 hours reading the forums to figure out how to use the SaveAs command with no success whatsoever --snif--

What I need to do is create a button on my form that the user can press to save a copy of the filled form with a filename that is in one of the fields

I understand that I need to create a ".JS" file in the javascripts folder to authorize the SaveAs command but I dont understans javascrips enough to make heads or tails of all the information on the forums..

here are the parameters im working with:

name of the original pdf form file (set as read-only): dossier_client.pdf
field name that contains the desired filename for saveas (text field on page 2): nomfichier
path I want to save to: c:\dossier

I would really appreciate if someone could give me the scripts to paste in the button action and into the JS file.

Thanks a million.. Simon

My Product Information:
Acrobat Standard 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Have you read these articles?
http://www.acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript
http://www.acrobatusers.com/tutorials/2006/folder_level_scripts

Is this for a generally distributed form on a form used in controlled environment?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

madpco
Registered: Mar 30 2010
Posts: 3
Its for a controlled environment only. the resulting filled out forms will be saved for filing and occasionally printed

Yes I read the articles a few times... alot of head scratching and little results. lol This is why I posted my problem, hoping for an easier solution.

thank you
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Once you have the application folder level script installed, then you only need to provide 3 parameters.

1. The PDF document object to use, usually 'this'.
2. The directory to save the file to. You need to use Acrobat's path format.
3. The file name.

The mouse up code has a lot of code to fix the path from the 'this.getPath()' method.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There isn't an easier solution. But this isn't too bad once you get into it.

The article on saving a PDF file provides the exact code you'll need, the "mySaveAs" function. You'll need to copy this code into a ".js" file, which is located in on of the Acrobat JavaScript folders, as pointed out by the article on folder level scripts. Then place the code located rigth after "mySaveAs" in the article in a button on your form. Now you'll need change the input parameters to "mySaveAs" to match the save parameters you want.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script