NullPointerException when converting PDF to image

While I was playing with pdfbox 1.7.0 (apache), I came across a NullPointerException . I can't figure out what the hack is wrong with my code. You can see the full t21 stack at http://pastebin.com/XEuv7VmU and the code here: http://pastebin.com/vJYBwWtq .

I just want to convert every PDF page to an image ( BufferedImage ).

+4
source share
1 answer

Either I'm missing something obvious, or there is an error in the library. Type3StreamParser extension has the following method:

 public Image createImage( COSStream type3Stream ) throws IOException { processStream( null, null, type3Stream ); return image.createImage(); } 

it calls processStream() in the base class, defined as follows:

 public void processStream( PDPage aPage, PDResources resources, COSStream cosStream ) throws IOException { graphicsState = new PDGraphicsState(aPage.findCropBox()); //... } 

Obviously, this code will always throw NPE. If you are not abusing the API in any way, consider reporting the problem .

+2
source

All Articles