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

Java Script Submit Button to perform 3 functions.

klm7552
Registered: Oct 10 2007
Posts: 2

I have a PDF form and would like to have the users click a Submit Button and Java Script behind the button would save the filled out form as a pdf, kick off a vbScript that will email the form to a client using smtp, and then exit Acrobat Pro or Reader which ever they are using. Can this be done?
Thank You,
 
Ken Marvin

My Product Information:
Acrobat Pro 7.0.5, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Well, you can save a PDF from JavaScript, but only if the JavaScript is executed from a privileged context. To do this in Reader the PDF has to also have Save Rights.

You cannot run a VB Script, or any other program from JavaScript in a PDF. There are exceptions, but they are for well know programs, like an email client.

For example, you can use the mailFrom and submitForm JavaScript functions to email the current PDF, so there shouldn't be any need for an external proprogram.

Closing Acrobat is also a problem and there are variations on these points in the different versions of Acrobat.

You are better off using the IAC interface (Inter-Application Communication) to control Acrobat from a VB program. It will allow you to do all the things you want. The documentation is here.

[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Click on the documentation tab.

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

nozmoking
Registered: Feb 19 2009
Posts: 8
Addendum - upon further investigation I noticed that if the form is opened in Acrobat Reader v7 it offers up the desired options dialog when the email submit button is clicked, but with v8 and above readers, it jumps directly to the first available email application on the workstation. This may then be a version compatibility bug of some sort. Anyway I'd appreciate any additional input.

Thanks,
-nozmo