OptimizeResources() Damages Some PDFs

Hello,





I am using Aspose.PDF to optimize PDFs coming in to our internal system using the .NET framework. After updating to version 17.2.0, I started noticing that some PDFs were getting damaged after the process - they ended up being scrambled, looking like an old TV when the cable goes out.





I’ve attached a program that can recreate the issue (with the license file removed). If I optimize the same file with the previous version that I was using (16.11.0), the file optimizes without error. The code really comes down to:



pdfDocument.OptimizeResources(new Document.OptimizationOptions()


{


LinkDuplcateStreams = true,


RemoveUnusedObjects = true,


RemoveUnusedStreams = true,


CompressImages = true,


ImageQuality = 30


});


Hi Michael,


Thanks for contacting support.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}


I have tested the scenario and have managed to reproduce the problem that OptimizeResources() damaging the provided PDF document. For the sake of correction, I have logged it as PDFNET-42285 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.


We are sorry for this inconvenience.


Best Regards