Latest Supply Chain Attack:Mini Shai-Hulud Hits @antv npm Packages, 639 Versions Compromised.Learn More
Sign In

@pantherx.dev/node-pdf-signature

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pantherx.dev/node-pdf-signature

Sign PDF-Buffer documents with a QR code.

latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 23 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts