Free Support Forum - aspose.com

Invalid signature object when Signed by unknown

We are trying to remove all signatures from a .pdf which is having an issue with the signature ‘Signed by unknown’.

When we are trying to remove the signature using the below code it shows an error - ‘Invalid signature object.’.

//code
Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(@“C:\D_Drive\AsposeTest\Aspose.Total.lic”);

        // Create PdfFileSignature object
        PdfFileSignature pdfSign = new PdfFileSignature();
        // Open PDF document
        pdfSign.BindPdf(@"C:\D_Drive\AsposeTest\ConsoleApp1\ConsoleApp1\ConsoleApp1\" + "Test.pdf");
        // Get list of signature names
        IList<string> names = pdfSign.GetSignNames();
        // Remove all the signatures from the PDF file
        for (int index = 0; index < names.Count; index++)
        {
            pdfSign.RemoveSignature((string)names[index]);
        }

        // Save updated PDF file
        pdfSign.Save(@"C:\D_Drive\AsposeTest\ConsoleApp1\ConsoleApp1\ConsoleApp1\" + "Test_out.pdf");

screeshots-
image.png (16.9 KB)
Capture2.PNG (22.6 KB)

is there any other method or way to remove/deleted all signatures from pdf?

@swapnilyadav

The method you are trying already is the only method in the API to remove the signatures at the moment. However, please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.

Sample document attached. OutputFile.pdf (872.8 KB)

Aspose is not able to remove a signature/certificate from this document.

Please let us know cause and how we can remove the signature.

Is there any way we can ignore the signature and process document (add metadata and new certificate)?

@swapnilyadav

We have tested the scenario in our environment while using Aspose.PDF for .NET 21.2 and were able to notice the issue. We have logged an issue as PDFNET-49472 in our issue tracking system for this case. We will further investigate the reasons behind it and resolve it. As soon as the ticket is resolved, you will be notified in this forum thread. Please be patient and spare us some time.

We are sorry for the inconvenience.