[
https://issues.apache.org/jira/browse/PDFBOX-4814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17085232#comment-17085232
]
Andreas Küllinger commented on PDFBOX-4814:
-------------------------------------------
Thank you for your quick investigations! It's now working for me. I think there
is still a problem because the COSType changes from COSDictionary To COSObject.
Adobe Acrobat has no problem with the merged result but I think OCProperties
should remain a COSDictionary.
On the left you see the original OCProperties, on the right after merging.
Thanks for your help!
!image-2020-04-16-22-07-38-691.png!
> Wrong COSType for OCProperties after merge
> ------------------------------------------
>
> Key: PDFBOX-4814
> URL: https://issues.apache.org/jira/browse/PDFBOX-4814
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.19
> Reporter: Andreas Küllinger
> Assignee: Tilman Hausherr
> Priority: Major
> Fix For: 2.0.20, 3.0.0 PDFBox
>
> Attachments: PDFnoocg.pdf, PDFocg1.pdf, PDFocg2.pdf,
> image-2020-04-16-22-07-38-691.png
>
>
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]