Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to verify a pdf is signed?

Avatar

Former Community Member

Hello =)

I'm working with LiveCycle ES4 designing a form and I want my form to be filled by Adobe Reader users.

In this form, I have a signature field which I want to verify before the user submits the document.

I'm using this code in the click event of the button:

    

     var signature = event.target.getField("Form.subForm.signature");

     var signatureState = signature.signatureValidate();

     if (signatureState == 0){

         

          xfa.host.messageBox("Please sign the document.");

          }

     else if (signatureState == 1 || signatureState == 2){

         

          xfa.host.messageBox("Please use a valid signature.");

          }

     else if (signatureState >= 3){

         

          event.target.submitForm({cUrl:"mailto:xxxxxxxx@xxxx.xxx", cSubmitAs:"PDF"});

         

          xfa.host.messageBox("Form submited.");

         

          }

I've extended the features of this form in Reader using Acrobat Pro Extended.

The problem is..this line:

     var signature = event.target.getField("Form.subForm.signature");

.. isn't working the way it's supposed to. When I press the button in the signed, or unsigned, document, this variable is null.

Can PLEASE anyone explain me why?

5 Replies

Avatar

Level 10

You validating digital signature?!?

Not sure which one you really need, but check these out, your solution might be there

Digitally signing pdf documents

http://help.adobe.com/en_US/livecycle/10.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7c45.html

Verifying digital signatures

http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=000920.html

Setting up signature validation:

http://help.adobe.com/en_US/acrobat/X/standard/using/WS396794562021d52e-4a2d930c12b348f892b-8000.htm...

Hope this help!

Avatar

Employee

Ana,

Is it possible for you to upload sample form ?

--Santosh

-----------------------

Steps to attach document

  1. Click Reply to this comment
  2. Click "Use advanced editor" on the top right corner of editor
  3. You should see a Browse button to attach file

------------------------

Avatar

Former Community Member

Hi, Kumar =)

Thanks for replying.

I don't see a browse button to upload my sample. Maybe it's disabled.

Can you do a simple form with just a signature field and a button? Like this:

form1

     (Master Pages)

          Page1

               (untitled Content Area)

     Form                              *page*

          subForm                 *Subform*

               signature       *signature field*

               submit                 *button*

In the signature field, disable Lock Fields After Signing.

In the click event of the button paste this code:

     var signature = event.target.getField("Form.subForm.signature");

     //Signature is always null. Why?

     xfa.host.messageBox("signature = " + signature);

     var signatureState = signature.signatureValidate();

     if (signatureState == 0){

           xfa.host.messageBox("Please sign the document.");

           }

     else if (signatureState == 1 || signatureState == 2){

          xfa.host.messageBox("Please use a valid signature.");

          }

     else if (signatureState >= 3){

          //event.target.submitForm({cUrl:"mailto:xxxxxxxx@xxxx.xxx", cSubmitAs:"PDF"});

          xfa.host.messageBox("Form submited.");

          }

Then preview the pdf and click submit.

I know it's to ask a lot..but if you have the time..thanks! =)

Avatar

Former Community Member

Hi again, Magus069 =)

Thanks for replying.

I just want to check through a button if the document is signed or if the signature is valid.

It should be an easy thing to do. But the line I pointed above isn't working.

Can you help me?

Thanks =)

Avatar

Former Community Member

Hi, everyone =)

..I found the answer I was looking for here:

http://forms.stefcameron.com/2008/11/05/digital-signature-field-status/

..in the available sample.

In this code line:

     var signature = event.target.getField("Form.subForm.signature");

I was giving the wrong path to the digital signature field.

Apparently it's a bit more tricky than the easy ctrl + click trick. The correct path turned out to be Form[0].subForm[0].signature[0].

In the sample I downloaded in the upper link there's a function that gives this expression, SOM Expression (I think).

I'm not an expert, so I cannot explain any further but the problem I was having is solved.

I hope this helps anyone who gets here with the same issue. =)

Thanks again! =)