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

Where and how to code Doc.saveAs() method

Jesus
Registered: Mar 27 2007
Posts: 54

I’m developing a fillable form with drop down list, data connection, signatures and everything in Adobe LiveCycle Designer … and I want to have a button to save a copy of the form once it is completed. I put the following code in the click event of a button:
 
mySaveAs = app.trustPropagatorFunction(function(doc,path)
{
app.beginPriv();
doc.saveAs(path);
app.endPriv();
})
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
{
// privileged and/or non-privileged code above
app.beginPriv();
mySaveAs(doc,path);
app.endPriv();
// privileged and/or non-privileged code below
});
 
myTrustedSpecialTaskFunc(this, "/c/jesus/mySavedDoc.pdf");
 
But I’m getting the following error message:
 
NotAllowedError: Security settings prevent access to this property or method.
 
I read some Java Scripting documentation and I understand that there are different levels for Java Script: folder level, application level, form field level.
 
Where do I have to put the code in order to have the results that I want? What else I have to do?
 
Please, try to explain that to me as If I’m seven years old boy :=)
 
Thanks

My Product Information:
Acrobat Pro 8, Windows
pdftrainer
Expert
Registered: Dec 14 2005
Posts: 180
OK, let's start talking. What's wrong with:

app.execMenuItem("SaveAs");

as a JavaScript in a Click event?

A certified expert on Adobe Acrobat, Carl Young is an Adobe Acrobat and LiveCycle Designer trainer and consultant based in Phoenix. He is the producer of the [link=http://www.pdfconference.com/]PDF Conference[/link].

Jesus
Registered: Mar 27 2007
Posts: 54
The problem with app.execMenuItem("SaveAs"); is that you cannot dinamically assign a file name and a path...

Can you help me??
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You can either get your PDF certified and keep the code within the PDF or you will have to put the code in the Acrobat application JavaScript folder or in the specific user's application JavaScript folder. Putting the code in one of the application JavaScript folders, causes the script to be run during the application initialization which is one of the options for getting this code to work.

George Kaiser