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

ClassCastException when doing PDFSplit

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.10, 1.8.11, 2.0.0
    • Fix Version/s: 1.8.11, 2.0.0
    • Component/s: Utilities
    • Labels:
      None

      Description

      Exception in thread "main" java.lang.ClassCastException: org.apache.pdfbox.cos.COSArray cannot be cast to org.apache.pdfbox.cos.COSDictionary
      	at org.apache.pdfbox.pdmodel.PDDocumentCatalog.getViewerPreferences(PDDocumentCatalog.java:136)
      	at org.apache.pdfbox.multipdf.Splitter.createNewDocument(Splitter.java:190)
      	at org.apache.pdfbox.multipdf.Splitter.createNewDocumentIfNecessary(Splitter.java:154)
      	at org.apache.pdfbox.multipdf.Splitter.processPage(Splitter.java:204)
      	at org.apache.pdfbox.multipdf.Splitter.processPages(Splitter.java:128)
      	at org.apache.pdfbox.multipdf.Splitter.split(Splitter.java:63)
      	at org.apache.pdfbox.tools.PDFSplit.split(PDFSplit.java:171)
      	at org.apache.pdfbox.tools.PDFSplit.main(PDFSplit.java:59)
      	at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:85)
      

      The cause is a file that has ViewerPreferences as an array (should be a dictionary).

      1 0 obj
      << /Title (Example Manual)
      /Author (Doc Writer)
      /Creator (Asciidoctor PDF 1.5.0.alpha.9, based on Prawn 1.3.0)
      /Producer (Doc Writer)
      /CreationDate (D:20150807192809+02'00')
      /ModDate (D:20150807192809+02'00')
      >>
      endobj
      2 0 obj
      << /Type /Catalog
      /Pages 3 0 R
      /Names 14 0 R
      /Outlines 70 0 R
      /PageLabels 86 0 R
      /PageMode /UseOutlines
      /ViewerPreferences [/FitWindow]
      >>
      endobj
      

      I also opened an issue here:
      https://github.com/asciidoctor/asciidoctor-pdf/issues/303

        Attachments

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: