When signing a document using the Node.js NPM PDF SDK, I am trying to digitally sign with .pfx and information that will say the document is from the “company”, etc, but not wanting to add a rectangle, form field with “written” signature, just sign it with certificate. When trying, I am getting error missing formFieldName, etc. Is my requirement something that can be accomplished? And then how to verify?
const signature = new Signature();
signature.authority = "Linqed-IQ";
signature.contact = "ppayne@linqed-iq.com"
signature.date = "08/01/2012 12:15:00.000 PM";
//signature.formFieldName = "Signature1";
signature.location = "United States";
signature.password = "test1234";
//signature.rectangle = { lLX: 100, lLY: 100, uRX: 500, uRY: 500 };
signature.signaturePath = "Linqed-IQ.pfx";
signature.signatureType = SignatureType.PKCS7;
signature.visible = true;
signature.showProperties = true;
pdfApi.postSignDocument('ld_signed.pdf', signature, null, remoteFolder).then((result) => {
console.log(result.response);
}).catch(function(err) {
// Deal with an error
console.log(err);
console.log('SIGN ERROR!');
});
Error:
error: Error: cannot POST /v3.0/pdf/ld_signed.pdf/sign?folder=Aspose%20Demo (400)
at Response.toError (/Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/node/response.js:94:15)
at ResponseBase._setStatusProperties (/Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/response-base.js:123:16)
at new Response (/Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/node/response.js:41:8)
at Request._emitResponse (/Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/node/index.js:752:20)
at /Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/node/index.js:916:38
at IncomingMessage. (/Users/paulpayne/Desktop/velocityS3/SFDC Projects/akg-service-ticket/node_modules/asposepdfcloud/node_modules/superagent/lib/node/parsers/json.js:19:7)
at IncomingMessage.emit (events.js:228:7)
at IncomingMessage.EventEmitter.emit (domain.js:475:20)
at endReadableNT (_stream_readable.js:1185:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21) {
status: 400,
text: ‘{“name”:{“ChildNodes”:null,“Children”:null,“Key”:“name”,“SubKey”:{“Buffer”:“name”,“Offset”:0,“Length”:4,“Value”:“name”,“HasValue”:true},“IsContainerNode”:false,“RawValue”:“ld_signed.pdf”,“AttemptedValue”:“ld_signed.pdf”,“Errors”:[],“ValidationState”:2},“folder”:{“ChildNodes”:null,“Children”:null,“Key”:“folder”,“SubKey”:{“Buffer”:“folder”,“Offset”:0,“Length”:6,“Value”:“folder”,“HasValue”:true},“IsContainerNode”:false,“RawValue”:“Aspose Demo”,“AttemptedValue”:“Aspose Demo”,“Errors”:[],“ValidationState”:2},“FormFieldName”:{“ChildNodes”:null,“Children”:null,“Key”:“FormFieldName”,“SubKey”:{“Buffer”:“FormFieldName”,“Offset”:0,“Length”:13,“Value”:“FormFieldName”,“HasValue”:true},“IsContainerNode”:false,“RawValue”:null,“AttemptedValue”:null,“Errors”:[{“Exception”:null,“ErrorMessage”:“FormFieldName must be provided when signing document.”}],“ValidationState”:1}}’,
method: ‘POST’,
path: ‘/v3.0/pdf/ld_signed.pdf/sign?folder=Aspose%20Demo’
},