[
https://issues.apache.org/jira/browse/PDFBOX-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14091774#comment-14091774
]
Tilman Hausherr commented on PDFBOX-2266:
-----------------------------------------
The paint method of the shadings was redesigned in the trunk a few weeks ago.
Are you building from source? If yes, please try this change:
open the file PDPattern.java, and below the line
{code}
PDShading shading = shadingPattern.getShading();
{code}
insert something like this:
{code}
if (shading == null)
{
// some error message here
return Color.white;
}
{code}
I'll test it at a later time / day, the command line applications don't have a
"force" option.
> NPE when converting page to image
> ---------------------------------
>
> Key: PDFBOX-2266
> URL: https://issues.apache.org/jira/browse/PDFBOX-2266
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Jen Huang
> Priority: Minor
> Attachments: powerpoint2011.pdf
>
>
> I have a pdf that throws an NPE in version 2.0.0 when rendering a specific
> page to an image. I've tested the pdf with 1.8.6 and it worked correctly.
> It logged a warning (java.io.IOException: Error: Unknown shading type 0) but
> did not throw any exceptions. I will attach the pdf. Let me know if you
> need any more info.
> ! java.lang.NullPointerException: null
> ! at
> org.apache.pdfbox.pdmodel.graphics.color.PDPattern.toPaint(PDPattern.java:125)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:710)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:773)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.util.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:564)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:268)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:189)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:168)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:228)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:160)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
> ! at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:83)
> ~[pdfbox-2.0.0-SNAPSHOT.jar:na]
--
This message was sent by Atlassian JIRA
(v6.2#6252)