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.5.0 (engine pdfnative ≥ 1.8.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 and PDF/X diagnostics (unembedded form fonts, DeviceCMYK images, PDFX_ANNOTATIONS, TYPOGRAPHY_FEATURE_INEFFECTIVE… — 9 codes since v1.5.0) 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 (27 bundled scripts; lo, nod, khb, tdd, cjm since v1.5.0). ha, yo, ig, sw are aliases of latin.
Register and embed a TrueType/OpenType font you ship: <path.ttf>[:name], repeatable. Path checked, 32 MiB cap, sfnt signature required (no collections, no WOFF), validated by the font compiler; the name defaults to the file stem and is added to --lang.
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 27 script codes (ar, th, ja… plus lo, nod, khb, tdd, cjm since v1.5.0) works and doubles as the --lang code; 31 bundled font modules in total.
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.
Typography v1.5
Paragraphs may break across pages (widows/orphans default to 2).
A heading never ends a page alone.
Pair kerning — needs a registered font (--font latin --lang latin).
Comma-separated OpenType features: tnum, pnum, lnum, onum, zero, ordn, sups, subs, smcp, c2sc, case. TYPOGRAPHY_FEATURE_INEFFECTIVE warns when a tag changes nothing in the font.
The full layout.typography set (widows/orphans, unitBinding, punctuationSpacing, opticalMargins, hyphenationLanguage…) lives in the JSON or the --layout file; soft hyphens (U+00AD) are always honoured.
PDF/X-4 & output intent v1.5
PDF/X-4 claim. Needs an output ICC profile, every font embedded, --trapped true|false and a TrimBox or ArtBox per page. Exclusive with --tagged pdfa* and encryption.
ICC profile for layout.outputIntent (RGB, CMYK or Gray; prtr class for PDF/X-4). 16 MiB cap, acsp signature checked.
outputConditionIdentifier — defaults to the ICC file's basename. Requires --output-intent-icc, or outputIntent.iccProfile in the --layout file.
/Info /Trapped. Under --pdfx, unknown is refused and unset means false.
Colours everywhere also accept CMYK — [c, m, y, k] percent or "c m y k" operands 0–1 (DeviceCMYK). Check the result with inspect --check pdfx.
Watermark
Headers / footers
Placeholders: {page}, {pages}, {date}, {title}. {pages} is rejected with --stream.
Encryption (mutually exclusive with --tagged pdfa* and --pdfx)
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).
Bound on the TSA round-trip; reported as timestamp.timeoutMs in the envelope. Only together with --timestamp.
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.
Structural ISO 15930-7 (PDF/X-4) validation report; pdfxConformance is always present, --summary adds pdfx.
Report /CreationDate and /ModDate as ISO 8601 instead of raw PDF dates (additive).
Minimal verdict for agents; combine with the global --json.
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. Link entry (v1.5.0): { "type": "link", "page": 1, "rect": [72, 700, 300, 720], "url": "https://pdfnative.dev" } — http:, https: or mailto: only, otherwise E_INPUT.
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, and link (v1.5.0 — a /Link with a /URI action over a click rectangle). Colours accept CMYK too. 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 }.

Eight offline checks: cli version, node (≥ 22 since v1.4.0), webcrypto CSPRNG, the resolved pdfnative engine version, the commands count, and since v1.5.0 fonts (31 modules / 27 scripts, probed on disk), unicode (the USE database version) and conformance (pdfa1b,pdfa2b,pdfa2u,pdfa3b,pdfx4). --json emits { ok, checks: [{ name, status, value, detail }] }. 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.5.0.
Emits a completion script covering all 21 commands and their flags. Pipe it into your shell's completion directory.
Global flags (any command) v1.5
Since v1.5.0 global flags may precede the command name (pdfnative --json inspect …). Arguments without any command exit 2 / E_USAGE.
Pin the creation instant of every PDF written in this run (render, batch): /CreationDate, xmp:CreateDate, {date} and the trailer /ID derive from it, in UTC — identical SHA-256 on every host. Falls back to $SOURCE_DATE_EPOCH. Encrypted output is never reproducible.
Validate and exit without writing. render pre-flights the real build in memory; never performs network I/O.
Agent mode: JSON status/error envelope on stderr with a stable E_* code; data stays on stdout.
Suppress progress output on stderr.
Disable ANSI colour (also respects NO_COLOR).

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