We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

OptimizationOptions.ImageCompressionOptions is Read Only

You have deprecated the following properties of Aspose.Pdf.OptimizationOptions:

And moved them to ImageCompressionOptions class, but in order to use them I need to set the ImageCompressionOptions property in the OptimizationOptions class, however that is not possible since the property is read only, and there is no way to set it in the constructor, and there is no method to set it. How am I supposed to use the new class?


Thank you for contacting support.

You can set optimization options by using below code snippet in your environment.

        Document doc = new Document(@"D:\Example.pdf");
        //var optimizationOptions = new Document.OptimizationOptions();
        var optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
        optimizationOptions.ImageCompressionOptions.CompressImages = true;
        optimizationOptions.ImageCompressionOptions.ImageQuality = 50;
        optimizationOptions.ImageCompressionOptions.MaxResolution = 900;
        optimizationOptions.ImageCompressionOptions.ResizeImages = true;

We hope this will be helpful. Moreover, a ticket with ID PDFNET-45649 has been logged in our issue management system for correction of spellings. We will let you know as soon as the ticket will be resolved.