Unable to Remove Metadata From Specific PDF Files

Hello,

We are using Aspose to remove metadata, such as document properties, from PDFs. We are using Aspose.PDF 7.4.0. When we attempt to process these PDFs we get an error but we are unable to make sense of the stracktrace.

Thanks,

Kim

Hi Kim,

I tested your template files with the following sample code and I am getting “Wrong object format. Id:13 Generation:0” on save method. I have saved the issue in our issue tracking system as PDFNEWNET-34406 for further investigation.

string OriginalPdfPath = @"D:\AP Data\October2012\VOLUNTARY+LIFE.pdf";
string SavePdfPath = @"D:\AP Data\October2012\VOLUNTARY+LIFE.pdf";

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(OriginalPdfPath);

// get document information
DocumentInfo docInfo = pdfDocument.Info;

docInfo.Clear();
pdfDocument.Save(SavePdfPath);

Please confirm if you are getting the same exception? If you are using some other approach and facing some other exception, please do let us know so we can also check the issue in that particular scenario.

Also, you have posted the issue under normal support forum. If you need to raise the priority of this issue to Priority Support, please let us know and we can move this to Priority Support forum.

Sorry for the inconvenience,

Hi Kim,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-34406 reported earlier and as per our observations, both pdf documents has the same problem: object (13 0) ends with

endstream

endobj

Pay attention on the >> between endstream and endobj. Nothing can be placed between these words, so this is syntax error and Aspose.Pdf just says about it. To fix this error we can replace >> with two whitespaces. Please try code snippet with corrected documents DENTAL1.pdf and VOLUNTARY+LIFE1.pdf.

Hi Kim,


In addition to above reply. As we wrote in previous comment your shared PDF documents have errors in their structure and Aspose.Pdf can’t process such invalid documents. However as a workaround each pdf can be opened in Adobe Reader and then saved into new file. Your original code snippet will works with the new fixed PDF files without problems.

Best Regards,