Skip to content

signPdf

signPdf(pdf, cred): Promise<Uint8Array<ArrayBufferLike>>

Defined in: src/pdf/signature.ts:173

Sign a PDF that already carries a signature placeholder (from addSignaturePlaceholder). Computes the real /ByteRange, hashes the covered bytes (SHA-256), builds the detached PKCS#7/CMS, and writes it into the reserved /Contents hole — leaving every other byte untouched.

Uint8Array

The placeholder-bearing PDF bytes.

SignerCredentials

The signer’s certificate, key and algorithm.

Promise<Uint8Array<ArrayBufferLike>>

A new byte array with the real ByteRange and signature spliced in.

Error when no placeholder is found, it is malformed, WebCrypto is unavailable, or the signature exceeds the reserved /Contents size.