Hello,
Hi Benjamin,
Thanks for contacting support.
I have seen the PDF document which you have shared in your earlier post and the reasons Document.Pages[].Resources.Images is always returned as empty is because images are not added as resources but they are added as background artifact.
Aspose.Pdf for .NET supports the feature to compress/optimize the PDF file size but I am afraid this feature is not optimizing PDF file size, when using with images.pdf. For the sake of correction, I have logged this problem as PDFNEWNET-39705 in our issue tracking system. We will further look into the details of this problem and will keep you posted with our findings. We are sorry for this inconvenience.
[C#]
// Load the source PDF file
Document doc = new Document("c:/pdftest/images.pdf");
doc.OptimizeResources(new Document.OptimizationOptions()
{
CompressImages = true,
ImageQuality = 100,
RemoveUnusedObjects = true,
LinkDuplcateStreams = true,
AllowReusePageContent = true,
RemoveUnusedStreams = true
});
doc.Save("c:/pdftest/OptimizedFile.pdf");
Hello Nayyer,
Hi Benjamin,
Hi Benjamin,
Thanks for your inquiry. I believe you can meet this requirement using PdfSaveOptions.DownsampleOptions property of Aspose.Words. Here is description of possible settings:
DownsampleImages | Specifies whether images should be downsampled. |
---|---|
Resolution | Specifies the resolution in pixels per inch which the images should be downsampled to. |
ResolutionThreshold | Specifies the threshold resolution in pixels per inch. If resolution of an image in the document is less than threshold value, the downsampling algorithm will not be applied. A value of 0 means the threshold check is not used and all images that can be reduced in size are downsampled. |
Hope, this helps. In case the problem still remains with latest version of Aspose.Words for .NET 15.10.0, please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.
Best regards,