how can I check CheckBoxes and RadioButtons?
PDAcroForm form = getDoc().getAcroForm();
PDAcroFormField formField = form.getField("MyCheckBox");
PDAFButtonField checkbox = (PDAFButtonField) formField;
but MyCheckBox is not checked. What is wrong?
The PDF document is created with Acrobat 9 Pro.
PDF forms have a lot of caveats and very few inherent logic. In this case you should at least:
- verify that "On" is one of the valid states in your field (getAppearanceStates in the annotation)
- verify that every state has a valid appearance stream (this is what gets rendered)
- verify that you set the value in the correct object. A field MAY be separated in field and annotation AND a field may have multiple annotations and as such a hierarchy. In short, set the value in the top level (field) object and ensure that no other value entry is active in the child elements.
The result (if a single object) should look like the example from the PDF spec
<< /FT /Btn
/T ( Urgent )
/AP << /N << /Yes 2 0 R /Off 3 0 R>>
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.