[ 
https://issues.apache.org/jira/browse/PDFBOX-4084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16353473#comment-16353473
 ] 

Cheng Zhong commented on PDFBOX-4084:
-------------------------------------

Thanks for the reply and sorry for the incomplete information.

The second PDF would crash _ClassCastException_ at Page 2 (1-based page number) 
when you try to get its resources. Here is the stacktrace:
{code:java}
java.lang.ClassCastException: org.apache.pdfbox.cos.COSArray cannot be cast to 
org.apache.pdfbox.cos.COSDictionary
at org.apache.pdfbox.pdmodel.PDPage.getResources(PDPage.java:198) 
~[classes/:?]{code}
It doesn't happened in *PDDocument.getPages* but in *PDPage.getResoruces*. The 
/Resources was an *COSArray* instead of *COSDictonary*.

I could also find some _ClassCastException_ in other PDFs (sorry, I can find 
them out now) in *PDDocument.getDocumentInformation* and */Info* reference to a 
*COSStream* instead of a *COSDictonary*. I'm afraid that there might be other 
_ClassCastException_  I didn't discover.

> Can't draw PDFs while ANNOTS is COSStream instead of COSArray
> -------------------------------------------------------------
>
>                 Key: PDFBOX-4084
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4084
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.8
>            Reporter: Cheng Zhong
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>         Attachments: Benelux Equity Daily-20110321.pdf, TELECOM EQUIPMENT 
> DAILY - 12 AUG 2009.pdf
>
>
> PDFBox would failed to draw the attached document , error logs are below:
> {code:java}
> java.lang.ClassCastException: org.apache.pdfbox.cos.COSStream cannot be cast 
> to org.apache.pdfbox.cos.COSArray
> at org.apache.pdfbox.pdmodel.PDPage.getAnnotations(PDPage.java:661) 
> ~[classes/:?]
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:202) 
> ~[classes/:?]{code}
> This PDF put COSStream as the page's ANNOTS object, and caused the failure.
> Simply do type checks in PDPage.getAnnotations might avoid this issue, but 
> the annotations would lost.
>  
> This PDF show correctly (I mean annotation works) in:
>  * Chrome 63.0.3239.132
>  * Adobe Reader 11.0.23
> This PDF doesn't work perfectly in:
>  * Microsoft Edge
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to