js.documents 1.56.1 → 1.57.1
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 +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,35 @@
|
|
|
6
6
|
|
|
7
7
|
`documents.js` depends on `ooxml.js` for lossless docx/pptx/xlsx ⇄ JSON handling and extends it in two directions `ooxml.js` deliberately does not cover: full PDF support (parsing arbitrary real-world PDFs and generating new ones), and a read-**and-write** manipulation API for docx/pptx content — `ooxml.js`'s own typed readers (`readDocx`/`readPptx`) are one-way and explicitly forbid write-back. PDF reading, writing, and the docx⇄PDF/pptx⇄PDF conversion pipeline are provided by [`pdf-codec`](https://github.com/ExaDev/pdf-codec), a sibling package extracted from this one: a hand-written, dependency-minimal PDF codec with no external PDF library (`pdf-lib`, `pdfjs-dist`, `mupdf`, or any other) as a dependency — see pdf-codec's own README for how it's built and what it embeds (including the vendored STIX Two Math font this package renders formulas through). `src/mathml/` (the MathML typesetting engine) stays in this package and is hand-written too, for the same "no supply-chain surface beyond what's already declared" reason, but consumes pdf-codec's embedded math font through a structurally-typed port rather than any font-parsing code of its own — see [Architecture](#architecture).
|
|
8
8
|
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TD
|
|
11
|
+
schema("document-schema.js")
|
|
12
|
+
ooxml("ooxml.js")
|
|
13
|
+
odf("odf.js")
|
|
14
|
+
pdfcodec("pdf-codec")
|
|
15
|
+
documents("documents.js")
|
|
16
|
+
cli("document-cli")
|
|
17
|
+
|
|
18
|
+
schema --> ooxml
|
|
19
|
+
schema --> odf
|
|
20
|
+
schema --> pdfcodec
|
|
21
|
+
schema --> documents
|
|
22
|
+
ooxml --> documents
|
|
23
|
+
odf --> documents
|
|
24
|
+
pdfcodec --> documents
|
|
25
|
+
documents --> cli
|
|
26
|
+
odf --> cli
|
|
27
|
+
|
|
28
|
+
click schema "https://github.com/ExaDev/document-schema.js" "document-schema.js"
|
|
29
|
+
click ooxml "https://github.com/ExaDev/ooxml.js" "ooxml.js"
|
|
30
|
+
click odf "https://github.com/ExaDev/odf.js" "odf.js"
|
|
31
|
+
click pdfcodec "https://github.com/ExaDev/pdf-codec" "pdf-codec"
|
|
32
|
+
click documents "https://github.com/ExaDev/documents.js" "documents.js"
|
|
33
|
+
click cli "https://github.com/ExaDev/document-cli" "document-cli"
|
|
34
|
+
|
|
35
|
+
style documents fill:#f9a825,stroke:#333,stroke-width:3px
|
|
36
|
+
```
|
|
37
|
+
|
|
9
38
|
## Why
|
|
10
39
|
|
|
11
40
|
Converting docx/pptx to PDF and back is usually solved by wrapping a mature third-party PDF library. This package takes the opposite approach for the PDF side of the equation: pdf-codec hand-writes every layer of the PDF format — the object model, the cross-reference table, the content-stream operators, standard-font metrics, the parser's cross-reference/object-stream resolution and content-stream interpreter — against the ISO 32000-1 specification, rather than wrapping one. That is a genuinely large undertaking, and it comes with an honest trade-off spelled out in [Fidelity](#fidelity) below and in pdf-codec's own README: this is not, and does not attempt to be, as robust against adversarial or badly malformed real-world PDFs as a library with 15+ years of hardening. What it buys instead is a dependency-free, fully auditable PDF implementation, with `documents.js`'s own supply-chain surface staying limited to `ooxml.js`, `odf.js`, `document-schema.js`, `pdf-codec`, and `fflate`.
|
package/package.json
CHANGED