Convert PDF To Image using Java | Aspose.PDF for Java | Obtain high quality image

While Converting pdf to jpg, image quality is poor, How to Convert PDF to Image Without loosing the image quality using java

@Naresh9493

The output image quality depends upon what type of images are embedded in the source PDF and how they are added into it. Could you please share a sample source PDF along with expected output image so that we can test the scenario in our environment and address it accordingly.

TS9.pdf (3.4 MB)
I Need as it is Quality in image file also.

@Naresh9493

We have tested the scenario in our environment while using Aspose.PDF for Java 21.3 and the following code snippet:

Document pdfDocument = new Document(dataDir + "TS9.pdf");
for (Page page : pdfDocument.getPages()) {
 java.io.OutputStream imageStream = new java.io.FileOutputStream(dataDir + "Converted_Image_" + page.getNumber() + ".jpg");
 com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);
 com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(3400, 4400, resolution);
 jpegDevice.process(page, imageStream);
 imageStream.close();
}

Converted_Image_1.jpg (3.5 MB)

The image generated using above code snippet is also attached. Could you please check it and share your feedback if this quality is fine for you?