[
https://issues.apache.org/jira/browse/PDFBOX-4718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17889761#comment-17889761
]
Andreas Lehmkühler commented on PDFBOX-4718:
--------------------------------------------
I've reverted the problematic part of the optimization: Maybe it wasn't useful
at all. However, now the files from PDFBOX-2557 and PDFBOX-3182 are back to the
former rendering.
I couldn't check the file from PDFBOPX-3182 as it isn't available any more. The
origin link is dead.
The file from PDFBOX-3116 is tricky and it took me some time to find the root
cause. My changes are OK but they reveal an issue with very large values for a
rectangle. The file contains a form object with a malformed bounding box. The
first value of the COSArray leads to a very huge value and the calculation of
the bounding box using getBounds2D results in a wrong width value so that the
clipping path is to small a some of the output is cut.
{code}
14 0 obj <</Type /XObject /Subtype /Form /FormType 1
/BBox
[-89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184
0 2480 3508] /Matrix [1 0 0 1 0 0]
/Length 933 /Filter[/A85 /Fl]>>
{code}
I've fixed the issue by limiting the float values of a rectangle to
Integer.MAX_VALUE when calling the constructor
org.apache.pdfbox.pdmodel.common.PDRectangle.PDRectangle(COSArray)
WDYT? Is that a suitable way to fix such corner case?
> OutOfMemoryError - during renderImageWithDPI
> --------------------------------------------
>
> Key: PDFBOX-4718
> URL: https://issues.apache.org/jira/browse/PDFBOX-4718
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.17, 3.0.3 PDFBox, 4.0.0
> Environment: macOS Mojave (10.14.6)
> Java 11.0.2 -Xmx10G -Xms10G
> Reporter: Serhii Kolesnyk
> Assignee: Andreas Lehmkühler
> Priority: Blocker
> Fix For: 2.0.33, 3.0.4 PDFBox, 4.0.0
>
> Attachments: PDFBOX-4718-reduced.pdf, PDFBox4718Intersect.java,
> example.pdf, image-2019-12-19-05-55-57-648.png
>
>
> During rendering pdf we receive _java.lang.OutOfMemoryError: Java heap space_
> {code:java}
> Exception in thread "AWT-Shutdown" java.lang.OutOfMemoryError: Java heap
> spaceException in thread "AWT-Shutdown" java.lang.OutOfMemoryError: Java heap
> space at java.desktop/sun.awt.AppContext.getAppContexts(AppContext.java:167)
> at
> java.desktop/sun.awt.AppContext.stopEventDispatchThreads(AppContext.java:610)
> at java.desktop/sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:322) at
> java.base/java.lang.Thread.run(Thread.java:834)
> java.lang.OutOfMemoryError: Java heap space
> at java.desktop/sun.awt.geom.AreaOp.pruneEdges(AreaOp.java:362) at
> java.desktop/sun.awt.geom.AreaOp.calculate(AreaOp.java:159) at
> java.desktop/java.awt.geom.Area.intersect(Area.java:293) at
> org.apache.pdfbox.pdmodel.graphics.state.PDGraphicsState.intersectClippingPath(PDGraphicsState.java:618)
> at
> org.apache.pdfbox.pdmodel.graphics.state.PDGraphicsState.intersectClippingPath(PDGraphicsState.java:597)
> at org.apache.pdfbox.rendering.PageDrawer.endPath(PageDrawer.java:936) at
> org.apache.pdfbox.contentstream.operator.graphics.EndPath.process(EndPath.java:35)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:262) at
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:314) at
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243) at
> org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229){code}
> We check the different setting of MemoryUsageSetting (TempFileOnly,
> MainMemoryOnly), settings of DPI.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]