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

Free Support Forum - aspose.com

StackOverflowError while converting PDF To TIFF using Aspose Java API

Dear Support,

Requirement: I want to convert each page of pdf to one tiff image.
I am getting StackOverflowError similar to the case mentioned in this thread.
java.lang.StackOverflowError at runtime
No solution concluded in the above thread.
Since we are already in the process of purchasing the license, I need to resolve this on urgent basis.

As soon as the following code is executed, it throws the exception.
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“C:\sample.pdf”);
My development system is Win 7 with Java 1.6.0_31
Using aspose-pdf-4.3.1.jar file.
Note: pdf document is very simple tutorial.


Kindly get back ASAP.
Regards,
Abdul Majid

Hi Abdul Majid,


Thanks for your interest in our products.

Can you please share the source PDF file so that we can test the scenario at our end. Please note that every document has its own structure and complexity which might be the reason of such issues. We are sorry for your inconvenience.

Dear support,

PDF file used
http://www.waseda.jp/tokorozawa/kg/doc/12gte_guide_e.pdf
Code referred
http://www.aspose.com/docs/display/pdfjava/Convert+PDF+pages+to+TIFF+Image
Please note, in this sample code, there is a typo. You are using pngDevice instead of tffiDevice.

Kindly check this and get back to us ASAP.

Thanks & regards,
Abdul Majid

Hi Abdul Majid,


Thanks for sharing the resource file.

I have tested the scenario using following code snippet where I have used Aspose.Pdf for Java 4.3.0 in Eclipse Juno application running over Windows 7(x64) where I have JDK 1.7 and I am unable to notice any problem. The file is properly being converted to TIFF format. Can you please share further details regarding your working environment. We are sorry for your inconvenience.

[Java]

//open document<o:p></o:p>

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("c:/pdftest/12gte_guide_e.pdf");

// create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream("c:/pdftest/12gte_guide_e_Converted_Image.tiff");

//create Resolution object

com.aspose.pdf.Resolution resolution = new com.aspose.pdf.Resolution(300);

//create TiffDevice object with particular resolution

com.aspose.pdf.TiffDevice tiffDevice = new com.aspose.pdf.TiffDevice(resolution);

//convert a particular page (Page 1) and save the image to stream

tiffDevice.process(pdfDocument, imageStream);

//close the stream

imageStream.close();

Dear Nayyer Shahbaz,

Due to urgency I switched my development system and tried in another.
Now I am getting Null pointer error at
tiffDevice.process(pdfDocument, imageStream);
java.lang.NullPointerException
at com.aspose.ms.b.g.c.endWriteSequence(Unknown Source)
at com.aspose.ms.a.a.b.a.e(Unknown Source)
at com.aspose.pdf.a.j.b.c.e.a(Unknown Source)
at com.aspose.pdf.TiffDevice.processInternal(Unknown Source)
at com.aspose.pdf.DocumentDevice.a(Unknown Source)
at com.aspose.pdf.DocumentDevice.process(Unknown Source)
at TestPDF.PdfToTiffConvertAspose(TestPDF.java:99)
at TestPDF.main(TestPDF.java:158)

Actually I want to convert each page of PDF to TIFF, hence I have written the following code.
tiffDevice.process(pdfDocument, 1, 1, imageStream);
In any case I am getting the Null Pointer error.

I am having Win 7(x32) having Netbeans 7.2 with aspose-pdf-4.3.1.jar and JDK 1.7

Awaiting for your early response.

Thanks & regards,
Abdul Majid

Hi Abdul,


We are sorry for the inconvenience caused. While testing the scenario with 32bit JRE, we’ve manged to reproduce the issue and logged as PDFNEWJAVA-33804 in our issue tracking system for further investigation. We will keep you updated about the issue progress via this forum thread.

Please feel free to contact us for any further assistance.

Best Regards,


P.S: PDF to TIFF conversion working fine with 64bit JRE.

Hi Abdul,


Thanks for your patience. Please note your above reported issue has been fixed in Aspose.Pdf for Java 9.7.0 in result of some other fix. 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,