Skip to main content
Participating Frequently
July 28, 2020
Question

How to call Digital Signature using JavaScript?

  • July 28, 2020
  • 2 replies
  • 4628 views

My requirement is to show warning message before signing the document without customizing the PDF.

For this I am creating custom menu to execute below action in sequence:

  1. Execute JavaScript to show alert 
  2. And then pop up digital signature

 

Below is the Javascript:

 

 

 

var DoMyMenuItem = app.trustedFunction(function(cItemName) {
    app.beginPriv();
    app.execMenuItem(cItemName);
    app.endPriv();
});

function CallMenu() {
    try {
        app.execMenuItem("FillSignApp");
        //DoMyMenuItem("Signatures");
    } catch (e) {
        app.alert("Error: " + e);
    }
}
app.addMenuItem({ cName: "My Action Menu", cParent: "Help", cExec: "CallMenu(); " });

 

 

I am getting this error "Error: InvalidArgsError: Invalid arguments." on runtime. 
 
Is there anywhere I can show warning message to user before signing document and Is there a way to call Digital Signature using JavaScript execMenuItem function?

  

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 28, 2020

Where did you get this menu item name from? It doesn't work even from the Console...

ideepakAuthor
Participating Frequently
July 28, 2020

You are correct, this script is not working. I want to know what need to be pass inside app.execMenuItem method to open signature popup.

 

For example, try replacing below line in above code.

app.execMenuItem("ReadingMode");

 

Note: You need to close the Adobe and open again.  After then open any pdf document and click on new menu "My Action Menu" under help.

try67
Community Expert
Community Expert
July 28, 2020

There's no menu item from signing a Signature field. It can be done using the signatureSign method of the Field object. Read the documentation carefully before using it.

ls_rbls
Community Expert
Community Expert
July 28, 2020

Where are you trying to run these scripts from?

 

Another text field ? or as an javascript action that executes when the signer clicks on the signature field?

ideepakAuthor
Participating Frequently
July 28, 2020

I have created "Config.js" and kept inside "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts"

 

Refer this link - https://acrobatusers.com/tutorials/add_custom_menu_items/