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

Michael Klink commented on PDFBOX-5471:
---------------------------------------

Strictly speaking the missing *BBox* entry is an error. You may consider at 
least logging a warning.

> NPE when Transparency Group is missing the BBox
> -----------------------------------------------
>
>                 Key: PDFBOX-5471
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5471
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.26
>            Reporter: Henry Iguaro
>            Priority: Major
>             Fix For: 2.0.27, 3.0.0 PDFBox
>
>         Attachments: getbbox-null.pdf, image-2022-07-04-14-55-28-527.png
>
>
> Some files contain transparency groups with no {{{}BBox{}}}. When this 
> happens, PDFBox rendering code throws a {{NullPointerException}} in the 
> {{TransparencyGroup}} constructor:
>  
> {code:java}
> // transform the bbox
> GeneralPath transformedBox = form.getBBox().transform(transform);
>                                   \_______/ 
>                                NPE when its null{code}
> The following is a screenshot taken from {{pdf-debugger}} when trying to open 
> a file with has this issue:
> !image-2022-07-04-14-55-28-527.png!
> The stack trace:
> {code:java}
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException: Cannot invoke 
> "org.apache.pdfbox.pdmodel.common.PDRectangle.transform(org.apache.pdfbox.util.Matrix)"
>  because the return value of 
> "org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroup.getBBox()" is 
> null
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:485)
>     
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     
> java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
>     
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> Caused by: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException: Cannot invoke 
> "org.apache.pdfbox.pdmodel.common.PDRectangle.transform(org.apache.pdfbox.util.Matrix)"
>  because the return value of 
> "org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroup.getBBox()" is 
> null
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:465)
>     
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     
> java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
>     
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> Caused by: java.lang.NullPointerException: Cannot invoke 
> "org.apache.pdfbox.pdmodel.common.PDRectangle.transform(org.apache.pdfbox.util.Matrix)"
>  because the return value of 
> "org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroup.getBBox()" is 
> null
>     
> org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1672)
>     
> org.apache.pdfbox.rendering.PageDrawer$TransparencyGroup.<init>(PageDrawer.java:1637)
>     
> org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroupOnGraphics(PageDrawer.java:1575)
>     
> org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroup(PageDrawer.java:1553)
>     
> org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:81)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:966)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:541)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:516)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155)
>     org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:279)
>     org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:355)
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:453)
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:435)
>     java.base/java.lang.Thread.run(Thread.java:832)
>  {code}
> The following is an example file that reproduces this problem:
> [^getbbox-null.pdf]
>  
> A potential fix PR: https://github.com/apache/pdfbox/pull/145



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to