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,
Dear support,
PDF file used
Box
Code referred
Convert PDF to Images formats|Aspose.PDF for Java
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
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,
Hi Abdul,