150 dpi resolution in pdf document

Hi,

I tried to convert normal pdf to 150 dpi using the following code.
/sample code/
Aspose.Pdf.Document pdfDocument …
var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
optimizeOptions.ImageCompressionOptions.CompressImages = true;
optimizeOptions.ImageCompressionOptions.ImageQuality = 75;
optimizeOptions.ImageCompressionOptions.ResizeImages = true;
optimizeOptions.ImageCompressionOptions.MaxResolution = 150;

When I tried to check the dpi of the pdf document, always showing as 300 dpi.
Could you please provide me a suggestion?

Thanks

@kamatchi

To convert a PDF document to 150 DPI using Aspose.PDF, you need to ensure that you are using the correct approach for image resolution settings. The code snippet you provided indicates that you are trying to optimize the images within the PDF, but it seems that the DPI is still being reported as 300 DPI.

Unfortunately, Aspose.PDF does not currently provide a direct API to set the resolution of images in a PDF document. This limitation means that even if you attempt to set the maximum resolution to 150 DPI, the images may still retain their original resolution of 300 DPI.

Here are a few suggestions to help you achieve your goal:

  1. Check the Version: Ensure that you are using the latest version of Aspose.PDF. Sometimes, newer versions may include enhancements or additional features that could help with your requirements.

  2. Image Manipulation: If you need to set the DPI for images specifically, consider manipulating the images before adding them to the PDF. You can use image processing libraries to adjust the DPI of the images and then insert them into the PDF.

  3. Feature Request: Since there is a known limitation regarding setting image resolution directly, you might want to keep an eye on any updates from Aspose regarding this feature. A feature request has been logged for this functionality, and you may receive updates through the forum.

  4. Testing and Verification: After making changes, always verify the DPI of the images in the PDF using appropriate tools to ensure that the desired settings have been applied correctly.

If you need further assistance or specific code examples for manipulating images before adding them to the PDF, feel free to ask!

Sources:
[1]: Set DPI for Images inside the PDF using C#
[2]: Setting DPI or PPI of Images in PDF using Java | Aspose.PDF Java PDF …