Rather than save a file and then sign it I am filling the data fields with a stamper in a memory stream.
MemoryStream fs = GetSaarForm();
PdfReader.unethicalreading = true;
PdfReader reader = new PdfReader(fs.ToArray(), null);
string pwd = "";
if (string.IsNullOrEmpty(pwd))
pwd = System.Web.Security.Membership.GeneratePassword(20, 5);
using (MemoryStream ms = new MemoryStream())
{
using (PdfStamper stamper = new PdfStamper(reader, ms, '\0', false))
{
stamper.SetEncryption(
null,
System.Text.Encoding.UTF8.GetBytes(pwd),
PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_COPY,
PdfWriter.ENCRYPTION_AES_128);
AcroFields form = stamper.AcroFields;
StampSaarPdf(form, candidate, saar);
}
//SaveSaarPassword(candidateId, pwd);
return ms.ToArray();
}
Stamping the individual fields is in the method. But the signatures are the problem. They have to look like the attached.
I've looked over all of the ways that people have done the signature and just cannot see how I can do this. This is a DOD CAC signature. Does anyone have any ideas? There are four separate signatures I have to put in the form. I changed the signature fields to be a plain textbox.