pdf-codec 3.0.10 → 3.0.11
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 +16 -16
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pdf-codec
|
|
2
2
|
|
|
3
|
-
[](https://github.com/ExaDev/pdf-codec) [](https://www.npmjs.com/package/pdf-codec) [](https://github.com/ExaDev/documents.js/tree/main/packages/pdf-codec) [](https://www.npmjs.com/package/pdf-codec) [](https://www.npmjs.com/package/pdf-codec) [](https://github.com/ExaDev/documents.js/actions)
|
|
4
4
|
|
|
5
5
|
> A hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs into a structured, positioned-content document and generates new PDFs from one, built on its own codec-owned `LayoutDocument` item model and [Zod 4](https://zod.dev) codecs.
|
|
6
6
|
|
|
@@ -39,15 +39,15 @@ graph TD
|
|
|
39
39
|
odf --> cli
|
|
40
40
|
pdfcodec --> cli
|
|
41
41
|
|
|
42
|
-
click schema "https://github.com/ExaDev/document-schema.js" "document-schema.js"
|
|
43
|
-
click ooxml "https://github.com/ExaDev/ooxml.js" "ooxml.js"
|
|
44
|
-
click odf "https://github.com/ExaDev/odf.js" "odf.js"
|
|
45
|
-
click pdfcodec "https://github.com/ExaDev/pdf-codec" "pdf-codec"
|
|
46
|
-
click mdcodec "https://github.com/ExaDev/markdown-codec" "markdown-codec"
|
|
47
|
-
click bytecodec "https://github.com/ExaDev/byte-codec" "byte-codec"
|
|
42
|
+
click schema "https://github.com/ExaDev/documents.js/tree/main/packages/document-schema.js" "document-schema.js"
|
|
43
|
+
click ooxml "https://github.com/ExaDev/documents.js/tree/main/packages/ooxml.js" "ooxml.js"
|
|
44
|
+
click odf "https://github.com/ExaDev/documents.js/tree/main/packages/odf.js" "odf.js"
|
|
45
|
+
click pdfcodec "https://github.com/ExaDev/documents.js/tree/main/packages/pdf-codec" "pdf-codec"
|
|
46
|
+
click mdcodec "https://github.com/ExaDev/documents.js/tree/main/packages/markdown-codec" "markdown-codec"
|
|
47
|
+
click bytecodec "https://github.com/ExaDev/documents.js/tree/main/packages/byte-codec" "byte-codec"
|
|
48
48
|
click documents "https://github.com/ExaDev/documents.js" "documents.js"
|
|
49
|
-
click mcp "https://github.com/ExaDev/document-mcp" "document-mcp"
|
|
50
|
-
click cli "https://github.com/ExaDev/document-cli" "document-cli"
|
|
49
|
+
click mcp "https://github.com/ExaDev/documents.js/tree/main/packages/document-mcp" "document-mcp"
|
|
50
|
+
click cli "https://github.com/ExaDev/documents.js/tree/main/packages/document-cli" "document-cli"
|
|
51
51
|
|
|
52
52
|
style pdfcodec fill:#f9a825,stroke:#333,stroke-width:3px
|
|
53
53
|
```
|
|
@@ -174,7 +174,7 @@ const image = decodeJpeg2000(jp2OrCodestreamBytes); // -> { width, height, bitDe
|
|
|
174
174
|
|
|
175
175
|
Both accept a whole JP2 file or a bare codestream; `decodeJpeg2000` takes an optional `onWarning` for recoverable cases and throws `Jpeg2000UnsupportedError` for anything outside [JPEG 2000 scope](#jpeg-2000-scope). Inside a PDF none of this needs calling: `readPdf` decodes a `/JPXDecode` image XObject through the same path automatically.
|
|
176
176
|
|
|
177
|
-
The generic byte- and image-container primitives (`crc32`, `deflate`/`inflate`/`inflateTolerant`, `ByteReader`/`ByteWriter`/`concatBytes`, `readJpegInfo`, `decodePng`/`encodePng`, `unfilterScanlines`/`filterScanlines`) are re-exported from [byte-codec](
|
|
177
|
+
The generic byte- and image-container primitives (`crc32`, `deflate`/`inflate`/`inflateTolerant`, `ByteReader`/`ByteWriter`/`concatBytes`, `readJpegInfo`, `decodePng`/`encodePng`, `unfilterScanlines`/`filterScanlines`) are re-exported from [byte-codec](../byte-codec/README.md). The PDF-specific image codecs (`decodeCcittFax`, `decodeJbig2Embedded`, `decodeJpeg2000`/`readJpeg2000Metadata`/`parseJp2Container`) stay here.
|
|
178
178
|
|
|
179
179
|
Every module under `src/` is also deep-importable directly by its own subpath:
|
|
180
180
|
|
|
@@ -275,13 +275,11 @@ A differential test pins the *set* of template positions and offsets but not the
|
|
|
275
275
|
|
|
276
276
|
## Release and publishing
|
|
277
277
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
Whether that release actually published a new version is detected by diffing `package.json`'s version before and after the release step. Two further jobs gate on that: one republishes the same build under the scoped `@exadev/pdf-codec` alias to GitHub Packages (authenticating with `GITHUB_TOKEN`), and one packs the release, generates an SPDX SBOM (`pnpm sbom`), and signs both an SBOM and a build-provenance attestation against that exact tarball — verifiable independently of the registry, and still present if the package is later unpublished.
|
|
278
|
+
Release, CI, and commit-message conventions are all workspace-wide, not package-local — see the [monorepo root README](../../README.md#releases) for the mechanism (topological per-package `semantic-release` via `@exadev/semantic-release-workspace`, OIDC trusted npm publishing, automatic sibling dependency-range rewriting) and its [known gap](../../README.md#releases) note on GitHub Packages republishing and SBOM/provenance signing, both dropped in the migration to this monorepo and not yet restored.
|
|
281
279
|
|
|
282
280
|
## Contributing
|
|
283
281
|
|
|
284
|
-
|
|
282
|
+
Conventional Commits, enforced workspace-wide by commitlint through a root `commit-msg` hook. Work inside `packages/pdf-codec/`; see the [root README](../../README.md#contributing) for the shared git hooks and history conventions. The package's own scripts are turbo-wrapped:
|
|
285
283
|
|
|
286
284
|
```sh
|
|
287
285
|
pnpm build # tsdown (ESM + CJS + .d.ts)
|
|
@@ -298,18 +296,20 @@ There is a single `main` branch and no open pull request workflow established so
|
|
|
298
296
|
## References
|
|
299
297
|
|
|
300
298
|
- [documents.js](https://github.com/ExaDev/documents.js) — the package this codec was extracted from, and its principal downstream consumer: docx/pptx/odt/odp/ods/odg ⇄ PDF conversion, and MathML formula rendering (its own `src/mathml/` typesetting engine feeds a real `MathBox` into this package's `writePdf({ formulas })` with zero cast).
|
|
301
|
-
- [document-schema.js](
|
|
299
|
+
- [document-schema.js](../document-schema.js/README.md) — the sibling package that owns the canonical `ContentDocument`/`DocumentPackage` pivots the wider family shares, plus the shared leaf shapes and port types this package imports (`Color`, `LayoutFont`, `LayoutMetadata`, `TextMeasurer`, the math family). The `LayoutDocument` item family itself lived there until moving into this package.
|
|
302
300
|
- [qpdf](https://qpdf.sourceforge.io/) — the independent implementation that produces this package's encrypted-PDF test fixtures. A build-time and test-time tool only, never a dependency of the package itself.
|
|
303
301
|
- The specifications `src/crypto/` implements, each cited in the module that implements it and checked against published conformance vectors: [RFC 1321](https://www.rfc-editor.org/rfc/rfc1321) (MD5), [FIPS 180-4](https://csrc.nist.gov/pubs/fips/180-4/upd1/final) (SHA-256/384/512), [FIPS 197](https://csrc.nist.gov/pubs/fips/197/final) (AES), and [NIST SP 800-38A](https://csrc.nist.gov/pubs/sp/800/38/a/final) (CBC mode). The standard security handler is ISO 32000-1 7.6, extended for revisions 5 and 6 by ISO 32000-2 7.6.4.3.
|
|
304
302
|
- [STIX Two Math](https://github.com/stipub/stixfonts) — the embedded math font, vendored at `assets/fonts/STIXTwoMath-Regular.otf` and embedded into `dist/` as a base64 string (`src/assets/stix-two-math-font.ts`, generated by `scripts/generate-math-font-asset.mjs`). Copyright 2001-2021 The STIX Fonts Project Authors, licensed [OFL-1.1](assets/fonts/OFL.txt) — see `assets/fonts/NOTICE.md` for the exact source commit and version.
|
|
305
303
|
|
|
306
304
|
## npm aliases
|
|
307
305
|
|
|
308
|
-
This package also
|
|
306
|
+
This package also published under the following alternate npm names from the pre-monorepo pipeline:
|
|
309
307
|
|
|
310
308
|
- [pdf-codec.js](https://www.npmjs.com/package/pdf-codec.js)
|
|
311
309
|
- [pdf-parser.js](https://www.npmjs.com/package/pdf-parser.js)
|
|
312
310
|
|
|
311
|
+
**Frozen since the monorepo migration** — see the [root README's release note](../../README.md#releases): the alias republish step was dropped along with GitHub Packages mirroring and SBOM/provenance signing, and nothing today keeps either name in sync with `pdf-codec`'s own releases. Tracked in [ExaDev/documents.js#729](https://github.com/ExaDev/documents.js/issues/729).
|
|
312
|
+
|
|
313
313
|
## License
|
|
314
314
|
|
|
315
315
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-codec",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"description": "Hand-written, dependency-minimal PDF codec: parses arbitrary real-world PDFs and generates new ones, built on its own codec-owned LayoutDocument item model and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"license": "MIT",
|
|
82
82
|
"packageManager": "pnpm@11.6.0",
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"byte-codec": "^1.1.
|
|
85
|
-
"document-schema.js": "^4.3.
|
|
84
|
+
"byte-codec": "^1.1.12",
|
|
85
|
+
"document-schema.js": "^4.3.6",
|
|
86
86
|
"fflate": "^0.8.3",
|
|
87
87
|
"zod": "^4.4.3"
|
|
88
88
|
},
|