Removing metadata from PDFs created by Corel damages the PDF

When our iScrub product uses ASPOSE to remove PDF metadata from the attached PDF created by Corel PDF Engine 15.0.0.512 the resulting PDF is damaged and cannot be opened. Adobe will report that it is “either not a supported file type or because the file was damaged … and wasn’t correctly decoded”.

This sample was also previously modified by iText Sharp but I have another sample of a PDF created by Corel that was NOT modified by iText Sharp but unfortunately can’t submit that sample. The common thread is PDFs created by Corel.

Is this something you are aware of and working on?

Thanks,
Kristen Theologus
Senior Support Analyst
Esquire Innovations

Hi Kristen,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.7.0 and as per my observations, I am unable to notice any issue while viewing the PDF document (in Adobe Reader 11.0.2) from which Metadata is removed using following code lines.

Can you please share the code snippet which you are using so that we can again test the scenario in our environment. We are sorry for this inconvenience.

For your reference, I have also attached the resultant PDF generated over my end.

[C#]

//Open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/16+-+scheduling+order.pdf");

//Get properties

Console.WriteLine(pdfDocument.Metadata["xmp:CreateDate"]);

Console.WriteLine(pdfDocument.Metadata["xmp:Nickname"]);

Console.WriteLine(pdfDocument.Metadata["xmp:CustomProperty"]);

pdfDocument.RemoveMetadata();

//Save document

pdfDocument.Save(“c:/pdftest/16±+scheduling+order_Metadata_Removed.pdf”);

I will provide the code snippet soon (our developer is on another project). Please do not close issue.

Thanks,
Kristen

Hi Kristen,


We will be waiting for input/code snippet from your side and this thread is still open.

Thanks for your patience. Attached is the code snippet you requested.

Hi Kristen,


Thanks for sharing the code snippet.

I have gone through the code and it contains many methods defined inside it but I don’t see any method related to MetaData removal from PDF file. Can you please further check with development team and ask them to share the code snippet which can help us in replicating this issue in our environment.

PS, I have tried using following code snippet (based on few methods inside your shared code with latest release of Aspose.Pdf for .NET 9.9.0) and I am unable to notice any problem in resultant file.

[C#]

_filePath=“c:/pdftest/16±+scheduling+order.pdf”;<o:p></o:p>

Document doc = new Document(_filePath);

DocumentInfo info = new DocumentInfo(doc);

info.Remove("Keywords");

info.Keywords = "keywords";

doc.OptimizeResources(Document.OptimizationOptions.All());

doc.Save(“c:/pdftest/Updated_MetaData.pdf”);

I’ve been able to confirm the problem is resolved in Aspose 9.9.0.

Thanks,

Hi Kristen,


Thanks for sharing the feedback.

We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.