pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteban R <eru...@hotmail.com>
Subject RE: Out Of Memory while converting a small pdf to image (pattern_issue_oom)
Date Tue, 03 Jul 2018 21:10:56 GMT
Ok. I understand. Thank you!

Esteban Ruiz
________________________________
De: Tilman Hausherr <THausherr@t-online.de>
Enviado: martes, 3 de julio de 2018 20:25
Para: users@pdfbox.apache.org
Asunto: Re: Out Of Memory while converting a small pdf to image (pattern_issue_oom)

The patterns have XStep and YStep of 2876... so at 300dpi (which is
about 4x the default) a pattern image would be created that would have a
size of (2876 * 4)^2 = 132342016. If this is an ARGB image, it would
take 529 368 064 bytes, i.e. 1/2 gigabyte.

Detecting these is tricky... I think one would have to create a dummy
tool, that doesn't create images but only calculates the size.

Tilman

Am 03.07.2018 um 21:46 schrieb Esteban R:
> Hello.
>
> I get an OutOfMemoryError when running the following command:
>
> java -Xmx2g -jar pdfbox-app-2.0.11.jar PDFToImage -dpi 300 pattern_issue_oom.pdf
>
> (Windows 10, java version "1.8.0_112")
>
> The file is available here:
> http://www.filedropper.com/patternissueoom
>
> It is a simplification of a real life pdf and it contains nested patterns. It is really
small: 4429 bytes.
>
> Is this the expected memory usage for this pdf? Can I expect some improvements in pdfbox?
> Can I somehow detect this kind of pdfs and avoid rendering (i.e.: with the PDFBOX api)?
>
> Exception details:
>
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
>          at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
>          at java.awt.image.Raster.createPackedRaster(Raster.java:467)
>          at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
>          at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
>          at org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:143)
>          at org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:103)
>          at org.apache.pdfbox.rendering.TilingPaintFactory.create(TilingPaintFactory.java:59)
>          at org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:323)
>          at org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:679)
>          at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:748)
>          at org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processTransparencyGroup(PDFStreamEngine.java:238)
>          at org.apache.pdfbox.rendering.PageDrawer.access$1600(PageDrawer.java:103)
>          at org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1618)
>          at org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1497)
>          at org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroup(PageDrawer.java:1437)
>          at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:66)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processTilingPattern(PDFStreamEngine.java:401)
>          at org.apache.pdfbox.rendering.PageDrawer.drawTilingPattern(PageDrawer.java:284)
>          at org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:177)
>          at org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:103)
>          at org.apache.pdfbox.rendering.TilingPaintFactory.create(TilingPaintFactory.java:59)
>          at org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:323)
>          at org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:679)
>          at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:748)
>          at org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
>          at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
>
> Esteban Ruiz
>


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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message