pdfnative 1.0.5 → 1.1.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
@@ -181,6 +181,11 @@ registerFonts({
181
181
  hy: () => import('pdfnative/fonts/noto-armenian-data.js'),
182
182
  bn: () => import('pdfnative/fonts/noto-bengali-data.js'),
183
183
  ta: () => import('pdfnative/fonts/noto-tamil-data.js'),
184
+ // v1.1.0+ — optional Latin fallback for PDF/A documents with curly quotes,
185
+ // em-dash, ellipsis, etc. (activates automatically when needed):
186
+ latin: () => import('pdfnative/fonts/noto-sans-data.js'),
187
+ // v1.1.0+ — optional monochrome emoji:
188
+ emoji: () => import('pdfnative/fonts/noto-emoji-data.js'),
184
189
  });
185
190
 
186
191
  const thaiFont = await loadFontData('th');
@@ -212,6 +217,8 @@ const pdf = buildPDFBytes({
212
217
  | Armenian | `hy` | Noto Sans Armenian | Armenian alphabet |
213
218
  | Bengali | `bn` | Noto Sans Bengali | GSUB conjuncts + GPOS marks |
214
219
  | Tamil | `ta` | Noto Sans Tamil | GSUB ligatures + split vowels |
220
+ | Latin (PDF/A) | `latin` | Noto Sans VF | WinAnsi-extended Latin (curly quotes, em-dash, ellipsis…) |
221
+ | Emoji | `emoji` | Noto Emoji | Monochrome emoji (BMP/SMP, Fitzpatrick, ZWJ, VS-15/16) |
215
222
 
216
223
  ## Multi-Font (Mixed Scripts)
217
224
 
@@ -369,7 +376,7 @@ Generate sample PDFs for all supported languages to visually verify output:
369
376
  npm run test:generate
370
377
  ```
371
378
 
372
- This creates **140+ PDF files** in `test-output/` (git-ignored), organized in twenty-three categories.
379
+ This creates **150+ PDF files** in `test-output/` (git-ignored), organized in twenty-five categories (including `emoji/` and `pdfa-latin/` added in v1.1.0).
373
380
  See [scripts/README.md](scripts/README.md) for the modular generator architecture.
374
381
 
375
382
  ### Financial Statements (per language)
@@ -814,20 +821,31 @@ pdfnative ships as a library, but two official companion packages cover the most
814
821
 
815
822
  ### pdfnative-cli — command-line interface
816
823
 
817
- [`pdfnative-cli`](https://github.com/Nizoka/pdfnative-cli) is the **official CLI**. It exposes three commands — `render`, `sign`, `inspect` — for use in shell scripts, Makefiles, GitHub Actions, and Docker images. Zero extra runtime dependencies, npm-provenance-signed.
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.
818
825
 
819
- ```bash
820
- # render a JSON document spec to PDF
821
- npx pdfnative-cli render document.json --output report.pdf
822
-
823
- # sign an existing PDF (RSA or ECDSA, CMS/PKCS#7)
824
- npx pdfnative-cli sign report.pdf --cert cert.pem --key key.pem --output signed.pdf
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.
825
827
 
826
- # inspect a PDF (page count, metadata, fonts, signatures)
827
- npx pdfnative-cli inspect signed.pdf
828
+ ```bash
829
+ # render with full layout coverage (encryption + watermark + PDF/A-2b)
830
+ npx pdfnative-cli render --input doc.json --output report.pdf \
831
+ --tagged pdfa2b --compress \
832
+ --watermark-text "DRAFT" --watermark-opacity 0.15
833
+
834
+ # sign with metadata and intermediate cert chain
835
+ npx pdfnative-cli sign --input report.pdf --output signed.pdf \
836
+ --reason "Approved" --name "Finance Team" \
837
+ --signing-time 2026-04-28T10:00:00Z \
838
+ --cert-chain intermediate.pem
839
+
840
+ # verify embedded signatures (byte-range + chain + trust)
841
+ npx pdfnative-cli verify --input signed.pdf --strict --trust ca-root.pem
842
+
843
+ # inspect with CI assertions (exit 1 on failure)
844
+ npx pdfnative-cli inspect --input signed.pdf \
845
+ --check pdfa --check signed --format json
828
846
  ```
829
847
 
830
- See the [CLI Guide](https://pdfnative.dev/guides/cli.html) for full reference, security model, and pipeline examples.
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.
831
849
 
832
850
  ### pdfnative-mcp — Model Context Protocol server
833
851
 
@@ -931,7 +949,7 @@ src/
931
949
  fonts/ # Pre-built font data modules (16 scripts)
932
950
  tools/ # CLI: build-font-data.cjs (TTF → JS module)
933
951
  scripts/ # Modular sample PDF generation (23 generators, 140+ PDFs)
934
- tests/ # 1588+ tests (40 files: unit + integration + fuzz + parser)
952
+ tests/ # 1726+ tests (48 files: unit + integration + fuzz + parser)
935
953
  bench/ # Performance benchmarks (vitest bench)
936
954
  ```
937
955
 
@@ -945,7 +963,7 @@ npm install
945
963
  npm run build # tsup → dist/ (ESM + CJS + .d.ts)
946
964
  npm run test # vitest run (1588+ tests)
947
965
  npm run test:coverage # vitest with v8 coverage (95%+)
948
- npm run test:generate # Generate 140+ sample PDFs → test-output/
966
+ npm run test:generate # Generate 150+ sample PDFs → test-output/
949
967
  npm run lint # ESLint 9 + typescript-eslint strict
950
968
  npm run typecheck # tsc --noEmit (src/)
951
969
  npm run typecheck:tests # tsc --project tsconfig.test.json
@@ -1010,17 +1028,26 @@ When `tagged` is set, the output includes:
1010
1028
 
1011
1029
  The `tagged` option is backward-compatible — omitting it or setting `false` produces the same output as before.
1012
1030
 
1013
- > **PDF/A status (v1.0.4).** As of v1.0.4 every PDF emits a trailer
1014
- > `/ID` and the `/Info CreationDate` is byte-equivalent to the
1015
- > `xmp:CreateDate` (with timezone offset) closing two veraPDF
1016
- > reference-validator findings. **Latin font embedding** is **not yet
1017
- > implemented**: standard 14 Helvetica is still emitted as an
1018
- > unembedded reference, which veraPDF flags under ISO 19005-1 §6.3.4.
1019
- > Treat the `pdfaid:part` claim in XMP as aspirational until **v1.0.5**
1020
- > lands. See [docs/guides/pdfa.html](docs/guides/pdfa.html) and the
1021
- > tracking issue [release-notes/draft-issue-v1.0.5-latin-embedding.md](release-notes/draft-issue-v1.0.5-latin-embedding.md).
1022
- > Run `npm run validate:pdfa` locally (with veraPDF installed) to
1023
- > verify against the reference validator.
1031
+ > **PDF/A status (v1.1.0).** Every PDF/A-claiming sample now passes
1032
+ > the **veraPDF** reference validator (1b / 2b / 2u / 3b) when the
1033
+ > Latin font module is registered. Trailer `/ID` and
1034
+ > `/Info CreationDate` are byte-equivalent to `xmp:CreateDate`
1035
+ > (with timezone offset). `<dc:title>`, `<dc:description>`,
1036
+ > `<pdf:Keywords>` mirror `/Info /Title`, `/Subject`, `/Keywords`
1037
+ > byte-for-byte (ISO 19005-1 §6.7.3 t1 / t4 / t5). Object 3 / Object 4
1038
+ > are emitted as Type0 redirector dicts pointing to the embedded
1039
+ > CIDFontType2 chain — no more unembedded `Helvetica` references
1040
+ > (ISO 19005-1 §6.3.4 / ISO 19005-2 §6.2.11.4.1). To produce strict
1041
+ > PDF/A:
1042
+ >
1043
+ > ```ts
1044
+ > import { registerFont } from 'pdfnative';
1045
+ > registerFont('latin', () => import('pdfnative/fonts/noto-sans-data.js'));
1046
+ > ```
1047
+ >
1048
+ > Run `npm run validate:pdfa` locally (with veraPDF installed, see
1049
+ > [docs/guides/pdfa.html](docs/guides/pdfa.html)) to verify against
1050
+ > the reference validator. CI runs veraPDF as a blocking check.
1024
1051
 
1025
1052
  ### PDF Encryption — Implemented ✅
1026
1053