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

org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSArray

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.5
    • Fix Version/s: None
    • Component/s: AcroForm
    • Labels:
      None

      Description

          public static void main(String[] args) throws IOException
          {
              PDDocument.load(new File("D1790B.pdf")).getDocumentCatalog().getAcroForm().getFields();
          }
      

      throws

      Exception in thread "main" java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSArray
      	at org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.getFields(PDAcroForm.java:368)
      	at pdfboxpageimageextraction.PDFBOX3777.main(PDFBOX3777.java:20)
      

      Maruan Sahyoun wrote in the mailing list

      the field definition in the AcroForm is wrong as the field root is defined as a dictionary and not as an array as it's required by the PDF spec.
      ...
      I think we should fix that as Adobe Reader and another viewer I tested can open the form just fine. So we should do the same.

        Attachments

        1. D1790B.PDF
          122 kB
          John Liston

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              JohnListon John Liston
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: