v1.2.0 — pdfnative 1.5.0: page-tree (merge/split/extract), annotations, bookmarks, math font, native crypto & AI-governance (HITL)
pdfnative-cli v1.2.0
Released 2026-07-06
v1.2.0 lands the pdfnative 1.5.0 engine's page-tree and annotation APIs
on the CLI as five new commands, adds document bookmarks, a math font, layout
introspection, native constant-time signing, and — for autonomous agents —
surfaces pdfnative's AI-governance / Human-in-the-Loop (HITL) contract.
New commands: merge (concatenate PDFs), split (one PDF → many,
per-page or per-range), extract (pull selected pages), annotate
(attach markup annotations with an incremental save — signatures stay intact),
and govern (rules / policy / verify-issue). render gains PDF
bookmarks (--outline), a bundled math font (--font math), and layout
introspection (--inspect-layout / --debug-layout). sign now uses native
node:crypto for constant-time signatures by default (--pure-crypto opts
out). inspect reports page labels and lists markup/link annotations
(--annotations). Adds the stable E_POLICY error code.
100% backward-compatible with v1.1.0 — every existing invocation keeps working.
⭐ Star
pdfnative— the
zero-dependency PDF engine that powers this CLI. Every star helps the
long-term project.
Highlights
- Page-tree operations.
merge,split, andextractexpose pdfnative
1.5.0'smergePdfs/splitPdf/extractPages. All three honour
--drop-annotationsand a--max-output-sizeguard, validate every path
against traversal, and bounds-check page references. - Markup annotations.
annotate --annotations <spec.json>attaches
highlight / text / underline / strikeout / squiggly / square / circle / line /
freetext annotations via an incremental save, so the original bytes — and
any existing signature — stay intact. Only known fields are forwarded (no
dictionary injection). - AI-governance / HITL.
governmakes pdfnative's monorepo governance model
actionable: agents are draftsmen, never autonomous submitters.
govern verify-issuegates a local draft (exit 1 /E_POLICYon a violation)
before a human reviews and submits it. Fully offline. - PDF bookmarks.
render --outline autoderives a bookmark tree from the
document's headings;--outline <tree.json>supplies an explicit
OutlineItem[]tree. - Math & layout tooling.
render --font mathregisters the bundled Noto
Sans Math font;--inspect-layoutemits aLayoutInspectionJSON report and
--debug-layoutoverlays margin/content/cell guides. - Native constant-time signing.
signroutes CMS signing through Node's
node:cryptoby default for side-channel-resistant RSA/ECDSA;
--pure-cryptoselects the portable pure-JS path. - Richer inspection.
inspect --annotationslists markup + link
annotations, and/PageLabelsare reported automatically when present.
What's new
New commands
merge
pdfnative merge a.pdf b.pdf c.pdf --output combined.pdfConcatenate 2–50 PDFs (positional paths and/or repeatable --input) via
mergePdfs. Flags: --output, --drop-annotations, --max-output-size,
--dry-run.
split
# One output per page (default)
pdfnative split --input report.pdf --output-dir pages/ --prefix page
# One output per comma-separated range
pdfnative split --input report.pdf --output-dir out/ --pages "1-2,3-4"Split one PDF via splitPdf. --output-dir is required; parts are written as
<prefix>-<n>.pdf (zero-padded).
extract
pdfnative extract --input report.pdf --output cover.pdf --pages "4,1-2"Pull selected pages via extractPages. --pages is 1-based; order is preserved
and repeats are allowed.
annotate
pdfnative annotate --input report.pdf --output annotated.pdf \
--annotations notes.jsonnotes.json is a JSON array (or { "annotations": [...] }), each entry a markup
annotation plus a 1-based page. Written with an incremental save, so existing
signatures stay valid. Read them back with inspect --annotations.
govern
pdfnative govern rules # human/agent protocol (AGENT_RULES)
pdfnative govern policy --json # machine-readable policy JSON
pdfnative govern verify-issue draft.md # gate a draft (exit 1 / E_POLICY)Agents act as draftsmen: a human must always review and submit under their
own GitHub identity. verify-issue fails a draft that proposes an external
runtime dependency or omits a reproduction code block; missing recommended
fields are surfaced as warnings. A passing check is necessary but not
sufficient — the human review gate always applies.
render
--outline auto | <tree.json>— add a navigable PDF bookmark tree
(/Outlines).autoderives it from headings; a file supplies an explicit
OutlineItem[].--font math— register the bundled Noto Sans Math font; pdfnative
auto-routes math-operator / geometric-shape code points to it.--inspect-layout— emit aLayoutInspectionJSON report (per-page
blocks, positions, sizes) instead of a PDF (document variant only).--debug-layout [margins,content,cells]— render a normal PDF with layout
debug guides overlaid.
sign
- Native
node:cryptoby default — constant-time, side-channel-resistant
RSA/ECDSA signing viacreateNativeCryptoProvider. Pass--pure-cryptoto
force pdfnative's portable pure-JS bignum path.
inspect
--annotations— list markup and link annotations per page.- Page labels — the
/PageLabelsnumber tree is reported automatically when
present.
Agent / governance
E_POLICYstable error code for governance-gate failures.schemagainsannotate(annotation-spec input) andgovern-verify
({ ok, errors, warnings }) subjects.--dry-runnow also coversmerge/
split/extract/annotate.- New governance files:
.github/ai-governance.json,.github/AGENT_RULES.md,
.github/drafts/README.md— mirrored by thegoverncommand.
Compatibility
- Built on pdfnative
^1.5.0(was^1.3.0). - Node.js ≥ 20, Bun, Deno (
node dist/cli.cjs). - Zero extra runtime dependencies —
pdfnativeremains the sole dependency. - 100% backward-compatible with v1.1.0.
Security
- npm audit clean — added
js-yaml ^4.3.0andvite ^8.0.16overridesto
resolve two transitive dev-only advisories (0 vulnerabilities). merge/split/extract/annotatevalidate every path (incl.merge
positionals and--output-dir) against traversal, cap output via
--max-output-size, and bounds-check page references.annotatere-keys only
known annotation fields — no dictionary injection.govern verify-issueis a pure, fully offline validator — no GitHub or network
access.- Native
node:cryptosigning is constant-time; key material is never logged.
Notes
- Sign-side LTV (embedding timestamps /
/DSSat signing time) remains
upstream-blocked in pdfnative;sign --timestampstays reserved and errors
clearly. See ROADMAP.md and SECURITY.md. - The
governcommand adds no network surface — it only prints the policy /
rules and validates local drafts. The CLI stays offline by default.