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

acroforms saveas

shahal
Registered: May 3 2007
Posts: 43

I placed this code into acroforms to create and save a document in the mydocs folder. It won't work? Why?
I am new to javascripting. I got this script from the Javascript for acrobat reference API.
 
var myDoc = app.newDoc();
var myPath = app.getPath("user", "documents") + "/myDoc.pdf"
myDoc.saveAs(myPath);
myDoc.closeDoc();

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
both the "app.getPath()" and "doc.saveAs()" funtions are privileged. For security reasons they cannot be run from a document script.

To use these functions you'll need to create a folder level script using the "app.trustedFunction()" function.

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