reamkit 1.33.1 → 1.34.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 +13 -10
- package/dist/esm/core/converter/facade.js +1 -0
- package/dist/esm/core/converter/ream.d.ts +6 -6
- package/dist/esm/core/converter/ream.js +11 -5
- package/dist/esm/core/crypto/index.js +1 -2
- package/dist/esm/core/document-model/index.d.ts +1 -1
- package/dist/esm/core/document-model/types.d.ts +15 -0
- package/dist/esm/core/drawingml/text-warp.d.ts +34 -0
- package/dist/esm/core/drawingml/text-warp.js +49 -1
- package/dist/esm/core/font/index.d.ts +1 -1
- package/dist/esm/core/font/index.js +8 -0
- package/dist/esm/core/font/indic-shaper.d.ts +47 -0
- package/dist/esm/core/font/indic-shaper.js +1146 -0
- package/dist/esm/core/font/indic-table.d.ts +12 -0
- package/dist/esm/core/font/indic-table.js +463 -0
- package/dist/esm/core/font/measure.d.ts +45 -4
- package/dist/esm/core/font/measure.js +253 -14
- package/dist/esm/core/font/opentype-lookups.d.ts +214 -0
- package/dist/esm/core/font/opentype-lookups.js +1112 -0
- package/dist/esm/core/fonts/families.d.ts +4 -0
- package/dist/esm/core/fonts/families.js +43 -12
- package/dist/esm/core/fonts/provider.js +1 -0
- package/dist/esm/core/fonts/remote-fonts.d.ts +4 -2
- package/dist/esm/core/fonts/remote-fonts.js +36 -0
- package/dist/esm/core/fonts/scripts.d.ts +19 -0
- package/dist/esm/core/fonts/scripts.js +96 -1
- package/dist/esm/core/numbering/apply.js +12 -8
- package/dist/esm/core/style-cascade/index.d.ts +1 -1
- package/dist/esm/core/style-cascade/index.js +2 -2
- package/dist/esm/core/style-cascade/resolver.d.ts +9 -0
- package/dist/esm/core/style-cascade/resolver.js +31 -3
- package/dist/esm/core/style-cascade/table.js +3 -8
- package/dist/esm/excel/xlsx-to-pdf.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/layout/line-paint.d.ts +5 -4
- package/dist/esm/layout/line-paint.js +6 -5
- package/dist/esm/layout/page-doc.d.ts +26 -0
- package/dist/esm/layout/styled-layout.d.ts +8 -1
- package/dist/esm/layout/styled-layout.js +459 -112
- package/dist/esm/layout/undrawn.d.ts +18 -0
- package/dist/esm/layout/undrawn.js +59 -0
- package/dist/esm/pdf/cid-font.d.ts +5 -0
- package/dist/esm/pdf/cid-font.js +8 -2
- package/dist/esm/pdf/styled-page-emitter.js +117 -28
- package/dist/esm/pdf/text-page-renderer.js +1 -0
- package/dist/esm/pdf-reader/content.d.ts +1 -1
- package/dist/esm/pdf-reader/content.js +48 -13
- package/dist/esm/pdf-reader/embedded-fonts.js +1 -0
- package/dist/esm/pdf-reader/encodings.d.ts +9 -0
- package/dist/esm/pdf-reader/encodings.js +66 -1
- package/dist/esm/pdf-reader/face-outlines.js +1 -0
- package/dist/esm/pdf-reader/text.d.ts +10 -0
- package/dist/esm/pdf-reader/text.js +25 -3
- package/dist/esm/pdf-reader/vector.js +2 -2
- package/dist/esm/pptx/embedded-fonts.js +1 -0
- package/dist/esm/pptx/slide-parser.js +22 -7
- package/dist/esm/pptx/sp-helpers.d.ts +3 -2
- package/dist/esm/pptx/sp-helpers.js +9 -4
- package/dist/esm/svg/svg-text.js +30 -7
- package/dist/esm/word/doc/doc-reader.js +148 -57
- package/dist/esm/word/doc/doc-text.d.ts +80 -11
- package/dist/esm/word/doc/doc-text.js +438 -75
- package/dist/esm/word/document-parser.js +48 -28
- package/dist/esm/word/docx-to-pdf.d.ts +5 -5
- package/dist/esm/word/docx-to-pdf.js +9 -7
- package/dist/esm/word/docx-writer.js +3 -5
- package/dist/esm/word/font-embed.js +1 -0
- package/dist/esm/word/font-table.js +1 -0
- package/dist/esm/word/numbering-parser.js +3 -0
- package/dist/esm/word/paragraph-properties.js +2 -2
- package/dist/esm/word/run-properties.js +2 -2
- package/dist/esm/word/xml-helpers.d.ts +18 -0
- package/dist/esm/word/xml-helpers.js +48 -1
- package/package.json +3 -3
|
@@ -6,6 +6,14 @@ export interface DocCharProps {
|
|
|
6
6
|
readonly underlineKul?: number;
|
|
7
7
|
/** Font size in half-points. */
|
|
8
8
|
readonly sizeHalfPts?: number;
|
|
9
|
+
/** The font of ASCII characters, by name — `sprmCRgFtc0`. */
|
|
10
|
+
readonly fontAscii?: string;
|
|
11
|
+
/** The font of East Asian characters — `sprmCRgFtc1`. */
|
|
12
|
+
readonly fontEastAsia?: string;
|
|
13
|
+
/** The font of the characters neither ASCII nor East Asian — `sprmCRgFtc2`. */
|
|
14
|
+
readonly fontOther?: string;
|
|
15
|
+
/** The font of complex-script characters — `sprmCFtcBi`. */
|
|
16
|
+
readonly fontBi?: string;
|
|
9
17
|
/** The character is special — `sprmCFSpec` (e.g. a picture placeholder). */
|
|
10
18
|
readonly fSpec?: boolean;
|
|
11
19
|
/** `sprmCPicLocation` — offset into the `Data` stream of the picture's PICF. */
|
|
@@ -80,6 +88,8 @@ export interface DocParaProps {
|
|
|
80
88
|
readonly keepNext?: boolean;
|
|
81
89
|
/** `sprmPFKeep` — every line on one page. */
|
|
82
90
|
readonly keepLines?: boolean;
|
|
91
|
+
/** `sprmPFPageBreakBefore` — the paragraph starts a new page. */
|
|
92
|
+
readonly pageBreakBefore?: boolean;
|
|
83
93
|
}
|
|
84
94
|
/** One maximal same-formatting run of text, or an embedded picture. */
|
|
85
95
|
export interface DocRun {
|
|
@@ -87,6 +97,15 @@ export interface DocRun {
|
|
|
87
97
|
readonly props: DocCharProps;
|
|
88
98
|
/** Set instead of `text` when the run is an embedded picture. */
|
|
89
99
|
readonly picture?: DocPicture;
|
|
100
|
+
/** The run is a manual page break (0x0C), alone in a run with no text. */
|
|
101
|
+
readonly pageBreak?: boolean;
|
|
102
|
+
/** The run is a manual column break (0x0E), alone in a run whose text is `\n`. */
|
|
103
|
+
readonly columnBreak?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The run is the result of a PAGE or NUMPAGES field, whose `text` is the
|
|
106
|
+
* number Word cached when it last saved.
|
|
107
|
+
*/
|
|
108
|
+
readonly field?: 'PAGE' | 'NUMPAGES';
|
|
90
109
|
}
|
|
91
110
|
/** One paragraph: its runs plus the decoded paragraph properties. */
|
|
92
111
|
export interface DocParagraph {
|
|
@@ -97,11 +116,59 @@ export interface DocParagraph {
|
|
|
97
116
|
* closes a table cell. With `props.rowEnd` it also closes the row.
|
|
98
117
|
*/
|
|
99
118
|
readonly cellMark?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* The paragraph was ended by the section mark of the (zero-based) section it
|
|
121
|
+
* is the last of — the index into {@link DocContent.sections}.
|
|
122
|
+
*/
|
|
123
|
+
readonly sectionEnd?: number;
|
|
124
|
+
/** The paragraph mark's own character properties: what an empty line is set in. */
|
|
125
|
+
readonly mark?: DocCharProps;
|
|
126
|
+
}
|
|
127
|
+
/** One section of the main document (§2.8.26 PlcfSed): what its SEP says. */
|
|
128
|
+
export interface DocSection {
|
|
129
|
+
/**
|
|
130
|
+
* `sprmSBkc` — where the section starts: 0 on the page in hand, 1 in the next
|
|
131
|
+
* column, 2 on a new page, 3 on an even page, 4 on an odd page. Absent when
|
|
132
|
+
* the SEP says nothing, which is a new page.
|
|
133
|
+
*/
|
|
134
|
+
readonly bkc?: number;
|
|
135
|
+
/** The page size in points (xaPage/yaPage), when present and sane. */
|
|
136
|
+
readonly pageSize?: {
|
|
137
|
+
readonly widthPt: number;
|
|
138
|
+
readonly heightPt: number;
|
|
139
|
+
};
|
|
140
|
+
/** `sprmSFTitlePage` — the first page shows the first-page header and footer. */
|
|
141
|
+
readonly titlePage?: boolean;
|
|
142
|
+
/** The margins the SEP states, in twips; each absent one is Word's default. */
|
|
143
|
+
readonly margins?: DocMargins;
|
|
144
|
+
/**
|
|
145
|
+
* `sprmSFPgnRestart` with `sprmSPgnStart97` — the number the section's first
|
|
146
|
+
* page is printed with, when the section starts its count again; absent, the
|
|
147
|
+
* count runs on from the section before.
|
|
148
|
+
*/
|
|
149
|
+
readonly pageNumberStart?: number;
|
|
150
|
+
/** `sprmSNfcPgn` — the MSONFC the section's page numbers print in; absent, arabic. */
|
|
151
|
+
readonly pageNumberNfc?: number;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A section's margins in twips (§2.6.4 sprmSDxaLeft … sprmSDzaGutter). A top or
|
|
155
|
+
* bottom margin is stored signed, negative for one the header or footer may not
|
|
156
|
+
* push; its size is the same either way.
|
|
157
|
+
*/
|
|
158
|
+
export interface DocMargins {
|
|
159
|
+
readonly leftTwips?: number;
|
|
160
|
+
readonly rightTwips?: number;
|
|
161
|
+
readonly topTwips?: number;
|
|
162
|
+
readonly bottomTwips?: number;
|
|
163
|
+
readonly headerTwips?: number;
|
|
164
|
+
readonly footerTwips?: number;
|
|
165
|
+
readonly gutterTwips?: number;
|
|
100
166
|
}
|
|
101
167
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
168
|
+
* One section's header/footer stories ([MS-DOC] Plcfhdd: six per section, after
|
|
169
|
+
* the six separator stories). `default` is the odd-page (primary) one. A story
|
|
170
|
+
* the section leaves empty is the previous section's, the very same array; one
|
|
171
|
+
* that holds no text is absent.
|
|
105
172
|
*/
|
|
106
173
|
export interface DocHeaderFooters {
|
|
107
174
|
readonly defaultHeader?: ReadonlyArray<DocParagraph>;
|
|
@@ -121,6 +188,8 @@ export interface DocLvl {
|
|
|
121
188
|
readonly nfc: number;
|
|
122
189
|
readonly iStartAt: number;
|
|
123
190
|
readonly xst: ReadonlyArray<number>;
|
|
191
|
+
/** `ixchFollow` — what follows the number text: 0 a tab, 1 a space, 2 nothing. */
|
|
192
|
+
readonly follow: number;
|
|
124
193
|
}
|
|
125
194
|
/**
|
|
126
195
|
* The document's list tables (DOC-10): an LFO → lsid map (a paragraph's 1-based
|
|
@@ -136,23 +205,23 @@ export interface DocListTables {
|
|
|
136
205
|
/** Everything extracted from a `.doc`'s `WordDocument` stream. */
|
|
137
206
|
export interface DocContent {
|
|
138
207
|
readonly paragraphs: ReadonlyArray<DocParagraph>;
|
|
139
|
-
|
|
208
|
+
/** Each section's header/footer stories, in section order. */
|
|
209
|
+
readonly headerFooters?: ReadonlyArray<DocHeaderFooters>;
|
|
210
|
+
/** `Dop.fFacingPages` — even pages show the even header and footer. */
|
|
211
|
+
readonly facingPages?: boolean;
|
|
140
212
|
/** The list tables resolving a paragraph's (ilfo, ilvl) to its number format. */
|
|
141
213
|
readonly listTables?: DocListTables;
|
|
142
214
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
215
|
+
* Every section of the main document, in order, when the PlcfSed is usable. A
|
|
216
|
+
* section with no page size takes the reader's default (US Letter).
|
|
145
217
|
*/
|
|
146
|
-
readonly
|
|
147
|
-
readonly widthPt: number;
|
|
148
|
-
readonly heightPt: number;
|
|
149
|
-
};
|
|
218
|
+
readonly sections?: ReadonlyArray<DocSection>;
|
|
150
219
|
/** The file is encrypted/obfuscated — text cannot be read without the key. */
|
|
151
220
|
readonly encrypted: boolean;
|
|
152
221
|
}
|
|
153
222
|
/**
|
|
154
223
|
* Extract a `.doc`'s `WordDocument` stream into its main-document paragraphs plus
|
|
155
|
-
* the section's header/footer stories, list tables and
|
|
224
|
+
* the section's header/footer stories, list tables and sections.
|
|
156
225
|
* Joins the piece table (CLX → CPs/FCs), CHPX run formatting and PAPX paragraph
|
|
157
226
|
* formatting, splitting at the CR / cell marks. Every offset is bounds-checked, so
|
|
158
227
|
* a structurally odd file yields no text rather than throwing.
|