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

XML, acroform PDF and javascript

Sylvain Auger-Léger
Registered: Dec 27 2010
Posts: 1

Hi all,
 
I quite desperate about some problem. So I am posting here, maybe you can help. I hope this is the good topic.
 
Here is my problem:
 
We have a pdf (acroform) with controls in javascript on many fields.
We have an xml, with data, to fill in the acroform.
 
We made a java program, with the iText lib, to fill the pdf acroform with the xml. It's working fine, except that the javascript control are not launched. So if there is a problem in the xml, the pdf is wronlgy filled in.
 
Is there a way, to launch the javascript controls in java? What library to use??
 
Do you know a product / java lib that can help us deal with this problem??
 
Thanks.
 
Sylvain.

maxwyss
Registered: Jul 25 2006
Posts: 255
I am not quite sure if I understand the question correctly.

You fill the Fields with values provided by your XML, using a library. So, you have "raw" data filled in when you save your "instance" of the form. So far so fine.

Acrobat JavaScript requires Acrobat to run. So, your form will require Acrobat / Reader to execute those Acrobat JavaScripts. This can happen when you open the form. You will therefore create Document level scripts and a PageOpen script attached to the page the document opens, which will act as a trigger for those (I assume Field-level) scripts.

Another approach would be inserting the XML as a File Attachment, and then have the form process it when it opens; that would ensure that all relevant built in scripts are triggered.

If the use of libraries is an absolute necessity, and you can't/don't want to use Acrobat's functionality, you will have to repeat all the functionality in your Java application.

HTH.