OptimizationOptions.ImageCompressionOptions is Read Only

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

  • [CompressImages](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/properties/compressimages)
  • [ImageQuality](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/properties/imagequality)
  • [MaxResoultion](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/properties/maxresoultion) (note the misspelling)
  • [ResizeImages](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/properties/resizeimages)

And moved them to [ImageCompressionOptions](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/imagecompressionoptions) class, but in order to use them I need to set the [ImageCompressionOptions](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/properties/imagecompressionoptions) property in the [OptimizationOptions](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions) class, however that is not possible since the property is read only, and there is no way to set it in the [constructor](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/constructors/main), and there is no [method](https://reference.aspose.com/net/pdf/aspose.pdf.optimization/optimizationoptions/methods/index) to set it. How am I supposed to use the new class?

@bmillspaugh

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;
        doc.OptimizeResources(optimizationOptions);
        doc.Save(@"D:\ExampleOptimized_18.11.pdf");

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.