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

Emal Acroforms

shahal
Registered: May 3 2007
Posts: 43

Thom Parker said" So there is a work around, use the "doc.saveAs()" function to rename the file before mailing. Of course, this will only work in Reader if the form has been Reader Enabled."
 
Can you provide an example?
 
Thanks

My Product Information:
Acrobat Pro 7.0.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Say you have a form named "MyOrderForm.pdf" and you want the data sent back to be named "MyOrderForm_LastName.FDF". Where "LastName" is the contents of the LastName field on the form.

// First build the new namevar cFilePath = this.path.split(".").shift() + this.getField("LastName").value + ".pdf"; // Save to the Doc with new namethis.saveAs(cFilePath); // Now Submit by emailthis.mailForm("<span class="spamspan"><span class="u">mySales</span> [at] <span class="d">myCompany [dot] com</span></span>");
The functions "doc.saveAs()" and "doc.mailForm()" both require Forms Rights to operate on Reader.

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

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I just did some testing and I'm sorry to say that this method won't work from a document script. The "doc.saveAs()" function can only be run from a privileged context. Document scripts are not privileged, even in a Reader Enabled doc.

When I've used this strategy in the past it was either on a local network where a folder level script can be used to get around this issue, or we displayed a popup that asked the user to save the file to a specific name. Awkward, but that's how a lot of these scripting tasks go.

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