I have a PDF which has been signed by 2 people (by Eid).
I'm trying to retrieve this information but I'm unable so far.
This is what I have so far:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string workingFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string inputFile = Path.Combine(workingFolder, "Tax Return.pdf");
PdfReader reader = new PdfReader(inputFile);
Console.ReadLine();
}
}
}
If I inspect 'reader' during runtime I can see that AcroForm has 2 Fields that point to the signatures but I'm unable to see any specific information about these signatures.
Short example:
StringBuilder sb = new StringBuilder();
PdfReader reader = new PdfReader(pdf);
AcroFields af = reader.AcroFields;
ArrayList names = af.GetSignatureNames();
for (int i = 0; i < names.Count; ++i) {
String name = (string)names[i];
PdfPKCS7 pk = af.VerifySignature(name);
sb.AppendFormat("Signature field name: {0}\n", name);
sb.AppendFormat("Signature signer name: {0}\n", pk.SignName);
sb.AppendFormat("Signature date: {0}\n", pk.SignDate);
sb.AppendFormat("Signature country: {0}\n",
PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("C")
);
sb.AppendFormat("Signature organization: {0}\n",
PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("O")
);
sb.AppendFormat("Signature unit: {0}\n",
PdfPKCS7.GetSubjectFields(pk.SigningCertificate).GetField("OU")
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With