You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2015/03/23 21:57:53 UTC

[jira] [Comment Edited] (PDFBOX-2726) org.apache.pdfbox.cos.COSArray cannot be cast to org.apache.pdfbox.cos.COSDictionary

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

Tilman Hausherr edited comment on PDFBOX-2726 at 3/23/15 8:57 PM:
------------------------------------------------------------------

{code}
/Filter [/JBIG2Decode]
/Height 3755
/Length 57773
/Subtype /Image
/ColorSpace /DeviceGray
/DecodeParms [<<
/Width 1244 0 R
/Height 1245 0 R
/JB2Quality 1246 0 R
/DoHalftoneCoding false
>>]
{code}

I initially thought it is a malformed PDF but it isn't. Because the filter is in an array, the decodeparms dictionaries are also to be in an array. There's a method to get the correct item but it wasn't used in the JBIG2Filter for some reason.


was (Author: tilman):
{code}
/Filter [/JBIG2Decode]
/Height 3755
/Length 57773
/Subtype /Image
/ColorSpace /DeviceGray
/DecodeParms [<<
/Width 1244 0 R
/Height 1245 0 R
/JB2Quality 1246 0 R
/DoHalftoneCoding false
>>]
{code}

I initially thought it is a malformed PDF but it isn't. Because the filter is in an array, the decodeparms dictionaries are also to be in an array. There's a method to get the correct item but in 2.0 it isn't used in the JBIG2Filter for some reason. I haven't investigated 1.8 yet.

> org.apache.pdfbox.cos.COSArray cannot be cast to org.apache.pdfbox.cos.COSDictionary
> ------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-2726
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2726
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.8, 1.8.9, 2.0.0
>         Environment: levigo-jbig2-imageio-1.6.1.jar, jai_codec.jar, jai_imageio.jar
>            Reporter: Dmitry Andreev
>            Assignee: Tilman Hausherr
>              Labels: JBIG2
>         Attachments: Book_1.Working_project.pdf, Book_1.Working_project_1.jpg, PDFBOX-2726.pdf
>
>
> When I start .convertToImage() this error is occur:
> org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap getRGBImage
> SEVERE: java.lang.ClassCastException: org.apache.pdfbox.cos.COSArray cannot be cast to org.apache.pdfbox.cos.COSDictionary
> java.lang.ClassCastException: org.apache.pdfbox.cos.COSArray cannot be cast to org.apache.pdfbox.cos.COSDictionary
> 	at org.apache.pdfbox.filter.JBIG2Filter.decode(JBIG2Filter.java:73)
> 	at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:351)
> 	at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:299)
> 	at org.apache.pdfbox.cos.COSStream.getUnfilteredStream(COSStream.java:225)
> 	at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:232)
> 	at org.apache.pdfbox.pdmodel.common.PDStream.getByteArray(PDStream.java:510)
> 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap.getRGBImage(PDPixelMap.java:254)
> 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage.mask(PDXObjectImage.java:221)
> 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage.applyMasks(PDXObjectImage.java:154)
> 	at org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap.getRGBImage(PDPixelMap.java:365)
> 	at org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:87)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:557)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
> 	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:139)
> 	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:801)
> 	at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:732)
> 	at com.sign.PDFCutter.PDFCut(PDFCutter.java:75)
> 	at com.sign.CopyFileTree.visitFile(CopyFileTree.java:103)
> 	at com.sign.CopyFileTree.visitFile(CopyFileTree.java:21)
> 	at java.nio.file.Files.walkFileTree(Files.java:2667)
> 	at java.nio.file.Files.walkFileTree(Files.java:2739)
> 	at com.sign.Copy.main(Copy.java:158)
> and some resulting images are blank, some images in grey shades with fading text



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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