[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15022693#comment-15022693 ] Eric Tice commented on PDFBOX-2617: --- Ilya can you provide the demo if you still have it. tice...@gmail.com. Thank you. Eric > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14742142#comment-14742142 ] Tilman Hausherr commented on PDFBOX-2617: - This is a closed issue, so better open a new one, you can attach files there. Mention this issue. > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14742060#comment-14742060 ] Ilya Sazonov commented on PDFBOX-2617: -- Here's how I used to collect possible values for a group of checkboxes before 1.8.9 . To continue using this code I have to check if checkbox has kids and if it does - convert it to PDRadioButton public List getValuesWithWorkaround(PDField group) { try { List fieldValues = new ArrayList(); List kids = group.getKids(); for (int i = 0;kids != null && i < kids.size(); i++) { COSObjectable kid = kids.get(i); if (kid instanceof PDCheckbox) { if (!fieldValues.contains(((PDCheckbox) kid).getOnValue())) { fieldValues.add(((PDCheckbox) kid).getOnValue()); } } } return fieldValues; } catch(IOException e) { throw new RuntimeException("trouble getting values"); } } And here's how I have to do it now private static final COSName KEY = COSName.getPDFName("AS"); private static final COSName OFF_VALUE = COSName.getPDFName("Off"); public List getValues(PDCheckbox checbox) { try { List fieldValues = new ArrayList(); List kids = checbox.getKids(); List widgets = new ArrayList(); for (int i = 0;kids != null && i < kids.size(); i++) { COSObjectable kid = kids.get(i); if (kid instanceof PDAnnotationWidget) { widgets.add((PDAnnotationWidget) kid); } } for (PDAnnotationWidget widget : widgets) { COSDictionary ap = (COSDictionary) widget.getDictionary().getDictionaryObject(COSName.getPDFName("AP")); widget.getDictionary().setItem(KEY, COSName.getPDFName("Yes")); COSBase n = ap.getDictionaryObject(COSName.getPDFName("N")); //N can be a COSDictionary or a COSStream if( n instanceof COSDictionary ) { for( COSName key :((COSDictionary)n).keySet() ) { if( !key.equals( OFF_VALUE) ) { String onValue = key.getName(); if (!fieldValues.contains(onValue)) fieldValues.add(onValue); } } } } return fieldValues; } catch(IOException e) { throw new RuntimeException("trouble getting values"); } } Please note, that KEY and OFF_VALUE are originally static private fields for checkbox and I think this code should be a part of of PDCheckbox class. And PDCheckbox doesn't have such methods even in 2.0. It look like 2.0 treats checkbox as a single entity with single value, which is wrong. I have made a demo project with a class which has 2 methods and unit test. > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail:
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14742061#comment-14742061 ] Ilya Sazonov commented on PDFBOX-2617: -- I've made a demo project to describe the problem, but it looks like I can't upload it here. Where do I send 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14737022#comment-14737022 ] Maruan Sahyoun commented on PDFBOX-2617: The fix is there for more than half a year. It's now becoming an issue for you as you'd like to go from an older version of PDFBox (which) to a newer one (which)? Now the fix is not only relevant to checkboxes but to how terminal fields (fields which descendants are not fields) are recognized in PDFBox. This is important where the same field has multiple occurrences in a PDF. As a side effect the old (wrong) behavior no longer works. Of course it's not our intention to break an application with a bugfix - OTOH if you are dependent on a bug we will not be able to fix it, which might cause issues for others. Maybe you could provide us with a code snippet and a sample form how you are depending on the old behavior and we can come up with a solution? > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14736990#comment-14736990 ] Ilya Sazonov commented on PDFBOX-2617: -- All code, that was relying on treating checkbox with kids as radio collection is broken now. Introducing breaking changes in major release is ok, but doing it with a bugfix is questionable. I understand, that, according to pdf specs, existing behaviour was incorrect, and it had to be fixed. But it was there for years and a lot of code depends on it. Refreshing library to a new patch version is supposed to be safe, it isn't supposed to break user code. I think putting it to 1.8 wasn't a right thing to do. Think of all the people, who have refreshed pdfbox to a new version, which has changed the way their code worked without warning. Maybe you should revert this bugfix for 1.8 and leave it in 2.0 only. > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14737382#comment-14737382 ] Maruan Sahyoun commented on PDFBOX-2617: I don't take it personally. And if the patch causes breaking changes we can avoid then I'm happy to change that. So please upload a sample form with a little code snippet how you are using it. For PDFBox 2.0 there is PDCheckbox reflecting a PDF checkbox and PDRadioButton reflecting PDF radio buttons. There no longer is a PDRadioCollection. > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14737141#comment-14737141 ] Ilya Sazonov commented on PDFBOX-2617: -- I have refreshed pdfbox from 1.8.6 to 1.8.9 and it made 3 of my tests fail. So it wasn't a big deal for me, I have already worked around the issue by checking if PDCheckbox has kids and converting it to PDRadioCollection if it does. I know a workaround is not a nice way of doing things, but I'm planning to wait till 2.0 is released and then doing it properly. Don't worry about me, I got it covered :). But introducing breaking changes with a patch is still not a nice thing to do. Changing the way how terminal fields are recognized in pdfbox seems pretty big to me. Totally worth of increasing minor version at least. Yes, a half of a year has passed and I'm the only guy complaining, so maybe it's ok this time, but I don't want to meet something similar in the future. I want to trust pdfbox, that's what I want to say :). Also I honestly don't see how the changes https://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDFieldFactory.java?r1=1654480=1654479=1654480;>here help with multiple occurrences of the same field in a pdf. But I understand I either have to make that workaround, or write code to walk through widget dictionaries and retrieve field values. If library has replaced PDRadioCollection with PDCheckbox, then PDCheckbox should have a method to get it's possible values, but it doesn't. Even in 2.0 . So, thank you for your answer, and please don't take my complaints personally, I'm not Linus Torvalds you know :). And if I'm wrong about having to retrieve field values manually, please correct me. It would be nice to know there's a nice way of doing it. If I wasn't clear about what I wanted and you want code, I can send it to you a little bit later. > 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: 1.8.9, 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 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 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14293392#comment-14293392 ] Maruan Sahyoun commented on PDFBOX-2617: A small clarification. The reporter wrote that for a PDRadioCollection object the kids were returned as PDCheckbox object. This behavior was wrong and has changed with the fix but only for 2.0.0 to not break current 1.8 dependent code. 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: 1.8.9, 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(); ListPDField 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()); ListCOSObjectable 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) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290629#comment-14290629 ] Maruan Sahyoun commented on PDFBOX-2617: Yes, please upload a sample file probably under a new issue. It would be great if we could get permission to include your files in our unit tests. Not sure if having PDRadioCollection childs as PDCheckbox is correct although very handy. Will probably change that for PDFBox 2 although it’s handled there in the same manner currently. Please be aware that there will be further changes to AcroForms with PDFBox 2. Having more test files is a very good way how you could help. 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290639#comment-14290639 ] Gilad Denneboom commented on PDFBOX-2617: - OK, I created https://issues.apache.org/jira/browse/PDFBOX-2631 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290494#comment-14290494 ] ASF subversion and git services commented on PDFBOX-2617: - Commit 1654480 from [~msahyoun] in branch 'pdfbox/branches/1.8' [ https://svn.apache.org/r1654480 ] PDFBOX-2617 correct creation of fields and termination of field tree 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290473#comment-14290473 ] Maruan Sahyoun commented on PDFBOX-2617: Same issue with 2.0.0 - investigating 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 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290489#comment-14290489 ] Maruan Sahyoun commented on PDFBOX-2617: with the change the output is now Name:Test Type:Btn Class:class org.apache.pdfbox.pdmodel.interactive.form.PDPushButton Kid Class: class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget Kid Class: class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget Will look into putting that into 1.8 too 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290488#comment-14290488 ] ASF subversion and git services commented on PDFBOX-2617: - Commit 1654479 from [~msahyoun] in branch 'pdfbox/trunk' [ https://svn.apache.org/r1654479 ] PDFBOX-2617 correct creation of fields and termination of field tree 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290499#comment-14290499 ] Maruan Sahyoun commented on PDFBOX-2617: Output with 1.8 is now Name:Test Type:Btn Class:class org.apache.pdfbox.pdmodel.interactive.form.PDPushButton Kid Class: class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget Kid Class: class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290498#comment-14290498 ] ASF subversion and git services commented on PDFBOX-2617: - Commit 1654481 from [~msahyoun] in branch 'pdfbox/branches/1.8' [ https://svn.apache.org/r1654481 ] PDFBOX-2617 remove unused imports 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(); ListPDField 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()); ListCOSObjectable 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)
[jira] [Commented] (PDFBOX-2617) Group of Button fields treated as a Radio Button group
[ https://issues.apache.org/jira/browse/PDFBOX-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14290500#comment-14290500 ] Maruan Sahyoun commented on PDFBOX-2617: [~giladd] I’ve made changes how form fields are created and the termination of the field tree node is recognized. Thanks for the report. It revealed a very important issue we had. Could you verify that the changes work for you? 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(); ListPDField 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()); ListCOSObjectable 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)