• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to call Digital Signature using JavaScript?

New Here ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

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?

  

TOPICS
Acrobat SDK and JavaScript

Views

3.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

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/

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines