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 2017/01/18 23:26:27 UTC

[jira] [Comment Edited] (PDFBOX-3653) NegativeArraySizeException thrown when converting PDF to Image (in TilingPaint.java)

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

Tilman Hausherr edited comment on PDFBOX-3653 at 1/18/17 11:26 PM:
-------------------------------------------------------------------

I get an OutOfMemoryError on JDK8. On JDK9 it works. Maybe the JDK you're using believes that the huge number is negative.

Some observations:
createCompatibleWritableRaster gets called with rasterWidth 923 and rasterHeight 499494. The cause is the pattern in {{Root/Pages/Kids/[0]/Resources/Pattern/p480}} and the calculations done in {{TilingPaint.getAnchorRect()}}. The YStep 3847 gets huge because it is multiplied with the Y scale 129.


was (Author: tilman):
I get an OutOfMemoryError on JDK8. On JDK9 it works. Maybe the JDK you're using believes that the huge number is negative.

createCompatibleWritableRaster gets called with rasterWidth 923 and rasterHeight 499494. The cause is the pattern in {{Root/Pages/Kids/[0]/Resources/Pattern/p480}} and the calculations done in {{TilingPaint.getAnchorRect()}}. The XStep 3847 gets huge because it is multiplied with the Y scale 129.

> NegativeArraySizeException thrown when converting PDF to Image (in TilingPaint.java)
> ------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3653
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3653
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.4
>            Reporter: Emily Coyne
>         Attachments: PowerPoint-slides.pdf
>
>
> Specifically page 7 of the PDF document is failing.
> PDF Document:
> http://download.win2pdf.com/samples/PowerPoint-slides.pdf
> (also attached to ticket)
> Stack trace:
> Exception in thread "main" java.lang.NegativeArraySizeException 
> at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:76)
> at java.awt.image.Raster.createInterleavedRaster(Raster.java:266)
> at java.awt.image.Raster.createInterleavedRaster(Raster.java:212)
> at java.awt.image.ComponentColorModel.createCompatibleWritableRaster(ComponentColorModel.java:2825)
> at org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:134)
> at org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:69)
> at org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:251)
> at org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:526)
> at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:597)
> at org.apache.pdfbox.contentstream.operator.graphics.FillEvenOddRule.process(FillEvenOddRule.java:36)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:829)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:486)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:460)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:145)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:94)
> at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:236)
> at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:94)



--
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