I'm currently trying to take an existing PDF, find all existing check boxes and complete them based on some criteria using C#.
After reviewing other related questions: https://stackoverflow.com/a/4827996/6328714
The main issue I am having is finding all of the Checkbox objects within the PDF - which I believe I need to be able to reference the correct checkbox within my code.
As for tools to view the PDF's internal structure I am using PDFXplorer, but I'm not having much luck finding the actual check boxes within the tree-structure.
So:
- Do I ~need~ the object to be able to check the box?
- Is checking the boxes as simple as the posted code below? (It seems fairly straight forward if so)
Below example is taken from the linked question:
PdfReader reader = new PdfReader(fileNameIn);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(fileNameOut));
AcroFields form = stamper.getAcroFields();
form.setField("Name","Test Name");
form.setField("odot","123456");
form.setField("Consortium","A Testing Co");
form.setField("PName","My Name");
form.setField("date","10/14/03");
form.setField("Box1","true"); //This is the checkbox control
stamper.close();