0

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.

visible signature

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.

Dean.DePue
  • 1,013
  • 1
  • 21
  • 45
  • You need to use the `X509Certificate2` from the DoD CAC card. – Dai May 23 '19 at 17:59
  • *"I changed the signature fields to be a plain textbox"* - if you want to sign the document, why do you change signature fields to textboxes? – mkl May 23 '19 at 20:48

1 Answers1

0

You have to use a Java applet because it has to be signed at the client level using ActivClient as the CAC middleware.

Joe
  • 1