We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Nullpointer error while trying to extract images from PDF

Hi,


We are trying to use Aspose.pdf for Java (Version 17.2.0), with a trial license, to extract images from a PDF document and save it as JPG. This PDF is actually a scanned document.

This is a 32 page document. For most of the pages, we are getting the JPG correctly. However for 4 pages, we are getting the below error.

java.lang.NullPointerException
at com.aspose.pdf.internal.p93.z22.m1(Unknown Source)
at com.aspose.pdf.internal.p93.z20.m3(Unknown Source)
at com.aspose.pdf.internal.p93.z14.m3(Unknown Source)
at com.aspose.pdf.internal.p93.z20.(Unknown Source)
at com.aspose.pdf.internal.p93.z14.(Unknown Source)
at com.aspose.pdf.internal.p93.z22.(Unknown Source)
at com.aspose.pdf.internal.p93.z18.m13(Unknown Source)
at com.aspose.pdf.internal.p93.z18.m12(Unknown Source)
at com.aspose.pdf.internal.p93.z18.(Unknown Source)
at com.aspose.pdf.internal.p93.z18.(Unknown Source)
at com.aspose.pdf.internal.p93.z15.(Unknown Source)
at com.aspose.pdf.internal.p93.z10.m1(Unknown Source)
at com.aspose.pdf.internal.p78.z4.m1(Unknown Source)
at com.aspose.pdf.internal.p78.z4.m2(Unknown Source)
at com.aspose.pdf.internal.p35.z4.(Unknown Source)
at com.aspose.pdf.internal.p35.z3.(Unknown Source)
at com.aspose.pdf.internal.p35.z4.m1(Unknown Source)
at com.aspose.pdf.internal.p59.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p59.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p59.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p35.z6.m1(Unknown Source)
at com.aspose.pdf.XImage.saveInternal(Unknown Source)
at com.aspose.pdf.XImage.m1(Unknown Source)
at com.aspose.pdf.XImage.m1(Unknown Source)
at com.aspose.pdf.XImage.save(Unknown Source)
at TestPdf4.main(TestPdf4.java:47)

I have attached the TestPdf4.java herewith. Can you please help us with this issue.
Please note: I am running the TestPdf4.java in Eclipse on my local machine (Windows) when I am getting this error.

Hi Ntn,


Thanks for contacting support.

I have tested the scenario with one of my sample PDF file and it is working fine. I will appreciate if you please share your sample PDF file. It will help us to reproduce the issue at our end and address it accordingly.

We are sorry for the inconvenience.

Best Regards,

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ‘Helvetica Neue’; -webkit-text-stroke: #000000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ‘Helvetica Neue’; -webkit-text-stroke: #000000; min-height: 14.0px}
span.s1 {font-kerning: none}