Skip to main content
Participant
July 27, 2016
Answered

Digital Signature with JavaScript, Appearance won't change

  • July 27, 2016
  • 3 replies
  • 5279 views

I am trying to set up a script to certify multiple documents with my hand drawn signature. Everything in the code appears to function correctly except that it won't apply my appearance attribute, instead just applying the default Adobe signature appearance.

Here is the code I am using (personal info omitted for obvious reasons)

/* Add Signature*/

// Validate signatures when the document is opened:

  security.validateSignaturesOnOpen = true;

  // List all the available signature handlers

  for (var i=0; i<security.handlers.length; i++)

  console.println(security.handlers);

  // Select the Adobe.PPKLite engine with the Acrobat user interface:

  var ppklite = security.getHandler(security.PPKLiteHandler, true);

var oParams = {

  cPassword: "password",

  cDIPath: "/C/Users/user/Desktop/file.pfx" // Digital signature profile

  };

  ppklite.login(oParams);

var myInfo = {

  password: "password",

  location: "",

  reason: "",

  contactInfo: "email",

  appearance: "Signature", // This is the part that does not get applied

  mdp: "allowNone"

  };

// Obtain the signature field object:

  var f = this.getField("NameOfSigField");

  // Sign the field:

  f.signatureSign({

  oSig: ppklite,

  oInfo: myInfo,

  cDIPath: "/C/temp/mySignedFile.pdf",

  //cLegalAttest: ""

  }); //End of signature

console.println(myInfo.appearance); // This returns "Signature" in the console, so it clearly sees the attribute but does not change it

This topic has been closed for replies.
Correct answer stepan_ilchuk

Had the same issue and spent hours trying different things and finally found a solution on how to set custom appearance on digital signature using JavaScript!

The solution is to set a property to the signature field which would accept only specified named appearance. In your case it would look like this:

f.signatureSetSeedValue({appearanceFilter: "Signature", flags: 256});

"Signature" is the name of your custom appearance setup in the settings, and the flag 256 makes this property mandatory, forcing exactly this appearance. If appearance under that name is not found, it will throw an error.

You can read more about it in official Acrobat JS API Reference.

Works for Acrobat 9.0 and higher

3 replies

stepan_ilchuk
stepan_ilchukCorrect answer
Participant
August 31, 2018

Had the same issue and spent hours trying different things and finally found a solution on how to set custom appearance on digital signature using JavaScript!

The solution is to set a property to the signature field which would accept only specified named appearance. In your case it would look like this:

f.signatureSetSeedValue({appearanceFilter: "Signature", flags: 256});

"Signature" is the name of your custom appearance setup in the settings, and the flag 256 makes this property mandatory, forcing exactly this appearance. If appearance under that name is not found, it will throw an error.

You can read more about it in official Acrobat JS API Reference.

Works for Acrobat 9.0 and higher

Adobe Employee
October 19, 2016

Hi,

Can you please let me know the version of Acrobat/Reader on your machine.

Thanks,

Shakti K

October 19, 2016

Adobe Acrobat XI Version 11.0.18

Sincerely yours,

Elsa M. Cole, E.I.T.

[personal info. removed by moderator]

October 16, 2016

I no longer have the script that I was using, but this happened to me every time Adobe was loaded by IT, anD the IT person did not do a "check for updates" after doing the installation. You might want to try this, because your script might be fine.