Trying to make a javascript script to sign automatically a pdf file

New Here ,
Feb 06, 2020

Copy link to clipboard

Copied

I tried to make a script to automatically sign a pdf file on Adobe Acrobat DC when called using a folder level script but the only results i've got is this 

sign(this)
GeneralError: Operation failed.
Field.signatureSign:30:Console undefined:Exec
The document could not be signed.

There was an error when attempting to commit this signature. The document was not saved.

The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder.

undefined

Here is my code if you see any flaw

var sign = app.trustedFunction(
	function(doc){
		app.beginPriv();

		var ppklite = security.getHandler("Adobe.PPKLite");

		ppklite.login("password", "/I/Certificates/test.pfx");
		doc.addField("Text1", "signature", 0, [0,100,100,0]);
		var f = doc.getField("Text1");

		var myInfo = {
			password: "password",
			location: "Country, IN",
			reason: "I am approving doc document",
			contactInfo: "mail@gmail.com",
			appearance: "basic",
			mdp: "allowNone" 
		};
		console.println(f.signatureSign({oSig: ppklite, oInfo: myInfo,cDIPath: "I/gg.pdf", bUI: false }));
		ppklite.logout();
		app.endPriv();}
	);

It doesn't work on new or on file pdfs. I am a complete debutant in adobe JS and I tried using the documentation but I don't understand why it doesn't achieve anything.

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

I don't know what the diPath parameter means here but this is certainly wrong as all DIPaths start /

Also, I would not try to work in root directories, Acrobat may reject them.

cDIPath: "I/gg.pdf"

  

TOPICS
Acrobat SDK and JavaScript

Views

624

Likes

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

Trying to make a javascript script to sign automatically a pdf file

New Here ,
Feb 06, 2020

Copy link to clipboard

Copied

I tried to make a script to automatically sign a pdf file on Adobe Acrobat DC when called using a folder level script but the only results i've got is this 

sign(this)
GeneralError: Operation failed.
Field.signatureSign:30:Console undefined:Exec
The document could not be signed.

There was an error when attempting to commit this signature. The document was not saved.

The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder.

undefined

Here is my code if you see any flaw

var sign = app.trustedFunction(
	function(doc){
		app.beginPriv();

		var ppklite = security.getHandler("Adobe.PPKLite");

		ppklite.login("password", "/I/Certificates/test.pfx");
		doc.addField("Text1", "signature", 0, [0,100,100,0]);
		var f = doc.getField("Text1");

		var myInfo = {
			password: "password",
			location: "Country, IN",
			reason: "I am approving doc document",
			contactInfo: "mail@gmail.com",
			appearance: "basic",
			mdp: "allowNone" 
		};
		console.println(f.signatureSign({oSig: ppklite, oInfo: myInfo,cDIPath: "I/gg.pdf", bUI: false }));
		ppklite.logout();
		app.endPriv();}
	);

It doesn't work on new or on file pdfs. I am a complete debutant in adobe JS and I tried using the documentation but I don't understand why it doesn't achieve anything.

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

I don't know what the diPath parameter means here but this is certainly wrong as all DIPaths start /

Also, I would not try to work in root directories, Acrobat may reject them.

cDIPath: "I/gg.pdf"

  

TOPICS
Acrobat SDK and JavaScript

Views

625

Likes

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
Feb 06, 2020 0
Most Valuable Participant ,
Feb 06, 2020

Copy link to clipboard

Copied

Are you able to do it manually?

Likes

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
Reply
Loading...
Feb 06, 2020 0
New Here ,
Feb 06, 2020

Copy link to clipboard

Copied

Yes, I have no problem to do so but I need it automated

Likes

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
Reply
Loading...
Feb 06, 2020 0
Most Valuable Participant ,
Feb 06, 2020

Copy link to clipboard

Copied

I don't know what the diPath parameter means here but this is certainly wrong as all DIPaths start /

Also, I would not try to work in root directories, Acrobat may reject them.

cDIPath: "I/gg.pdf"

  

Likes

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
Reply
Loading...
Feb 06, 2020 0
CaraxIT LATEST
New Here ,
Feb 06, 2020

Copy link to clipboard

Copied

Thank you ! That was it

Likes

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
Reply
Loading...
Feb 06, 2020 0