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 +51 -24
- package/dist/index.cjs +776 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +146 -4
- package/dist/index.d.ts +146 -4
- package/dist/index.js +770 -260
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +423 -187
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.js +423 -187
- package/dist/worker/index.js.map +1 -1
- package/fonts/noto-emoji-data.d.ts +27 -0
- package/fonts/noto-emoji-data.js +64 -0
- package/fonts/noto-sans-data.d.ts +22 -0
- package/fonts/noto-sans-data.js +64 -0
- package/package.json +2 -1
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 **
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
827
|
-
|
|
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
|
|
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/ #
|
|
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
|
|
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
|
|
1014
|
-
>
|
|
1015
|
-
>
|
|
1016
|
-
>
|
|
1017
|
-
>
|
|
1018
|
-
>
|
|
1019
|
-
>
|
|
1020
|
-
>
|
|
1021
|
-
>
|
|
1022
|
-
>
|
|
1023
|
-
>
|
|
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
|
|