vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
676 stars 174 forks source link

Signer implementation expected using 3.2.3 #231

Closed bretto36 closed 4 months ago

bretto36 commented 4 months ago

I have switched to the latest branch to fix that bug with the word trailer.

My code now doesn't working, complaining about Signer implementation expected. Have i missed something?


        // certificate.p12 is the certificate that is going to be used to sign
        var certificateBuffer = fs.readFileSync('./resources/certificate.p12');
        var signer = new P12Signer(certificateBuffer);

        // The PDF needs to have a placeholder for a signature to be signed.
        pdfBuffer = plainAddPlaceholder({
            pdfBuffer: pdfBuffer,
            reason: 'The user is declaring consent through JavaScript.',
            contactInfo: 'signpdf@example.com',
            name: 'John Doe',
            location: 'Free Text Str., Free World',
        });

        // pdfWithPlaceholder is now a modified buffer that is ready to be signed.
        pdfBuffer = await signpdf
            .sign(pdfBuffer, signer)
"dependencies": {
    "@aws-sdk/client-s3": "^3.523.0",
    "@aws-sdk/lib-storage": "^3.523.0",
    "@signpdf/placeholder-plain": "^3.2.3",
    "@signpdf/signer-p12": "^3.2.3",
    "@signpdf/signpdf": "^3.2.3",
    "node-forge": "^1.3.1",
    "puppeteer-core": "22.2.0"
  },
bretto36 commented 4 months ago

Ignore - all i did was add npm install pdfkit@~0.10.0 and it resolved it.