vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
700 stars 175 forks source link

Using require instead of nodejs modules (import) #42

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello,

After install of the node-signpdf i do:

const signpdf = require('node-signpdf')
const sign = signpdf.sign(
                        FS.readFileSync("pdf.pdf"),
                        FS.readFileSync("p12.p12")
                        );

But it gives: TypeError: signpdf.sign is not a function

How to proceed with this? Thank you.

ghost commented 4 years ago

I found out.... it is:

const signpdf = require('node-signpdf')
const sign = signpdf.SignPdf(
                        FS.readFileSync("pdf.pdf"),
                        FS.readFileSync("p12.p12")
                        );

The documentation is wrong.

romische commented 4 years ago

Hello, Just in case it helps someone... for me it was

var { SignPdf } = require("node-signpdf")
new SignPdf().sign(pdfBuffer, p12Buffer);