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

Free Support Forum - aspose.com

OptimizeResources bug

I thought I posted this before, but I can’t find it now. We have a complex form (over 200 fields) that we are filling (HFCA for medical billing), and we discovered that if we optimize resources on a document containing fields, the document is silently corrupted by replacing some fields with other fields, so that info is incorrectly duplicated in multiple locations. We have to wait until after a form as been flattened, and even then, I am somewhat nervous to use this feature.

Hi Joseph,

Thanks for contacting support.

Can you please share the resource file so that we can test the scenario at our end. We are sorry for your inconvenience.

This is a purchased/licensed product, so all I can send you is a link to a sample download: http://www.pdfsmartforms.com/SmartForm_CMS1500_02_12_TRIAL.pdf

Hi Joseph,

Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for .NET 9.2.1 and I am unable to notice any problem. As per my observations, the fields are properly being displayed in resultant PDF (except the extended rights feature is removed). For your reference, I have also attached the resultant PDF generated over my end.

In case the problem still persists, please share some details which can help us in identifying the issue. We are sorry for this inconvenience.

Can you post the code you used? I am thinking that it might be a problem of the order in which commands are issued. Thanks.

Hi Joseph,

I have used the following code snippet with Aspose.Pdf for .NET 9.2.1.


load source PDF

Document doc = new Document("c:/pdftest/SmartForm_CMS1500_02_12_TRIAL.pdf");

doc.OptimizeResources(new Document.OptimizationOptions()


LinkDuplcateStreams = true,

RemoveUnusedObjects = true,

RemoveUnusedStreams = true


// save updated document