pdfnative 1.2.0 → 1.4.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 +151 -39
- package/dist/index.cjs +4062 -776
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1107 -30
- package/dist/index.d.ts +1107 -30
- package/dist/index.js +4029 -777
- package/dist/index.js.map +1 -1
- package/dist/tools/build-emoji-font.js +1139 -0
- package/dist/worker/index.cjs +2084 -121
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.js +2084 -121
- package/dist/worker/index.js.map +1 -1
- package/fonts/noto-color-emoji-data.d.ts +28 -0
- package/fonts/noto-color-emoji-data.js +26 -0
- package/fonts/noto-ethiopic-data.d.ts +13 -0
- package/fonts/noto-ethiopic-data.js +64 -0
- package/fonts/noto-khmer-data.d.ts +13 -0
- package/fonts/noto-khmer-data.js +64 -0
- package/fonts/noto-myanmar-data.d.ts +13 -0
- package/fonts/noto-myanmar-data.js +64 -0
- package/fonts/noto-sinhala-data.d.ts +13 -0
- package/fonts/noto-sinhala-data.js +64 -0
- package/fonts/noto-telugu-data.d.ts +13 -0
- package/fonts/noto-telugu-data.js +64 -0
- package/fonts/noto-tibetan-data.d.ts +13 -0
- package/fonts/noto-tibetan-data.js +64 -0
- package/package.json +38 -7
package/dist/index.d.cts
CHANGED
|
@@ -33,6 +33,122 @@ interface FontData {
|
|
|
33
33
|
readonly mark1Anchors: Record<number, Record<number, [number, number]>>;
|
|
34
34
|
readonly mark2Classes: Record<number, [number, number, number]>;
|
|
35
35
|
} | null;
|
|
36
|
+
/**
|
|
37
|
+
* Colour glyph table (COLR/CPAL), keyed by base glyph id. Present only
|
|
38
|
+
* for colour fonts such as Noto Color Emoji (opt-in via the
|
|
39
|
+
* `'emoji-color'` lang). Each entry is an ordered list of paint layers
|
|
40
|
+
* resolved against the font's CPAL palette (painter's algorithm).
|
|
41
|
+
* `undefined`/`null` for ordinary monochrome fonts. (v1.3.0)
|
|
42
|
+
*/
|
|
43
|
+
readonly colorGlyphs?: Record<number, ColorGlyph> | null;
|
|
44
|
+
}
|
|
45
|
+
/** An sRGB colour with alpha, each channel 0–255. Resolved from CPAL. */
|
|
46
|
+
type CpalColor = readonly [number, number, number, number];
|
|
47
|
+
/** A gradient colour stop: `offset` in [0,1] with a resolved colour. */
|
|
48
|
+
interface ColorStop {
|
|
49
|
+
readonly offset: number;
|
|
50
|
+
readonly color: CpalColor;
|
|
51
|
+
}
|
|
52
|
+
/** How a gradient extends beyond its [0,1] range (COLR Extend / PDF Extend). */
|
|
53
|
+
type GradientExtend = 'pad' | 'repeat' | 'reflect';
|
|
54
|
+
/** A flat colour fill (COLR PaintSolid / COLRv0 layer). */
|
|
55
|
+
interface SolidPaint {
|
|
56
|
+
readonly kind: 'solid';
|
|
57
|
+
readonly color: CpalColor;
|
|
58
|
+
}
|
|
59
|
+
/** A linear (axial) gradient fill (COLR PaintLinearGradient → PDF Shading 2). */
|
|
60
|
+
interface LinearGradientPaint {
|
|
61
|
+
readonly kind: 'linear';
|
|
62
|
+
readonly p0: readonly [number, number];
|
|
63
|
+
readonly p1: readonly [number, number];
|
|
64
|
+
readonly stops: readonly ColorStop[];
|
|
65
|
+
readonly extend: GradientExtend;
|
|
66
|
+
}
|
|
67
|
+
/** A radial gradient fill (COLR PaintRadialGradient → PDF Shading 3). */
|
|
68
|
+
interface RadialGradientPaint {
|
|
69
|
+
readonly kind: 'radial';
|
|
70
|
+
readonly c0: readonly [number, number];
|
|
71
|
+
readonly r0: number;
|
|
72
|
+
readonly c1: readonly [number, number];
|
|
73
|
+
readonly r1: number;
|
|
74
|
+
readonly stops: readonly ColorStop[];
|
|
75
|
+
readonly extend: GradientExtend;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A sweep (conic/angular) gradient fill (COLR PaintSweepGradient).
|
|
79
|
+
*
|
|
80
|
+
* PDF has no native conic shading, so the renderer approximates it as a fan
|
|
81
|
+
* of flat-colour triangular wedges clipped to the glyph outline — pure path
|
|
82
|
+
* operators, no shading resource. Angles are in counter-clockwise degrees
|
|
83
|
+
* from the positive x-axis.
|
|
84
|
+
*
|
|
85
|
+
* @since 1.4.0
|
|
86
|
+
*/
|
|
87
|
+
interface SweepGradientPaint {
|
|
88
|
+
readonly kind: 'sweep';
|
|
89
|
+
readonly center: readonly [number, number];
|
|
90
|
+
readonly startAngle: number;
|
|
91
|
+
readonly endAngle: number;
|
|
92
|
+
readonly stops: readonly ColorStop[];
|
|
93
|
+
readonly extend: GradientExtend;
|
|
94
|
+
}
|
|
95
|
+
/** A paint used to fill a colour-glyph layer. */
|
|
96
|
+
type ColorPaint = SolidPaint | LinearGradientPaint | RadialGradientPaint | SweepGradientPaint;
|
|
97
|
+
/** A single colour-glyph layer: a base outline filled by a paint. */
|
|
98
|
+
interface ColorLayer {
|
|
99
|
+
/** Glyph id of the base outline (in the font's `glyf` table). */
|
|
100
|
+
readonly glyphId: number;
|
|
101
|
+
/** The fill applied to the outline. */
|
|
102
|
+
readonly paint: ColorPaint;
|
|
103
|
+
/**
|
|
104
|
+
* Optional affine transform `[a b c d e f]` (font-unit space) applied to
|
|
105
|
+
* both the outline and the paint geometry of this layer — flattened from
|
|
106
|
+
* COLRv1 `PaintTransform`/`PaintTranslate`/`PaintScale`. Identity when
|
|
107
|
+
* absent.
|
|
108
|
+
*/
|
|
109
|
+
readonly transform?: readonly [number, number, number, number, number, number];
|
|
110
|
+
/**
|
|
111
|
+
* Optional PDF blend mode name (`/BM`) for this layer, flattened from a
|
|
112
|
+
* COLRv1 `PaintComposite` whose composite mode maps to a separable or
|
|
113
|
+
* non-separable PDF blend mode (e.g. `Multiply`, `Screen`, `Overlay`,
|
|
114
|
+
* `Darken`, `Lighten`, `Difference`, `Hue`, `Luminosity`). Absent =
|
|
115
|
+
* `Normal`. Porter-Duff structural modes (Clear/Src/Dest/Xor) are not
|
|
116
|
+
* mapped — those glyphs fall back to the monochrome font instead.
|
|
117
|
+
*
|
|
118
|
+
* @since 1.4.0
|
|
119
|
+
*/
|
|
120
|
+
readonly blendMode?: string;
|
|
121
|
+
}
|
|
122
|
+
/** A resolved colour glyph: ordered layers painted back-to-front. */
|
|
123
|
+
interface ColorGlyph {
|
|
124
|
+
readonly layers: readonly ColorLayer[];
|
|
125
|
+
}
|
|
126
|
+
/** A colour-emoji Form XObject collected during content building. */
|
|
127
|
+
interface ColorEmojiForm {
|
|
128
|
+
/** Resource name (without leading `/`), e.g. `CEm0`. */
|
|
129
|
+
readonly name: string;
|
|
130
|
+
/** Form XObject content stream (font-unit space). */
|
|
131
|
+
readonly content: string;
|
|
132
|
+
/** Inline `/Resources` body (shadings + ExtGStates), may be empty. */
|
|
133
|
+
readonly resources: string;
|
|
134
|
+
/** Form BBox `[x0 y0 x1 y1]` in font units. */
|
|
135
|
+
readonly bbox: readonly [number, number, number, number];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Collects unique colour-emoji glyphs encountered while building a document's
|
|
139
|
+
* content streams, de-duplicating them into a shared set of Form XObjects.
|
|
140
|
+
* Present on the {@link EncodingContext} only when an `'emoji-color'` font
|
|
141
|
+
* (a {@link FontData} carrying `colorGlyphs`) is registered. (v1.3.0)
|
|
142
|
+
*/
|
|
143
|
+
interface ColorEmojiCollector {
|
|
144
|
+
/**
|
|
145
|
+
* Register use of a colour glyph and return its Form resource name, or
|
|
146
|
+
* `null` when `gid` is not a colour glyph (caller falls back to normal
|
|
147
|
+
* text rendering).
|
|
148
|
+
*/
|
|
149
|
+
useGlyph(fontData: FontData, gid: number): string | null;
|
|
150
|
+
/** The de-duplicated colour-emoji forms, in first-use order. */
|
|
151
|
+
readonly forms: ColorEmojiForm[];
|
|
36
152
|
}
|
|
37
153
|
/** A font entry binding FontData to a PDF font reference. */
|
|
38
154
|
interface FontEntry {
|
|
@@ -67,6 +183,12 @@ interface EncodingContext {
|
|
|
67
183
|
readonly f2: string;
|
|
68
184
|
readonly fontData?: FontData;
|
|
69
185
|
readonly getUsedGids?: () => Map<string, Set<number>>;
|
|
186
|
+
/**
|
|
187
|
+
* Colour-emoji collector — present only when an `'emoji-color'` font
|
|
188
|
+
* (carrying `colorGlyphs`) is registered. Used by the text emitter to
|
|
189
|
+
* draw colour-emoji Form XObjects inline. (v1.3.0)
|
|
190
|
+
*/
|
|
191
|
+
readonly colorEmoji?: ColorEmojiCollector;
|
|
70
192
|
}
|
|
71
193
|
/** A single row in the PDF table. */
|
|
72
194
|
interface PdfRow {
|
|
@@ -172,6 +294,14 @@ interface ColumnDef {
|
|
|
172
294
|
* @since 1.2.0
|
|
173
295
|
*/
|
|
174
296
|
readonly kind?: 'amount';
|
|
297
|
+
/**
|
|
298
|
+
* Vertical alignment of this column's cell content within the row band
|
|
299
|
+
* (`'top'` | `'middle'` | `'bottom'`). Overrides the table-level
|
|
300
|
+
* `TableBlock.cellVAlign`. When omitted, the historic baseline placement is
|
|
301
|
+
* preserved (byte-identical to pre-1.4.0).
|
|
302
|
+
* @since 1.4.0
|
|
303
|
+
*/
|
|
304
|
+
readonly vAlign?: 'top' | 'middle' | 'bottom';
|
|
175
305
|
}
|
|
176
306
|
/**
|
|
177
307
|
* Options for generating a PDF in a Web Worker via `generatePDFInWorker()`.
|
|
@@ -301,6 +431,112 @@ interface PdfLayoutOptions {
|
|
|
301
431
|
* Default: undefined (no attachments).
|
|
302
432
|
*/
|
|
303
433
|
readonly attachments?: readonly PdfAttachment[];
|
|
434
|
+
/**
|
|
435
|
+
* Maximum number of document blocks `buildDocumentPDF` / `buildDocumentPDFBytes`
|
|
436
|
+
* (and the streaming variants) will accept before throwing. This is a
|
|
437
|
+
* safety rail against accidental unbounded input, not a hard engine limit —
|
|
438
|
+
* raise it for very large generated reports (e.g. multi-thousand-page
|
|
439
|
+
* medical or financial documents).
|
|
440
|
+
*
|
|
441
|
+
* Default: `DEFAULT_MAX_BLOCKS` (100 000), matching the table builder's
|
|
442
|
+
* 100 000-row ceiling. Has no effect on the table builder (`buildPDF`).
|
|
443
|
+
*
|
|
444
|
+
* @since 1.3.0
|
|
445
|
+
*/
|
|
446
|
+
readonly maxBlocks?: number;
|
|
447
|
+
/**
|
|
448
|
+
* Apply Unicode normalization to all rendered text before shaping and
|
|
449
|
+
* encoding. Uses the native `String.prototype.normalize` (zero dependency).
|
|
450
|
+
*
|
|
451
|
+
* Useful when input text may contain decomposed combining sequences (e.g.
|
|
452
|
+
* Vietnamese, some Indic input, or text copied from macOS which favours
|
|
453
|
+
* NFD) so that base + combining marks compose to the precomposed code
|
|
454
|
+
* points a font's cmap is most likely to cover, maximising glyph coverage.
|
|
455
|
+
*
|
|
456
|
+
* - `'NFC'` (recommended): canonical composition
|
|
457
|
+
* - `'NFD'`: canonical decomposition
|
|
458
|
+
* - `'NFKC'` / `'NFKD'`: compatibility (de)composition
|
|
459
|
+
* - `false` / omitted: no normalization (default — output is byte-identical)
|
|
460
|
+
*
|
|
461
|
+
* Default: `false` (backward compatible, byte-stable).
|
|
462
|
+
*
|
|
463
|
+
* @since 1.3.0
|
|
464
|
+
*/
|
|
465
|
+
readonly normalize?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | false;
|
|
466
|
+
/**
|
|
467
|
+
* Override the PDF creation date embedded in `/Info /CreationDate` and
|
|
468
|
+
* XMP metadata. Accepts any `Date` object.
|
|
469
|
+
*
|
|
470
|
+
* When omitted, defaults to `new Date()` at build time. Pinning this
|
|
471
|
+
* value makes output byte-identical across repeated calls — useful for
|
|
472
|
+
* deterministic tests and content-addressable storage.
|
|
473
|
+
*
|
|
474
|
+
* Default: `undefined` (current wall-clock time).
|
|
475
|
+
*
|
|
476
|
+
* @since 1.3.0
|
|
477
|
+
*/
|
|
478
|
+
readonly creationDate?: Date;
|
|
479
|
+
/**
|
|
480
|
+
* How a conforming viewer should present the document when it is first
|
|
481
|
+
* opened: initial page layout, page mode (bookmark/thumbnail panel, full
|
|
482
|
+
* screen…), window fit/centering, UI-chrome visibility, and whether the
|
|
483
|
+
* window title shows the document title. Maps to catalog `/PageLayout`,
|
|
484
|
+
* `/PageMode`, and the `/ViewerPreferences` dictionary (ISO 32000-1 §12.2).
|
|
485
|
+
*
|
|
486
|
+
* Purely presentational, PDF/A-safe, and fully optional. When the document
|
|
487
|
+
* also has an outline, an explicit `pageMode` here overrides the outline's
|
|
488
|
+
* default `/UseOutlines`.
|
|
489
|
+
*
|
|
490
|
+
* Default: `undefined` (viewer default presentation).
|
|
491
|
+
*
|
|
492
|
+
* @since 1.4.0
|
|
493
|
+
*/
|
|
494
|
+
readonly viewerPreferences?: ViewerPreferences;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Viewer presentation preferences (ISO 32000-1 §12.2, Table 150 + §7.7.2).
|
|
498
|
+
* Every field is optional; omitted fields leave the viewer's default behaviour
|
|
499
|
+
* unchanged. Purely presentational and PDF/A-safe.
|
|
500
|
+
*
|
|
501
|
+
* @since 1.4.0
|
|
502
|
+
*/
|
|
503
|
+
interface ViewerPreferences {
|
|
504
|
+
/**
|
|
505
|
+
* Initial page layout (catalog `/PageLayout`):
|
|
506
|
+
* - `'singlePage'`: one page at a time
|
|
507
|
+
* - `'oneColumn'`: continuous single column
|
|
508
|
+
* - `'twoColumnLeft'` / `'twoColumnRight'`: continuous two columns, odd pages on the left/right
|
|
509
|
+
* - `'twoPageLeft'` / `'twoPageRight'`: two pages at a time, odd pages on the left/right
|
|
510
|
+
*/
|
|
511
|
+
readonly pageLayout?: 'singlePage' | 'oneColumn' | 'twoColumnLeft' | 'twoColumnRight' | 'twoPageLeft' | 'twoPageRight';
|
|
512
|
+
/**
|
|
513
|
+
* Initial page mode (catalog `/PageMode`):
|
|
514
|
+
* - `'useNone'`: neither bookmarks nor thumbnails visible
|
|
515
|
+
* - `'useOutlines'`: bookmark panel open
|
|
516
|
+
* - `'useThumbs'`: thumbnail panel open
|
|
517
|
+
* - `'fullScreen'`: full-screen, no menu/panel
|
|
518
|
+
* - `'useOC'`: optional-content (layers) panel
|
|
519
|
+
* - `'useAttachments'`: attachments panel
|
|
520
|
+
*/
|
|
521
|
+
readonly pageMode?: 'useNone' | 'useOutlines' | 'useThumbs' | 'fullScreen' | 'useOC' | 'useAttachments';
|
|
522
|
+
/** Hide the viewer's tool bars. */
|
|
523
|
+
readonly hideToolbar?: boolean;
|
|
524
|
+
/** Hide the viewer's menu bar. */
|
|
525
|
+
readonly hideMenubar?: boolean;
|
|
526
|
+
/** Hide UI elements (scrollbars, navigation controls), leaving only the page. */
|
|
527
|
+
readonly hideWindowUI?: boolean;
|
|
528
|
+
/** Resize the document window to fit the first displayed page. */
|
|
529
|
+
readonly fitWindow?: boolean;
|
|
530
|
+
/** Centre the document window on the screen. */
|
|
531
|
+
readonly centerWindow?: boolean;
|
|
532
|
+
/** Show the document title (from `/Info /Title`) in the window title bar. */
|
|
533
|
+
readonly displayDocTitle?: boolean;
|
|
534
|
+
/** Page mode to use when exiting full-screen (`/NonFullScreenPageMode`). */
|
|
535
|
+
readonly nonFullScreenPageMode?: 'useNone' | 'useOutlines' | 'useThumbs' | 'useOC';
|
|
536
|
+
/** Predominant reading order: left-to-right (default) or right-to-left. */
|
|
537
|
+
readonly direction?: 'l2r' | 'r2l';
|
|
538
|
+
/** Page-scaling default for the Print dialog (`/PrintScaling`). */
|
|
539
|
+
readonly printScaling?: 'none' | 'appDefault';
|
|
304
540
|
}
|
|
305
541
|
/**
|
|
306
542
|
* Relationship of an embedded file to the PDF document (ISO 19005-3 §6.8).
|
|
@@ -754,6 +990,31 @@ declare function buildAppearanceStreamDict(w: number, h: number, streamLength: n
|
|
|
754
990
|
*/
|
|
755
991
|
declare function buildRadioGroupParent(name: string, selectedValue: string, childObjNums: readonly number[], readOnly: boolean, required: boolean): string;
|
|
756
992
|
|
|
993
|
+
/**
|
|
994
|
+
* pdfnative — Page Labels (ISO 32000-1 §12.4.2)
|
|
995
|
+
* ==============================================
|
|
996
|
+
* Builds the `/PageLabels` number tree placed in the document catalog.
|
|
997
|
+
* Page labels control the page numbering shown in a viewer's page-number
|
|
998
|
+
* box and thumbnails (e.g. roman-numeral front matter `i, ii, iii`,
|
|
999
|
+
* decimal body `1, 2, 3`, prefixed appendices `A-1, A-2`).
|
|
1000
|
+
*
|
|
1001
|
+
* The builder is **pure** and emits an inline dictionary string — page
|
|
1002
|
+
* labels require no indirect objects. Output is PDF/A-safe.
|
|
1003
|
+
*/
|
|
1004
|
+
/** Page-numbering style for a {@link PageLabelRange}. */
|
|
1005
|
+
type PageLabelStyle = 'decimal' | 'roman' | 'Roman' | 'alpha' | 'Alpha' | 'none';
|
|
1006
|
+
/** A contiguous run of pages sharing a numbering scheme. */
|
|
1007
|
+
interface PageLabelRange {
|
|
1008
|
+
/** 0-based index of the first page in this range. */
|
|
1009
|
+
readonly startPage: number;
|
|
1010
|
+
/** Numbering style. Omit or use `'none'` for prefix-only labels. */
|
|
1011
|
+
readonly style?: PageLabelStyle;
|
|
1012
|
+
/** Optional label prefix (e.g. `'A-'`). */
|
|
1013
|
+
readonly prefix?: string;
|
|
1014
|
+
/** First numeric value in the range (default `1`). */
|
|
1015
|
+
readonly start?: number;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
757
1018
|
/**
|
|
758
1019
|
* pdfnative — Document Content Model Types
|
|
759
1020
|
* ==========================================
|
|
@@ -869,14 +1130,77 @@ interface TableBlock {
|
|
|
869
1130
|
* @since 1.2.0
|
|
870
1131
|
*/
|
|
871
1132
|
readonly cellPadding?: number;
|
|
1133
|
+
/**
|
|
1134
|
+
* Draw borders around each header/data cell. When omitted, no cell borders
|
|
1135
|
+
* are drawn (byte-identical to pre-1.4.0 — the table keeps only its header
|
|
1136
|
+
* underline and row separators). See {@link CellBorders}.
|
|
1137
|
+
*
|
|
1138
|
+
* @since 1.4.0
|
|
1139
|
+
*/
|
|
1140
|
+
readonly cellBorders?: CellBorders;
|
|
1141
|
+
/**
|
|
1142
|
+
* Vertical alignment of cell content within the row band: `'top'`,
|
|
1143
|
+
* `'middle'`, or `'bottom'`. A per-column {@link ColumnDef.vAlign} overrides
|
|
1144
|
+
* this. When omitted, the historic baseline placement is preserved exactly
|
|
1145
|
+
* (byte-identical to pre-1.4.0).
|
|
1146
|
+
*
|
|
1147
|
+
* @since 1.4.0
|
|
1148
|
+
*/
|
|
1149
|
+
readonly cellVAlign?: 'top' | 'middle' | 'bottom';
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Per-cell border configuration for a {@link TableBlock}. All sides are off by
|
|
1153
|
+
* default; enable individual sides or use `all: true`. Pure vector strokes
|
|
1154
|
+
* (`re`/`l`/`S`), so output stays PDF/A-safe.
|
|
1155
|
+
*
|
|
1156
|
+
* @since 1.4.0
|
|
1157
|
+
*/
|
|
1158
|
+
interface CellBorders {
|
|
1159
|
+
/** Draw the top edge of each cell. */
|
|
1160
|
+
readonly top?: boolean;
|
|
1161
|
+
/** Draw the right edge of each cell. */
|
|
1162
|
+
readonly right?: boolean;
|
|
1163
|
+
/** Draw the bottom edge of each cell. */
|
|
1164
|
+
readonly bottom?: boolean;
|
|
1165
|
+
/** Draw the left edge of each cell. */
|
|
1166
|
+
readonly left?: boolean;
|
|
1167
|
+
/** Draw all four edges (shorthand; overrides the individual side flags). */
|
|
1168
|
+
readonly all?: boolean;
|
|
1169
|
+
/** Stroke colour. Default: `'0.8 0.8 0.8'` (light grey). */
|
|
1170
|
+
readonly color?: PdfColor;
|
|
1171
|
+
/** Stroke width in points. Default: `0.5`. */
|
|
1172
|
+
readonly width?: number;
|
|
1173
|
+
/** Stroke style. Default: `'solid'`. */
|
|
1174
|
+
readonly style?: 'solid' | 'dashed' | 'dotted';
|
|
872
1175
|
}
|
|
873
1176
|
/** List block — bullet or numbered items. */
|
|
874
1177
|
interface ListBlock {
|
|
875
1178
|
readonly type: 'list';
|
|
876
|
-
|
|
1179
|
+
/**
|
|
1180
|
+
* List entries. Each entry is either a plain string (leaf item) or a
|
|
1181
|
+
* {@link ListItem} object that can carry its own nested sub-list, enabling
|
|
1182
|
+
* hierarchical (multi-level) bullet/numbered lists. Plain strings and
|
|
1183
|
+
* nested objects may be freely mixed. Passing only strings is byte-identical
|
|
1184
|
+
* to the pre-1.4.0 flat-list behaviour.
|
|
1185
|
+
*/
|
|
1186
|
+
readonly items: readonly (string | ListItem)[];
|
|
877
1187
|
readonly style: 'bullet' | 'numbered';
|
|
878
1188
|
readonly fontSize?: number;
|
|
879
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* A single hierarchical list entry: text plus an optional nested sub-list.
|
|
1192
|
+
* Used by {@link ListBlock} to build multi-level outlines (bullets within
|
|
1193
|
+
* bullets, numbered sub-items, …). Sub-items inherit the parent list's
|
|
1194
|
+
* `style`; numbered sub-lists restart their numbering at 1.
|
|
1195
|
+
*
|
|
1196
|
+
* @since 1.4.0
|
|
1197
|
+
*/
|
|
1198
|
+
interface ListItem {
|
|
1199
|
+
/** The item's text content. */
|
|
1200
|
+
readonly text: string;
|
|
1201
|
+
/** Optional nested child entries (recursive). */
|
|
1202
|
+
readonly items?: readonly (string | ListItem)[];
|
|
1203
|
+
}
|
|
880
1204
|
/** Spacer block — vertical whitespace. */
|
|
881
1205
|
interface SpacerBlock {
|
|
882
1206
|
readonly type: 'spacer';
|
|
@@ -993,6 +1317,38 @@ interface DocumentMetadata {
|
|
|
993
1317
|
readonly subject?: string;
|
|
994
1318
|
readonly keywords?: string;
|
|
995
1319
|
}
|
|
1320
|
+
/**
|
|
1321
|
+
* A document outline (bookmark) entry — ISO 32000-1 §12.3.3.
|
|
1322
|
+
*
|
|
1323
|
+
* Outline items form a navigable tree shown in a viewer's bookmarks
|
|
1324
|
+
* panel. Each item points at a 0-based page index and may nest children.
|
|
1325
|
+
* Bookmarks are purely navigational and PDF/A-safe.
|
|
1326
|
+
*
|
|
1327
|
+
* @since 1.4.0
|
|
1328
|
+
*/
|
|
1329
|
+
interface OutlineItem {
|
|
1330
|
+
/** Bookmark label (UTF-16BE encoded automatically). */
|
|
1331
|
+
readonly title: string;
|
|
1332
|
+
/** 0-based destination page index. */
|
|
1333
|
+
readonly pageIndex: number;
|
|
1334
|
+
/** Destination Y coordinate in points (default: top of page). */
|
|
1335
|
+
readonly y?: number;
|
|
1336
|
+
/** Render the label bold (`/F` flag bit 2). */
|
|
1337
|
+
readonly bold?: boolean;
|
|
1338
|
+
/** Render the label italic (`/F` flag bit 1). */
|
|
1339
|
+
readonly italic?: boolean;
|
|
1340
|
+
/** Label colour (`/C`). Accepts hex, RGB tuple, or PDF operator string. */
|
|
1341
|
+
readonly color?: PdfColor;
|
|
1342
|
+
/**
|
|
1343
|
+
* Initial expansion state. `true` (default) renders the bookmark expanded
|
|
1344
|
+
* (positive `/Count`); `false` renders it collapsed (negative `/Count`),
|
|
1345
|
+
* hiding its children until the reader expands it. Only meaningful when the
|
|
1346
|
+
* item has `children`.
|
|
1347
|
+
*/
|
|
1348
|
+
readonly open?: boolean;
|
|
1349
|
+
/** Nested child bookmarks. */
|
|
1350
|
+
readonly children?: readonly OutlineItem[];
|
|
1351
|
+
}
|
|
996
1352
|
/**
|
|
997
1353
|
* Parameters for the free-form document PDF builder.
|
|
998
1354
|
*
|
|
@@ -1016,6 +1372,26 @@ interface DocumentParams {
|
|
|
1016
1372
|
readonly fontEntries?: readonly FontEntry[];
|
|
1017
1373
|
readonly metadata?: DocumentMetadata;
|
|
1018
1374
|
readonly layout?: Partial<PdfLayoutOptions>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Document outline / bookmarks (ISO 32000-1 §12.3.3).
|
|
1377
|
+
*
|
|
1378
|
+
* - An array of {@link OutlineItem}s builds an explicit bookmark tree.
|
|
1379
|
+
* - The literal `'auto'` derives a flat outline from every `heading`
|
|
1380
|
+
* block in document order, using each heading's page and position.
|
|
1381
|
+
*
|
|
1382
|
+
* Adds `/Outlines` + `/PageMode /UseOutlines` to the catalog. PDF/A-safe.
|
|
1383
|
+
*
|
|
1384
|
+
* @since 1.4.0
|
|
1385
|
+
*/
|
|
1386
|
+
readonly outline?: readonly OutlineItem[] | 'auto';
|
|
1387
|
+
/**
|
|
1388
|
+
* Page labels (ISO 32000-1 §12.4.2) — controls the page numbering shown
|
|
1389
|
+
* in a viewer's page box and thumbnails (e.g. roman front matter then
|
|
1390
|
+
* decimal body). Emitted as an inline `/PageLabels` number tree. PDF/A-safe.
|
|
1391
|
+
*
|
|
1392
|
+
* @since 1.4.0
|
|
1393
|
+
*/
|
|
1394
|
+
readonly pageLabels?: readonly PageLabelRange[];
|
|
1019
1395
|
}
|
|
1020
1396
|
|
|
1021
1397
|
/**
|
|
@@ -1670,6 +2046,83 @@ declare function verifyCertSignature(cert: X509Certificate, issuerCert: X509Cert
|
|
|
1670
2046
|
*/
|
|
1671
2047
|
declare function isSelfSigned(cert: X509Certificate): boolean;
|
|
1672
2048
|
|
|
2049
|
+
/**
|
|
2050
|
+
* pdfnative — Pluggable Signature Crypto Provider
|
|
2051
|
+
* ================================================
|
|
2052
|
+
* pdfnative ships its own pure-TypeScript RSA (PKCS#1 v1.5) and ECDSA (P-256)
|
|
2053
|
+
* implementations so that signing works in any runtime with **zero
|
|
2054
|
+
* dependencies**. Those pure-JS primitives are built on JavaScript `BigInt`
|
|
2055
|
+
* arithmetic, which V8/SpiderMonkey do **not** execute in constant time — see
|
|
2056
|
+
* the timing-side-channel caveat in `SECURITY.md`.
|
|
2057
|
+
*
|
|
2058
|
+
* For high-security, high-frequency server pipelines (a backend signing many
|
|
2059
|
+
* PDFs/s with one key under adversarial timing observation), this module lets
|
|
2060
|
+
* you inject a hardware-backed, **constant-time** signer — Node.js
|
|
2061
|
+
* `node:crypto` or a Web Crypto wrapper — without giving up the zero-dependency
|
|
2062
|
+
* default. The pure-JS path remains the fallback when no provider is set.
|
|
2063
|
+
*
|
|
2064
|
+
* The provider produces the raw CMS signature value over the **DER-encoded
|
|
2065
|
+
* signed attributes** (`tbs`, "to be signed"), matching the requested
|
|
2066
|
+
* algorithm:
|
|
2067
|
+
* - `'rsa-sha256'` → RSASSA-PKCS1-v1_5 signature over `SHA-256(tbs)`.
|
|
2068
|
+
* - `'ecdsa-sha256'`→ a **DER-encoded** ECDSA (P-256) signature over
|
|
2069
|
+
* `SHA-256(tbs)` (i.e. `SEQUENCE { r INTEGER, s INTEGER }`).
|
|
2070
|
+
*
|
|
2071
|
+
* @example Node.js `node:crypto` (constant-time, hardware-backed)
|
|
2072
|
+
* ```ts
|
|
2073
|
+
* import { setCryptoProvider } from 'pdfnative';
|
|
2074
|
+
* import { createSign, createPrivateKey } from 'node:crypto';
|
|
2075
|
+
*
|
|
2076
|
+
* const key = createPrivateKey(pemPrivateKey);
|
|
2077
|
+
* setCryptoProvider({
|
|
2078
|
+
* sign(tbs, algorithm) {
|
|
2079
|
+
* // node:crypto hashes `tbs` internally and returns a DER ECDSA sig.
|
|
2080
|
+
* return new Uint8Array(createSign('sha256').update(tbs).sign(key));
|
|
2081
|
+
* },
|
|
2082
|
+
* });
|
|
2083
|
+
* ```
|
|
2084
|
+
*
|
|
2085
|
+
* @since 1.4.0
|
|
2086
|
+
*/
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* A pluggable signer that replaces pdfnative's pure-JS RSA/ECDSA math with a
|
|
2090
|
+
* native, constant-time implementation.
|
|
2091
|
+
*/
|
|
2092
|
+
interface CryptoProvider {
|
|
2093
|
+
/**
|
|
2094
|
+
* Sign the DER-encoded CMS SignedAttributes (`tbs`) and return the raw
|
|
2095
|
+
* signature value to embed in the CMS `SignerInfo`.
|
|
2096
|
+
*
|
|
2097
|
+
* The implementation MUST hash `tbs` with SHA-256 internally (native
|
|
2098
|
+
* `crypto.sign('sha256', …)` does this for you) and produce a signature
|
|
2099
|
+
* matching `algorithm`:
|
|
2100
|
+
* - `'rsa-sha256'` → RSASSA-PKCS1-v1_5 over `SHA-256(tbs)`.
|
|
2101
|
+
* - `'ecdsa-sha256'` → DER-encoded ECDSA-P256 over `SHA-256(tbs)`.
|
|
2102
|
+
*/
|
|
2103
|
+
readonly sign: (tbs: Uint8Array, algorithm: SignatureAlgorithm) => Uint8Array;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Install (or clear) a global signature {@link CryptoProvider}. When set, every
|
|
2107
|
+
* `signPdfBytes()` call that does not pass an explicit per-call provider routes
|
|
2108
|
+
* its signature math through `provider` instead of pdfnative's pure-JS RSA/ECDSA
|
|
2109
|
+
* primitives. Pass `null` to restore the zero-dependency default.
|
|
2110
|
+
*
|
|
2111
|
+
* A per-call `PdfSignOptions.provider` always takes precedence over the global
|
|
2112
|
+
* one set here.
|
|
2113
|
+
*
|
|
2114
|
+
* @param provider The native signer, or `null` to revert to pure-JS.
|
|
2115
|
+
* @since 1.4.0
|
|
2116
|
+
*/
|
|
2117
|
+
declare function setCryptoProvider(provider: CryptoProvider | null): void;
|
|
2118
|
+
/**
|
|
2119
|
+
* The currently-installed global {@link CryptoProvider}, or `null` if none.
|
|
2120
|
+
* Primarily for internal dispatch and testing.
|
|
2121
|
+
*
|
|
2122
|
+
* @since 1.4.0
|
|
2123
|
+
*/
|
|
2124
|
+
declare function getCryptoProvider(): CryptoProvider | null;
|
|
2125
|
+
|
|
1673
2126
|
/**
|
|
1674
2127
|
* pdfnative — CMS SignedData Builder (RFC 5652)
|
|
1675
2128
|
* ==============================================
|
|
@@ -1694,6 +2147,14 @@ interface CmsSignOptions {
|
|
|
1694
2147
|
readonly signingTime?: Date;
|
|
1695
2148
|
/** Signature algorithm. */
|
|
1696
2149
|
readonly algorithm: SignatureAlgorithm;
|
|
2150
|
+
/**
|
|
2151
|
+
* Optional native signer. When supplied (or when a global provider is set
|
|
2152
|
+
* via {@link setCryptoProvider}), the signature value is produced by the
|
|
2153
|
+
* provider instead of the pure-JS RSA/ECDSA primitives, and `rsaKey` /
|
|
2154
|
+
* `ecKey` are not required.
|
|
2155
|
+
* @since 1.4.0
|
|
2156
|
+
*/
|
|
2157
|
+
readonly provider?: CryptoProvider;
|
|
1697
2158
|
}
|
|
1698
2159
|
/**
|
|
1699
2160
|
* Build a CMS SignedData structure for a PDF detached signature.
|
|
@@ -1757,6 +2218,15 @@ interface PdfSignOptions extends SigDictMetadata {
|
|
|
1757
2218
|
readonly ecKey?: EcPrivateKey;
|
|
1758
2219
|
/** Algorithm to use. Default: 'rsa-sha256'. */
|
|
1759
2220
|
readonly algorithm?: SignatureAlgorithm;
|
|
2221
|
+
/**
|
|
2222
|
+
* Optional native signature provider (e.g. `node:crypto` / Web Crypto). When
|
|
2223
|
+
* set — or when a global provider is installed via {@link setCryptoProvider}
|
|
2224
|
+
* — the constant-time native signer replaces pdfnative's pure-JS RSA/ECDSA
|
|
2225
|
+
* math, and `rsaKey` / `ecKey` become optional. A per-call provider takes
|
|
2226
|
+
* precedence over the global one.
|
|
2227
|
+
* @since 1.4.0
|
|
2228
|
+
*/
|
|
2229
|
+
readonly provider?: CryptoProvider;
|
|
1760
2230
|
}
|
|
1761
2231
|
/**
|
|
1762
2232
|
* Build a /Sig signature dictionary string for embedding in a PDF.
|
|
@@ -1997,6 +2467,36 @@ declare function buildPDFStreamPageByPage(params: PdfParams, layoutOptions?: Par
|
|
|
1997
2467
|
* ```
|
|
1998
2468
|
*/
|
|
1999
2469
|
declare function buildPDFStream(params: PdfParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
|
|
2470
|
+
/**
|
|
2471
|
+
* Build a free-form PDF document with **true constant-memory streaming**.
|
|
2472
|
+
*
|
|
2473
|
+
* Unlike {@link buildDocumentPDFStream} (which assembles the full binary
|
|
2474
|
+
* then chunks it), this variant assembles the PDF into its raw parts and
|
|
2475
|
+
* yields them progressively, freeing each part as it is emitted. The
|
|
2476
|
+
* fully-joined PDF binary never exists in memory at once. Byte output is
|
|
2477
|
+
* identical to {@link buildDocumentPDFBytes}.
|
|
2478
|
+
*
|
|
2479
|
+
* Constraints (same as `buildDocumentPDFStream`):
|
|
2480
|
+
* - TOC blocks are not allowed (require multi-pass pagination)
|
|
2481
|
+
* - `{pages}` placeholder is not allowed in header/footer templates
|
|
2482
|
+
*
|
|
2483
|
+
* @param params - Document content (title, blocks, footer, fonts)
|
|
2484
|
+
* @param layoutOptions - Optional layout customization
|
|
2485
|
+
* @param streamOptions - Chunk size configuration
|
|
2486
|
+
* @yields Uint8Array chunks of the PDF
|
|
2487
|
+
*/
|
|
2488
|
+
declare function buildDocumentPDFStreamTrue(params: DocumentParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
|
|
2489
|
+
/**
|
|
2490
|
+
* Build a table-centric PDF with **true constant-memory streaming**.
|
|
2491
|
+
* See {@link buildDocumentPDFStreamTrue} for the full contract. Byte
|
|
2492
|
+
* output is identical to {@link buildPDFBytes}.
|
|
2493
|
+
*
|
|
2494
|
+
* @param params - PDF content (title, rows, headers, etc.)
|
|
2495
|
+
* @param layoutOptions - Optional layout customization
|
|
2496
|
+
* @param streamOptions - Chunk size configuration
|
|
2497
|
+
* @yields Uint8Array chunks of the PDF
|
|
2498
|
+
*/
|
|
2499
|
+
declare function buildPDFStreamTrue(params: PdfParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
|
|
2000
2500
|
/**
|
|
2001
2501
|
* Concatenate an array of Uint8Array chunks into a single Uint8Array.
|
|
2002
2502
|
*
|
|
@@ -2011,6 +2511,37 @@ declare function concatChunks(chunks: readonly Uint8Array[]): Uint8Array;
|
|
|
2011
2511
|
* @returns Total byte count
|
|
2012
2512
|
*/
|
|
2013
2513
|
declare function streamByteLength(stream: AsyncGenerator<Uint8Array>): Promise<number>;
|
|
2514
|
+
/** Result of {@link streamToFile}. */
|
|
2515
|
+
interface StreamToFileResult {
|
|
2516
|
+
/** Total number of bytes written to the file. */
|
|
2517
|
+
readonly bytesWritten: number;
|
|
2518
|
+
/** The path the stream was written to. */
|
|
2519
|
+
readonly path: string;
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Write a streaming PDF (any of the `streamPdf`/`buildPDFStream*` generators)
|
|
2523
|
+
* directly to a file on disk in **constant memory**, honouring write
|
|
2524
|
+
* back-pressure. Node.js-only convenience wrapper.
|
|
2525
|
+
*
|
|
2526
|
+
* The dependency on `node:fs` is loaded **dynamically** so this module stays
|
|
2527
|
+
* tree-shakeable and bundler-safe for the browser; calling `streamToFile` in
|
|
2528
|
+
* a non-Node environment throws a descriptive error.
|
|
2529
|
+
*
|
|
2530
|
+
* @example
|
|
2531
|
+
* ```ts
|
|
2532
|
+
* await streamToFile(streamDocumentPdf({ blocks }), './out.pdf');
|
|
2533
|
+
* ```
|
|
2534
|
+
*
|
|
2535
|
+
* @param stream An async generator of PDF byte chunks.
|
|
2536
|
+
* @param filePath Destination path. The caller is responsible for validating
|
|
2537
|
+
* untrusted paths (path traversal, allowed directories).
|
|
2538
|
+
* @param opts Optional `AbortSignal` to cancel mid-write.
|
|
2539
|
+
* @returns Bytes written and the destination path.
|
|
2540
|
+
* @since 1.4.0
|
|
2541
|
+
*/
|
|
2542
|
+
declare function streamToFile(stream: AsyncGenerator<Uint8Array>, filePath: string, opts?: {
|
|
2543
|
+
readonly signal?: AbortSignal;
|
|
2544
|
+
}): Promise<StreamToFileResult>;
|
|
2014
2545
|
|
|
2015
2546
|
/**
|
|
2016
2547
|
* pdfnative — SHA-384, SHA-512, HMAC-SHA256
|
|
@@ -2079,6 +2610,12 @@ declare const DEFAULT_MARGINS: {
|
|
|
2079
2610
|
l: number;
|
|
2080
2611
|
};
|
|
2081
2612
|
declare const DEFAULT_CW: number;
|
|
2613
|
+
/**
|
|
2614
|
+
* Default ceiling for `buildDocumentPDF` block count, overridable per call via
|
|
2615
|
+
* `PdfLayoutOptions.maxBlocks`. Matches the table builder's 100 000-row cap.
|
|
2616
|
+
* @since 1.3.0
|
|
2617
|
+
*/
|
|
2618
|
+
declare const DEFAULT_MAX_BLOCKS = 100000;
|
|
2082
2619
|
declare const ROW_H = 12;
|
|
2083
2620
|
declare const TH_H = 15;
|
|
2084
2621
|
declare const INFO_LN = 13;
|
|
@@ -2264,7 +2801,7 @@ declare function helveticaBoldWidth(str: string, sz: number): number;
|
|
|
2264
2801
|
* Latin mode is used as before — strict PDF/A conformance requires the caller
|
|
2265
2802
|
* to register a Latin font (e.g. Noto Sans VF).
|
|
2266
2803
|
*/
|
|
2267
|
-
declare function createEncodingContext(fontEntries: FontEntry[], pdfA?: boolean): EncodingContext;
|
|
2804
|
+
declare function createEncodingContext(fontEntries: FontEntry[], pdfA?: boolean, normalize?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | false): EncodingContext;
|
|
2268
2805
|
|
|
2269
2806
|
/**
|
|
2270
2807
|
* pdfnative — Font Loader
|
|
@@ -2324,6 +2861,47 @@ declare function clearFontCache(): void;
|
|
|
2324
2861
|
*/
|
|
2325
2862
|
declare function resetFontRegistry(): void;
|
|
2326
2863
|
|
|
2864
|
+
/**
|
|
2865
|
+
* pdfnative — Font Data Validator
|
|
2866
|
+
* ================================
|
|
2867
|
+
* `validateFontData()` performs a read-only structural sanity check on a
|
|
2868
|
+
* {@link FontData} module before it is used for rendering. The bundled font
|
|
2869
|
+
* modules under `pdfnative/fonts/*` are already trusted; this validator exists
|
|
2870
|
+
* for consumers who **build their own** font data (via `tools/build-font-data.cjs`
|
|
2871
|
+
* or by hand) from an untrusted or unfamiliar TTF/OTF.
|
|
2872
|
+
*
|
|
2873
|
+
* It catches the common failure modes — a corrupt/empty base64 payload, a
|
|
2874
|
+
* non-SFNT binary, an empty `cmap`, glyph ids that point outside the metrics,
|
|
2875
|
+
* a malformed `pdfWidthArray`, or non-finite metrics — and reports them as
|
|
2876
|
+
* descriptive errors instead of letting a cryptic `.notdef`/`NaN` failure
|
|
2877
|
+
* surface deep inside the encoding/subsetting pipeline.
|
|
2878
|
+
*
|
|
2879
|
+
* The check is **opt-in and standalone**: it is NOT invoked automatically by
|
|
2880
|
+
* `registerFont()` (that would add cost to every load and risks false-rejecting
|
|
2881
|
+
* edge-valid fonts). Call it yourself when ingesting third-party font data.
|
|
2882
|
+
*
|
|
2883
|
+
* @since 1.4.0
|
|
2884
|
+
*/
|
|
2885
|
+
/** Result of {@link validateFontData}. */
|
|
2886
|
+
interface FontValidationResult {
|
|
2887
|
+
/** True when no blocking errors were found. */
|
|
2888
|
+
readonly valid: boolean;
|
|
2889
|
+
/** Blocking structural problems that would break rendering. */
|
|
2890
|
+
readonly errors: readonly string[];
|
|
2891
|
+
/** Non-blocking concerns (suspicious but not necessarily fatal). */
|
|
2892
|
+
readonly warnings: readonly string[];
|
|
2893
|
+
}
|
|
2894
|
+
/**
|
|
2895
|
+
* Structurally validate a {@link FontData} module. Returns `{ valid, errors,
|
|
2896
|
+
* warnings }`; `valid` is `false` when any blocking problem is found. Does not
|
|
2897
|
+
* throw on malformed input — it reports.
|
|
2898
|
+
*
|
|
2899
|
+
* @param data The font data to validate (typically the default export of a
|
|
2900
|
+
* generated `*-data.js` module).
|
|
2901
|
+
* @since 1.4.0
|
|
2902
|
+
*/
|
|
2903
|
+
declare function validateFontData(data: unknown): FontValidationResult;
|
|
2904
|
+
|
|
2327
2905
|
/**
|
|
2328
2906
|
* pdfnative — Thai Mini-Shaper
|
|
2329
2907
|
* =============================
|
|
@@ -2360,6 +2938,18 @@ declare function isArmenianCodepoint(cp: number): boolean;
|
|
|
2360
2938
|
declare function isBengaliCodepoint(cp: number): boolean;
|
|
2361
2939
|
/** Check if a codepoint falls in the Tamil Unicode block. */
|
|
2362
2940
|
declare function isTamilCodepoint(cp: number): boolean;
|
|
2941
|
+
/** Check if a codepoint falls in the Telugu Unicode block. */
|
|
2942
|
+
declare function isTeluguCodepoint(cp: number): boolean;
|
|
2943
|
+
/** Check if a codepoint falls in any Ethiopic Unicode block. */
|
|
2944
|
+
declare function isEthiopicCodepoint(cp: number): boolean;
|
|
2945
|
+
/** Check if a codepoint falls in the Sinhala Unicode block. */
|
|
2946
|
+
declare function isSinhalaCodepoint(cp: number): boolean;
|
|
2947
|
+
/** Check if a codepoint falls in the Tibetan Unicode block. */
|
|
2948
|
+
declare function isTibetanCodepoint(cp: number): boolean;
|
|
2949
|
+
/** Check if a codepoint falls in any Khmer Unicode block. */
|
|
2950
|
+
declare function isKhmerCodepoint(cp: number): boolean;
|
|
2951
|
+
/** Check if a codepoint falls in any Myanmar Unicode block. */
|
|
2952
|
+
declare function isMyanmarCodepoint(cp: number): boolean;
|
|
2363
2953
|
/** Check if a codepoint falls in any Devanagari Unicode block. */
|
|
2364
2954
|
declare function isDevanagariCodepoint(cp: number): boolean;
|
|
2365
2955
|
/** Check if text contains Arabic characters requiring shaping. */
|
|
@@ -2372,6 +2962,18 @@ declare function containsThai(str: string): boolean;
|
|
|
2372
2962
|
declare function containsBengali(str: string): boolean;
|
|
2373
2963
|
/** Check whether a string contains any Tamil characters. */
|
|
2374
2964
|
declare function containsTamil(str: string): boolean;
|
|
2965
|
+
/** Check whether a string contains any Telugu characters. */
|
|
2966
|
+
declare function containsTelugu(str: string): boolean;
|
|
2967
|
+
/** Check whether a string contains any Ethiopic characters. */
|
|
2968
|
+
declare function containsEthiopic(str: string): boolean;
|
|
2969
|
+
/** Check whether a string contains any Sinhala characters. */
|
|
2970
|
+
declare function containsSinhala(str: string): boolean;
|
|
2971
|
+
/** Check whether a string contains any Tibetan characters. */
|
|
2972
|
+
declare function containsTibetan(str: string): boolean;
|
|
2973
|
+
/** Check whether a string contains any Khmer characters. */
|
|
2974
|
+
declare function containsKhmer(str: string): boolean;
|
|
2975
|
+
/** Check whether a string contains any Myanmar characters. */
|
|
2976
|
+
declare function containsMyanmar(str: string): boolean;
|
|
2375
2977
|
/** Check whether a string contains any Devanagari characters. */
|
|
2376
2978
|
declare function containsDevanagari(str: string): boolean;
|
|
2377
2979
|
|
|
@@ -2437,6 +3039,191 @@ declare function shapeBengaliText(str: string, fontData: FontData): ShapedGlyph[
|
|
|
2437
3039
|
*/
|
|
2438
3040
|
declare function shapeTamilText(str: string, fontData: FontData): ShapedGlyph[];
|
|
2439
3041
|
|
|
3042
|
+
/**
|
|
3043
|
+
* pdfnative — Telugu Mini-Shaper
|
|
3044
|
+
* ================================
|
|
3045
|
+
* Pure JS OpenType GSUB + GPOS shaping for Telugu script.
|
|
3046
|
+
* Zero external dependency.
|
|
3047
|
+
*
|
|
3048
|
+
* Handles:
|
|
3049
|
+
* - Syllable cluster building (base + virama-mediated conjuncts / subjoined
|
|
3050
|
+
* consonants — Telugu stacks the dependent consonant below the base)
|
|
3051
|
+
* - GSUB LigatureSubst: conjunct / subjoined-consonant formation
|
|
3052
|
+
* (C + Virama + C → ligature glyph)
|
|
3053
|
+
* - GSUB SingleSubst: contextual glyph substitution
|
|
3054
|
+
* - GPOS MarkToBase: combining-mark positioning (above/below vowel signs,
|
|
3055
|
+
* anusvara, candrabindu, length marks)
|
|
3056
|
+
*
|
|
3057
|
+
* Telugu is structurally close to Devanagari but:
|
|
3058
|
+
* - has **no reph** (Ra forms a subjoined glyph, not a top mark),
|
|
3059
|
+
* - has **no pre-base matra reordering** — every Telugu vowel sign attaches
|
|
3060
|
+
* to the right of, or above/below, the base (nothing renders to its left),
|
|
3061
|
+
* - has **no nukta**.
|
|
3062
|
+
*
|
|
3063
|
+
* References:
|
|
3064
|
+
* - Unicode Standard §12.8 Telugu
|
|
3065
|
+
* - OpenType spec: Script-specific shaping for Telugu (tel2 / Indic2)
|
|
3066
|
+
* - ISO 15924 script code: Telu
|
|
3067
|
+
*/
|
|
3068
|
+
|
|
3069
|
+
/**
|
|
3070
|
+
* Shape a string of Telugu text into an array of positioned glyphs.
|
|
3071
|
+
*
|
|
3072
|
+
* @param str - Raw Telugu string
|
|
3073
|
+
* @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
|
|
3074
|
+
* @returns Array of positioned glyphs
|
|
3075
|
+
*/
|
|
3076
|
+
declare function shapeTeluguText(str: string, fontData: FontData): ShapedGlyph[];
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* pdfnative — Sinhala Mini-Shaper
|
|
3080
|
+
* ================================
|
|
3081
|
+
* Pure JS OpenType GSUB + GPOS shaping for the Sinhala script (Sri Lanka).
|
|
3082
|
+
* Zero external dependency.
|
|
3083
|
+
*
|
|
3084
|
+
* Handles:
|
|
3085
|
+
* - Syllable cluster building (base + al-lakuna-mediated conjuncts)
|
|
3086
|
+
* - GSUB LigatureSubst: conjunct / touching-form ligatures
|
|
3087
|
+
* (C + Al-lakuna + ZWJ + Ya/Ra → yansaya / rakaaransaya, C+C conjuncts)
|
|
3088
|
+
* - Pre-base (left-side) vowel reordering — the kombuva family
|
|
3089
|
+
* (U+0DD9 / U+0DDB and the left half of the two-part vowels U+0DDA,
|
|
3090
|
+
* U+0DDC, U+0DDD, U+0DDE) renders to the LEFT of its base consonant, so
|
|
3091
|
+
* the shaper emits that glyph BEFORE the base in visual order.
|
|
3092
|
+
* - Two-part dependent vowels are decomposed into their left + right halves.
|
|
3093
|
+
* - GPOS MarkToBase: above / below pilla positioning.
|
|
3094
|
+
*
|
|
3095
|
+
* Known limitations (documented):
|
|
3096
|
+
* - Complex multi-consonant stacks beyond the font's pre-baked ligature
|
|
3097
|
+
* table fall back to sequential base + al-lakuna rendering.
|
|
3098
|
+
* - GSUB MultipleSubst (LookupType 2) is not consumed; two-part vowels are
|
|
3099
|
+
* instead decomposed by this shaper's own table.
|
|
3100
|
+
*
|
|
3101
|
+
* References:
|
|
3102
|
+
* - Unicode Standard §13.2 Sinhala
|
|
3103
|
+
* - OpenType spec: Script-specific shaping for Sinhala (sinh)
|
|
3104
|
+
* - ISO 15924 script code: Sinh
|
|
3105
|
+
*/
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* Shape a string of Sinhala text into an array of positioned glyphs.
|
|
3109
|
+
*
|
|
3110
|
+
* @param str - Raw Sinhala string
|
|
3111
|
+
* @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
|
|
3112
|
+
* @returns Array of positioned glyphs
|
|
3113
|
+
*/
|
|
3114
|
+
declare function shapeSinhalaText(str: string, fontData: FontData): ShapedGlyph[];
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* pdfnative — Tibetan Mini-Shaper
|
|
3118
|
+
* ================================
|
|
3119
|
+
* Pure JS OpenType GSUB + GPOS shaping for the Tibetan script.
|
|
3120
|
+
* Zero external dependency.
|
|
3121
|
+
*
|
|
3122
|
+
* Tibetan builds vertical stacks: a head consonant with zero or more
|
|
3123
|
+
* *subjoined* consonants (U+0F90–U+0FBC) stacked beneath it, plus vowel
|
|
3124
|
+
* signs above / below and spacing marks to the right.
|
|
3125
|
+
*
|
|
3126
|
+
* Handles:
|
|
3127
|
+
* - Stack building (head consonant + subjoined consonants + vowels + marks)
|
|
3128
|
+
* - GSUB LigatureSubst: pre-baked stacked-consonant ligatures when the font
|
|
3129
|
+
* provides them (head + subjoined → single stack glyph)
|
|
3130
|
+
* - GPOS MarkToBase: subjoined consonants and above/below vowel signs are
|
|
3131
|
+
* anchored on the base when no ligature exists
|
|
3132
|
+
*
|
|
3133
|
+
* Known limitations (documented):
|
|
3134
|
+
* - Deep stacks beyond the font's ligature coverage fall back to GPOS
|
|
3135
|
+
* below-base anchoring of each subjoined consonant, which approximates but
|
|
3136
|
+
* may not perfectly match a native stacking engine.
|
|
3137
|
+
* - GSUB contextual substitution (LookupType 5/6) is not consumed.
|
|
3138
|
+
*
|
|
3139
|
+
* References:
|
|
3140
|
+
* - Unicode Standard §13.4 Tibetan
|
|
3141
|
+
* - OpenType spec: Script-specific shaping for Tibetan (tibt)
|
|
3142
|
+
* - ISO 15924 script code: Tibt
|
|
3143
|
+
*/
|
|
3144
|
+
|
|
3145
|
+
/**
|
|
3146
|
+
* Shape a string of Tibetan text into an array of positioned glyphs.
|
|
3147
|
+
*
|
|
3148
|
+
* @param str - Raw Tibetan string
|
|
3149
|
+
* @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
|
|
3150
|
+
* @returns Array of positioned glyphs
|
|
3151
|
+
*/
|
|
3152
|
+
declare function shapeTibetanText(str: string, fontData: FontData): ShapedGlyph[];
|
|
3153
|
+
|
|
3154
|
+
/**
|
|
3155
|
+
* pdfnative — Khmer Mini-Shaper
|
|
3156
|
+
* ==============================
|
|
3157
|
+
* Pure JS OpenType GSUB + GPOS shaping for the Khmer script (Cambodia).
|
|
3158
|
+
* Zero external dependency.
|
|
3159
|
+
*
|
|
3160
|
+
* Khmer is a USE-class (Universal Shaping Engine) script. This is a pragmatic
|
|
3161
|
+
* USE-lite implementation that covers the common cases:
|
|
3162
|
+
* - Coeng (U+17D2) + consonant → subscript consonant (stacked below / behind)
|
|
3163
|
+
* - Pre-base (left-side) vowel reordering — U+17C1 (e), U+17C2 (ae),
|
|
3164
|
+
* U+17C3 (ai) render to the LEFT of their base, so they are emitted first.
|
|
3165
|
+
* - Two-part vowels (U+17BE, U+17BF, U+17C0, U+17C4, U+17C5) are decomposed
|
|
3166
|
+
* into their pre-base + post-base halves.
|
|
3167
|
+
* - GSUB LigatureSubst: coeng-form subscript ligatures when the font provides
|
|
3168
|
+
* them; GPOS MarkToBase for above / below vowel signs and diacritics.
|
|
3169
|
+
*
|
|
3170
|
+
* Known limitations (documented):
|
|
3171
|
+
* - This is not a full USE implementation. Robat (U+17CC), complex
|
|
3172
|
+
* multi-coeng stacks beyond the font's ligature coverage, and contextual
|
|
3173
|
+
* GSUB (LookupType 5/6) are approximated, not fully reordered.
|
|
3174
|
+
*
|
|
3175
|
+
* References:
|
|
3176
|
+
* - Unicode Standard §16.4 Khmer
|
|
3177
|
+
* - OpenType spec: Universal Shaping Engine; Khmer (khmr)
|
|
3178
|
+
* - ISO 15924 script code: Khmr
|
|
3179
|
+
*/
|
|
3180
|
+
|
|
3181
|
+
/**
|
|
3182
|
+
* Shape a string of Khmer text into an array of positioned glyphs.
|
|
3183
|
+
*
|
|
3184
|
+
* @param str - Raw Khmer string
|
|
3185
|
+
* @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
|
|
3186
|
+
* @returns Array of positioned glyphs
|
|
3187
|
+
*/
|
|
3188
|
+
declare function shapeKhmerText(str: string, fontData: FontData): ShapedGlyph[];
|
|
3189
|
+
|
|
3190
|
+
/**
|
|
3191
|
+
* pdfnative — Myanmar Mini-Shaper
|
|
3192
|
+
* ================================
|
|
3193
|
+
* Pure JS OpenType GSUB + GPOS shaping for the Myanmar (Burmese) script.
|
|
3194
|
+
* Zero external dependency.
|
|
3195
|
+
*
|
|
3196
|
+
* Myanmar is a USE-class (Universal Shaping Engine) script. This is a pragmatic
|
|
3197
|
+
* USE-lite implementation covering the common cases:
|
|
3198
|
+
* - Medial consonants: medial ya (U+103B), ra (U+103C), wa (U+103D),
|
|
3199
|
+
* ha (U+103E). Medial **ra** renders to the LEFT of its base (pre-base)
|
|
3200
|
+
* and is therefore emitted first.
|
|
3201
|
+
* - Virama / stacker (U+1039): C + U+1039 + C → stacked subscript consonant.
|
|
3202
|
+
* - Asat (U+103A, visible killer) is preserved.
|
|
3203
|
+
* - GSUB LigatureSubst for medial / stacked forms when the font provides
|
|
3204
|
+
* them; GPOS MarkToBase for above / below vowel signs and tone marks.
|
|
3205
|
+
*
|
|
3206
|
+
* Known limitations (documented):
|
|
3207
|
+
* - This is not a full USE implementation. Kinzi (U+1004 U+103A U+1039),
|
|
3208
|
+
* deep stacks beyond the font's ligature coverage, and contextual GSUB
|
|
3209
|
+
* (LookupType 5/6) are approximated, not fully reordered. Kinzi is rendered
|
|
3210
|
+
* via its stacking sequence rather than a dedicated reordering pass.
|
|
3211
|
+
*
|
|
3212
|
+
* References:
|
|
3213
|
+
* - Unicode Standard §16.3 Myanmar
|
|
3214
|
+
* - OpenType spec: Universal Shaping Engine; Myanmar (mymr)
|
|
3215
|
+
* - ISO 15924 script code: Mymr
|
|
3216
|
+
*/
|
|
3217
|
+
|
|
3218
|
+
/**
|
|
3219
|
+
* Shape a string of Myanmar text into an array of positioned glyphs.
|
|
3220
|
+
*
|
|
3221
|
+
* @param str - Raw Myanmar string
|
|
3222
|
+
* @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
|
|
3223
|
+
* @returns Array of positioned glyphs
|
|
3224
|
+
*/
|
|
3225
|
+
declare function shapeMyanmarText(str: string, fontData: FontData): ShapedGlyph[];
|
|
3226
|
+
|
|
2440
3227
|
/**
|
|
2441
3228
|
* pdfnative — Devanagari Mini-Shaper
|
|
2442
3229
|
* ====================================
|
|
@@ -2524,29 +3311,30 @@ interface BidiRun {
|
|
|
2524
3311
|
readonly start: number;
|
|
2525
3312
|
}
|
|
2526
3313
|
/**
|
|
2527
|
-
* UAX #9 explicit embedding
|
|
3314
|
+
* UAX #9 explicit embedding normalization (v1.2.0, refined v1.3.0).
|
|
2528
3315
|
*
|
|
2529
|
-
* Maps the legacy explicit
|
|
2530
|
-
*
|
|
2531
|
-
*
|
|
3316
|
+
* Maps the legacy explicit *embedding* characters into their sealed-isolate
|
|
3317
|
+
* equivalents so the rest of the pipeline can process them via the existing
|
|
3318
|
+
* isolate machinery:
|
|
2532
3319
|
*
|
|
2533
3320
|
* - LRE (U+202A) → LRI (U+2066)
|
|
2534
3321
|
* - RLE (U+202B) → RLI (U+2067)
|
|
2535
|
-
* -
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2539
|
-
*
|
|
2540
|
-
*
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
2545
|
-
*
|
|
2546
|
-
*
|
|
3322
|
+
* - PDF (U+202C) → PDI (U+2069), but only when popping a matched LRE/RLE
|
|
3323
|
+
* from the stack (otherwise preserved or dropped, see below)
|
|
3324
|
+
*
|
|
3325
|
+
* The explicit *override* characters LRO (U+202D) / RLO (U+202E) and the
|
|
3326
|
+
* PDF (U+202C) that closes them are **preserved verbatim** — they carry
|
|
3327
|
+
* character-level type-override semantics (UAX #9 X4/X5) that the isolate
|
|
3328
|
+
* machinery cannot express. They are resolved separately by
|
|
3329
|
+
* {@link resolveBidiRuns} via the override pre-pass, which forces every
|
|
3330
|
+
* inner code point to L (LRO) or R (RLO). A PDF that would pop an override
|
|
3331
|
+
* frame is therefore left in place for that pre-pass to consume.
|
|
3332
|
+
*
|
|
3333
|
+
* This split keeps the ≥ 95 % common embedding cases on the fast isolate
|
|
3334
|
+
* path while giving LRO/RLO faithful character-level override behaviour.
|
|
2547
3335
|
*
|
|
2548
3336
|
* @param text - Raw input text in logical order
|
|
2549
|
-
* @returns
|
|
3337
|
+
* @returns Text with embeddings mapped to isolates; overrides preserved.
|
|
2550
3338
|
*/
|
|
2551
3339
|
declare function normalizeBidiEmbeddings(text: string): string;
|
|
2552
3340
|
/**
|
|
@@ -2564,10 +3352,13 @@ declare function normalizeBidiEmbeddings(text: string): string;
|
|
|
2564
3352
|
*/
|
|
2565
3353
|
declare function resolveBidiRuns(text: string): BidiRun[];
|
|
2566
3354
|
/**
|
|
2567
|
-
* Check if text contains any RTL characters (Arabic or Hebrew)
|
|
3355
|
+
* Check if text contains any RTL characters (Arabic or Hebrew) or an explicit
|
|
3356
|
+
* directional override (LRO U+202D / RLO U+202E). The override markers are
|
|
3357
|
+
* included so a direct caller that has not yet stripped controls still routes
|
|
3358
|
+
* through the bidi resolver, where the X4/X5 override pass applies.
|
|
2568
3359
|
*
|
|
2569
3360
|
* @param text - Input text string
|
|
2570
|
-
* @returns True if text contains R or
|
|
3361
|
+
* @returns True if text contains R/AL bidi types or an LRO/RLO override
|
|
2571
3362
|
*/
|
|
2572
3363
|
declare function containsRTL(text: string): boolean;
|
|
2573
3364
|
/**
|
|
@@ -2602,19 +3393,20 @@ declare function stripBidiControls(text: string): string;
|
|
|
2602
3393
|
* Based on the Universal Shaping Engine specification:
|
|
2603
3394
|
* https://learn.microsoft.com/en-us/typography/script-development/use
|
|
2604
3395
|
*
|
|
2605
|
-
* Scope (v1.
|
|
3396
|
+
* Scope (v1.3.0):
|
|
2606
3397
|
* - Public API for cluster classification: callers can run their own
|
|
2607
3398
|
* reordering / GSUB pipelines on top of the cluster categories.
|
|
2608
3399
|
* - 11 cluster categories sufficient for the four scripts pdfnative
|
|
2609
3400
|
* ships shaping for (Devanagari, Bengali, Tamil) plus a generic
|
|
2610
3401
|
* fallback that classifies any USE-eligible code point.
|
|
2611
|
-
*
|
|
2612
|
-
*
|
|
2613
|
-
* -
|
|
2614
|
-
*
|
|
2615
|
-
*
|
|
2616
|
-
*
|
|
2617
|
-
*
|
|
3402
|
+
* - Marathi eyelash-ra (Ra + virama + ZWJ) is recognised as a distinct
|
|
3403
|
+
* reph variant (`UseCluster.eyelash`).
|
|
3404
|
+
* - The bundled Devanagari/Bengali/Tamil shapers consume
|
|
3405
|
+
* `classifyUseCategory` as the single source of truth for joiner
|
|
3406
|
+
* (ZWJ/ZWNJ) and half-form/eyelash decisions; their hand-tuned
|
|
3407
|
+
* happy-path reordering (pinned by the vitest suite) is preserved.
|
|
3408
|
+
*
|
|
3409
|
+
* Not in scope (deferred):
|
|
2618
3410
|
* - State-table classification for Khmer/Myanmar/Tibetan/Sinhala/
|
|
2619
3411
|
* other USE-required scripts not currently bundled.
|
|
2620
3412
|
*/
|
|
@@ -2656,6 +3448,12 @@ interface UseCluster {
|
|
|
2656
3448
|
readonly post: UseClassifiedCp[];
|
|
2657
3449
|
/** Halant + consonant chains attached after the base (conjunct tail). */
|
|
2658
3450
|
readonly tail: UseClassifiedCp[];
|
|
3451
|
+
/**
|
|
3452
|
+
* True when the cluster head is a Marathi eyelash-ra — `Ra + virama + ZWJ`
|
|
3453
|
+
* — which renders as the eyelash (rakar) form rather than a reph. The
|
|
3454
|
+
* leading `Ra` is still recorded in {@link prebase} with category `'R'`.
|
|
3455
|
+
*/
|
|
3456
|
+
readonly eyelash?: boolean;
|
|
2659
3457
|
}
|
|
2660
3458
|
/**
|
|
2661
3459
|
* Classify a single Unicode code point into a USE-lite category.
|
|
@@ -2729,6 +3527,154 @@ declare function classifyClusters(codePoints: readonly number[]): UseCluster[];
|
|
|
2729
3527
|
*/
|
|
2730
3528
|
declare function shapeArabicText(str: string, fontData: FontData): ShapedGlyph[];
|
|
2731
3529
|
|
|
3530
|
+
/**
|
|
3531
|
+
* pdfnative — TrueType `glyf` Outline Extractor
|
|
3532
|
+
* ==============================================
|
|
3533
|
+
* Pure-JS reader that turns a TrueType glyph outline into ordered contours
|
|
3534
|
+
* of quadratic on/off-curve points. Zero external dependency.
|
|
3535
|
+
*
|
|
3536
|
+
* Used by the colour-glyph renderer (COLR/CPAL) to fill a base glyph's
|
|
3537
|
+
* outline as a native PDF path. Handles both simple and composite glyphs
|
|
3538
|
+
* (the latter via recursive 2×2 + translate component transforms).
|
|
3539
|
+
*
|
|
3540
|
+
* References:
|
|
3541
|
+
* - ISO/IEC 14496-22 (OpenType) §5.3.3 `glyf`
|
|
3542
|
+
* - Apple TrueType Reference Manual — Glyph data format
|
|
3543
|
+
*/
|
|
3544
|
+
/** A single outline point in font units. */
|
|
3545
|
+
interface OutlinePoint {
|
|
3546
|
+
readonly x: number;
|
|
3547
|
+
readonly y: number;
|
|
3548
|
+
/** True for on-curve points; false for quadratic control (off-curve). */
|
|
3549
|
+
readonly onCurve: boolean;
|
|
3550
|
+
}
|
|
3551
|
+
/** A closed contour: an ordered ring of on/off-curve points. */
|
|
3552
|
+
type Contour = OutlinePoint[];
|
|
3553
|
+
/** A parsed TrueType font exposing just enough to read glyph outlines. */
|
|
3554
|
+
interface GlyfFont {
|
|
3555
|
+
readonly view: DataView;
|
|
3556
|
+
readonly glyfOffset: number;
|
|
3557
|
+
readonly locaOffsets: number[];
|
|
3558
|
+
readonly unitsPerEm: number;
|
|
3559
|
+
}
|
|
3560
|
+
/**
|
|
3561
|
+
* Parse the table directory, `head`, `maxp` and `loca` so that subsequent
|
|
3562
|
+
* {@link extractGlyphContours} calls are O(1) lookups.
|
|
3563
|
+
*
|
|
3564
|
+
* @param bytes - Raw TrueType/OpenType (glyf-flavoured) font bytes.
|
|
3565
|
+
* @returns A {@link GlyfFont}, or `null` if the font has no `glyf` outlines
|
|
3566
|
+
* (e.g. a CFF font) or is structurally invalid.
|
|
3567
|
+
*/
|
|
3568
|
+
declare function parseGlyfFont(bytes: Uint8Array): GlyfFont | null;
|
|
3569
|
+
/**
|
|
3570
|
+
* Extract the contours of a single glyph in font units. Composite glyphs are
|
|
3571
|
+
* flattened by recursively transforming their components.
|
|
3572
|
+
*
|
|
3573
|
+
* @param font - Parsed {@link GlyfFont}.
|
|
3574
|
+
* @param gid - Glyph id.
|
|
3575
|
+
* @param depth - Internal recursion guard for composite glyphs.
|
|
3576
|
+
* @returns Array of contours (empty for whitespace / empty glyphs).
|
|
3577
|
+
*/
|
|
3578
|
+
declare function extractGlyphContours(font: GlyfFont, gid: number, depth?: number): Contour[];
|
|
3579
|
+
|
|
3580
|
+
/**
|
|
3581
|
+
* pdfnative — COLR / CPAL Colour-Font Parser
|
|
3582
|
+
* ===========================================
|
|
3583
|
+
* Pure-JS reader for the OpenType COLR (colour layers) and CPAL (colour
|
|
3584
|
+
* palette) tables. Resolves each base colour glyph into a flat list of
|
|
3585
|
+
* {@link ColorLayer}s (base outline + paint), painted back-to-front.
|
|
3586
|
+
*
|
|
3587
|
+
* Supported:
|
|
3588
|
+
* - COLR v0 — layered solid fills.
|
|
3589
|
+
* - COLR v1 — PaintColrLayers, PaintGlyph, PaintColrGlyph, PaintSolid,
|
|
3590
|
+
* PaintLinearGradient, PaintRadialGradient, PaintSweepGradient,
|
|
3591
|
+
* PaintTransform, PaintTranslate, PaintScale (+ around-center),
|
|
3592
|
+
* PaintComposite (blend-mode-mappable composite modes).
|
|
3593
|
+
*
|
|
3594
|
+
* Unsupported paints (variable paints, Porter-Duff structural composite
|
|
3595
|
+
* modes Clear/Src/Dest/Xor/…) cause the affected glyph to be skipped so the
|
|
3596
|
+
* caller can fall back to the monochrome emoji font. This keeps output
|
|
3597
|
+
* correct (never garbled) while covering the overwhelming majority of
|
|
3598
|
+
* Noto Color Emoji glyphs.
|
|
3599
|
+
*
|
|
3600
|
+
* Zero external dependency.
|
|
3601
|
+
*
|
|
3602
|
+
* References:
|
|
3603
|
+
* - ISO/IEC 14496-22 (OpenType) §5.7.11 COLR, §5.7.12 CPAL
|
|
3604
|
+
* - https://learn.microsoft.com/typography/opentype/spec/colr
|
|
3605
|
+
*/
|
|
3606
|
+
|
|
3607
|
+
/**
|
|
3608
|
+
* Parse the CPAL table's first palette into an array of {@link CpalColor}s
|
|
3609
|
+
* (sRGB + alpha, each channel 0–255), indexed by palette entry.
|
|
3610
|
+
*/
|
|
3611
|
+
declare function parseCpal(bytes: Uint8Array): CpalColor[] | null;
|
|
3612
|
+
/**
|
|
3613
|
+
* Parse the COLR + CPAL tables of a font into a colour-glyph map keyed by
|
|
3614
|
+
* base glyph id. Returns `null` when the font has no COLR table.
|
|
3615
|
+
*
|
|
3616
|
+
* @param bytes - Raw OpenType font bytes.
|
|
3617
|
+
*/
|
|
3618
|
+
declare function parseColrCpal(bytes: Uint8Array): Record<number, ColorGlyph> | null;
|
|
3619
|
+
|
|
3620
|
+
/**
|
|
3621
|
+
* pdfnative — Colour Glyph Renderer (COLR/CPAL → native PDF)
|
|
3622
|
+
* ==========================================================
|
|
3623
|
+
* Renders a resolved {@link ColorGlyph} as a native PDF Form XObject: each
|
|
3624
|
+
* layer's base-glyph outline is emitted as a vector path and filled with a
|
|
3625
|
+
* flat colour or a `/Shading` gradient. No rasterisation, zero dependency.
|
|
3626
|
+
*
|
|
3627
|
+
* - Solid layers → `r g b rg … f` (with `/ca` ExtGState for alpha < 1).
|
|
3628
|
+
* - Linear gradients → `/Shading` Type 2 (axial) painted via `sh`,
|
|
3629
|
+
* clipped to the glyph outline.
|
|
3630
|
+
* - Radial gradients → `/Shading` Type 3, likewise.
|
|
3631
|
+
* - Sweep (conic) gradients → a fan of flat-colour triangular wedges
|
|
3632
|
+
* clipped to the outline (PDF has no native conic shading). (v1.4.0)
|
|
3633
|
+
* - Per-layer blend modes (`/BM`, from COLRv1 `PaintComposite`) via an
|
|
3634
|
+
* ExtGState applied around the layer's fill. (v1.4.0)
|
|
3635
|
+
*
|
|
3636
|
+
* The Form XObject's user space is font units; the caller scales it onto the
|
|
3637
|
+
* page with a `cm` and draws it with `Do`.
|
|
3638
|
+
*
|
|
3639
|
+
* References:
|
|
3640
|
+
* - ISO 32000-1 §8.7.4.5 (Shadings), §7.10.2 (Type 2 functions),
|
|
3641
|
+
* §8.10 (Form XObjects)
|
|
3642
|
+
*/
|
|
3643
|
+
|
|
3644
|
+
/** A rendered colour glyph ready to be assembled into a Form XObject. */
|
|
3645
|
+
interface ColorGlyphForm {
|
|
3646
|
+
/** Form XObject content stream (font-unit user space). */
|
|
3647
|
+
readonly content: string;
|
|
3648
|
+
/** Form BBox `[x0 y0 x1 y1]` in font units. */
|
|
3649
|
+
readonly bbox: readonly [number, number, number, number];
|
|
3650
|
+
/** Named `/Shading` resources referenced by the content stream. */
|
|
3651
|
+
readonly shadings: ReadonlyArray<{
|
|
3652
|
+
readonly name: string;
|
|
3653
|
+
readonly dict: string;
|
|
3654
|
+
}>;
|
|
3655
|
+
/** Named `/ExtGState` resources (constant alpha) referenced by content. */
|
|
3656
|
+
readonly extGStates: ReadonlyArray<{
|
|
3657
|
+
readonly name: string;
|
|
3658
|
+
readonly dict: string;
|
|
3659
|
+
}>;
|
|
3660
|
+
}
|
|
3661
|
+
/** Provider of glyph outlines (decoupled from the font parser for testing). */
|
|
3662
|
+
type OutlineProvider = (glyphId: number) => Contour[];
|
|
3663
|
+
type Mat = readonly [number, number, number, number, number, number];
|
|
3664
|
+
/**
|
|
3665
|
+
* Convert a set of TrueType quadratic contours into PDF path operators
|
|
3666
|
+
* (cubic Béziers), applying matrix `m`. Each contour is closed (`h`).
|
|
3667
|
+
*/
|
|
3668
|
+
declare function contoursToPath(contours: Contour[], m?: Mat): string;
|
|
3669
|
+
/**
|
|
3670
|
+
* Render a colour glyph into a {@link ColorGlyphForm}.
|
|
3671
|
+
*
|
|
3672
|
+
* @param glyph - Resolved colour glyph (ordered layers).
|
|
3673
|
+
* @param outlines - Provides the contours for a given base glyph id.
|
|
3674
|
+
* @param unitsPerEm - Font units per em (defines the BBox).
|
|
3675
|
+
*/
|
|
3676
|
+
declare function renderColorGlyph(glyph: ColorGlyph, outlines: OutlineProvider, unitsPerEm: number): ColorGlyphForm;
|
|
3677
|
+
|
|
2732
3678
|
/**
|
|
2733
3679
|
* pdfnative — PDF Token Scanner
|
|
2734
3680
|
* ===============================
|
|
@@ -3029,6 +3975,137 @@ interface PdfModifier {
|
|
|
3029
3975
|
*/
|
|
3030
3976
|
declare function createModifier(reader: PdfReader): PdfModifier;
|
|
3031
3977
|
|
|
3978
|
+
/**
|
|
3979
|
+
* pdfnative — Page-Tree Manipulation API (ISO 32000-1 §7.7.3)
|
|
3980
|
+
* ============================================================
|
|
3981
|
+
* Safe, **faithful** page-level document assembly: merge, split, and
|
|
3982
|
+
* extract pages across PDF documents.
|
|
3983
|
+
*
|
|
3984
|
+
* Unlike the incremental modifier (`createModifier`), these operations
|
|
3985
|
+
* **rebuild** a brand-new document from scratch: every kept page and its
|
|
3986
|
+
* transitive object graph (`/Contents`, `/Resources`, fonts, XObjects,
|
|
3987
|
+
* ExtGState, …) is deep-copied into a fresh, contiguous object-number
|
|
3988
|
+
* space, then wired into a new flat `/Pages` tree, `/Catalog`, xref, and
|
|
3989
|
+
* trailer. This avoids production-unsafe in-place surgery (relocating
|
|
3990
|
+
* `/Kids`, rewriting `/Parent` chains, merging resource pools).
|
|
3991
|
+
*
|
|
3992
|
+
* Safety guarantees (documented behaviour):
|
|
3993
|
+
* - **Encrypted sources are rejected** (no Standard Security Handler
|
|
3994
|
+
* writer yet) — throws.
|
|
3995
|
+
* - **Signatures are always removed** — any page-tree edit invalidates a
|
|
3996
|
+
* document signature's `/ByteRange`, so signature/Widget annotations and
|
|
3997
|
+
* the `/AcroForm` are dropped. The `dropSignatures` flag is accepted for
|
|
3998
|
+
* API clarity but the behaviour is unconditional.
|
|
3999
|
+
* - **Annotations** default to URI-`/Link`-only (self-contained). Cross-page
|
|
4000
|
+
* GoTo links and form widgets are dropped to guarantee no dangling
|
|
4001
|
+
* references. `dropAnnotations: true` removes all annotations.
|
|
4002
|
+
* - Output is **not** claimed to be PDF/A — merged OutputIntents / XMP
|
|
4003
|
+
* cannot be reconciled safely.
|
|
4004
|
+
*
|
|
4005
|
+
* @since 1.4.0
|
|
4006
|
+
*/
|
|
4007
|
+
/** A contiguous, inclusive page range (0-based). */
|
|
4008
|
+
interface PageRange {
|
|
4009
|
+
/** First page index (0-based, inclusive). */
|
|
4010
|
+
readonly start: number;
|
|
4011
|
+
/** Last page index (0-based, inclusive). Defaults to `start`. */
|
|
4012
|
+
readonly end?: number;
|
|
4013
|
+
}
|
|
4014
|
+
/**
|
|
4015
|
+
* Options for the page-tree manipulation API ({@link mergePdfs},
|
|
4016
|
+
* {@link splitPdf}, {@link extractPages}).
|
|
4017
|
+
*/
|
|
4018
|
+
interface MergeOptions {
|
|
4019
|
+
/**
|
|
4020
|
+
* Drop signature fields/widgets. Accepted for clarity; merging always
|
|
4021
|
+
* removes signatures because the operation invalidates `/ByteRange`.
|
|
4022
|
+
*/
|
|
4023
|
+
readonly dropSignatures?: boolean;
|
|
4024
|
+
/** Drop **all** annotations (default keeps self-contained URI links). */
|
|
4025
|
+
readonly dropAnnotations?: boolean;
|
|
4026
|
+
/**
|
|
4027
|
+
* Maximum size, in bytes, of the assembled output document. The operation
|
|
4028
|
+
* throws as soon as the copied object graph would exceed this limit — even
|
|
4029
|
+
* mid-copy, before a multi-gigabyte stream is materialised — so a malicious
|
|
4030
|
+
* or accidentally huge source cannot exhaust process memory.
|
|
4031
|
+
*
|
|
4032
|
+
* Defaults to `268435456` (256 MiB). Pass `Infinity` to disable the guard
|
|
4033
|
+
* (not recommended for untrusted input).
|
|
4034
|
+
*
|
|
4035
|
+
* @defaultValue 268435456 (256 MiB)
|
|
4036
|
+
*/
|
|
4037
|
+
readonly maxOutputSize?: number;
|
|
4038
|
+
}
|
|
4039
|
+
/**
|
|
4040
|
+
* Concatenate multiple PDF documents into one, preserving page order.
|
|
4041
|
+
*
|
|
4042
|
+
* @param sources 1–50 PDF byte arrays.
|
|
4043
|
+
* @param opts See {@link MergeOptions}.
|
|
4044
|
+
* @returns A new, self-contained PDF.
|
|
4045
|
+
* @throws If `sources` is empty/too large, or any source is encrypted.
|
|
4046
|
+
*/
|
|
4047
|
+
declare function mergePdfs(sources: readonly Uint8Array[], opts?: MergeOptions): Uint8Array;
|
|
4048
|
+
/**
|
|
4049
|
+
* Extract a subset of pages from a single document into a new PDF.
|
|
4050
|
+
* Indices may repeat and need not be ordered — output follows the given order.
|
|
4051
|
+
*
|
|
4052
|
+
* @param src Source PDF bytes.
|
|
4053
|
+
* @param pageIndices 0-based page indices to keep.
|
|
4054
|
+
* @param opts See {@link MergeOptions} (e.g. `maxOutputSize`,
|
|
4055
|
+
* `dropAnnotations`).
|
|
4056
|
+
* @throws If `src` is encrypted, indices is empty, or an index is out of range.
|
|
4057
|
+
*/
|
|
4058
|
+
declare function extractPages(src: Uint8Array, pageIndices: readonly number[], opts?: MergeOptions): Uint8Array;
|
|
4059
|
+
/**
|
|
4060
|
+
* Split a document into multiple PDFs, one per page range.
|
|
4061
|
+
*
|
|
4062
|
+
* @param src Source PDF bytes.
|
|
4063
|
+
* @param ranges Inclusive 0-based page ranges.
|
|
4064
|
+
* @param opts See {@link MergeOptions} (e.g. `maxOutputSize`,
|
|
4065
|
+
* `dropAnnotations`); applied to every emitted document.
|
|
4066
|
+
* @returns One PDF per range, in order.
|
|
4067
|
+
* @throws If `src` is encrypted, ranges is empty, or a range is invalid.
|
|
4068
|
+
*/
|
|
4069
|
+
declare function splitPdf(src: Uint8Array, ranges: readonly PageRange[], opts?: MergeOptions): Uint8Array[];
|
|
4070
|
+
|
|
4071
|
+
/**
|
|
4072
|
+
* pdfnative — PDF/UA structural validator (ISO 14289-1)
|
|
4073
|
+
* ======================================================
|
|
4074
|
+
* A lightweight, read-only conformance checker for tagged-PDF (PDF/UA)
|
|
4075
|
+
* structural prerequisites. It does **not** render or rasterise; it parses the
|
|
4076
|
+
* document with the native reader and inspects the catalog, structure tree and
|
|
4077
|
+
* per-page marked-content.
|
|
4078
|
+
*
|
|
4079
|
+
* Scope (what this validator can verify from structure alone):
|
|
4080
|
+
* - Catalog `/MarkInfo << /Marked true >>` (ISO 14289-1 §7.1)
|
|
4081
|
+
* - Catalog `/StructTreeRoot` (ISO 14289-1 §7.1)
|
|
4082
|
+
* - Catalog `/Metadata` (XMP) and `/Lang` (ISO 14289-1 §7.2, §7.3)
|
|
4083
|
+
* - `/StructTreeRoot /ParentTree` (ISO 32000-1 §14.7.4.4)
|
|
4084
|
+
* - MCID uniqueness within each page's content stream (ISO 32000-1 §14.7.4.3)
|
|
4085
|
+
*
|
|
4086
|
+
* It is intended as a fast developer-time gate, not a substitute for a full
|
|
4087
|
+
* reference validator (e.g. veraPDF) which also checks fonts, colour and
|
|
4088
|
+
* rendering. A `valid` result here means the structural prerequisites hold.
|
|
4089
|
+
*
|
|
4090
|
+
* @since 1.3.0
|
|
4091
|
+
*/
|
|
4092
|
+
/** Result of a PDF/UA structural validation. */
|
|
4093
|
+
interface PdfUAValidationResult {
|
|
4094
|
+
/** True when no blocking errors were found. */
|
|
4095
|
+
readonly valid: boolean;
|
|
4096
|
+
/** Blocking conformance violations. */
|
|
4097
|
+
readonly errors: readonly string[];
|
|
4098
|
+
/** Non-blocking recommendations (PDF/UA best practices). */
|
|
4099
|
+
readonly warnings: readonly string[];
|
|
4100
|
+
}
|
|
4101
|
+
/**
|
|
4102
|
+
* Validate the PDF/UA (ISO 14289-1) structural prerequisites of a tagged PDF.
|
|
4103
|
+
*
|
|
4104
|
+
* @param bytes - Complete PDF file bytes (e.g. from `buildDocumentPDFBytes`).
|
|
4105
|
+
* @returns A structured result with `valid`, `errors` and `warnings`.
|
|
4106
|
+
*/
|
|
4107
|
+
declare function validatePdfUA(bytes: Uint8Array): PdfUAValidationResult;
|
|
4108
|
+
|
|
3032
4109
|
/**
|
|
3033
4110
|
* pdfnative — DEFLATE Decompressor (FlateDecode reader)
|
|
3034
4111
|
* ======================================================
|
|
@@ -3176,4 +4253,4 @@ declare function createPDF(pdfParams: PdfParams, options?: {
|
|
|
3176
4253
|
layoutOptions?: Partial<PdfLayoutOptions>;
|
|
3177
4254
|
}): Promise<Uint8Array>;
|
|
3178
4255
|
|
|
3179
|
-
export { type AddSignaturePlaceholderOptions, type Annotation, type Asn1Node, BAL_H, type BarcodeBlock, type BarcodeFormat, type BidiRun, type CmsSignOptions, type ColumnDef, DEFAULT_COLORS, DEFAULT_COLUMNS, DEFAULT_CW, DEFAULT_FONT_SIZES, DEFAULT_MARGINS, DEFAULT_MAX_INFLATE_OUTPUT, type DocumentBlock, type DocumentMetadata, type DocumentParams, type EcPrivateKey, type EcPublicKey, type EmbeddedFilesResult, type EncodingContext, type EncryptionOptions, FT_H, type FontData, type FontEntry, type FontLoader, type FontMetrics, type FontRun, type FormField, type FormFieldBlock, type FormFieldType, type FormWidgetResult, HEADER_H, type HeadingBlock, INFO_LN, type ImageBlock, type InternalLink, KNOWN_DECODE_FILTERS, type LinkAnnotation, type LinkBlock, type ListBlock, MAX_PARSE_DEPTH, MAX_XREF_CHAIN, PAGE_SIZES, PDF_A_CONFORMANCE_TARGETS, PG_H, PG_W, type PageBreakBlock, type PageTemplate, type ParagraphBlock, type PdfArray as ParsedArray, type PdfDict as ParsedDict, type ParsedImage, type PdfAConfig, type PdfAConformanceTarget, type PdfAttachment, type PdfAttachmentRelationship, type PdfColor, type PdfColors, type PdfIndirectObject, type PdfInfoItem, type PdfLayoutOptions, type PdfModifier, type PdfName, type PdfParams, type PdfReader, type PdfRef, type PdfRgbString, type PdfRgbTuple, type PdfRow, type PdfSignOptions, type PdfStream, type PdfToken, type PdfTokenizer, type PdfValue, type QRErrorLevel, ROW_H, type RadioGroupContext, type RsaPrivateKey, type RsaPublicKey, type ShapedGlyph, type SigDictMetadata, type SignatureAlgorithm, type SpacerBlock, type StreamOptions, type SvgBlock, type SvgRenderOptions, type SvgSegment, TH_H, TITLE_LN, type TableBlock, type TextRun, type TocBlock, type TokenType, type UseCategory, type UseClassifiedCp, type UseCluster, WORKER_THRESHOLD, WORKER_TIMEOUT_MS, type WatermarkImage, type WatermarkOptions, type WatermarkState, type WatermarkText, type WorkerGenerationOptions, type WorkerInputMessage, type WorkerOutputMessage, type X509Certificate, type X509Name, type XrefEntry, type XrefTable, addSignaturePlaceholder, applyDecodeFilter, buildAcroFormDict, buildAppearanceStreamDict, buildCmsSignedData, buildDocumentPDF, buildDocumentPDFBytes, buildDocumentPDFStream, buildDocumentPDFStreamPageByPage, buildEmbeddedFiles, buildFormWidget, buildImageOperators, buildImageXObject, buildInternalLinkAnnotation, buildLinkAnnotation, buildPDF, buildPDFBytes, buildPDFStream, buildPDFStreamPageByPage, buildRadioGroupParent, buildSMaskXObject, buildSigDict, buildWatermarkState, chunkBinaryString, classifyClusters, classifyUseCategory, clearFontCache, computeColumnPositions, concatChunks, containsArabic, containsBengali, containsDevanagari, containsHebrew, containsRTL, containsTamil, containsThai, createEncodingContext, createModifier, createPDF, createTokenizer, decodeASCII85, decodeASCIIHex, decodeEcPublicKey, decodeLZW, decodeRunLength, defaultFieldHeight, derBitString, derDecode, derInteger, derOctetString, derOid, derSequence, detectCharLang, detectFallbackLangs, detectImageFormat, dictGet, dictGetArray, dictGetDict, dictGetName, dictGetNum, dictGetRef, downloadBlob, ean13CheckDigit, ecPublicKeyFromPrivate, ecdsaSign, ecdsaVerify, encodeCode128, encodeEcPublicKey, encodePDF417, encodePdfTextString, estimateCmsSize, estimateContentsSize, findStartxref, generateDataMatrix, generatePDFInWorker, generatePDFMainThread, generateQR, getMaxInflateOutputSize, getRegisteredLangs, getTrailerRef, getTrailerValue, hasFontLoader, helveticaBoldWidth, helveticaWidth, hmacSha256, inflateSync, initCrypto, initNodeCompression, initNodeDecompression as initNodeDecompression_parser, isArmenianCodepoint, isArray, isBengaliCodepoint, isCyrillicCodepoint, isDevanagariCodepoint, isDict, isGeorgianCodepoint, isLinkAnnotation, isName, isRef, isSelfSigned, isStream, isTamilCodepoint, isValidPdfRgb, loadFontData, nameValue, needsUnicodeFont, normalizeBidiEmbeddings, normalizeColors, openPdf, parseCertificate, parseColor, parseImage, parseIndirectObject, parseJPEG, parsePNG, parseRsaPrivateKey, parseRsaPublicKey, parseSvgPath, parseValue, parseXrefTable, pdfString, registerFont, registerFonts, renderBarcode, renderCode128, renderDataMatrix, renderEAN13, renderPDF417, renderQR, renderSvg, resetFontRegistry, resolveBidiRuns, resolveLayout, resolvePdfAConfig, resolveTemplate, rsaSign, rsaSignHash, rsaVerify, rsaVerifyHash, setDeflateImpl, setInflateImpl, setMaxInflateOutputSize, sha384, sha512, shapeArabicText, shapeBengaliText, shapeDevanagariText, shapeTamilText, shapeThaiText, signPdfBytes, slugify, splitTextByFont, streamByteLength, stripBidiControls, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };
|
|
4256
|
+
export { type AddSignaturePlaceholderOptions, type Annotation, type Asn1Node, BAL_H, type BarcodeBlock, type BarcodeFormat, type BidiRun, type CellBorders, type CmsSignOptions, type ColorGlyph, type ColorGlyphForm, type ColorLayer, type ColorPaint, type ColorStop, type ColumnDef, type Contour, type CpalColor, type CryptoProvider, DEFAULT_COLORS, DEFAULT_COLUMNS, DEFAULT_CW, DEFAULT_FONT_SIZES, DEFAULT_MARGINS, DEFAULT_MAX_BLOCKS, DEFAULT_MAX_INFLATE_OUTPUT, type DocumentBlock, type DocumentMetadata, type DocumentParams, type EcPrivateKey, type EcPublicKey, type EmbeddedFilesResult, type EncodingContext, type EncryptionOptions, FT_H, type FontData, type FontEntry, type FontLoader, type FontMetrics, type FontRun, type FontValidationResult, type FormField, type FormFieldBlock, type FormFieldType, type FormWidgetResult, type GlyfFont, type GradientExtend, HEADER_H, type HeadingBlock, INFO_LN, type ImageBlock, type InternalLink, KNOWN_DECODE_FILTERS, type LinearGradientPaint, type LinkAnnotation, type LinkBlock, type ListBlock, type ListItem, MAX_PARSE_DEPTH, MAX_XREF_CHAIN, type MergeOptions, type OutlineItem, type OutlinePoint, type OutlineProvider, PAGE_SIZES, PDF_A_CONFORMANCE_TARGETS, PG_H, PG_W, type PageBreakBlock, type PageLabelRange, type PageLabelStyle, type PageRange, type PageTemplate, type ParagraphBlock, type PdfArray as ParsedArray, type PdfDict as ParsedDict, type ParsedImage, type PdfAConfig, type PdfAConformanceTarget, type PdfAttachment, type PdfAttachmentRelationship, type PdfColor, type PdfColors, type PdfIndirectObject, type PdfInfoItem, type PdfLayoutOptions, type PdfModifier, type PdfName, type PdfParams, type PdfReader, type PdfRef, type PdfRgbString, type PdfRgbTuple, type PdfRow, type PdfSignOptions, type PdfStream, type PdfToken, type PdfTokenizer, type PdfUAValidationResult, type PdfValue, type QRErrorLevel, ROW_H, type RadialGradientPaint, type RadioGroupContext, type RsaPrivateKey, type RsaPublicKey, type ShapedGlyph, type SigDictMetadata, type SignatureAlgorithm, type SolidPaint, type SpacerBlock, type StreamOptions, type StreamToFileResult, type SvgBlock, type SvgRenderOptions, type SvgSegment, TH_H, TITLE_LN, type TableBlock, type TextRun, type TocBlock, type TokenType, type UseCategory, type UseClassifiedCp, type UseCluster, type ViewerPreferences, WORKER_THRESHOLD, WORKER_TIMEOUT_MS, type WatermarkImage, type WatermarkOptions, type WatermarkState, type WatermarkText, type WorkerGenerationOptions, type WorkerInputMessage, type WorkerOutputMessage, type X509Certificate, type X509Name, type XrefEntry, type XrefTable, addSignaturePlaceholder, applyDecodeFilter, buildAcroFormDict, buildAppearanceStreamDict, buildCmsSignedData, buildDocumentPDF, buildDocumentPDFBytes, buildDocumentPDFStream, buildDocumentPDFStreamPageByPage, buildDocumentPDFStreamTrue, buildEmbeddedFiles, buildFormWidget, buildImageOperators, buildImageXObject, buildInternalLinkAnnotation, buildLinkAnnotation, buildPDF, buildPDFBytes, buildPDFStream, buildPDFStreamPageByPage, buildPDFStreamTrue, buildRadioGroupParent, buildSMaskXObject, buildSigDict, buildWatermarkState, chunkBinaryString, classifyClusters, classifyUseCategory, clearFontCache, computeColumnPositions, concatChunks, containsArabic, containsBengali, containsDevanagari, containsEthiopic, containsHebrew, containsKhmer, containsMyanmar, containsRTL, containsSinhala, containsTamil, containsTelugu, containsThai, containsTibetan, contoursToPath, createEncodingContext, createModifier, createPDF, createTokenizer, decodeASCII85, decodeASCIIHex, decodeEcPublicKey, decodeLZW, decodeRunLength, defaultFieldHeight, derBitString, derDecode, derInteger, derOctetString, derOid, derSequence, detectCharLang, detectFallbackLangs, detectImageFormat, dictGet, dictGetArray, dictGetDict, dictGetName, dictGetNum, dictGetRef, downloadBlob, ean13CheckDigit, ecPublicKeyFromPrivate, ecdsaSign, ecdsaVerify, encodeCode128, encodeEcPublicKey, encodePDF417, encodePdfTextString, estimateCmsSize, estimateContentsSize, extractGlyphContours, extractPages, findStartxref, generateDataMatrix, generatePDFInWorker, generatePDFMainThread, generateQR, getCryptoProvider, getMaxInflateOutputSize, getRegisteredLangs, getTrailerRef, getTrailerValue, hasFontLoader, helveticaBoldWidth, helveticaWidth, hmacSha256, inflateSync, initCrypto, initNodeCompression, initNodeDecompression as initNodeDecompression_parser, isArmenianCodepoint, isArray, isBengaliCodepoint, isCyrillicCodepoint, isDevanagariCodepoint, isDict, isEthiopicCodepoint, isGeorgianCodepoint, isKhmerCodepoint, isLinkAnnotation, isMyanmarCodepoint, isName, isRef, isSelfSigned, isSinhalaCodepoint, isStream, isTamilCodepoint, isTeluguCodepoint, isTibetanCodepoint, isValidPdfRgb, loadFontData, mergePdfs, nameValue, needsUnicodeFont, normalizeBidiEmbeddings, normalizeColors, openPdf, parseCertificate, parseColor, parseColrCpal, parseCpal, parseGlyfFont, parseImage, parseIndirectObject, parseJPEG, parsePNG, parseRsaPrivateKey, parseRsaPublicKey, parseSvgPath, parseValue, parseXrefTable, pdfString, registerFont, registerFonts, renderBarcode, renderCode128, renderColorGlyph, renderDataMatrix, renderEAN13, renderPDF417, renderQR, renderSvg, resetFontRegistry, resolveBidiRuns, resolveLayout, resolvePdfAConfig, resolveTemplate, rsaSign, rsaSignHash, rsaVerify, rsaVerifyHash, setCryptoProvider, setDeflateImpl, setInflateImpl, setMaxInflateOutputSize, sha384, sha512, shapeArabicText, shapeBengaliText, shapeDevanagariText, shapeKhmerText, shapeMyanmarText, shapeSinhalaText, shapeTamilText, shapeTeluguText, shapeThaiText, shapeTibetanText, signPdfBytes, slugify, splitPdf, splitTextByFont, streamByteLength, streamToFile, stripBidiControls, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validateFontData, validatePdfUA, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };
|