[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14290515#comment-14290515 ]
Gilad Denneboom commented on PDFBOX-2617: ----------------------------------------- [~msahyoun] Thanks for taking care of it. I tested my code using the latest 1.8.9 snapshot (pdfbox-1.8.9-20150124.080542-47.jar) and it seems to have solved this issue. However, I added some more fields and played around with it a bit more, and might have come against another (minor) issue. When I create a group of radio-buttons the group itself is a PDRadioCollection object and each child is a PDCheckbox object, which makes sense. But if the group only contains one child (for some reason), its Kids property is null. Should there not be 1 PDCheckbox child in this case? If you want I can upload a sample file that demonstrates it. > Group of Button fields treated as a Radio Button group > ------------------------------------------------------ > > Key: PDFBOX-2617 > URL: https://issues.apache.org/jira/browse/PDFBOX-2617 > Project: PDFBox > Issue Type: Bug > Components: AcroForm > Affects Versions: 1.8.8, 2.0.0 > Environment: Windows 7, Eclipse, JRE 1.8.0_25 > Reporter: Gilad Denneboom > Assignee: Maruan Sahyoun > Priority: Minor > Fix For: 2.0.0 > > Attachments: test.pdf > > > When creating a group of identical button fields PDFBox reads them as a group > of radio-button fields, with each widget as a check-box, which is incorrect. > The main field has the class PDRadioCollection and each kid is a PDCheckbox. > Run the following code on the attached file: > PDDocument doc = PDDocument.load( new File("test.pdf") ); > PDAcroForm form = doc.getDocumentCatalog().getAcroForm(); > List<PDField> fields = form.getFields(); > for (PDField f: fields) { > System.out.println("Name:" + f.getFullyQualifiedName()); > System.out.println("Type:" + f.getFieldType()); > System.out.println("Class:" + f.getClass()); > List<COSObjectable> kids = f.getKids(); > if (kids!=null) { > for (COSObjectable c : kids) { > System.out.println("Kid Class: " + c.getClass()); > > } > > } > } > The results are: > Name:Test > Type:Btn > Class:class org.apache.pdfbox.pdmodel.interactive.form.PDRadioCollection > Kid Class: class org.apache.pdfbox.pdmodel.interactive.form.PDCheckbox > Kid Class: class org.apache.pdfbox.pdmodel.interactive.form.PDCheckbox -- This message was sent by Atlassian JIRA (v6.3.4#6332)