Dimensions on JPEG are large

When using Aspose.PDF to convert PDF documents to JPEG I have noticed the resulting dimensions seem large to me and I think that might be causing our files to be larger. We are using a resolution of 250 and a quality of 0. The dimensions of the resulting JPEGS are around 2000X2000. Do you have any suggestions how we could keep a good resolution and quality without creating a JPEG with Dimensions that are so big? We cannot set the Pagesize to letter as sometimes documents are not always letter size, or legal,. etc.

Thanks in advance.

Sarah Clements

Werner Enterprises.

Hi Sarah,


Thanks for using our products.

In your current circumstances, I would suggest you to set the page size for image when converting PDF to JPEG. You can check that if the source PDF is in Letter dimensions, the output should be in letter dimensions and if the source is in legal dimensions, you can set the output size of Image to legal. Please take a look over the following overloaded constructor of JpegDevice class which specified the output size of resultant image as A4 and image quality is maximum (100. Best quality). You may try using the code snippet shared over Convert all PDF pages to JPEG Images

JpegDevice jpegDevice = new JpegDevice(Aspose.Pdf.PageSize.A4,resolution,100);<o:p></o:p>


In case of any further query, please share the source PDF file so that we can test the scenario at our end.

I found this option as I was waiting for you reply and it seems to work pretty well for me. Would you guys suggest this as a method as well? I believe the best way to convert from point to pixel is to take Point * 1.33. Please suggest if there is a better way. This process happens on the backend so there is no client involved.

for (int i = 1; i <= pages; i++)

{

var res = new Resolution(jpegConfig.JpegDpi);

var jpegDevice = new JpegDevice(Convert.ToInt32(pdfDoc.Pages[1].ArtBox.Width * 1.33), Convert.ToInt32(pdfDoc.Pages[1].ArtBox.Height * 1.33), res, jpegConfig.JpegQuality);

string pageOutputFileName = string.Format(outputFilePathFormat, i);

jpegDevice.Process(pdfDoc.Pages[i], pageOutputFileName);

outputFileNames.Add(pageOutputFileName);

}

v/r

Sarah Clements

Sarah Clements:

I found this option as I was waiting for you reply and it seems to work pretty well for me. Would you guys suggest this as a method as well? I believe the best way to convert from point to pixel is to take Point * 1.33. Please suggest if there is a better way. This process happens on the backend so there is no client involved.

Hi Sarah,

As per my understanding, you need to understand/know the aspect ration for conversion of Points to Pixel. The basic unit in Aspose.Pdf for .NET is Point where 1 Inch = 72 Points and 1cm = 28.3 Points. In case I can be of any further assistance, please feel free to contact.