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

Free Support Forum - aspose.com

Converting PDF to Pgn Image

I'm evaluation for Site EOM purchase and getting NPE when using your example from github:

Code:
final PdfConverter converter = new PdfConverter();
converter.bindPdf("/Users/psemeniuk/src/officeconnector/Zen/target/test-classes/src/pdf-bezier-curve.pdf");
converter.doConvert();
int imageCount = 1;
while (converter.hasNextImage())
{
converter.getNextImage("/Users/psemeniuk/src/officeconnector/Zen/target/" + "image" + imageCount + ".jpg", ImageFormat.getJpeg());
imageCount++;
}


Stacktrace:
class com.aspose.ms.System.e: null key
Parameter name: key
com.aspose.ms.System.a.f.get_Item(Unknown Source)
com.aspose.pdf.a.b.e.b.d.a(Unknown Source)
com.aspose.pdf.a.e.a.a(Unknown Source)
com.aspose.pdf.a.j.b.g.a(Unknown Source)
com.aspose.pdf.a.j.h.a(Unknown Source)
com.aspose.pdf.Z.a(Unknown Source)
com.aspose.pdf.ImageDevice.a(Unknown Source)
com.aspose.pdf.JpegDevice.processInternal(Unknown Source)
com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)
com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)
com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

Can you advise on what I'm doing wrong?


Hi Petro,


Thanks for your interest in our products.

I have tested the scenario using latest hotfix of Aspose.Pdf for Java 4.2.1 and I am unable to notice any problem. You might be using some older release.

For your reference, I have also attached the resultant Image being generated over my end. We are sorry for this inconvenience.

Thanks for the quick reply. I re-downloaded library and still getting NPE.


Would you be able to post code snippet you’re using for image generation (apparently conversion does work for you). Also, do you know if code has any dependencies on java/OS version? I’m on MacOs 10.8.5 and jdk 1.7.0_25


It looks like I’m getting the same exception as this guy:

Apose.Pdf 4.2.1 null key exception

Hi Petro,


Thanks for sharing the details.

In my earlier attempt, I have tested the scenario using Aspose.Pdf for Java 4.2.1 in Juno Eclipse application running over Windows 7 (X64) where I have JDK 1.7 and I used the same code snippet which you have shared in your first post. However, as you are facing the problem over MAC OSX, I will test the scenario over this environment and will keep you posted with my findings. We apologize for this inconvenience.

[Java]

final com.aspose.pdf.facades.PdfConverter converter
= new com.aspose.pdf.facades.PdfConverter();<o:p></o:p>

converter.bindPdf("c:/pdftest/pdf-bezier-curve.pdf");

converter.doConvert();

int imageCount = 1;

while (converter.hasNextImage())

{

converter.getNextImage("c:/pdftest/pdf-bezier-curve_" + "image" + imageCount + ".jpg",com.aspose.ms.System.Drawing.Imaging.ImageFormat.getJpeg());

imageCount++;

}

Hi Nayyer Shahbaz,


Thanks for the reply. Other thing worth to mention is that I downloaded raw jar, put it into classpath and run example.

Do you I need to do anything special to enable evaluation mode? If so can you point me to example?

Cheers
Petro

Hi Petro,


Once you have included aspose-pdf-4.x.x.jar file in your application class path and have referenced the library in your project, you are good to go with the evaluation of product. Please note that the evaluation/trial version provides the same set of features as offered in licensed mode, except for the fact that an evaluation watermark is displayed in PDF files generated with trial mode.

However, you may consider requesting a 30 days temporary license to test the component without any limitations. For further details, please visit Get a temporary license

Hi Petro,


Thanks for your patience.

I have tested the scenario over MAC OSX 10.8.2 where I have java version “1.6.0_43” Java™ SE Runtime Environment (build 1.6.0_43-b01-447-11M4203) and as per my observations, when using Aspose.Pdf for Java in trial mode, a null key exception is generated. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWJAVA-33752. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.


However in order to test our component without this problem, you may consider requesting a 30 days temporary license. For further details, please visit Get a temporary license

Hi Petro,


Adding more to my previous comments, I have also observed that when using a valid license file with Aspose.Pdf for Java and when converting PDF page to Image format over MAC OS X 10.8.2, some contents are missing over resultant image file. For
the sake of correction, I have separately logged it in our issue tracking system as
PDFNEWJAVA-33753. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.


PS, this problem does not seem to be occurring when converting PDF to Image format over Windows or Linux platform.

Hi Nayyer,


Thanks a lot for looking into it.

Please note that though 90% of our developers are on MacOs, the rest are on unix (Ubuntu) and production systems are running on unix (rhel 6 believe) os would be nice it fix will work on all these platforms.

Cheers
Petro

Hi Petro,


Thanks for sharing the information.

We will definitely consider resolving the issue occurring on all platforms including MAC, Linux and Windows. Please be patient and spare us little time.

Hi Petro,


Thanks for your patience. Please note your above reported issues (PDFNEWJAVA-33752, PDFNEWJAVA-33753) have been fixed in Aspose.Pdf for Java 9.7.0 in result of some other fixes. Please download and try latest version of Aspose.Pdf for Java it will help you to accomplish the task.

Please feel free to contact us for any further assistance.

Best Regards,