Free Support Forum -

How to control the image size while converting pdf page to JPEG Image


I have requirement to convert the PDF page to JPEG Image. I’ve used the below code.

PdfConverter converter = new PdfConverter();

// set start and end pages

String suffix = “.jpg”;
int imageCount = 1;
while (converter.hasNextImage()) {
converter.getNextImage(outputFilePath + File.separator + “Thumbnail_” + imageCount
+ suffix, ImageType.JPEG);

It serves my purpose of converting PDF to JPEG Image. But can I control the output Image size. I want JPEG Image to be of size 640 x 480.

Is there any APIs available which allow me to do that.

Hi Tejas,

I’m sorry to inform you that specifying custom output image size is currently not supported in the Aspose.Pdf.Kit for Java. However, we have logged a new feature request as PDFKITJAVA-18151 in our issue tracking system. You’ll be updated via this forum thread once it is supported in future.

We’re sorry for the inconvenience.