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

Wrong COSType for OCProperties after merge

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.19
    • 2.0.20, 3.0.0 PDFBox
    • PDModel
    • None

    Description

      If you merge a PDF document with OCProperties to a PDF document without OCProperties, the result of the merge is that the OCProperties type is no longer a COSDictionary but a COSObject. If a third document with OCProperties is merged with the previously created merge result, this leads to the following ClassCastException:

      org.apache.pdfbox.cos.COSObject cannot be cast to org.apache.pdfbox.cos.COSDictionary at org.apache.pdfbox.multipdf.PDFCloneUtility.cloneMerge(PDFCloneUtility.java:227) at org.apache.pdfbox.multipdf.PDFCloneUtility.cloneMerge(PDFCloneUtility.java:229) at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:730) at pdfboxtest.Test.main(Test.java:38)

      According to PDF Specification, OCProperties is always a dictionary.

      Attachments

        1. image-2020-04-16-22-07-38-691.png
          106 kB
          Andreas Küllinger
        2. image-2020-04-16-22-18-30-330.png
          3 kB
          Tilman Hausherr
        3. PDFnoocg.pdf
          323 kB
          Andreas Küllinger
        4. PDFocg1.pdf
          374 kB
          Andreas Küllinger
        5. PDFocg2.pdf
          2.82 MB
          Andreas Küllinger

        Activity

          People

            tilman Tilman Hausherr
            kuelli Andreas Küllinger
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: