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

Digital Signature Automation

Community Beginner ,
Mar 10, 2023 Mar 10, 2023

Copy link to clipboard

Copied

Hi, 

Good day everybody, I have 500 documents that needs to be digitally signed and I want to automate this process. I wanted to know can I automate this process using javascript? If not, how can I automate it using action wizard without having to select the digital id and entering th password of the id manullay for each file?
Seeking for solutions 🙏🙏

Thank you

TOPICS
How to , JavaScript , Security digital signatures and esignatures

Views

1.9K

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

correct answers 1 Correct answer

Community Expert , Mar 10, 2023 Mar 10, 2023

Yes, you can do it using a combination of an Action and a script.

Read the documentation of the signatureSign method of the Field object to learn how to do it.

Votes

Translate

Translate
Community Expert ,
Mar 10, 2023 Mar 10, 2023

Copy link to clipboard

Copied

Yes, you can do it using a combination of an Action and a script.

Read the documentation of the signatureSign method of the Field object to learn how to do 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
Community Beginner ,
Mar 10, 2023 Mar 10, 2023

Copy link to clipboard

Copied

Ok thanks, I will give it a try, please help me if get stuck somewhere

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 Beginner ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

// Get the signature field object
var signatureField = this.getField("signatureField");

// Get the security handler for digital signatures
var ppklite = security.getHandler("Adobe.PPKLite");

// Configure the digital signature parameters
var signatureParams = {
password: "alvarocuba5456",
location: "San Francisco, CA",
reason: "I approve this document",
contactInfo: "id@gmail.com",
appearance: "Handwritten"
};

// Login to the security handler
ppklite.login({cPassword: "alvarocuba5456"});

// Set the digital ID to use for the signature
var digitalID = {
oPKCS7: util.readFileIntoStream("/D/temp/myid.pfx"), // Path to PFX file
password: "alvarocuba5456"
};

// Add the digital signature to the signature field
signatureField.signatureSign(ppklite, signatureParams, digitalID);

// Logout of the security handler
ppklite.logout();
NotAllowedError: Security settings prevent access to this property or method.
Field.signatureSign:26:Console undefined:Exec

undefined

I tried this code but it is not working, if you don't mind can you please show a code snippet on how to do it properly?

 

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 Beginner ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

Never mind, I just did it 😅, thanks for the 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
New Here ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

will you be able to share the code? I am trying to do the same for my company to save time

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
Adobe Employee ,
Oct 29, 2024 Oct 29, 2024

Copy link to clipboard

Copied

LATEST

Hi @okboo_7867,

 

Hope you are doing well. Thanks for writing in!

 

The error encountered in the above script —NotAllowedError: Security settings prevent access to this property or method—indicates that certain security restrictions are preventing your code from executing as intended.

 

Unfortunately, JavaScript in Acrobat has strict security limitations, especially concerning digital signatures. The signatureSign method used above is often restricted in standard JavaScript contexts.

 

Here's an alternative approach you can take to set up digital signatures programmatically, while also considering the limitations:

  1. Use the Trusted Functionality: Ensure your JavaScript is running in a trusted context. You may need to set Acrobat preferences to allow JavaScript to access certain functionalities.

  2. Use Pre-Signed Certificates: If you can pre-sign documents and store them with your certificate, you can automate the process of applying signatures without needing to input the password each time.

If you still want to attempt automation within the allowed limits, here’s a simplified snippet you could try, though it may not resolve your issue if security restrictions apply:

 

// Ensure that the script is running in a trusted context
if (app.trustedFunction) {
    var signatureField = this.getField("signatureField");

    // Configuration for digital signature
    var signatureParams = {
        location: "Add-your-location",
        reason: "add-your-reason",
        contactInfo: "abc@abc.com",
        appearance: "Handwritten"
    };

    try {
        // Attempt to sign the document
        signatureField.signatureSign({
            cPassword: "your-password-here",  // Password for the digital ID
            oPKCS7: util.readFileIntoStream("/location/certificate.pfx"), // Path to PFX file
            password: "your-password-here"  // Password for the PFX file
        }, signatureParams);
    } catch (e) {
        console.println("Error signing the document: " + e.message);
    }
} else {
    console.println("The script is not running in a trusted context.");
}

 

Important Notes

  • Trusted Context: Ensure your script runs in a trusted context, which may require adjustments to the preferences or using the JavaScript console directly.
  • Security Settings: If you encounter persistent issues, review your security settings to allow script access to digital signatures.
  • Testing: Always test your scripts on a copy of your document to avoid any accidental loss of data.

Hope this helps.


-Souvik

Community & Social Consultant | Document Cloud | Adobe

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