iText - read check box value

2.3k views Asked by At

I'm trying to read pdf form. I managed to get normal textbox value by doing this.
Code

PdfReader reader = new PdfReader(RESULT1);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(RESULT2));
AcroFields form = stamper.getAcroFields();
String name = form.getField("Text1");//Check Box 1
System.out.println("Name "+name);

How do I get check box value. Please advice.

1

There are 1 answers

1
rhens On BEST ANSWER

As Bruno said in his comment, you should be able to get the value of a check box with the code you posted. You can use form.getAppearanceStates(NAME_OF_CHECKBOX) to get a String array of possible values. For a check box, these should be Off and Yes.