Sign PDF-Buffer documents with a QR code.
npm install @pantherx.dev/node-pdf-signatureSmall (TS) library to "sign" PDF documents with a QR code.
The goal of this library is to enable novice users to easily verify whether a PDF (on, or off-screen "printed") is authentic, and has been signed, by directing them to a website.
File-based conversion:
``js
import { promises as fs } from 'fs';
import { signPdfBuffer } from '../src';
const source = 'source.pdf'
const destination = 'destination.pdf'
const message = a1113493-b844-4169-95c5-a626c36e665chttps://someurl.com/a1113493-b844-4169-95c5-a626c36e665c
const qrCodeContent =
async function automatic() {
const pdfBuffer = await fs.readFile(source)
const modifiedPdf = await signPdfBuffer(pdfBuffer, message, qrCodeContent)
await fs.writeFile(destination, modifiedPdf.data, 'utf-8')
}
`
- [ ] File based conversion
- [ ] Delete images after file-based conversion
- [ ] Properly handle horizontal and vertical orientation of input
- [ ] Rename input files prior to file-based conversion to mitigate some exploits
- [ ] Position the QR code in varios locations
- [ ] Embed Signature in PDF
The hard work is done by:
- pdf-lib`