Reputation: 339
how to check checkbox on iText?
form.setField("pt_gender_female", "On");
form.setField("pt_gender_female", true);
I did couple of trial and error but none of these worked. I searched but didn't find the perfect answer.
Upvotes: 6
Views: 6492
Reputation: 12391
That's how it's done in itextPdf
form.setField("pt_gender_female","Yes"); // to check it
form.setField("pt_gender_female","Off"); // to uncheck it
Upvotes: 0
Reputation: 339
String states[] = stamper.getAcroFields().getAppearanceStates("pt_gender_female");
form.setField("pt_gender_female",states[1]);
I tried the abode snipet. It checked the checkbox.
Upvotes: 8