@embedpdf/plugin-signature
Document-scoped digital signing for EmbedPDF: sign a signature field with a mark (a stamp-library asset — drawn, typed, uploaded — or bytes you bring) through a signer port you configure; fill a field visually without sealing; validate what is signed; and drop an armed mark onto a field.
The plugin owns the act and nothing else:
- marks are the stamp plugin's (
@embedpdf/plugin-stamp) — one library of kindsignaturesper person, holding asignatureasset and optionalinitials; - the key is a
SignerPortfrom@embedpdf/core-signature(webCryptoSigner,remoteSigner,personalSigner), thekeysetting, resolved per signing; - the engine draws the mark's page into the field and seals the bytes
(
doc.signatures.prepare→ CMS →complete); on the cloud the server publishes the new version.
import { toFieldRef } from '@embedpdf/plugin-form';
import {
signaturePlugin,
SignatureToken,
personalSigner,
indexedDbKeyStore,
} from '@embedpdf/plugin-signature';
signaturePlugin({
key: () => personalSigner({ subject: 'Ada Lovelace', store: indexedDbKeyStore('keys') }),
trust: { anchors: async () => [rootCertificateDer] },
mode: 'sign', // 'sign' (the default with a key) | 'visual' (the default without) | 'ask'
});
const signature = ctx.get(SignatureToken);
await signature.placeMark({ assetId }, { field: toFieldRef('approval') }); // sign / fill / ask, by mode
await signature.placeMark({ assetId }, { page, center: { x: 120, y: 90 } }); // elsewhere: a stamp
With the interaction hub and the stamp plugin present, a mark armed from a
signatures library and clicked over an unsigned signature field goes into
the field; anywhere else it is placed as a stamp.
Requires @embedpdf/plugin-form; optional @embedpdf/plugin-stamp,
@embedpdf/plugin-annotation, @embedpdf/plugin-interaction. See the docs
page headless/forms/signatures for the full contract.