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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.5
    • 2.0.22, 3.0.0 PDFBox
    • AcroForm
    • 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)
      

      msahyoun 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

            Unassigned Unassigned
            JohnListon John Liston
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: