iTextSharp validate pdf

2k views Asked by At

For my internship, I need to verify a signed PFD/A file to guarantee that the client will receive the official document. Now I've created a signed PDF/A file with iTextSharp. When I open this file in Adobe Reader it shows me that there is a signature present.

Now I need to verify the file in the code before I can send it to the clients, but when I try to verify it using the GetSignatureNames function or the GetBlankSignatures function, it keeps returning that there are no signature names.

I'm using the following code to verify:

PdfReader reader = new PdfReader(cdr.PDFAkteNaam);
AcroFields af = reader.AcroFields;
var names = af.GetSignatureNames();
if (names.Count == 0)
{
    MessageBox.Show("Error","No Signature Present in PDF file.");
}
else
{
    MessageBox.Show("Succes!", "Success!");
}

EDIT: Here is the signed test-file we got from notaryship. It contains fictional data just for testing. Link to file

0

There are 0 answers