1
votes

I am using the Java iText library to manipulate form fields of a PDF document and have run into a simple problem. I am able to set properties of AcroFields that I retrieved from a PdfStamper object however what I really want to do is set an Action to an existing push button field.

I have found countless examples of creating a new PushButton field and adding it to a document, however none that actually retrieve an existing PushbuttonField object. I am sure that is the correct object because it has a setAction method where the AcroField object does not.

I am willing to accept that it is impossible because I could work around this by using Acrobat to remove the button from the template and then programatically adding it fresh everytime.

Further I would like to know if anybody knows of a more comprehensive location for documentation on iText. Incomplete javadocs and specific code examples don't make for the best documentation.

1

1 Answers

0
votes

You need to know the name of the pushbuttonfield to retrieve it. Take a look at the example to see how to retrieve, adjust and replace.

You can set actions if you have the PushbuttonField#getField()#setAction()