You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2009/11/01 15:32:59 UTC

[jira] Created: (PDFBOX-552) NPE while printing a pdf with an image inside

NPE while printing a pdf with an image inside
---------------------------------------------

                 Key: PDFBOX-552
                 URL: https://issues.apache.org/jira/browse/PDFBOX-552
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing
    Affects Versions: 0.8.0-incubator
            Reporter: Andreas Lehmkühler
             Fix For: 1.0.0


Whenever a pdf is printed java uses a 2-pass-algo to create each page. The first pass using sun.print.PeekGraphics works fine, but during the second pass using sun.print.PSPathGraphics an exception occurs if the pdf includes an image.

java.lang.NullPointerException
	at java.awt.geom.Area.<init>(Area.java:108)
	at sun.print.PSPathGraphics.drawImageToPlatform(PSPathGraphics.java:560)
	at sun.print.PathGraphics.drawImage(PathGraphics.java:1701)
	at org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:121)
	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:516)
	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:229)
	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:188)
	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:99)
	at org.apache.pdfbox.pdmodel.PDPage.print(PDPage.java:795)
	at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1964)
	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1431)
	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1247)
	at org.apache.pdfbox.pdmodel.PDDocument.print(PDDocument.java:1003)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-552) NPE while printing a pdf with an image inside

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler updated PDFBOX-552:
--------------------------------------

    Attachment: MODULE17FHE38EX.pdf

Attaching a sample pdf to demonstrate the issue. Werner Nell send this pdf to me.

> NPE while printing a pdf with an image inside
> ---------------------------------------------
>
>                 Key: PDFBOX-552
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-552
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 0.8.0-incubator
>            Reporter: Andreas Lehmkühler
>             Fix For: 1.0.0
>
>         Attachments: MODULE17FHE38EX.pdf
>
>
> Whenever a pdf is printed java uses a 2-pass-algo to create each page. The first pass using sun.print.PeekGraphics works fine, but during the second pass using sun.print.PSPathGraphics an exception occurs if the pdf includes an image.
> java.lang.NullPointerException
> 	at java.awt.geom.Area.<init>(Area.java:108)
> 	at sun.print.PSPathGraphics.drawImageToPlatform(PSPathGraphics.java:560)
> 	at sun.print.PathGraphics.drawImage(PathGraphics.java:1701)
> 	at org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:121)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:516)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:229)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:188)
> 	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:99)
> 	at org.apache.pdfbox.pdmodel.PDPage.print(PDPage.java:795)
> 	at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1964)
> 	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1431)
> 	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1247)
> 	at org.apache.pdfbox.pdmodel.PDDocument.print(PDDocument.java:1003)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-552) NPE while printing a pdf with an image inside

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-552.
---------------------------------------

    Resolution: Fixed

During investigating a little bit in the internet I've found some hints that probably an empty clippping area causes the NPE described above. After replacing a possible null-value for the clipping area with a rectangle having the same dimension than the page to be printed, everythings works fine.

I've modified the "Invoke" and the "BeginInlineImage" operator with version 831683.

> NPE while printing a pdf with an image inside
> ---------------------------------------------
>
>                 Key: PDFBOX-552
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-552
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 0.8.0-incubator
>            Reporter: Andreas Lehmkühler
>             Fix For: 1.0.0
>
>         Attachments: MODULE17FHE38EX.pdf
>
>
> Whenever a pdf is printed java uses a 2-pass-algo to create each page. The first pass using sun.print.PeekGraphics works fine, but during the second pass using sun.print.PSPathGraphics an exception occurs if the pdf includes an image.
> java.lang.NullPointerException
> 	at java.awt.geom.Area.<init>(Area.java:108)
> 	at sun.print.PSPathGraphics.drawImageToPlatform(PSPathGraphics.java:560)
> 	at sun.print.PathGraphics.drawImage(PathGraphics.java:1701)
> 	at org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:121)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:516)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:229)
> 	at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:188)
> 	at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:99)
> 	at org.apache.pdfbox.pdmodel.PDPage.print(PDPage.java:795)
> 	at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1964)
> 	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1431)
> 	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1247)
> 	at org.apache.pdfbox.pdmodel.PDDocument.print(PDDocument.java:1003)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.