Removing PDF metadata corrupts e-signature

We are using Aspose.Pdf for .NET 17.8 to remove document properties with our Scrub product.

I have a client with e-signatures in their documents and when processed the e-signature is corrupt. Then you click on the e-signature is warns: Error during signature verification. Signature contain incorrect, unrecognized, corrupted or suspicious data."

This is basically what the code does in a condensed version:

public void ClearAuthorAndTitleFromPdf(string path)
{
var pdf = new Aspose.Pdf.Document();
var pdfInfo = new Aspose.Pdf.DocumentInfo(pdf);
pdfInfo.Author = string.Empty;
pdfInfo.Title = string.Empty;
pdf.Save();
}

I’m attaching a sample PDF that reproduces the issue.

Kristen Theologus
Product Specialist

Microsoft Outlook - Memo Style.pdf (443.6 KB)

@KTechnogal

Thank you for contacting support.

We would like to share with you that a signed PDF document can not be modified. Making any modifications to a signed document makes the signatures invalid. Therefore a warning is displayed, as mentioned by you.

We hope this will clarify any ambiguity. Please feel free to contact us if you need any further assistance.

Is there a way to detect a signed PDF so we can have our program skip processing it?

Thanks,

@KTechnogal

A signed document can be distinguished by using below code snippet in your environment.

string inFile = dataDir + "Microsoft Outlook - Memo Style.pdf";
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(inFile);
if (pdfSign.ContainsSignature())
{
    Console.WriteLine("Signature exists");
}
else
{
    Console.WriteLine("Signature does not exist");
}

We hope this will be helpful. Please let us know if you have any further query.

Thank you. I’ve passed this on to my developers.