I have PDF with acroForm that was created using Adobe Acrobat Standard DC.
There is Chekcbox field that I populate using Java iText 5. When I was creating it in Properties I set it up Check Box Style to "Check" so it will put "V" style symbol when it is checked.
And it does really work if I open the form in Preview mode and check this CheckBox:
But when I set this field to checked state using iText 5 it checks it is Cross:
I can't figure out why it is changing style?
My code is simple:
void populateCheckBox(AcroFields form, String searchKey, String value) throws IOException, DocumentException {
if (form.getFieldType(searchKey) == AcroFields.FIELD_TYPE_CHECKBOX) {
String[] states = form.getAppearanceStates(searchKey);
if (ArrayUtils.contains(states, "On") && ArrayUtils.contains(states, "Off")) {
value = (value.equals("1")) ? "On" : "Off";
form.setField(searchKey, value);
}
}
}