Home  ›  Playgrounds  ›  CLI command builder

pdfnative-cli command builder

Pick a command, fill the form, copy the resulting npx pdfnative-cli invocation. Covers all twenty-one commands of pdfnative-cli v1.4.0 — authoring (render, fill, annotate, metadata), the page tree (merge, split, extract), the complete PAdES ladder (sign --timestamp B-T, ltv B-LT, doc-timestamp B-LTA, plus encrypt / decrypt and verify), reading (inspect, extract-text, compare), and automation (batch with declarative manifests, doctor, schema, completion, govern). The most-used flags have form fields; the CLI guide is the exhaustive flag reference. The builder runs entirely in your browser — nothing is uploaded.

Path to JSON input. Omit to read from stdin.
Output path. Omit to write to stdout.
Selects the renderer variant.
Single value or top,right,bottom,left in points.
FlateDecode all content streams.
AsyncGenerator streaming output. Chunk it with --chunk-size.
Escalate PDF/A diagnostics (unembedded form fonts, DeviceCMYK images…) into a hard failure before the first byte — exit 1 / E_CHECK_FAILED.
Chunk size in bytes for --stream / --stream-true.
Load any subset of PdfLayoutOptions. CLI flags override the layout file.
Comma-separated language codes. Non-Latin scripts need their font registered — pass the same code to --font (22 bundled scripts).
Iteration helpers
Re-render when the --input file changes (only that file is watched). Requires --input + a file --output.
Base document JSON: the input (stdin or --input) is deep-merged on top — caller wins, arrays replace. Not variable substitution.
Bundled font codes — besides these, any of the 22 script codes (ar, th, ja…) works and doubles as the --lang code.
Bookmarks, math & layout v1.2
Add a /Outlines bookmark tree. auto derives it from headings.
Emit a LayoutInspection JSON report instead of a PDF.
Overlay layout-debug guides on a normal PDF.
Watermark
Headers / footers
Placeholders: {page}, {pages}, {date}, {title}. {pages} is rejected with --stream.
Encryption (mutually exclusive with --tagged pdfa*)
Required if any --encrypt-* flag is set. Prefer the env var.
Since v1.3.0 the CLI also has a unified encryption vocabulary shared by render / merge / split / extract--encrypt aes-128|aes-256, --owner-password, --user-password, --permissions. See the CLI guide.
PDF/A-3 attachments
Format: path[:mime[:relationship[:description]]]. Repeatable.
Or set $PDFNATIVE_SIGN_KEY.
Or set $PDFNATIVE_SIGN_CERT.
Repeatable. Or set $PDFNATIVE_SIGN_CHAIN.
Force the portable pure-JS CMS path. The default delegates to node:crypto, inheriting its side-channel hardening; the pure-JS path is not constant-time.
PAdES & timestamps v1.4
Embed an RFC 3161 token (PAdES B-T). The only network opt-in on sign — SSRF-guarded, no silent fallback (E_NETWORK / E_PARSE).
CMS digest for RSA keys; ECDSA stays SHA-256.
Add a signature to an already-signed PDF instead of refusing.
Visible widget: x1,y1,x2,y2. Pair with --signature-page.
Reserve a larger /Contents (long chains, big TSA tokens).
Adds trailerKeys, catalogKeys, objectCount, xmpMetadata.
Per-page geometry, annotations, form fields.
List markup + link annotations per page. Page labels reported automatically.
List AcroForm fields (name, type, value, flags).
Report the encryption scheme (algorithm, revision, opened-as).
Structural signature inventory — fieldName, subFilter, byteRange, isDocTimestamp, isPlaceholder, sigObjNum, contentsLength. Never the signature bytes.
Open an encrypted PDF. Prefer the env var.
--check (CI assertions, ANDed)
Minimum number of real signatures.
Exit code 0 on all-pass, 1 on any failure. Composable with --format. Since v1.4.0, --check signed counts only real signatures — unsigned placeholders and /DocTimeStamp revisions no longer pass.
Exit 1 on any failure or zero signatures.
Trust-anchor PEMs. Repeatable.
Minimal verdict under --json: { valid, signatures, invalid }.

Scope (since v1.0.0): full CMS/PKCS#7 verification (RSA-SHA256 — plus SHA-384/512 since v1.4.0 — and ECDSA-SHA256), byte-range integrity, certificate chain, trust evaluation against --trust roots, RFC 3161 timestamp validation (PAdES-T) incl. /DocTimeStamp revisions (v1.4.0), and OCSP/CRL revocation checking. See the CLI guide.

Source PDFs, concatenated in order. Repeatable.
Output ceiling in bytes (default 256 MiB).

Encrypted sources are supported since v1.3.0 — decrypt them on ingest with --password, and re-encrypt the merged output with --encrypt. Signatures and /AcroForm are dropped (page edits invalidate /ByteRange); URI /Link annotations are preserved. Every path is validated against traversal.

Required. Parts written as <prefix>-<n>.pdf.
Comma-separated 1-based inclusive ranges. Omit for one output per page.
1-based page list/ranges. Order is preserved and repeats are allowed.
JSON array (or { "annotations": [...] }): each entry a markup annotation plus a 1-based page.
Annotate an encrypted PDF — added objects are encrypted under the existing scheme.

Written with an incremental save, so existing signatures stay valid. Types: text, highlight, underline, strikeout, squiggly, square, circle, line, freetext. Overlay, not redaction.

rules prints the agent/human protocol; policy the machine-readable JSON; verify-issue gates a draft.
Path to the local issue draft to gate. Exit 1 / E_POLICY on a violation.
Machine-readable output (best with policy).

Agents act as draftsmen: a human must always review and submit. verify-issue is a pure, fully offline validator — no GitHub or network access.

All fields from a JSON file (schema metadata). Mutually exclusive with the individual flags.

Written as an incremental save — the original bytes stay as a prefix, so existing signatures remain valid for their revision. /Info and XMP stay in sync. Reading metadata remains inspect's job.

PAdES B-LT: certificates, OCSP responses and CRLs embedded into the /DSS dictionary.
collect writes the evidence JSON; embed / add write the PDF.
Required for collect / add — the explicit network opt-in (SSRF-guarded). embed is 100 % offline.
Evidence JSON produced by collect — the air-gap bridge.
Additional certificates for the /DSS. Repeatable.

Air-gapped workflow: ltv collect --online on a connected machine → transfer the JSON → ltv embed --data inside the enclave, where no network I/O is even possible. Continue to B-LTA with doc-timestamp.

Required — making the network use an explicit opt-in. SSRF-guarded, 10 s timeout, 5 MiB cap, no redirects.
Never touches the network.

Appends an RFC 3161 /DocTimeStamp revision (/SubFilter /ETSI.RFC3161, ISO 32000-2 §12.8.5) covering every byte — PAdES B-LTA. Earlier revisions stay byte-identical; run again years later to renew the protection.

Required. Prefer the env var — never shell history.
Without it the document opens with no prompt; the owner password only governs permissions.
Comma list: print, copy, modify, extract.
Open an already-encrypted source (password rotation).
Reads RC4, AES-128 and AES-256 sources.
Include positioned runs { text, x, y, fontSize, fontName }.
Hard cap on total characters; 0 disables.
(json) Emit only { pages, characters }.

Real Unicode from the /ToUnicode mapping in reading order — ndjson is a natural feed for a RAG ingestion pipeline.

Structure = page count, page/print boxes, metadata, form fields, annotations, encryption, signatures.

CI contract: identical → exit 0; different → the report prints on stdout first, then exit 1 / E_CHECK_FAILED. Not a visual diff — pdfnative has no rasteriser; compare diffs what the format declares.

Required unless --flatten or --export.
Freeze the values into page content.
Read-only: dump current values in --data shape.
Flatten even when a signed signature field is present (invalidates it).

The three modes compose into a round trip: --export the current values, edit the JSON, feed it back with --data, optionally --flatten.

Directory of *.json documents (directory mode).
Declarative pipeline: { "version": 1, "tasks": [{ "id", "command", "flags" }] }. "@<id>" references an earlier task's output; a 14-command whitelist applies (never ltv / compare / the meta commands); validated in full before anything runs; max 1 000 tasks.
Required before any network flag inside the manifest (--timestamp, --url, --online, --revocation online).
Keep going after a failure; @id-dependent tasks are skipped.
Emit { total, succeeded, failed }.

Five offline checks: CLI version, Node (≥ 22 since v1.4.0), WebCrypto CSPRNG, resolved pdfnative engine version, and the command count. The first thing to run in a new environment — and the first thing an agent should call.

Versioned JSON Schemas (Draft 2020-12) — the $id embeds the CLI version, so agents can self-validate before invoking a command. 19 subjects in v1.4.0.
Emits a completion script covering all 21 commands and their flags. Pipe it into your shell's completion directory.

Generated command

npx pdfnative-cli render

Paste this in any shell. Secrets are never sent — the entire builder runs client-side.

What this playground does not do

It does not execute the CLI in your browser — signing real PDFs requires real private keys, and we will not pretend to. For an in-browser demo of render output, see the homepage live demo. To exercise the full CLI on your machine: npx pdfnative-cli <your built command>.

Resources