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

Acrobat X Save As function

telby30
Registered: Nov 11 2011
Posts: 3
Answered

Hello all,
 
I have spent a day reading many different forums on how to save a .pdf using a script. I have tried multiple different ways but have not had any luck. I am trying to use the folder level script but don't know which folder to put it in with Acrobat X. Or I keep getting a "event.target.saveAs is not a function".
 
What I need done is this:
 
A button to press and pull a string (case number) from a form. Using this case number as the name of the file and need it to save to a particular path.
 
Any help would be great!
 
Thanks,
 

My Product Information:
Acrobat Pro 10.0, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Adobe just changed the folder where one can place privleged scripts for Acrobat X, User JavaScript Changes for 10.1.1 (Acrobat | Reader).

George Kaiser

telby30
Registered: Nov 11 2011
Posts: 3
Thanks for the response.

That is where I put my folder script but still not working. Below is my folder level script.

var mySaveDoc = app.trustedFunction(function(doc)
{
app.beginPriv();
var myPath = "/u/elbertt/" + caseNum;
doc.saveAs(myPath);
app.endPriv();
});

How do I call this function?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You call the method with it's name and parameters in parenthesis, but you should probably pass caseNum as a parameter as well (and don't forget to add ".pdf" at the end of the file path). At the moment you can call your method like this:
mySaveDoc(this);

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

telby30
Registered: Nov 11 2011
Posts: 3
Great! Got it to work!

Another quick question. This is going to be used by many people. I do not feel like, or have the time to set up this folder script for all my users...

Is there a way, within the "app.execMenuItem("Save")" to auto populate the file name and path? With the only user interaction being a click to accept it?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
No, there isn't.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com