5 Replies Latest reply on Apr 26, 2017 8:20 AM by Qloud

    Create digital initials after signing a form using a signature field.

    bsabourin1962

      Without problems, I can create and populate signatures using my Common Access Card (CAC), even place the current date in a corresponding field nearby after signing. However, I would like to digitally initial forms. That is, digitally sign the form with a digital signature, but extract my initials (certificate) from my CAC and populate a filed on my form. I am a designer for the Army, and we often using digital initials to sign our forms. That is, we use a digital signature to sign a form, and at the same time, populates a field on my form that accesses my certificate from my CAC and populates that field with my initials.

        • 1. Re: Create digital initials after signing a form using a signature field.
          Kraze4Kaze

          Anyone ever figure out a solution for this issue? I too am looking for a digital signature consisting of the user's initials rather than the large digital signature block.

           

          bsabourin1962 you mentioned you were a designer for the army. As a prior service member myself I can only assume this was in preparation of the form conversion from .xfdl to fillable .pdfs . Has your organization found a workaround for this?

          • 2. Re: Create digital initials after signing a form using a signature field.
            Dustin C. Bourque

            I too would like to know if there is a specific command using JavaScript or another program similar to create a PDF form that is able to extract initials from a digital signature and insert into the same document.

            • 3. Re: Create digital initials after signing a form using a signature field.
              Stacy316

              How did you get it to just pull CAC?  Right now its just pulling my creds from the computer and not my CAC creds.

              • 4. Re: Create digital initials after signing a form using a signature field.
                AdamantineWolverine Level 1

                I'm an app developer and someone in my chain of command showed me an eval form (A7222_1.pdf) that had this initials feature.  Unfortunately, that form was locked, so couldn't look at the code.

                 

                I spent some time evaluating how that form worked and recreated the functionality, and here's how to do it.

                 

                1) Add a small signature block field and call it something like Signature1.

                 

                2) Add a text field next to it called txtInitials1.  Add another text field called txtDebugOut.

                 

                3) Used the Select Object Tool (Tools -> Advanced Editing ->Select Object Tool), right click and select properties. and click on the Signature1 signature field.   Under Signed ->   check the "This script executes when field is signed." radio button.

                4) Click Edit and add the following script:

                 

                var sig=this.getField("Signature1");
                var txtDebugOut=this.getField("txtDebugOut");
                var txtInitials1=this.getField("txtInitials1");

                sig.signatureValidate();
                var sigInfo=sig.signatureInfo();
                //app.alert("signed: " + sigInfo);

                var output="";
                for (var propertyName in sigInfo.value)
                {
                try{
                    output+=propertyName + ": " + sigInfo.value[propertyName] + "\r\n";
                }
                catch (e)
                {
                output+=propertyName + ":" + "Error: "+e.message + "\r\n";
                }
                }

                 

                try
                {

                var strInitials="";
                if(sigInfo.certificates.length>0 && !(typeof sigInfo.certificates[0].subjectCN=="undefined"))
                {
                //app.alert("sigInfo.certificates.length: "+sigInfo.certificates.length);
                var cert=sigInfo.certificates[0];
                output+= "subjectCN=" + cert.subjectCN+"\r\n";

                var iniArray=cert.subjectCN.split(".");

                if (iniArray.length >=2)
                {
                    strInitials=iniArray[1][0];
                    if (iniArray.length >2 && isNaN(iniArray[2][0]))
                    {
                        strInitials+=iniArray[2][0];      
                    }
                strInitials+= iniArray[0][0];

                    output+="Initials: " + strInitials + "\r\n";

                }

                }

                //app.alert(strInitials);
                txtInitials1.value=strInitials;

                }
                catch (e)
                {
                  output+="Error: " + e.message+"\r\n";
                }

                txtDebugOut.value=output;

                 

                Click OK.

                5) Click the Actions Tab and for the Action On Blur, Run JavaScript.

                 

                Cut and paste the same code into there.

                 

                6) The code will parse the subjectCN of the certificate.  It assumes the format is LastName.FirstName.MiddleName.EDIPINumber.

                 

                7)  If you want to create additional initial fields, then repeat from step 1, but call the fields Signature2 and txtInitials2.  Edit the code and replace Signature1 and txtInitials1 with Signature2 and txtInitials2, respectively.

                 

                 

                 

                -Will

                1 person found this helpful
                • 5. Re: Create digital initials after signing a form using a signature field.
                  Qloud

                  Thanks Will,

                   

                       This did exactly what you said. However, I adjusted mine a little bit to do exactly what I wanted. Basically I edited yours to just print the first and last name when signed. I also added a date field. The date field is currently filled with "util.printd" I would like to set it up the same way the signature/name is set up. I'm not as well versed and don't know how to script it to get date signed and to also validate it. So when signature is cleared, the date field is cleared. I just need help doing date and validation for date.This is my edited version.

                   

                  var sig=this.getField("Signature");

                  var txtDebugOut=this.getField("Description");

                  var txtInitials1=this.getField("Signer's Name");

                  sig.signatureValidate();

                  var sigInfo=sig.signatureInfo();

                  //app.alert("signed: " + sigInfo);

                  var output="";

                  for (var propertyName in sigInfo.value)

                  {

                  try{

                      output+=propertyName + ": " + sigInfo.value[propertyName] + "\r\n";

                  }

                  catch (e)

                  {

                  output+=propertyName + ":" + "Error: "+e.message + "\r\n";

                  }

                  }

                   

                  try

                  {

                  var strInitials="";

                  if(sigInfo.certificates.length>0 && !(typeof sigInfo.certificates[0].subjectCN=="undefined"))

                  {

                  //app.alert("sigInfo.certificates.length: "+sigInfo.certificates.length);

                  var cert=sigInfo.certificates[0];

                  output+= "subjectCN=" + cert.subjectCN+"\r\n";

                  var iniArray=cert.subjectCN.split(".");

                  if (iniArray.length >=2)

                  {

                      strInitials=iniArray[1];

                      if (iniArray.length >2 && isNaN(iniArray[2]))

                      {

                          strInitials+=' ';

                    var f = this.getField("Date");

                  f.value = util.printd("dd mmm yyyy", new Date());     

                      }

                  strInitials+= iniArray[0];

                      output+="Initials: " + strInitials + "\r\n";

                   

                   

                  }

                  }

                  //app.alert(strInitials);

                  txtInitials1.value=strInitials;

                  }

                  catch (e)

                  {

                    output+="Error: " + e.message+"\r\n";

                  }

                  Description.value=output;