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

Script for Batch sign multiple pdf documents at once ?

Community Beginner ,
Oct 10, 2022 Oct 10, 2022

I have 1000 similar documents that all need to be signed in the same location on the document on page 1. Is it possible to do so by scripting in Adobe without having to individually open sign and save the document?

Adobe Acrobat Pro. Same location on the same page in all files and digital signature. 

TOPICS
JavaScript
16.9K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 13, 2022 Oct 13, 2022

Then you can use an Action (Tools - Action Wizard) with the following code:

 

var sigField = this.addField("Signature1", "signature", 0, [10, 67, 122, 24]);
var mySignatureProfileFilePath = "/C/Users/YOUR_USER_NAME/AppData/Roaming/Adobe/Acrobat/DC/Security/TEST.pfx"; // ADJUST TO ACTUAL FILE PATH ON YOUR COMPUTER
var myPassword = "ABCD1234"; // ADJUST TO ACTUAL PASSWORD FOR THE PROFILE SELECTED ABOVE
var myEngine = security.getHandler( "Adobe.PPKLite");
if (myEngine.login(myPassword, mySignatureProfileFilePath))
	sigField.signatureSign( myEngine, { password: myPassword});
else app.alert("Error! Could not login to the Security Handler.");

 

This will add a Signature field to the bottom-left corner of the first page and then sign it using the specified signature profile. However, you might be prompted to save the file manually after doing so... If it's not, add a Save command to your Action, after the command that executes this JS code.

View solution in original post

Translate
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 ,
Oct 10, 2022 Oct 10, 2022

Do the files already contain a digital signature field? If so, does it have the same name in all files?

 

Translate
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 ,
Oct 10, 2022 Oct 10, 2022

no digital signature field.

Translate
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 ,
Oct 11, 2022 Oct 11, 2022

So the Action should add a digital signature field and then sign it? Should it always appear on the same page and in the same location?

 

Translate
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 ,
Oct 11, 2022 Oct 11, 2022

Yes, exactly and on the first page and same location in all the pdf files. 

Thank you so much for helping out!

Translate
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 11, 2022 Oct 11, 2022
Khanh nguyen
Translate
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 ,
Oct 11, 2022 Oct 11, 2022

What's the exact version number of the application (You can find it out by going to Help - About Adobe Acrobat)? What's your OS version?

Translate
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 ,
Oct 12, 2022 Oct 12, 2022

TANMAY265185123txa_0-1665642657139.png

Adobe Acrobat Pro DC

Coutinous release version 2022.002.20191 64 bit

 

OS Version 

Edition Windows 10 Business
Version 21H2
OS build 19044.1586
Experience Windows Feature Experience Pack 120.2212.4170.0

Translate
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 ,
Oct 13, 2022 Oct 13, 2022

Then you can use an Action (Tools - Action Wizard) with the following code:

 

var sigField = this.addField("Signature1", "signature", 0, [10, 67, 122, 24]);
var mySignatureProfileFilePath = "/C/Users/YOUR_USER_NAME/AppData/Roaming/Adobe/Acrobat/DC/Security/TEST.pfx"; // ADJUST TO ACTUAL FILE PATH ON YOUR COMPUTER
var myPassword = "ABCD1234"; // ADJUST TO ACTUAL PASSWORD FOR THE PROFILE SELECTED ABOVE
var myEngine = security.getHandler( "Adobe.PPKLite");
if (myEngine.login(myPassword, mySignatureProfileFilePath))
	sigField.signatureSign( myEngine, { password: myPassword});
else app.alert("Error! Could not login to the Security Handler.");

 

This will add a Signature field to the bottom-left corner of the first page and then sign it using the specified signature profile. However, you might be prompted to save the file manually after doing so... If it's not, add a Save command to your Action, after the command that executes this JS code.

Translate
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 ,
Oct 14, 2022 Oct 14, 2022

hi,

thanks for the code I was able to get the PDF sign but there is an issue after signing the document, if I right-click on the signature field there is an option to clear the signature. sharing the screenshot for your reference.  

TANMAY265185123txa_0-1665754708038.png

so can you help me out how to lock the digital signature .

Translate
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 ,
Oct 14, 2022 Oct 14, 2022

Only you can do that... If you open it on another computer it will not appear.

Translate
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 ,
Sep 01, 2023 Sep 01, 2023

Hi, Is it possible to place pfx file/digitally sign the complete set of documents instead of individually signing in each sign field. Also, please share how to add the save command to the action.

Translate
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 ,
Sep 01, 2023 Sep 01, 2023
LATEST

No, it has to be done one file (and one field) at a time.

And there's a built-in Save command in the Action Wizard you can add, under Save & Export:

 

try67_0-1693568006542.png

 

Translate
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 19, 2022 Oct 19, 2022

@try67, I tried using this code, but the signature field was not filled. Maybe I am doing something wrong?

 

The folder of my certificate is write like this:

"/Z/OneDrive/1. Colibri/0. Contabilidade e Finanças/99. Certificado Digital/2022/Certificate.pfx"

 

Should I, instead of that, use _ istead of spaces, like this?

 

"/Z/OneDrive/1._Colibri/0._Contabilidade_e_Finanças/99._Certificado Digital/2022/Certificate.pfx";

 

 

I would like to do something similar you indicated, but with a small change:

 

- I want an invisible signature, not a visible one

- I would like block the document after sign

 

Could you help me with that?

Translate
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 19, 2022 Oct 19, 2022

Just to let you know...

I tried also using the _ instead of space, but I still can't load automatically the signature to the filed that was created.

Translate
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 ,
Apr 14, 2023 Apr 14, 2023

@try67 - I am getting the same empty signature field as @sergiolucianojr . I then have to click the signature fill and apply the information manually.

Is the line below supposed to have my specific signature names used instead? 

var sigField = this.addField("Signature1", "signature", 0, [10, 67, 122, 24]);

 

Translate
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 ,
Apr 14, 2023 Apr 14, 2023

Yes, that only adds a blank Signature field. To sign it you must use the signatureSign method of the Field object, with all the required parameters.

Translate
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 ,
May 11, 2023 May 11, 2023

Hello, i have a similar problem. I want to sign a batch of 12 contrats, each one with 4 pages, and signature (digital certificate) should be on the last page. I want a find the way of only having to enter the signature PIN 1 time (i´m using a card reader). My Adobe version is 

Architecture: arm64

Processor: Apple M1

Build: 23.1.20177.0

AGM: 7.0.4

CoolType: 8.2.1

JP2K: 4.0.0.52671

Translate
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 ,
May 15, 2023 May 15, 2023

No help?

Translate
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