Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.19
-
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.