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)