pdfnative 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,24 @@
15
15
 
16
16
  Pure native PDF generation library — zero vendor dependencies. ISO 32000-1 (PDF 1.7) compliant.
17
17
 
18
+ ## Ecosystem
19
+
20
+ pdfnative ships as three coordinated packages — pick whichever entry point fits your workflow:
21
+
22
+ | Package | Latest | Use it for |
23
+ |---|:---:|---|
24
+ | [`pdfnative`](https://www.npmjs.com/package/pdfnative) | **v1.2.0** | The library itself — call from Node, browsers, Workers, Deno, Bun. |
25
+ | [`pdfnative-cli`](https://www.npmjs.com/package/pdfnative-cli) | **v0.3.0** | Render JSON → PDF, sign (RSA + ECDSA-SHA256, RFC 3161 detection), inspect, and verify CMS signatures from the shell. New in v0.3.0: `--watch`, `--template`, `--font {latin,emoji}`, auto signature placeholder. |
26
+ | [`pdfnative-mcp`](https://www.npmjs.com/package/pdfnative-mcp) | **v0.3.0** | Use pdfnative from Claude Desktop, Cursor, Continue, Zed (or any stdio MCP client) — **9 structured tools** including the new `inspect_pdf`, a `pdfA` flag on every doc tool, multi-script `lang`, and per-tool `outputSchema` (MCP 2025-06-18). |
27
+
28
+ ```bash
29
+ npm install pdfnative # library
30
+ npm install -g pdfnative-cli # CLI
31
+ npm install -g pdfnative-mcp # MCP server
32
+ ```
33
+
34
+ Detailed docs: [CLI guide](docs/guides/cli.md) · [MCP guide](docs/guides/mcp.md) · [Onboarding cheatsheet](docs/guides/onboarding.md).
35
+
18
36
  ## Highlights
19
37
 
20
38
  - **Zero dependencies** — built from scratch in pure TypeScript. Zero runtime dependencies, tree-shakeable, auditable
@@ -22,17 +40,19 @@ Pure native PDF generation library — zero vendor dependencies. ISO 32000-1 (PD
22
40
  - **16 Unicode scripts** — Thai, Japanese, Chinese (SC), Korean, Greek, Devanagari, Turkish, Vietnamese, Polish, Arabic, Hebrew, Cyrillic, Georgian, Armenian, Bengali, Tamil
23
41
  - **Thai OpenType shaping** — GSUB substitution + GPOS mark-to-base + mark-to-mark positioning
24
42
  - **Arabic positional shaping** — GSUB isolated/initial/medial/final forms + lam-alef ligatures
25
- - **BiDi text layout** — simplified Unicode Bidirectional Algorithm (UAX #9) with glyph mirroring
43
+ - **BiDi text layout** — Unicode Bidirectional Algorithm (UAX #9) with glyph mirroring, isolates (LRI/RLI/FSI/PDI), and explicit embeddings (LRE/RLE/LRO/RLO/PDF)
44
+ - **USE-lite cluster classifier** — public API (`classifyUseCategory`, `classifyClusters`) with per-script tables for Devanagari, Bengali, Tamil (v1.2.0; shaper rewire lands in v1.3)
26
45
  - **Multi-font fallback** — automatic cross-script font switching with continuation bias
27
46
  - **TTF subsetting** — only used glyphs embedded (dramatic file size reduction)
28
47
  - **Tagged PDF / PDF/A** — structure tree, /ActualText, XMP metadata, sRGB OutputIntent (PDF/A-1b, 2b, 2u, 3b with embedded file attachments)
29
48
  - **PDF Encryption** — AES-128 (V4/R4) and AES-256 (V5/R6), owner + user passwords, granular permissions
30
49
  - **Free-form document builder** — headings, paragraphs, lists, tables, images, barcodes, SVG paths, form fields, spacers, page breaks, table of contents
50
+ - **Smart tables** — multi-page slicing with repeated headers, auto-wrap on column overflow, zebra striping, captions, and smart auto-fit columns (v1.2.0). [Guide →](docs/guides/tables.md)
31
51
  - **Barcode & QR code generation** — Code 128, EAN-13, QR Code, Data Matrix, PDF417 — pure PDF path operators (no images)
32
52
  - **SVG path rendering** — path, rect, circle, ellipse, line, polyline, polygon as native PDF operators
33
53
  - **AcroForm fields** — text, multiline, checkbox, radio, dropdown, listbox with appearance streams (ISO 32000-1 §12.7)
34
- - **Digital signatures** — CMS/PKCS#7 detached signatures with RSA + ECDSA, SHA-256/384/512, X.509 parsing (ISO 32000-1 §12.8)
35
- - **Streaming output** — AsyncGenerator-based progressive PDF emission with configurable chunk size
54
+ - **Digital signatures** — CMS/PKCS#7 detached signatures with RSA + ECDSA, SHA-256/384/512, X.509 parsing (ISO 32000-1 §12.8). One-call placeholder injection via `addSignaturePlaceholder()` (v1.2.0)
55
+ - **Streaming output** — AsyncGenerator-based progressive PDF emission with configurable chunk size, plus object-boundary page-by-page streaming (`buildPDFStreamPageByPage()`, v1.2.0)
36
56
  - **PDF parser & modifier** — read existing PDFs (tokenizer, xref, object parser, FlateDecode inflate) + incremental modification
37
57
  - **Image embedding** — JPEG (DCTDecode) and PNG (FlateDecode) with auto-scaling and alignment
38
58
  - **Hyperlinks** — PDF link annotations (/URI) with URL validation, blue underlined text, tagged /Link
@@ -42,7 +62,7 @@ Pure native PDF generation library — zero vendor dependencies. ISO 32000-1 (PD
42
62
  - **FlateDecode compression** — zlib stream compression (50–90% size reduction), zero-dependency, platform-native
43
63
  - **Web Worker support** — off-main-thread generation for large datasets
44
64
  - **Tree-shakeable** — ESM + CJS dual build with TypeScript declarations
45
- - **95%+ test coverage** — 1588+ tests across 40 files, fuzz suite, performance benchmarks
65
+ - **95%+ test coverage** — 1822+ tests across 53 files, fuzz suite, performance benchmarks
46
66
  - **NPM provenance** — signed builds via GitHub Actions OIDC
47
67
  - **On-device generation** — runs in Node, browsers, Workers, Deno, Bun. No SaaS round-trip; documents never leave the calling process unless your application explicitly sends them
48
68
  - **No telemetry, no network calls** — verifiable in source. The library never opens a socket, fetches remote fonts, or phones home
@@ -821,9 +841,11 @@ pdfnative ships as a library, but two official companion packages cover the most
821
841
 
822
842
  ### pdfnative-cli — command-line interface
823
843
 
824
- [`pdfnative-cli`](https://github.com/Nizoka/pdfnative-cli) v0.2.0 is the **official CLI**. It exposes four commands — `render`, `sign`, `inspect`, **`verify`** — covering the full `pdfnative` v1.0.5 surface for use in shell scripts, Makefiles, GitHub Actions, and Docker images. Zero extra runtime dependencies, npm-provenance-signed.
844
+ [`pdfnative-cli`](https://github.com/Nizoka/pdfnative-cli) v0.3.0 is the **official CLI**. It exposes four commands — `render`, `sign`, `inspect`, **`verify`** — covering the full `pdfnative` v1.1.0 surface for use in shell scripts, Makefiles, GitHub Actions, and Docker images. Zero extra runtime dependencies, npm-provenance-signed.
825
845
 
826
- **Highlights (v0.2.0):** hybrid `flags + --layout file.json` model, encryption (AES-128/256), watermarks (text + image), header/footer page templates with `{page}/{pages}/{date}/{title}`, PDF/A-3 attachments (Factur-X / ZUGFeRD pattern), multilingual fonts via `--lang`, table-variant rendering, signing metadata + intermediate cert chains, `inspect --verbose/--pages/--check`, and a brand-new `verify` command for byte-range integrity and certificate-chain validation. **100 % backward-compatible** with v0.1.0.
846
+ **New in v0.3.0:** ECDSA-SHA256 (P-256) signing fully wired, real CMS/PKCS#7 verification with RFC 3161 timestamp detection, automatic signature-placeholder injection on `sign`, plus three iteration-friendly `render` flags (`--watch`, `--template`, `--font {latin,emoji}`). **100 % backward-compatible** with v0.2.0.
847
+
848
+ **Previously (v0.2.0):** hybrid `flags + --layout file.json` model, encryption (AES-128/256), watermarks (text + image), header/footer page templates with `{page}/{pages}/{date}/{title}`, PDF/A-3 attachments (Factur-X / ZUGFeRD pattern), multilingual fonts via `--lang`, table-variant rendering, signing metadata + intermediate cert chains, `inspect --verbose/--pages/--check`, and the `verify` command.
827
849
 
828
850
  ```bash
829
851
  # render with full layout coverage (encryption + watermark + PDF/A-2b)
@@ -845,11 +867,13 @@ npx pdfnative-cli inspect --input signed.pdf \
845
867
  --check pdfa --check signed --format json
846
868
  ```
847
869
 
848
- See the [CLI Guide](https://pdfnative.dev/guides/cli.html) for the full v0.2.0 reference, security model, recipes, and the `--conformance` → `--tagged` migration path. Try the [interactive CLI playground](https://pdfnative.dev/playgrounds/cli.html) to build commands without leaving the browser.
870
+ See the [CLI Guide](https://pdfnative.dev/guides/cli.html) for the full v0.3.0 reference, security model, recipes, and the `--conformance` → `--tagged` migration path. Try the [interactive CLI playground](https://pdfnative.dev/playgrounds/cli.html) to build commands without leaving the browser.
849
871
 
850
872
  ### pdfnative-mcp — Model Context Protocol server
851
873
 
852
- [`pdfnative-mcp`](https://github.com/Nizoka/pdfnative-mcp) is a **Model Context Protocol server** that bridges pdfnative to any MCP-compatible AI client. Once configured, your AI assistant can generate PDFs, embed barcodes, create forms, sign documents, and render international text — all without writing code.
874
+ [`pdfnative-mcp`](https://github.com/Nizoka/pdfnative-mcp) v0.3.0 is a **Model Context Protocol server** that bridges pdfnative to any MCP-compatible AI client. Once configured, your AI assistant can generate PDFs, embed barcodes, create forms, sign documents, render international text, and **inspect** existing PDFs — all without writing code.
875
+
876
+ **New in v0.3.0:** `inspect_pdf` (the 9th tool, structured metadata/page/signature/PDF/A report), `pdfA` flag on every document tool, multi-script `lang` (`string | string[] | csv`) with bundled `latin` + `emoji` codes, `add_table` `autoFitColumns`/`clipCells`, and per-tool `outputSchema` per the MCP 2025-06-18 spec.
853
877
 
854
878
  ```bash
855
879
  npx -y pdfnative-mcp
@@ -860,13 +884,14 @@ npx -y pdfnative-mcp
860
884
  | Tool | Purpose |
861
885
  |------|---------|
862
886
  | `generate_basic_pdf` | Multi-page documents from structured blocks (headings, paragraphs, lists) |
863
- | `add_table` | Tabular reports from column headers and data rows |
887
+ | `add_table` | Tabular reports from column headers and data rows (v0.3.0: `autoFitColumns`, `clipCells`) |
864
888
  | `add_barcode` | QR Code, Code 128, EAN-13, Data Matrix, PDF417 |
865
- | `add_international_text` | 16 non-Latin scripts with BiDi & OpenType shaping |
889
+ | `add_international_text` | 16 non-Latin scripts with BiDi & OpenType shaping (v0.3.0: multi-script `lang`) |
866
890
  | `add_form` | Interactive AcroForm PDFs (text, checkbox, radio, dropdown) |
867
891
  | `embed_image` | Embed a JPEG or PNG image (base64) |
868
892
  | `prepare_signature_placeholder` | PDF with a `/Sig` field ready to be signed |
869
893
  | `sign_pdf` | CMS/PKCS#7 digital signatures (RSA-SHA256 / ECDSA-SHA256) |
894
+ | `inspect_pdf` | **New in v0.3.0** — structured PDF report (metadata, pages, signatures, PDF/A) |
870
895
 
871
896
  ### Claude Desktop configuration
872
897