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

PDFMergerUtility: java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSNumber

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.9
    • 2.0.10, 3.0.0 PDFBox
    • Utilities
    • None
    • Ubuntu 14.04 and Windows 7

    Description

      Given a problematic PDF, there can be ClassCastException when merging two PDFs, causing the merge to fail.

       

      Problematic example PDF: https://bibliothek.wzb.eu/pdf/2001/ii01-303.pdf

       

      Provoking command line:

       java -jar pdfbox-app-2.0.9.jar PDFMerger ii01-303.pdf ii01-303.pdf out.pdf

       

      Stacktrace:

      Exception in thread "main" java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary cannot be cast to org.apache.pdfbox.cos.COSNumber
       at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:504)
       at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:263)
       at org.apache.pdfbox.tools.PDFMerger.merge(PDFMerger.java:70)
       at org.apache.pdfbox.tools.PDFMerger.main(PDFMerger.java:49)
       at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:81)

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            eduard Eduard von Feek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: