@pantherx.dev/node-pdf-signature
v0.1.3
Published
Sign PDF-Buffer documents with a QR code.
Downloads
54
Readme
node PDF Signature
Small (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.
Example
File-based conversion:
import { promises as fs } from 'fs';
import { signPdfBuffer } from '../src';
const source = 'source.pdf'
const destination = 'destination.pdf'
const message = `a1113493-b844-4169-95c5-a626c36e665c`
const qrCodeContent = `https://someurl.com/a1113493-b844-4169-95c5-a626c36e665c`
async function automatic() {
const pdfBuffer = await fs.readFile(source)
const modifiedPdf = await signPdfBuffer(pdfBuffer, message, qrCodeContent)
await fs.writeFile(destination, modifiedPdf.data, 'utf-8')
}
TODO
- [ ] 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
Thanks
The hard work is done by:
pdf-lib