Method not found for optimisation of PDF in android

How can i optimise the images inside PDF file.
I am following Optimse PDF Document documentation.

According to above documentation there is a way to optimse or compress the image quality that is below:

Document.OptimizationOptions opt = new Document.OptimizationOptions();
// Enable image compression
opt.setCompressImages(true);
// Set the quality of images in PDF file
opt.setImageQuality(10);

But I am not able to call the method setCompressImages(true) and setImageQuality(10), Not found in android.
I am using Aspose.PDF SDK 19.3.

@MathiasT

Thank you for contacting support.

Below is an updated code snippet for your kind reference.

Document doc = new Document(dataDir + "Test.pdf");
com.aspose.pdf.optimization.OptimizationOptions opt = new com.aspose.pdf.optimization.OptimizationOptions();
// Enable image compression
opt.getImageCompressionOptions().setCompressImages(true);
// Set the quality of images in PDF file
opt.getImageCompressionOptions().setImageQuality(10);
doc.optimizeResources(opt);
doc.save(dataDir + "optimized.pdf");

We will be updating the documentation article accordingly.

Please check the attached image because there is no optimization package and also OptimizationOptions is the subclass of com.aspose.pdf.Document and inside OptimizationOptions, getImageCompressionOptions is not exist.
Screenshot from 2019-11-05 12-11-53.png (52.1 KB)

@MathiasT

Thank you for elaborating further.

We have logged a ticket with ID PDFANDROID-573 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.