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

Free Support Forum - aspose.com

Converting pdf to jpeg & png

I’m using latest version of aspose.pdf

(Aspose.Pdf for Java 9.0.0)


when i’m trying to convert png i’m unable to do it
& the coverted jpeg files are very poor

http://www.aspose.com/docs/display/pdfjava/Convert+PDF+pages+to+PNG+Image

i have used the above link as reference
i have attached the sample files

Hi Bharathkumar,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for Java 9.0.0 in Eclipse Juno project running over Windows 7(x64) with JDK 1.7 and I am unable to notice any problem. The PDF pages are properly being converted to PNG and JPEG images. For your reference, I have also attached the some of the images images generated over my end. Can you please share some further details which can help us in identifying these problems. 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/AISB08.pdf");

// loop through all the pages of PDF file

for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++)

{

// create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream("c:/pdftest/AISB08_Converted_Image" + pageCount + ".jpg");

//create Resolution object

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

//create JpegDevice object where second argument indicates the quality of resultant image

com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);

//convert a particular page and save the image to stream

jpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);

//close the stream

imageStream.close();

}