PDF Toolkit — assemble, secure & extract
The document toolkit started in 1.4.0 — outline bookmarks, page labels, viewer preferences, nested lists, table cell borders & vertical alignment, and a page-tree API to merge / split / extract pages — and 1.6.0 completes the round trip: fill & flatten AcroForms (encrypted ones included), re-encrypt rebuilt documents with AES-256, and extract text with positions from any PDF. Every demo below runs entirely in your browser and downloads a real PDF — open it in any compliant viewer (the bookmarks preset is best viewed in a desktop reader with a bookmarks panel).
Also new in 1.4.0, but Node-only (no browser demo):
streamToFile() writes a streamed PDF to disk with back-pressure; a pluggable crypto provider (setCryptoProvider) lets you sign with native constant-time primitives; validateFontData() sanity-checks a font module; and the pdfnative-build-emoji-font CLI generates a colour-emoji module with exactly the glyphs you need.
View underlying code
Features exercised here:
- Outline / bookmarks (1.4.0) —
outline: 'auto'derives a bookmark tree from headings; explicitOutlineItem[]supports nesting, bold/italic/colour, and collapsed nodes (open: false). - Page labels (1.4.0) —
pageLabelsrenders roman front-matter then decimal body numbering in the viewer's page box. - Viewer preferences (1.4.0) —
layout.viewerPreferencesopens the bookmark panel and shows the document title in the window chrome. - Nested lists (1.4.0) —
ListItementries nest bullet/numbered sub-lists to any depth. - Table cell borders & vertical alignment (1.4.0) —
cellBorders(solid / dashed / dotted) andcellVAlignper table or per column. - Page-tree manipulation (1.4.0) —
mergePdfs,splitPdf, andextractPagesrebuild a clean object graph from existing PDFs. - Encrypted form fill & flatten (1.6.0) —
fillForm/flattenFormappend encrypted incremental updates under the document's existing scheme (RC4, AES-128, AES-256). - Decrypt on ingest, re-encrypt on output (1.6.0) —
MergeOptions.encryptre-secures rebuilt documents with AES-128/256, fresh keys and CSPRNG IVs; nothing from the source's encryption state is reused. - Text extraction (1.6.0) —
extractTextreturns reading-order text per page plus positioned runs (device-space points, effective font size), including from encrypted PDFs.
All zero-dependency, all in the browser. The exact same code runs in Node.js, Deno, Bun and Web Workers.