I have a pdf file,I want to optimize it by Aspose.PDF,But thow a NullReferenceException when i invoke OptimizeResources method.
please tell me how to do? I am try to invoke Repair() method to repair the pdf file ,but it not work!
the version is Aspose.PDF for .Net 20.12.0.0.
the sample code :
string inputFile = @"C:\Users\sullivan\Desktop\6下第5单元详细考点梳理.pdf";
string outputFIle = @"C:\Users\sullivan\Desktop\result.pdf";
var pdfDocument = new Aspose.Pdf.Document(inputFile);
var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
optimizeOptions.ImageCompressionOptions.CompressImages = true;
optimizeOptions.ImageCompressionOptions.ImageQuality = 70;
optimizeOptions.ImageCompressionOptions.Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Fast;
pdfDocument.OptimizeResources(optimizeOptions);
pdfDocument.Save(outputFIle);
the sample file:
6下第5单元详细考点梳理.pdf (405.8 KB)
thank you!