# pdfnative-cli v1.3.0 _Released 2026-07-24_ **v1.3.0** surfaces the **pdfnative 1.6.0** engine's additions on the CLI: five new commands — **`extract-text`**, **`fill`**, **`encrypt`**, **`decrypt`**, and a **`doctor`** preflight — plus **native vector charts** in `render`, **`fill --export`** (read → edit → fill), and **`--password` / `--encrypt` / `--stream`** on the page-tree commands. It **unifies** the `render` encryption flags with the page-tree vocabulary (and fixes a silent `render --encrypt` no-op). For autonomous agents it adds a machine-readable **capability manifest** (`schema manifest` + `llms.txt`) and the stable **`E_PASSWORD`** code. Also lands PowerShell completion and a `CLAUDE.md`. 100% backward-compatible with v1.2.0 — every existing invocation keeps working. > ⭐ Star [`pdfnative`](https://github.com/Nizoka/pdfnative) — the > zero-dependency PDF engine that powers this CLI. Every star helps the > long-term project. ## Highlights - **Text extraction (RAG/agent-native).** `extract-text` decodes reading-order Unicode text — as plain text, a JSON array, or **NDJSON** (one object per page) — with `--runs` (positioned runs), `--pages`, and `--password`. No OCR. - **Fill, flatten & export forms.** `fill --data ` fills an existing AcroForm via an **incremental save** (an existing signature stays valid for its revision); `fill --flatten` stamps appearances and removes interactive fields; **`fill --export`** dumps current values as a `--data`-shaped map for a read → edit → fill round-trip. - **Environment preflight.** **`doctor`** reports the CLI / Node / `pdfnative` versions, Web Crypto (CSPRNG) availability — required by `encrypt` — and the command count. `--format json`, exit 0/1: an ideal agent pre-flight. - **Encrypt / decrypt.** `encrypt` re-secures with **AES-128/256** (CSPRNG-gated, RC4 never emitted); `decrypt` emits a plaintext copy. Passwords come from env (winning over flags) and are never logged. - **Native vector charts.** `render` gains the `chart` document block — bar, barH, line, pie, donut — as pure PDF path operators (zero deps, no rasterisation), tagged `/Figure` with alt text. - **Encrypted & streaming page-tree ops.** `merge` / `split` / `extract` accept `--password` (encrypted sources), `--encrypt [aes-128|aes-256]` (re-encrypt the output), and `--stream` + `--chunk-size` (constant-memory output). - **Richer inspection.** `inspect --form-fields` lists AcroForm fields; `inspect --encryption` reports the scheme (algorithm, revision, opened-as); `--password` opens encrypted documents. - **Agent tool discovery.** `schema manifest` emits a machine-readable capability manifest (commands, flags, error codes); `llms.txt` ships the LLM-facing version. New schema subjects `extract-text`, `fill`, `status`. ## What's new ### New commands #### `extract-text` ```bash pdfnative extract-text --input report.pdf --format ndjson --runs > pages.ndjson ``` Reading-order Unicode text via `extractText`. `--format text|json|ndjson`, `--pages`, `--runs`, `--password`, `--max-length`, plus `--summary`/`--fields`. No OCR — image-only pages yield empty text. #### `fill` ```bash pdfnative fill --input form.pdf --data values.json --output filled.pdf pdfnative fill --input filled.pdf --flatten --output flat.pdf ``` `--data` is a JSON map `name → string|boolean|string[]` (or `{ "values": {…} }`). Incremental save keeps existing signatures valid. Discover fields with `inspect --form-fields`. Signature fields cannot be filled. #### `encrypt` / `decrypt` ```bash pdfnative encrypt --input in.pdf --owner-password "$OWNER" --algorithm aes-256 --stream --output enc.pdf pdfnative decrypt --input enc.pdf --password "$USER" --output plain.pdf ``` Page-tree re-encryption / transparent decryption. Both rebuild the page tree (like `merge`), so signatures and form fields are dropped. `encrypt` requires a Web Crypto CSPRNG; RC4 is never emitted. `--stream` (+ `--chunk-size`) processes a large PDF at constant memory. #### `doctor` ```bash pdfnative doctor # human-readable pdfnative doctor --format json # { ok, checks: [{ name, status, value, detail }] } ``` Offline preflight of the CLI/Node/pdfnative versions, Web Crypto (CSPRNG), and command count. ### `render` - **Native vector charts** — the `chart` document block (bar, barH, line, pie, donut) renders as pure PDF path operators, multi-series with legend and nice ticks, tagged `/Figure` + `/Alt`. Supplied via document JSON / `--layout`. - **Unified encryption flags** — `render` now accepts `--encrypt [aes-128|aes-256]` / `--owner-password` / `--user-password` / `--permissions` (same vocabulary as merge/split/extract); the `--encrypt-*` flags remain as aliases. ### `merge` / `split` / `extract` - **`--password`** — read encrypted source PDFs. - **`--encrypt [aes-128|aes-256]`** with `--owner-password` / `--user-password` / `--permissions` — re-encrypt the rebuilt output. - **`--stream`** (+ `--chunk-size`) — constant-memory streaming output. ### `inspect` - **`--form-fields`** — list AcroForm fields (name, type, value, required/read-only, options). - **`--encryption`** — report the encryption scheme, or `null`. - **`--password`** — open an encrypted PDF for inspection. ### Agent / tooling - **`E_PASSWORD`** stable error code for a missing/incorrect PDF password. - **`schema manifest`** — machine-readable capability manifest for tool discovery; new subjects `extract-text`, `fill`, `status`. **`llms.txt`** at the repo root. - **`completion powershell`** — PowerShell completion (Register-ArgumentCompleter). - **`CLAUDE.md`** — Claude Code contributor guide. ## Compatibility - Built on **pdfnative `^1.6.0`** (was `^1.5.0`). - **Node.js ≥ 20**, Bun, Deno (`node dist/cli.cjs`). - Zero extra runtime dependencies — `pdfnative` remains the sole dependency. - 100% backward-compatible with v1.2.0. ## Security - Passwords (`--password`, `--owner-password`, `--user-password`) are read from env (winning over flags) and are **never logged** or echoed in error messages. - `encrypt` / re-encryption require a Web Crypto CSPRNG and only emit AES; RC4 is never produced. All new operations are memory-bounded (`--max-length`, `--max-output-size`, `--chunk-size`) and safe on untrusted input. - No new network surface — the CLI stays offline by default. ## Fixed - **`render --encrypt` was a silent no-op** — the `render --help` advertised `--encrypt aes-256 / --owner-password / …`, but the code only read `--encrypt-*` flags, so `render --encrypt aes-256 --owner-password X` produced an **unencrypted** PDF with no error. `render` now reads the unified flags (with `--encrypt-*` kept as aliases), and the help text matches the implementation (including the watermark flags). - **`schema` / `--version` in the published binary** — the CLI version was resolved with a bundle-relative `../../package.json` path that does not exist next to the flattened `dist/cli.cjs`, so every `schema ` call on an installed CLI failed with `Cannot find module '../../package.json'`. Version resolution now goes through a robust, name-guarded `src/utils/version.ts`. - **Empty environment password no longer overrides a flag** — an exported-but-empty `PDFNATIVE_PASSWORD` / `PDFNATIVE_ENCRYPT_*` value used to win over an explicit `--password` / `--owner-password`; an empty env value is now treated as absent. - **`fill` error classification** — malformed `--data` content now consistently raises `E_INPUT` at exit 1 (was a mix of exit 2 / `E_USAGE`). ## Notes - `extract-text` performs **no OCR** — pages with only images yield empty text. - `encrypt` / `decrypt` (and page-tree re-encryption) rebuild the page tree, so they drop signatures and form fields — use them before signing, not after. - **`merge` uses one password for all sources.** A single `--password` is applied to every source; merging encrypted sources with **different** passwords fails with `E_PASSWORD` (decrypt the outliers first). `split` / `extract` take a single input, so this doesn't apply. - The global **`--help` is now grouped** by category (Create & edit / Page tree / Security / Read & extract / Automation & meta) — display-only, no behaviour change. - Sign-side LTV (embedding timestamps / `/DSS` at signing time) remains upstream-blocked in pdfnative; `sign --timestamp` stays reserved. See [ROADMAP.md](../ROADMAP.md) and [SECURITY.md](../SECURITY.md). - **On the roadmap** (not in this release): a `batch --manifest` task orchestrator and a `compare` command are feasible today; an `optimize` command and a *visual* `compare` await pdfnative primitives (object GC / linearisation / a rasteriser). See [ROADMAP.md](../ROADMAP.md).