Closed nilopaim closed 4 years ago
Probably .default
is what you are missing. See the dist code and you'll know how to access the module
Nice, @vbuch !
But the error changed to
SignPdfError: Could not find ByteRange placeholder: /ByteRange [0 /** /** /**]
Some another hint?
Does declaracao.pdf contain a ByteRange placeholder?
It's a simple file create using LibreOffice. Just text, no images...
Read the docs.
I'm trying to sign PDFfiles using NodeJs.
This is my code in a file called sign.js:
` var signer = require("node-signpdf"); var fs = require("fs");
function signIt() { const PATH_TO_PDF_FILE = "./declaracao.pdf"; const PATH_TO_P12_CERTIFICATE = "./Associacao.pfx";
var signedPdf = signer .sign( fs.readFileSync(PATH_TO_PDF_FILE), fs.readFileSync(PATH_TO_P12_CERTIFICATE) ) .then((result) => { console.log(result); }) .catch((err) => { console.log(err); });
console.log(signedPdf); }
signIt(); `
Anyway, when I try
node sign.js
I receive asigner.sig is not a function
What am I missing?