Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2617

Group of Button fields treated as a Radio Button group

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.8, 2.0.0
    • Fix Version/s: 1.8.9, 2.0.0
    • Component/s: AcroForm
    • Labels:
      None
    • Environment:
      Windows 7, Eclipse, JRE 1.8.0_25

      Description

      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

        Attachments

        1. test.pdf
          6 kB
          Gilad Denneboom

          Activity

            People

            • Assignee:
              msahyoun Maruan Sahyoun
              Reporter:
              giladd Gilad Denneboom
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: