reamkit 1.29.0 → 1.31.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 +60 -24
- package/dist/esm/core/converter/project.js +3 -1
- package/dist/esm/core/crypto/offcrypto.js +1 -1
- package/dist/esm/core/document-model/index.d.ts +1 -1
- package/dist/esm/core/document-model/types.d.ts +65 -0
- package/dist/esm/core/drawingml/shape-render.js +13 -1
- package/dist/esm/core/font/index.d.ts +2 -0
- package/dist/esm/core/font/ttf-build.d.ts +113 -0
- package/dist/esm/core/font/ttf-build.js +1224 -0
- package/dist/esm/core/font/ttf-subset.d.ts +19 -0
- package/dist/esm/core/font/ttf-subset.js +14 -1
- package/dist/esm/core/fonts/index.d.ts +1 -1
- package/dist/esm/core/fonts/provider.d.ts +17 -0
- package/dist/esm/core/fonts/provider.js +27 -2
- package/dist/esm/core/fonts/remote-fonts.d.ts +8 -0
- package/dist/esm/core/fonts/remote-fonts.js +108 -18
- package/dist/esm/core/ir/flow.d.ts +88 -1
- package/dist/esm/core/numbering/index.d.ts +1 -1
- package/dist/esm/core/numbering/state.d.ts +11 -1
- package/dist/esm/core/numbering/state.js +10 -1
- package/dist/esm/core/style-cascade/resolver.js +35 -4
- package/dist/esm/core/style-cascade/types.d.ts +19 -1
- package/dist/esm/core/style-cascade/types.js +3 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/layout/page-doc.d.ts +10 -3
- package/dist/esm/layout/styled-layout.d.ts +48 -7
- package/dist/esm/layout/styled-layout.js +881 -119
- package/dist/esm/layout/turned-section.d.ts +38 -0
- package/dist/esm/layout/turned-section.js +193 -0
- package/dist/esm/pdf/styled-page-emitter.js +78 -2
- package/dist/esm/pdf-reader/annot-draw.js +93 -1
- package/dist/esm/pdf-reader/annots.d.ts +18 -0
- package/dist/esm/pdf-reader/annots.js +86 -9
- package/dist/esm/pdf-reader/cff-outline.d.ts +27 -0
- package/dist/esm/pdf-reader/cff-outline.js +169 -21
- package/dist/esm/pdf-reader/cmap.js +5 -2
- package/dist/esm/pdf-reader/content.d.ts +70 -4
- package/dist/esm/pdf-reader/content.js +172 -12
- package/dist/esm/pdf-reader/display.d.ts +36 -0
- package/dist/esm/pdf-reader/display.js +82 -1
- package/dist/esm/pdf-reader/document.js +5 -1
- package/dist/esm/pdf-reader/embedded-fonts.d.ts +25 -0
- package/dist/esm/pdf-reader/embedded-fonts.js +78 -9
- package/dist/esm/pdf-reader/encodings.d.ts +8 -0
- package/dist/esm/pdf-reader/encodings.js +25 -3
- package/dist/esm/pdf-reader/face-outlines.d.ts +78 -0
- package/dist/esm/pdf-reader/face-outlines.js +362 -0
- package/dist/esm/pdf-reader/figures.d.ts +52 -0
- package/dist/esm/pdf-reader/figures.js +433 -0
- package/dist/esm/pdf-reader/flow-build.d.ts +224 -7
- package/dist/esm/pdf-reader/flow-build.js +545 -39
- package/dist/esm/pdf-reader/font.d.ts +27 -1
- package/dist/esm/pdf-reader/font.js +632 -63
- package/dist/esm/pdf-reader/glyf-outline.d.ts +33 -0
- package/dist/esm/pdf-reader/glyf-outline.js +148 -3
- package/dist/esm/pdf-reader/glyph-names.js +154 -1
- package/dist/esm/pdf-reader/glyph-shapes.d.ts +18 -0
- package/dist/esm/pdf-reader/glyph-shapes.js +57 -0
- package/dist/esm/pdf-reader/image-decode.js +70 -4
- package/dist/esm/pdf-reader/images.d.ts +5 -0
- package/dist/esm/pdf-reader/images.js +4 -2
- package/dist/esm/pdf-reader/jbig2.d.ts +40 -1
- package/dist/esm/pdf-reader/jbig2.js +78 -16
- package/dist/esm/pdf-reader/jpeg.d.ts +6 -3
- package/dist/esm/pdf-reader/jpeg.js +21 -1
- package/dist/esm/pdf-reader/layout.d.ts +119 -2
- package/dist/esm/pdf-reader/layout.js +2219 -184
- package/dist/esm/pdf-reader/lexer.d.ts +10 -0
- package/dist/esm/pdf-reader/lexer.js +17 -0
- package/dist/esm/pdf-reader/page-numbers.d.ts +53 -0
- package/dist/esm/pdf-reader/page-numbers.js +167 -0
- package/dist/esm/pdf-reader/pattern-tint.d.ts +11 -1
- package/dist/esm/pdf-reader/pattern-tint.js +21 -3
- package/dist/esm/pdf-reader/regions.d.ts +25 -0
- package/dist/esm/pdf-reader/regions.js +167 -0
- package/dist/esm/pdf-reader/shading.d.ts +58 -2
- package/dist/esm/pdf-reader/shading.js +181 -11
- package/dist/esm/pdf-reader/struct-tree.js +112 -8
- package/dist/esm/pdf-reader/tagged.js +207 -28
- package/dist/esm/pdf-reader/text-rules.js +1 -1
- package/dist/esm/pdf-reader/text.d.ts +6 -3
- package/dist/esm/pdf-reader/text.js +106 -22
- package/dist/esm/pdf-reader/type1-outline.d.ts +11 -0
- package/dist/esm/pdf-reader/type1-outline.js +63 -8
- package/dist/esm/pdf-reader/vector.d.ts +8 -2
- package/dist/esm/pdf-reader/vector.js +105 -6
- package/dist/esm/word/doc/doc-reader.js +6 -2
- package/dist/esm/word/doc/doc-text.d.ts +6 -0
- package/dist/esm/word/doc/doc-text.js +19 -1
- package/dist/esm/word/document-parser.d.ts +2 -2
- package/dist/esm/word/document-parser.js +11 -1
- package/dist/esm/word/docx-reader.js +5 -3
- package/dist/esm/word/docx-writer.js +341 -54
- package/dist/esm/word/drawing-parser.d.ts +5 -3
- package/dist/esm/word/drawing-parser.js +56 -10
- package/dist/esm/word/font-embed.d.ts +30 -0
- package/dist/esm/word/font-embed.js +173 -0
- package/dist/esm/word/font-table.d.ts +10 -0
- package/dist/esm/word/font-table.js +13 -1
- package/dist/esm/word/index.js +1 -1
- package/dist/esm/word/numbering-parser.d.ts +3 -1
- package/dist/esm/word/numbering-parser.js +2 -1
- package/dist/esm/word/paragraph-properties.d.ts +7 -6
- package/dist/esm/word/paragraph-properties.js +16 -2
- package/dist/esm/word/run-properties.js +26 -0
- package/package.json +12 -5
|
@@ -7,6 +7,7 @@ import { LaidOutDocument, PageItem } from './page-doc.js';
|
|
|
7
7
|
import { AttachedFile } from '../pdf/embedded-file.js';
|
|
8
8
|
import { SignaturePlaceholder } from '../pdf/signature.js';
|
|
9
9
|
import { PdfEncryptOptions } from '../pdf/encryption.js';
|
|
10
|
+
import { Sheet } from './turned-section.js';
|
|
10
11
|
import { StructTreeBuilder } from '../pdf/struct-tree.js';
|
|
11
12
|
/**
|
|
12
13
|
* PDF/A conformance string: part 1 (ISO 19005-1, PDF 1.4) / 2 (ISO 19005-2) / 3
|
|
@@ -24,15 +25,27 @@ export interface PdfAProfile {
|
|
|
24
25
|
readonly version: '1.4' | '1.7';
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
|
-
* E-PARITY: renderer-compatibility profile
|
|
28
|
-
*
|
|
29
|
-
* `'
|
|
30
|
-
*
|
|
28
|
+
* E-PARITY: renderer-compatibility profile — how lines are measured, broken
|
|
29
|
+
* and stacked.
|
|
30
|
+
* `'ream'` (default) — kerned measuring, Knuth-Plass breaking, and the line
|
|
31
|
+
* height the document asks for (see {@link TypesetBy}).
|
|
32
|
+
* `'word'` — kern-free measuring, first-fit breaking, and lines as Word sets
|
|
33
|
+
* them whatever the document.
|
|
34
|
+
* `'libreoffice'` — first-fit breaking, lines from the face in hand: hhea, or
|
|
35
|
+
* the OS/2 typo line when USE_TYPO_METRICS is set.
|
|
31
36
|
*
|
|
32
|
-
* Opt-in: a profile emulates that renderer
|
|
33
|
-
* parity. It never changes default (`'ream'`) output.
|
|
37
|
+
* Opt-in: a profile emulates that renderer for closer visual parity.
|
|
34
38
|
*/
|
|
35
39
|
export type LayoutProfile = 'ream' | 'word' | 'libreoffice';
|
|
40
|
+
/**
|
|
41
|
+
* The application whose rules a document is set by: `'word'` stands its
|
|
42
|
+
* lines as tall as the faces on them make them (§17.3.1.33, see
|
|
43
|
+
* `fontLeadingPt`) rather than Ream's flat 1.2× of the size, and gives every
|
|
44
|
+
* horizontal table border the room it is wide (§17.4.38, see
|
|
45
|
+
* `withBorderBands`) rather than none. A Word document's reader asks for it
|
|
46
|
+
* (see `FlowDoc.typesetBy`).
|
|
47
|
+
*/
|
|
48
|
+
export type TypesetBy = 'word';
|
|
36
49
|
/**
|
|
37
50
|
* The full option set the layout engine and PDF emitter consume: the resolved
|
|
38
51
|
* font registry, the style/numbering tables, the section model and page
|
|
@@ -46,6 +59,8 @@ export interface StyledRenderOptions {
|
|
|
46
59
|
readonly registry: FontRegistry;
|
|
47
60
|
/** Renderer-compatibility profile for the line-height model (default `'ream'`). */
|
|
48
61
|
readonly layoutProfile?: LayoutProfile;
|
|
62
|
+
/** The application whose rules the document is set by (see {@link TypesetBy}). */
|
|
63
|
+
readonly typesetBy?: TypesetBy;
|
|
49
64
|
/**
|
|
50
65
|
* Per-run font resolution: when supplied, each text run picks the registry of
|
|
51
66
|
* its declared family (sans→arimo / serif→tinos / mono→cousine via the run's
|
|
@@ -173,6 +188,12 @@ export interface StyledRenderOptions {
|
|
|
173
188
|
* TOP margin, not the left.
|
|
174
189
|
*/
|
|
175
190
|
readonly gutterAtTop?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* [MS-DOCX] `compatibilityMode` — the version of Word whose layout the
|
|
193
|
+
* document asks for; a Word document that states none is an older Word's
|
|
194
|
+
* (see {@link legacyTableOutdent}).
|
|
195
|
+
*/
|
|
196
|
+
readonly compatibilityMode?: number;
|
|
176
197
|
/**
|
|
177
198
|
* §7.6 PDF encryption (AES-256, R6). Only honoured on the ASYNC conversion
|
|
178
199
|
* path (WebCrypto); mutually exclusive with `pdfA` (ISO 19005 forbids
|
|
@@ -302,6 +323,12 @@ export interface SectionRenderCtx {
|
|
|
302
323
|
}>;
|
|
303
324
|
readonly headerSet: HeaderFooterSet;
|
|
304
325
|
readonly footerSet: HeaderFooterSet;
|
|
326
|
+
/**
|
|
327
|
+
* §17.10 — where the body starts and ends on a page that shows each band:
|
|
328
|
+
* below the header band and above the footer band that page carries, each
|
|
329
|
+
* as tall as it is. Absent ⇒ every page takes `marginTop`/`marginBottom`.
|
|
330
|
+
*/
|
|
331
|
+
readonly bandMargins?: Readonly<Record<HfBand, BodyMargins>>;
|
|
305
332
|
readonly titlePg: boolean;
|
|
306
333
|
readonly evenAndOddHeaders: boolean;
|
|
307
334
|
/**
|
|
@@ -316,10 +343,24 @@ export interface SectionRenderCtx {
|
|
|
316
343
|
* paragraph in it. Absent on a bare context built outside a layout run.
|
|
317
344
|
*/
|
|
318
345
|
readonly options?: StyledRenderOptions;
|
|
346
|
+
/**
|
|
347
|
+
* §17.6.20 — the sheet a section whose lines run DOWN it prints on. Such a
|
|
348
|
+
* section's body is laid out in the frame its text reads in, which the
|
|
349
|
+
* geometry above describes — the sheet turned back a quarter — and turned
|
|
350
|
+
* onto this sheet page by page, while its header and footer are laid out
|
|
351
|
+
* on the sheet itself (see ./turned-section). Absent ⇒ the frame is the sheet.
|
|
352
|
+
*/
|
|
353
|
+
readonly sheet?: Sheet;
|
|
354
|
+
}
|
|
355
|
+
type HfBand = 'default' | 'first' | 'even';
|
|
356
|
+
/** The distances from the paper's top and bottom edges to the body's. */
|
|
357
|
+
interface BodyMargins {
|
|
358
|
+
readonly top: number;
|
|
359
|
+
readonly bottom: number;
|
|
319
360
|
}
|
|
320
361
|
interface HfBandEntry {
|
|
321
362
|
readonly commands: Array<PageItem>;
|
|
322
|
-
readonly renderDynamic?: (
|
|
363
|
+
readonly renderDynamic?: (pageText: string, totalPages: number) => Array<PageItem>;
|
|
323
364
|
/** Laid-out height of the band, so the body can be kept clear of it. */
|
|
324
365
|
readonly heightPt?: number;
|
|
325
366
|
}
|