Null pointer error convert pdf page to image

Hi
just testing aspose.pdf.10.4.1.jar for converting pdf. to images.

I always get null pointer error in the xxxDevice.process() function.

(using the same code as on your tutorial: http://www.aspose.com/docs/display/pdfjava/Convert+PDF+Pages+to+JPEG+Image)

The same does happen with all ImageDevices.

I see stackTrace is referenced from those:
org.apache.naming.resources.ImmutableNameNotFoundException (id=487)
org.apache.naming.resources.ImmutableNameNotFoundException (id=6126)
java.lang.NullPointerException (id=6125)
com.aspose.pdf.internal.p348.z72 (id=6121)


any idea?


I am successfully using aspose.slides to put together images to a ppt and i wanted also to use aspose to generate those images from pdf…


regards

reto



Hi Reto,


Thanks for your inquiry. I have tested the scenario with a sample PDF document and unable to notice the issue. It seems the issue is with your specific environment. Please share your environment details. So we will look into it further and provide you information accordingly.

Moreover, also please create a simple Java application and use Aspose.Pdf for Java Jar only, do not refer any additional jar, and share the results.

We are sorry for the inconvenience caused.

Best Regards,

Yes, thanks.
You were just minutes quicker than me.

I was doing this over the weekend. Standalone it’s working.

It was supposed to run inside a tomcat environment. I guess it has some conflict with another library…

do you have any reports on that? or how to nail down the source of the problem?

thanks

reto

Hi Reto,


Thanks for your feedback. We do not have any known issue with tomcat environment. We will appreciate it if you please share your complete code along with environment details and complete error code here. So we will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Would be great if we can find out something.

Here’s part of the error stacktrace:

class com.aspose.pdf.internal.p348.z72: java.lang.NullPointerException —> java.lang.NullPointerException
— End of inner exception stack trace —
com.aspose.pdf.devices.z1.m1(Unknown Source)
com.aspose.pdf.devices.z1.m1(Unknown Source)
com.aspose.pdf.devices.ImageDevice.m1(Unknown Source)
com.aspose.pdf.devices.JpegDevice.processInternal(Unknown Source)
com.aspose.pdf.devices.JpegDevice.process(Unknown Source)
ch.empiricon.common.activepdf.BatchPdfConverter.convertPdfToImagesAspose(BatchPdfConverter.java:193)

just happens in the last line of this code part:

// Create Resolution object
com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);
// Create JpegDevice object where second argument indicates the quality of resultant image
com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);
// Convert a particular page and save the image to stream
com.aspose.pdf.Page currp=pdfDocument.getPages().get_Item(pageCount);
jpegDevice.process(currp, imageStream);


Does that help to narrow the search?

Hi Rito,


Thanks for your feedback. Please share your OS, JDK version and Tomcat version as well. It will help us to investigate the issue.

Best Regards,

Now that’s interesting.

I deployed it on the testserver with tomcat 6.0.44 and there it works.
On the machine i developed first, was still tomcat 5.5.25, so seems to be a problem with that version. All the external jars are the same on both machines.
And also java 1.7.0_79 the same.
My machine has Win7-64, on the testserver win2008.

So for me, it’s ok, i can continue my tests with aspose.pdf within tomcat.

Thanks a lot!

(But would still be interesting to know the reason…)


Hi Rito,


Thanks for sharing your findings. It is good to know that you have managed to use Aspose.Pdf for Java with Tomcat 6.0.44. It seems it is some issue with tomcat 5.5.25. However, we have logged an investigation ticket PDFNEWJAVA-35051 in our issue tracking system and we will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Hi Rito,


Thanks for your patience. Our product team has investigated the issue and closed it as Known Issue. We no longer offer support for Apache Tomcat 5.5.x as Apache Tomcat 5.5.x is not supported from 30 September 2012 (https://tomcat.apache.org/tomcat-55-eol.html) and has serious security and compatibility issues. So it is recommended to use latest versions of Apache Tomcat.

Best Regards,