tags:

views:

27

answers:

2

I'm trying to make PDF forms (aka AcroForms) editable in Java. So far i got the GUI editing and printing working using Bruno Lowagie's iText and Sun's pdf-renderer.

But now i'm close to scrapping it all, because after switching from try & error to reading the PDF specification, i realized that it's all worthless unless i can make the multitude of possible JavaScript actions work as well. I don't think iText can do that.

So in short: are there any Java libraries that do proper form handling including actions? Or maybe even a Java GUI component to edit form data?

A: 

You might take a look at Mozilla Rhino: http://www.mozilla.org/rhino/ I haven't used it, but it looks promising, if you already have the GUI in Java.

Curtis
That will be my first choice if i have to implement the JavaScript handling. But PDF allows for a bunch of different events (focus, keyboard, page open, page close, data changed, etc..) to trigger actions. Some will change an input value, others will change another objects visibility and so on. And i'd rather have someone else do the script integration. E.g. when i set a form value programatically i'd like to execute the corresponding triggers either automatically or with a simple method call. Currently i'd need to first identify and then execute these triggers myself. Chances are i forget one
Stroboskop
+1  A: 

Does Suns PDFRenderer support Javascript? ARAIK, only JPedal and BigFaceless offer Javascript support.

mark stephens
No it doesn't support AcroForms or JavaScript. Thanks why i started to add editable components to it. Only the JavaScript part seems to be too hard because i'd need to emulate all kinds of built-in methods. But thanks for reminding me of JPedal.
Stroboskop
JPedal does indeed handle forms and they look better than what i had done.But i only tried the LGPL version and it doesn't seem to work well with radio button groups (you can check all buttons at the same time) and the JavaScript actions i knew of have not been executed.
Stroboskop
And Big Faceless' online example actually works!
Stroboskop
Did you send the JPedal guys the file to have a look at? The JS support is not in the LGPL version so you would need their commercial version (Bigfaceless does not have an Open Source version).You might also see if icepdf intend to add JS support if you want an Open Source solution?
mark stephens