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

Yet Another saveAs Question that I can't seem to solve

Jimmy0306
Registered: Dec 11 2008
Posts: 32

I am using a Folder-Level Javascript to manipulate the save path and file name and it works perfectly. My problem is...when I click my button, the original form closes and the new "renamed" file comes up in place of the original. The behavior I want, is for the original document to stay open and the renamed file to be saved silently. How do I accomplish this?
 
Here is the code that I pieced together from other posts:
Folder Level Script:
 
//DateTime function
function myDateString()
{
 
return util.printd("mmddyy_HHMMss", new Date());
 
}
 
// SaveAs Function
var mySaveDoc = app.trustedFunction(function(doc) {
 
app.beginPriv();
var myPath = "/c/Forms" + "/" + "Special Study Form" + "-" + myDateString() + ".pdf";
  
doc.saveAs(myPath);
app.endPriv();
 
});
 
On the MouseUp I have
 
event.target.mySaveDoc(event.target);
 
Any help would be greatly appreciated.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This function does not close the original form. It is saving the current document to a new name. Also, since this is a folder level script it can be called directly, it does not need the "event.target" qualifier.

What you want to do is save a copy. Look up the Doc.saveAs() function in the Acrobat JavaScript Reference. It has an argument named "bCopy".

doc.saveAs({cPath:myPath, bCopy:true});


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