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

Javascript Signature fail "signatureSign(.)" since 2022 in Acrobat Pro DC 32 bits

New Here ,
Aug 31, 2022 Aug 31, 2022

Copy link to clipboard

Copied

the code below was working since 2017 but with the new update in acrobat version 2022.002.20191, this month (2022 aug.) fails.
here:

f.signatureSign({

		oSig: ppklite,

		oInfo: myInfo,

		cDIPath: SignPdf,

		cLegalAttest: "Fonts are not embedded to reduce file size"

	});


With this error:

ErrMsg: Error en la operación. 
Stack: f_GEN57_SignPdfSaveAsNew<@Folder-Level:App:FunctionsPrivilegeGen57 V13.js:119
@External:Exec:1

 

The file is located in:
C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts

 

The whole source code in this file is:

var f_GEN57_SignPdfSaveAsNew = app.trustedFunction( function(Signpath,SignPdf,SignPass,PdfPageNumber, Lx, Ly, Ux, Uy,SignAppearance,SignInfoLOCATION,SignInfoREASON,SignInfoCONTACT) {
	app.beginPriv();
	try{
	if (f_GEN57_SignCheckPassword(SignPass,Signpath)==false){this.closeDoc(true);return "0|The digital signature password is incorrect";};

	var TheErrorBeloWouldBe = "";
	var name = "GEN57_FieldSignature";

	var type = "signature";

	var page = PdfPageNumber - 1;

	var location =[Lx, Ly, Ux, Uy];
		TheErrorBeloWouldBe = "Error creating field signature";

	var myField = this.addField(name, type, page, location);

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

	var oParams = {

			cPassword: SignPass,

			cDIPath: Signpath

		};
		TheErrorBeloWouldBe = "Error validating the user in the digital certificate";

	ppklite.login(oParams);

	var myInfo = {

			password: SignPass,

			location: SignInfoLOCATION,

			reason: SignInfoREASON,

			contactInfo: SignInfoCONTACT,
			Appearance: SignAppearance,

			mdp: "allowNone"

		};
		TheErrorBeloWouldBe = "Error accessing new field for signature";

	var f = this.getField("GEN57_FieldSignature");
		TheErrorBeloWouldBe = "The format does not exist for signature. Check format: " + SignAppearance + ". To create one follow these steps: " + 
			"Acrobat > Edit > Preferences > Signatures > More (appearance) > New > (create format)";
		f.signatureSetSeedValue({appearanceFilter: SignAppearance, flags:0x100});
		TheErrorBeloWouldBe = "Error printing signature in field. Perhaps the appearance of the signature does not exist. Check: " + SignAppearance + 
			". To create one follow these steps: " + 
			"Acrobat > Edit > Preferences > Signatures > More (appearance) > New > (create format)";

	f.signatureSign({

		oSig: ppklite,

		oInfo: myInfo,

		cDIPath: SignPdf,

		cLegalAttest: "Fonts are not embedded to reduce file size"

	});
		TheErrorBeloWouldBe = "Failed to close current pdf";
		this.closeDoc(true);
		TheErrorBeloWouldBe = "";
		return "1|New signed document created";
	}catch(err)
	{
		this.closeDoc(true);
		return "0|Acrobat Javascript&colon; " + err.message + ". " + TheErrorBeloWouldBe;
	};
 	app.endPriv();
});
// Login el archivo pfx de la firma digital
var f_GEN57_SignCheckPassword = app.trustedFunction( function(SignPass,Signpath) {
	app.beginPriv();
	try{
	var ppklite = security.getHandler(security.PPKLiteHandler, true);

	var oParams = {

		cPassword: SignPass,

		cDIPath: Signpath

			};

	ppklite.login(oParams);
	return true;
	}catch(err){return false;};
 	app.endPriv();
});
//Forzar a elegir el tiempo de apariencia a la firma, para antes de firmar el campo
/*
Creado 2017-03-17 11:34 (GEN57) ((1) 
'	Decripción:
'		El objetivo de esta función es asignar un tipo de apariencia para el campo firma para antes de firmar 
'		y la segunda es para aislar el error que se pueda producir aqui. Por ejemplo que la apariencia no exista
'		y que el usuario deba crearlo primero.)
*/
var f_GEN57_SignSetAppearance = app.trustedFunction( function(obA_SignField,SignAppearance) {
	app.beginPriv();
	try{
	obA_SignField.signatureSetSeedValue({
    	appearanceFilter: SignAppearance,
    	flags:0x100
     	});
	return true;
	}catch(err){return false;};
 	app.endPriv();
});

Views

157

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 ,
Jan 19, 2023 Jan 19, 2023

Copy link to clipboard

Copied

LATEST

Did you find a resolution to this issue?

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