@signpdf/placeholder-pdfkit
TypeScript icon, indicating that this package has built-in type declarations

3.2.4 • Public • Published

Helper that provides placeholder using PDFKit 0.11+

for @signpdf

npm version

Works on top of PDFKit 0.11+ and given a PDFDocument that is in the works, adds an e-signature placeholder. When the PDF is ready you can pass it to @signpdf/signpdf to complete the process.

Usage

You will need $ npm i -S @signpdf/signpdf @signpdf/placeholder-pdfkit node-forge. This works in an identical way to the pdfkit010 package and the pdfkit010.js example is still relevant.

Notes

Signature length

Signing in detached mode makes the signature length independent of the PDF's content length, but it may still vary between different signing certificates. So every time you sign using the same P12 you will get the same length of the output signature, no matter the length of the signed content. It is safe to find out the actual signature length your certificate produces and use it to properly configure the placeholder length.

PAdES compliant signatures

To produce PAdES compliant signatures, the ETSI Signature Dictionary SubFilter value must be ETSI.CAdES.detached instead of the standard Adobe value.

This can be declared using the subFilter option argument passed to pdfkitAddPlaceholder and plainAddPlaceholder.

import { pdfkitAddPlaceholder } from '@signpdf/placeholder-pdfkit';
import { SUBFILTER_ETSI_CADES_DETACHED } from '@signpdf/utils';

const pdfToSign = pdfkitAddPlaceholder({
  ...,
  subFilter: SUBFILTER_ETSI_CADES_DETACHED,
});

Package Sidebar

Install

npm i @signpdf/placeholder-pdfkit

Weekly Downloads

78

Version

3.2.4

License

MIT

Unpacked Size

16.5 kB

Total Files

15

Last publish

Collaborators

  • vbuch