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
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,
//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,
Hi Abdul,