pdfnative 1.1.0 → 1.3.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/dist/index.d.ts CHANGED
@@ -33,6 +33,93 @@ 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
+ /** A paint used to fill a colour-glyph layer. */
78
+ type ColorPaint = SolidPaint | LinearGradientPaint | RadialGradientPaint;
79
+ /** A single colour-glyph layer: a base outline filled by a paint. */
80
+ interface ColorLayer {
81
+ /** Glyph id of the base outline (in the font's `glyf` table). */
82
+ readonly glyphId: number;
83
+ /** The fill applied to the outline. */
84
+ readonly paint: ColorPaint;
85
+ /**
86
+ * Optional affine transform `[a b c d e f]` (font-unit space) applied to
87
+ * both the outline and the paint geometry of this layer — flattened from
88
+ * COLRv1 `PaintTransform`/`PaintTranslate`/`PaintScale`. Identity when
89
+ * absent.
90
+ */
91
+ readonly transform?: readonly [number, number, number, number, number, number];
92
+ }
93
+ /** A resolved colour glyph: ordered layers painted back-to-front. */
94
+ interface ColorGlyph {
95
+ readonly layers: readonly ColorLayer[];
96
+ }
97
+ /** A colour-emoji Form XObject collected during content building. */
98
+ interface ColorEmojiForm {
99
+ /** Resource name (without leading `/`), e.g. `CEm0`. */
100
+ readonly name: string;
101
+ /** Form XObject content stream (font-unit space). */
102
+ readonly content: string;
103
+ /** Inline `/Resources` body (shadings + ExtGStates), may be empty. */
104
+ readonly resources: string;
105
+ /** Form BBox `[x0 y0 x1 y1]` in font units. */
106
+ readonly bbox: readonly [number, number, number, number];
107
+ }
108
+ /**
109
+ * Collects unique colour-emoji glyphs encountered while building a document's
110
+ * content streams, de-duplicating them into a shared set of Form XObjects.
111
+ * Present on the {@link EncodingContext} only when an `'emoji-color'` font
112
+ * (a {@link FontData} carrying `colorGlyphs`) is registered. (v1.3.0)
113
+ */
114
+ interface ColorEmojiCollector {
115
+ /**
116
+ * Register use of a colour glyph and return its Form resource name, or
117
+ * `null` when `gid` is not a colour glyph (caller falls back to normal
118
+ * text rendering).
119
+ */
120
+ useGlyph(fontData: FontData, gid: number): string | null;
121
+ /** The de-duplicated colour-emoji forms, in first-use order. */
122
+ readonly forms: ColorEmojiForm[];
36
123
  }
37
124
  /** A font entry binding FontData to a PDF font reference. */
38
125
  interface FontEntry {
@@ -67,6 +154,12 @@ interface EncodingContext {
67
154
  readonly f2: string;
68
155
  readonly fontData?: FontData;
69
156
  readonly getUsedGids?: () => Map<string, Set<number>>;
157
+ /**
158
+ * Colour-emoji collector — present only when an `'emoji-color'` font
159
+ * (carrying `colorGlyphs`) is registered. Used by the text emitter to
160
+ * draw colour-emoji Form XObjects inline. (v1.3.0)
161
+ */
162
+ readonly colorEmoji?: ColorEmojiCollector;
70
163
  }
71
164
  /** A single row in the PDF table. */
72
165
  interface PdfRow {
@@ -163,6 +256,15 @@ interface ColumnDef {
163
256
  * @since 1.1.0
164
257
  */
165
258
  readonly maxWidth?: number;
259
+ /**
260
+ * Semantic kind for the column. When set to `'amount'`, data cells in
261
+ * this column render in Helvetica-Bold with credit/debit colouring
262
+ * driven by `row.type`. Opt-in replacement for the pre-1.2.0
263
+ * hardcoded `i === 3` heuristic in `renderTable`. Default: plain text
264
+ * in `colors.text` and `enc.f1` (Helvetica-Regular).
265
+ * @since 1.2.0
266
+ */
267
+ readonly kind?: 'amount';
166
268
  }
167
269
  /**
168
270
  * Options for generating a PDF in a Web Worker via `generatePDFInWorker()`.
@@ -292,6 +394,51 @@ interface PdfLayoutOptions {
292
394
  * Default: undefined (no attachments).
293
395
  */
294
396
  readonly attachments?: readonly PdfAttachment[];
397
+ /**
398
+ * Maximum number of document blocks `buildDocumentPDF` / `buildDocumentPDFBytes`
399
+ * (and the streaming variants) will accept before throwing. This is a
400
+ * safety rail against accidental unbounded input, not a hard engine limit —
401
+ * raise it for very large generated reports (e.g. multi-thousand-page
402
+ * medical or financial documents).
403
+ *
404
+ * Default: `DEFAULT_MAX_BLOCKS` (100 000), matching the table builder's
405
+ * 100 000-row ceiling. Has no effect on the table builder (`buildPDF`).
406
+ *
407
+ * @since 1.3.0
408
+ */
409
+ readonly maxBlocks?: number;
410
+ /**
411
+ * Apply Unicode normalization to all rendered text before shaping and
412
+ * encoding. Uses the native `String.prototype.normalize` (zero dependency).
413
+ *
414
+ * Useful when input text may contain decomposed combining sequences (e.g.
415
+ * Vietnamese, some Indic input, or text copied from macOS which favours
416
+ * NFD) so that base + combining marks compose to the precomposed code
417
+ * points a font's cmap is most likely to cover, maximising glyph coverage.
418
+ *
419
+ * - `'NFC'` (recommended): canonical composition
420
+ * - `'NFD'`: canonical decomposition
421
+ * - `'NFKC'` / `'NFKD'`: compatibility (de)composition
422
+ * - `false` / omitted: no normalization (default — output is byte-identical)
423
+ *
424
+ * Default: `false` (backward compatible, byte-stable).
425
+ *
426
+ * @since 1.3.0
427
+ */
428
+ readonly normalize?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | false;
429
+ /**
430
+ * Override the PDF creation date embedded in `/Info /CreationDate` and
431
+ * XMP metadata. Accepts any `Date` object.
432
+ *
433
+ * When omitted, defaults to `new Date()` at build time. Pinning this
434
+ * value makes output byte-identical across repeated calls — useful for
435
+ * deterministic tests and content-addressable storage.
436
+ *
437
+ * Default: `undefined` (current wall-clock time).
438
+ *
439
+ * @since 1.3.0
440
+ */
441
+ readonly creationDate?: Date;
295
442
  }
296
443
  /**
297
444
  * Relationship of an embedded file to the PDF document (ISO 19005-3 §6.8).
@@ -800,6 +947,66 @@ interface TableBlock {
800
947
  * @since 1.1.0
801
948
  */
802
949
  readonly autoFitColumns?: boolean;
950
+ /**
951
+ * Cell text wrapping policy.
952
+ *
953
+ * - `'auto'` (default) — wrap a cell's text only when its measured width
954
+ * exceeds the column's available width. Cells that fit stay on a single
955
+ * line, preserving byte-identical output with v1.1 for tables sized correctly.
956
+ * - `'always'` — wrap every cell using the available column width.
957
+ * - `'never'` — never wrap; fall back to v1.1 behaviour (character truncation
958
+ * via `ColumnDef.mx` / `mxH`, plus the clipping rectangle when `clipCells`
959
+ * is `true`). Useful when byte-identical v1.1 output is required.
960
+ *
961
+ * @since 1.2.0
962
+ */
963
+ readonly wrap?: 'auto' | 'always' | 'never';
964
+ /**
965
+ * Repeat the table header row on every continuation page when the table
966
+ * spans multiple pages. Default: `true`.
967
+ *
968
+ * Single-page tables are unaffected and byte-identical to v1.1.
969
+ *
970
+ * @since 1.2.0
971
+ */
972
+ readonly repeatHeader?: boolean;
973
+ /**
974
+ * Alternate-row background (zebra striping).
975
+ *
976
+ * - `false` (default) — no zebra background.
977
+ * - `true` — fill every other data row with a default light tint
978
+ * (`'0.969 0.973 0.984'`, matching the default header background).
979
+ * - `PdfColor` — fill every other data row with the provided color.
980
+ *
981
+ * Uses a static (non-transparent) fill so the table remains PDF/A-1b safe.
982
+ *
983
+ * @since 1.2.0
984
+ */
985
+ readonly zebra?: boolean | PdfColor;
986
+ /**
987
+ * Optional caption rendered immediately above the table.
988
+ *
989
+ * In tagged mode, the caption is emitted as a `/Caption` structure element
990
+ * inside the `/Table` (ISO 14289-1 §7.10.6) for assistive-technology access.
991
+ *
992
+ * @since 1.2.0
993
+ */
994
+ readonly caption?: string;
995
+ /**
996
+ * Minimum row height in points. Rows shorter than this are padded.
997
+ * Defaults to the v1.1 `ROW_H` constant (`12`pt). Rows that wrap to
998
+ * multiple lines grow as needed; this only sets the floor.
999
+ *
1000
+ * @since 1.2.0
1001
+ */
1002
+ readonly minRowHeight?: number;
1003
+ /**
1004
+ * Horizontal cell padding in points (applied to both the left and right
1005
+ * insets inside each cell). Defaults to the v1.1 constant (`3`pt).
1006
+ *
1007
+ * @since 1.2.0
1008
+ */
1009
+ readonly cellPadding?: number;
803
1010
  }
804
1011
  /** List block — bullet or numbered items. */
805
1012
  interface ListBlock {
@@ -1156,6 +1363,32 @@ interface PdfAConfig {
1156
1363
  /** OutputIntent /S name. */
1157
1364
  readonly outputIntentSubtype: string;
1158
1365
  }
1366
+ /**
1367
+ * Canonical list of PDF/A conformance targets accepted by the `tagged`
1368
+ * layout option. Useful as a single source of truth for tooling — most
1369
+ * notably the `pdfnative-mcp` server's tool-schema `enum:` field — so
1370
+ * agents like Gemini-CLI can autocomplete the legal values without
1371
+ * hardcoding string literals.
1372
+ *
1373
+ * @example
1374
+ * ```ts
1375
+ * import { PDF_A_CONFORMANCE_TARGETS, type PdfAConformanceTarget } from 'pdfnative';
1376
+ *
1377
+ * function pickTarget(input: string): PdfAConformanceTarget | undefined {
1378
+ * return (PDF_A_CONFORMANCE_TARGETS as readonly string[]).includes(input)
1379
+ * ? input as PdfAConformanceTarget
1380
+ * : undefined;
1381
+ * }
1382
+ * ```
1383
+ *
1384
+ * @since 1.2.0
1385
+ */
1386
+ declare const PDF_A_CONFORMANCE_TARGETS: readonly ["pdfa1b", "pdfa2b", "pdfa2u", "pdfa3b"];
1387
+ /**
1388
+ * Type alias for the string literal members of {@link PDF_A_CONFORMANCE_TARGETS}.
1389
+ * @since 1.2.0
1390
+ */
1391
+ type PdfAConformanceTarget = typeof PDF_A_CONFORMANCE_TARGETS[number];
1159
1392
  /**
1160
1393
  * Parse the `tagged` layout option into a resolved PDF/A configuration.
1161
1394
  *
@@ -1633,17 +1866,13 @@ declare function estimateCmsSize(certSizes: readonly number[], algorithm: Signat
1633
1866
  * Foxit, and other PDF validators can verify.
1634
1867
  */
1635
1868
 
1636
- interface PdfSignOptions {
1637
- /** Signer's X.509 certificate (DER-parsed). */
1638
- readonly signerCert: X509Certificate;
1639
- /** Optional certificate chain (intermediate CAs). */
1640
- readonly certChain?: readonly X509Certificate[];
1641
- /** RSA private key (for 'rsa-sha256'). */
1642
- readonly rsaKey?: RsaPrivateKey;
1643
- /** ECDSA private key (for 'ecdsa-sha256'). */
1644
- readonly ecKey?: EcPrivateKey;
1645
- /** Algorithm to use. Default: 'rsa-sha256'. */
1646
- readonly algorithm?: SignatureAlgorithm;
1869
+ /**
1870
+ * Metadata-only subset of {@link PdfSignOptions} used by
1871
+ * {@link buildSigDict} and {@link addSignaturePlaceholder}. None of
1872
+ * these fields require key material — they just go into the `/Sig`
1873
+ * dictionary as descriptive entries.
1874
+ */
1875
+ interface SigDictMetadata {
1647
1876
  /** Signing time (defaults to current time). */
1648
1877
  readonly signingTime?: Date;
1649
1878
  /** Signer display name (for /Name field). */
@@ -1655,6 +1884,18 @@ interface PdfSignOptions {
1655
1884
  /** Contact info (for /ContactInfo field). */
1656
1885
  readonly contactInfo?: string;
1657
1886
  }
1887
+ interface PdfSignOptions extends SigDictMetadata {
1888
+ /** Signer's X.509 certificate (DER-parsed). */
1889
+ readonly signerCert: X509Certificate;
1890
+ /** Optional certificate chain (intermediate CAs). */
1891
+ readonly certChain?: readonly X509Certificate[];
1892
+ /** RSA private key (for 'rsa-sha256'). */
1893
+ readonly rsaKey?: RsaPrivateKey;
1894
+ /** ECDSA private key (for 'ecdsa-sha256'). */
1895
+ readonly ecKey?: EcPrivateKey;
1896
+ /** Algorithm to use. Default: 'rsa-sha256'. */
1897
+ readonly algorithm?: SignatureAlgorithm;
1898
+ }
1658
1899
  /**
1659
1900
  * Build a /Sig signature dictionary string for embedding in a PDF.
1660
1901
  * The /Contents and /ByteRange fields use placeholders that will be
@@ -1664,7 +1905,7 @@ interface PdfSignOptions {
1664
1905
  * @param contentsSize - Size of /Contents hex string in bytes.
1665
1906
  * @returns The /Sig dictionary string and the contentsHexLen.
1666
1907
  */
1667
- declare function buildSigDict(options: PdfSignOptions, contentsSize?: number): string;
1908
+ declare function buildSigDict(options: SigDictMetadata, contentsSize?: number): string;
1668
1909
  /**
1669
1910
  * Sign a PDF that contains a signature placeholder.
1670
1911
  *
@@ -1685,6 +1926,71 @@ declare function signPdfBytes(pdfBytes: Uint8Array, options: PdfSignOptions): Ui
1685
1926
  */
1686
1927
  declare function estimateContentsSize(certSizes: readonly number[], algorithm?: SignatureAlgorithm): number;
1687
1928
 
1929
+ /**
1930
+ * pdfnative — Signature Placeholder Injector
1931
+ * ============================================
1932
+ * Inject an AcroForm + invisible signature widget placeholder into an
1933
+ * existing PDF via incremental update (ISO 32000-1 §7.5.6, §12.7.4.5,
1934
+ * §12.8). The resulting PDF can be fed straight to
1935
+ * {@link signPdfBytes} without any further preparation.
1936
+ *
1937
+ * Closes issue [#45](https://github.com/Nizoka/pdfnative/issues/45) —
1938
+ * removes the need for downstream tooling (pdfnative-cli) to ship a
1939
+ * local placeholder injector that duplicates the byte layout dictated
1940
+ * by `BYTERANGE_PLACEHOLDER` and `buildSigDict()` in
1941
+ * [pdf-signature.ts](./pdf-signature.ts).
1942
+ */
1943
+ /**
1944
+ * Options for {@link addSignaturePlaceholder}.
1945
+ */
1946
+ interface AddSignaturePlaceholderOptions {
1947
+ /**
1948
+ * Reserved bytes for the future CMS blob. The on-disk
1949
+ * `/Contents` hex string will be twice this size.
1950
+ *
1951
+ * @default 16384
1952
+ */
1953
+ readonly placeholderBytes?: number;
1954
+ /**
1955
+ * `/T` field name on the signature widget. Must be unique across
1956
+ * the AcroForm `/Fields` array — throws on collision with an
1957
+ * existing non-signature field.
1958
+ *
1959
+ * @default 'Signature1'
1960
+ */
1961
+ readonly fieldName?: string;
1962
+ /**
1963
+ * Page index (0-based) to attach the (invisible) widget to.
1964
+ *
1965
+ * @default 0
1966
+ */
1967
+ readonly pageIndex?: number;
1968
+ /**
1969
+ * `/Rect` for the widget annotation. `[0, 0, 0, 0]` makes the
1970
+ * signature invisible — the default. Pass explicit coordinates if
1971
+ * you want a visible signature appearance.
1972
+ *
1973
+ * @default [0, 0, 0, 0]
1974
+ */
1975
+ readonly rect?: readonly [number, number, number, number];
1976
+ }
1977
+ /**
1978
+ * Inject an AcroForm + signature widget placeholder into an existing
1979
+ * PDF via incremental update. Returns a NEW byte array. Idempotent:
1980
+ * if the PDF already carries a `/FT /Sig` widget, the input is
1981
+ * returned unchanged.
1982
+ *
1983
+ * @example
1984
+ * ```ts
1985
+ * import { buildDocumentPDFBytes, addSignaturePlaceholder, signPdfBytes } from 'pdfnative';
1986
+ *
1987
+ * const unsigned = buildDocumentPDFBytes(params);
1988
+ * const placeheld = addSignaturePlaceholder(unsigned, { fieldName: 'Author' });
1989
+ * const signed = await signPdfBytes(placeheld, { privateKey, certificate });
1990
+ * ```
1991
+ */
1992
+ declare function addSignaturePlaceholder(pdfBytes: Uint8Array, options?: AddSignaturePlaceholderOptions): Uint8Array;
1993
+
1688
1994
  /**
1689
1995
  * pdfnative — Streaming PDF Output
1690
1996
  * ==================================
@@ -1761,6 +2067,53 @@ declare function chunkBinaryString(str: string, chunkSize: number): Generator<Ui
1761
2067
  * ```
1762
2068
  */
1763
2069
  declare function buildDocumentPDFStream(params: DocumentParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
2070
+ /**
2071
+ * Build a free-form PDF document and yield Uint8Array chunks aligned
2072
+ * at PDF object boundaries (one indirect object per chunk, plus a
2073
+ * header chunk and a trailing xref/trailer chunk).
2074
+ *
2075
+ * Use this variant when the consumer benefits from receiving
2076
+ * semantically meaningful PDF segments rather than fixed-size byte
2077
+ * slices — for example, persisting each page object directly to disk
2078
+ * before the next one is produced, or for diagnostic tooling that
2079
+ * wants to inspect individual objects.
2080
+ *
2081
+ * **Scope note (v1.2.x):** the underlying assembler still buffers the
2082
+ * full PDF binary in memory before chunking; constant-memory
2083
+ * generation (true progressive assembly) is staged for v1.3. The
2084
+ * public API surface, however, is stable from v1.2 onward — code
2085
+ * written against `buildDocumentPDFStreamPageByPage()` will keep
2086
+ * working without changes when the internal refactor lands.
2087
+ *
2088
+ * Constraints (same as `buildDocumentPDFStream`):
2089
+ * - TOC blocks are not allowed (require multi-pass pagination)
2090
+ * - `{pages}` placeholder is not allowed in header/footer templates
2091
+ *
2092
+ * @param params - Document content (title, blocks, footer, fonts)
2093
+ * @param layoutOptions - Optional layout customization
2094
+ * @yields Uint8Array chunks of the PDF, one PDF indirect object per chunk
2095
+ *
2096
+ * @example
2097
+ * ```ts
2098
+ * import { createWriteStream } from 'fs';
2099
+ * const out = createWriteStream('large.pdf');
2100
+ * for await (const chunk of buildDocumentPDFStreamPageByPage(params)) {
2101
+ * out.write(chunk);
2102
+ * }
2103
+ * out.end();
2104
+ * ```
2105
+ */
2106
+ declare function buildDocumentPDFStreamPageByPage(params: DocumentParams, layoutOptions?: Partial<PdfLayoutOptions>): AsyncGenerator<Uint8Array>;
2107
+ /**
2108
+ * Build a table-centric PDF and yield Uint8Array chunks aligned at
2109
+ * PDF object boundaries. See {@link buildDocumentPDFStreamPageByPage}
2110
+ * for the full semantic contract.
2111
+ *
2112
+ * @param params - PDF content (title, rows, headers, etc.)
2113
+ * @param layoutOptions - Optional layout customization
2114
+ * @yields Uint8Array chunks of the PDF, one PDF indirect object per chunk
2115
+ */
2116
+ declare function buildPDFStreamPageByPage(params: PdfParams, layoutOptions?: Partial<PdfLayoutOptions>): AsyncGenerator<Uint8Array>;
1764
2117
  /**
1765
2118
  * Build a table-centric PDF and yield Uint8Array chunks progressively.
1766
2119
  *
@@ -1782,6 +2135,36 @@ declare function buildDocumentPDFStream(params: DocumentParams, layoutOptions?:
1782
2135
  * ```
1783
2136
  */
1784
2137
  declare function buildPDFStream(params: PdfParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
2138
+ /**
2139
+ * Build a free-form PDF document with **true constant-memory streaming**.
2140
+ *
2141
+ * Unlike {@link buildDocumentPDFStream} (which assembles the full binary
2142
+ * then chunks it), this variant assembles the PDF into its raw parts and
2143
+ * yields them progressively, freeing each part as it is emitted. The
2144
+ * fully-joined PDF binary never exists in memory at once. Byte output is
2145
+ * identical to {@link buildDocumentPDFBytes}.
2146
+ *
2147
+ * Constraints (same as `buildDocumentPDFStream`):
2148
+ * - TOC blocks are not allowed (require multi-pass pagination)
2149
+ * - `{pages}` placeholder is not allowed in header/footer templates
2150
+ *
2151
+ * @param params - Document content (title, blocks, footer, fonts)
2152
+ * @param layoutOptions - Optional layout customization
2153
+ * @param streamOptions - Chunk size configuration
2154
+ * @yields Uint8Array chunks of the PDF
2155
+ */
2156
+ declare function buildDocumentPDFStreamTrue(params: DocumentParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
2157
+ /**
2158
+ * Build a table-centric PDF with **true constant-memory streaming**.
2159
+ * See {@link buildDocumentPDFStreamTrue} for the full contract. Byte
2160
+ * output is identical to {@link buildPDFBytes}.
2161
+ *
2162
+ * @param params - PDF content (title, rows, headers, etc.)
2163
+ * @param layoutOptions - Optional layout customization
2164
+ * @param streamOptions - Chunk size configuration
2165
+ * @yields Uint8Array chunks of the PDF
2166
+ */
2167
+ declare function buildPDFStreamTrue(params: PdfParams, layoutOptions?: Partial<PdfLayoutOptions>, streamOptions?: StreamOptions): AsyncGenerator<Uint8Array>;
1785
2168
  /**
1786
2169
  * Concatenate an array of Uint8Array chunks into a single Uint8Array.
1787
2170
  *
@@ -1864,6 +2247,12 @@ declare const DEFAULT_MARGINS: {
1864
2247
  l: number;
1865
2248
  };
1866
2249
  declare const DEFAULT_CW: number;
2250
+ /**
2251
+ * Default ceiling for `buildDocumentPDF` block count, overridable per call via
2252
+ * `PdfLayoutOptions.maxBlocks`. Matches the table builder's 100 000-row cap.
2253
+ * @since 1.3.0
2254
+ */
2255
+ declare const DEFAULT_MAX_BLOCKS = 100000;
1867
2256
  declare const ROW_H = 12;
1868
2257
  declare const TH_H = 15;
1869
2258
  declare const INFO_LN = 13;
@@ -1976,6 +2365,11 @@ declare function encodePdfTextString(str: string): string;
1976
2365
  declare function toWinAnsi(str: string): string;
1977
2366
  /**
1978
2367
  * Create a PDF string literal: encode to WinAnsi and escape (, ), \.
2368
+ *
2369
+ * Invisible BiDi directional controls (LRM/RLM, LRE/RLE/PDF/LRO/RLO,
2370
+ * LRI/RLI/FSI/PDI) are stripped before encoding — they carry no
2371
+ * visible width per UAX #9 and would otherwise become '?' under
2372
+ * WinAnsi.
1979
2373
  */
1980
2374
  declare function pdfString(str: string): string;
1981
2375
  /**
@@ -2002,8 +2396,25 @@ declare function truncate(str: string, max: number): string;
2002
2396
  declare function truncateToWidth(str: string, maxWidthPt: number, sz: number, enc: EncodingContext): string;
2003
2397
  /**
2004
2398
  * Approximate text width in points using Helvetica character metrics.
2399
+ *
2400
+ * Invisible BiDi controls are stripped before measuring (zero-width
2401
+ * per UAX #9).
2005
2402
  */
2006
2403
  declare function helveticaWidth(str: string, sz: number): number;
2404
+ /**
2405
+ * Approximate text width in points using **Helvetica-Bold** character
2406
+ * metrics. Required for right- and centre-aligned bold text (table headers,
2407
+ * captions) where measuring with the regular {@link helveticaWidth}
2408
+ * would position the rendered glyphs slightly past the intended right edge —
2409
+ * Helvetica-Bold advances are ~16% wider on average than Helvetica-Regular.
2410
+ *
2411
+ * Widths are derived from the Adobe Helvetica-Bold AFM file (Type 1 standard
2412
+ * PostScript font, base-14 PDF). Invisible BiDi controls are stripped before
2413
+ * measuring (zero-width per UAX #9).
2414
+ *
2415
+ * @since 1.2.0
2416
+ */
2417
+ declare function helveticaBoldWidth(str: string, sz: number): number;
2007
2418
 
2008
2419
  /**
2009
2420
  * pdfnative — Encoding Context Factory
@@ -2027,7 +2438,7 @@ declare function helveticaWidth(str: string, sz: number): number;
2027
2438
  * Latin mode is used as before — strict PDF/A conformance requires the caller
2028
2439
  * to register a Latin font (e.g. Noto Sans VF).
2029
2440
  */
2030
- declare function createEncodingContext(fontEntries: FontEntry[], pdfA?: boolean): EncodingContext;
2441
+ declare function createEncodingContext(fontEntries: FontEntry[], pdfA?: boolean, normalize?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | false): EncodingContext;
2031
2442
 
2032
2443
  /**
2033
2444
  * pdfnative — Font Loader
@@ -2123,6 +2534,18 @@ declare function isArmenianCodepoint(cp: number): boolean;
2123
2534
  declare function isBengaliCodepoint(cp: number): boolean;
2124
2535
  /** Check if a codepoint falls in the Tamil Unicode block. */
2125
2536
  declare function isTamilCodepoint(cp: number): boolean;
2537
+ /** Check if a codepoint falls in the Telugu Unicode block. */
2538
+ declare function isTeluguCodepoint(cp: number): boolean;
2539
+ /** Check if a codepoint falls in any Ethiopic Unicode block. */
2540
+ declare function isEthiopicCodepoint(cp: number): boolean;
2541
+ /** Check if a codepoint falls in the Sinhala Unicode block. */
2542
+ declare function isSinhalaCodepoint(cp: number): boolean;
2543
+ /** Check if a codepoint falls in the Tibetan Unicode block. */
2544
+ declare function isTibetanCodepoint(cp: number): boolean;
2545
+ /** Check if a codepoint falls in any Khmer Unicode block. */
2546
+ declare function isKhmerCodepoint(cp: number): boolean;
2547
+ /** Check if a codepoint falls in any Myanmar Unicode block. */
2548
+ declare function isMyanmarCodepoint(cp: number): boolean;
2126
2549
  /** Check if a codepoint falls in any Devanagari Unicode block. */
2127
2550
  declare function isDevanagariCodepoint(cp: number): boolean;
2128
2551
  /** Check if text contains Arabic characters requiring shaping. */
@@ -2135,6 +2558,18 @@ declare function containsThai(str: string): boolean;
2135
2558
  declare function containsBengali(str: string): boolean;
2136
2559
  /** Check whether a string contains any Tamil characters. */
2137
2560
  declare function containsTamil(str: string): boolean;
2561
+ /** Check whether a string contains any Telugu characters. */
2562
+ declare function containsTelugu(str: string): boolean;
2563
+ /** Check whether a string contains any Ethiopic characters. */
2564
+ declare function containsEthiopic(str: string): boolean;
2565
+ /** Check whether a string contains any Sinhala characters. */
2566
+ declare function containsSinhala(str: string): boolean;
2567
+ /** Check whether a string contains any Tibetan characters. */
2568
+ declare function containsTibetan(str: string): boolean;
2569
+ /** Check whether a string contains any Khmer characters. */
2570
+ declare function containsKhmer(str: string): boolean;
2571
+ /** Check whether a string contains any Myanmar characters. */
2572
+ declare function containsMyanmar(str: string): boolean;
2138
2573
  /** Check whether a string contains any Devanagari characters. */
2139
2574
  declare function containsDevanagari(str: string): boolean;
2140
2575
 
@@ -2200,6 +2635,191 @@ declare function shapeBengaliText(str: string, fontData: FontData): ShapedGlyph[
2200
2635
  */
2201
2636
  declare function shapeTamilText(str: string, fontData: FontData): ShapedGlyph[];
2202
2637
 
2638
+ /**
2639
+ * pdfnative — Telugu Mini-Shaper
2640
+ * ================================
2641
+ * Pure JS OpenType GSUB + GPOS shaping for Telugu script.
2642
+ * Zero external dependency.
2643
+ *
2644
+ * Handles:
2645
+ * - Syllable cluster building (base + virama-mediated conjuncts / subjoined
2646
+ * consonants — Telugu stacks the dependent consonant below the base)
2647
+ * - GSUB LigatureSubst: conjunct / subjoined-consonant formation
2648
+ * (C + Virama + C → ligature glyph)
2649
+ * - GSUB SingleSubst: contextual glyph substitution
2650
+ * - GPOS MarkToBase: combining-mark positioning (above/below vowel signs,
2651
+ * anusvara, candrabindu, length marks)
2652
+ *
2653
+ * Telugu is structurally close to Devanagari but:
2654
+ * - has **no reph** (Ra forms a subjoined glyph, not a top mark),
2655
+ * - has **no pre-base matra reordering** — every Telugu vowel sign attaches
2656
+ * to the right of, or above/below, the base (nothing renders to its left),
2657
+ * - has **no nukta**.
2658
+ *
2659
+ * References:
2660
+ * - Unicode Standard §12.8 Telugu
2661
+ * - OpenType spec: Script-specific shaping for Telugu (tel2 / Indic2)
2662
+ * - ISO 15924 script code: Telu
2663
+ */
2664
+
2665
+ /**
2666
+ * Shape a string of Telugu text into an array of positioned glyphs.
2667
+ *
2668
+ * @param str - Raw Telugu string
2669
+ * @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
2670
+ * @returns Array of positioned glyphs
2671
+ */
2672
+ declare function shapeTeluguText(str: string, fontData: FontData): ShapedGlyph[];
2673
+
2674
+ /**
2675
+ * pdfnative — Sinhala Mini-Shaper
2676
+ * ================================
2677
+ * Pure JS OpenType GSUB + GPOS shaping for the Sinhala script (Sri Lanka).
2678
+ * Zero external dependency.
2679
+ *
2680
+ * Handles:
2681
+ * - Syllable cluster building (base + al-lakuna-mediated conjuncts)
2682
+ * - GSUB LigatureSubst: conjunct / touching-form ligatures
2683
+ * (C + Al-lakuna + ZWJ + Ya/Ra → yansaya / rakaaransaya, C+C conjuncts)
2684
+ * - Pre-base (left-side) vowel reordering — the kombuva family
2685
+ * (U+0DD9 / U+0DDB and the left half of the two-part vowels U+0DDA,
2686
+ * U+0DDC, U+0DDD, U+0DDE) renders to the LEFT of its base consonant, so
2687
+ * the shaper emits that glyph BEFORE the base in visual order.
2688
+ * - Two-part dependent vowels are decomposed into their left + right halves.
2689
+ * - GPOS MarkToBase: above / below pilla positioning.
2690
+ *
2691
+ * Known limitations (documented):
2692
+ * - Complex multi-consonant stacks beyond the font's pre-baked ligature
2693
+ * table fall back to sequential base + al-lakuna rendering.
2694
+ * - GSUB MultipleSubst (LookupType 2) is not consumed; two-part vowels are
2695
+ * instead decomposed by this shaper's own table.
2696
+ *
2697
+ * References:
2698
+ * - Unicode Standard §13.2 Sinhala
2699
+ * - OpenType spec: Script-specific shaping for Sinhala (sinh)
2700
+ * - ISO 15924 script code: Sinh
2701
+ */
2702
+
2703
+ /**
2704
+ * Shape a string of Sinhala text into an array of positioned glyphs.
2705
+ *
2706
+ * @param str - Raw Sinhala string
2707
+ * @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
2708
+ * @returns Array of positioned glyphs
2709
+ */
2710
+ declare function shapeSinhalaText(str: string, fontData: FontData): ShapedGlyph[];
2711
+
2712
+ /**
2713
+ * pdfnative — Tibetan Mini-Shaper
2714
+ * ================================
2715
+ * Pure JS OpenType GSUB + GPOS shaping for the Tibetan script.
2716
+ * Zero external dependency.
2717
+ *
2718
+ * Tibetan builds vertical stacks: a head consonant with zero or more
2719
+ * *subjoined* consonants (U+0F90–U+0FBC) stacked beneath it, plus vowel
2720
+ * signs above / below and spacing marks to the right.
2721
+ *
2722
+ * Handles:
2723
+ * - Stack building (head consonant + subjoined consonants + vowels + marks)
2724
+ * - GSUB LigatureSubst: pre-baked stacked-consonant ligatures when the font
2725
+ * provides them (head + subjoined → single stack glyph)
2726
+ * - GPOS MarkToBase: subjoined consonants and above/below vowel signs are
2727
+ * anchored on the base when no ligature exists
2728
+ *
2729
+ * Known limitations (documented):
2730
+ * - Deep stacks beyond the font's ligature coverage fall back to GPOS
2731
+ * below-base anchoring of each subjoined consonant, which approximates but
2732
+ * may not perfectly match a native stacking engine.
2733
+ * - GSUB contextual substitution (LookupType 5/6) is not consumed.
2734
+ *
2735
+ * References:
2736
+ * - Unicode Standard §13.4 Tibetan
2737
+ * - OpenType spec: Script-specific shaping for Tibetan (tibt)
2738
+ * - ISO 15924 script code: Tibt
2739
+ */
2740
+
2741
+ /**
2742
+ * Shape a string of Tibetan text into an array of positioned glyphs.
2743
+ *
2744
+ * @param str - Raw Tibetan string
2745
+ * @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
2746
+ * @returns Array of positioned glyphs
2747
+ */
2748
+ declare function shapeTibetanText(str: string, fontData: FontData): ShapedGlyph[];
2749
+
2750
+ /**
2751
+ * pdfnative — Khmer Mini-Shaper
2752
+ * ==============================
2753
+ * Pure JS OpenType GSUB + GPOS shaping for the Khmer script (Cambodia).
2754
+ * Zero external dependency.
2755
+ *
2756
+ * Khmer is a USE-class (Universal Shaping Engine) script. This is a pragmatic
2757
+ * USE-lite implementation that covers the common cases:
2758
+ * - Coeng (U+17D2) + consonant → subscript consonant (stacked below / behind)
2759
+ * - Pre-base (left-side) vowel reordering — U+17C1 (e), U+17C2 (ae),
2760
+ * U+17C3 (ai) render to the LEFT of their base, so they are emitted first.
2761
+ * - Two-part vowels (U+17BE, U+17BF, U+17C0, U+17C4, U+17C5) are decomposed
2762
+ * into their pre-base + post-base halves.
2763
+ * - GSUB LigatureSubst: coeng-form subscript ligatures when the font provides
2764
+ * them; GPOS MarkToBase for above / below vowel signs and diacritics.
2765
+ *
2766
+ * Known limitations (documented):
2767
+ * - This is not a full USE implementation. Robat (U+17CC), complex
2768
+ * multi-coeng stacks beyond the font's ligature coverage, and contextual
2769
+ * GSUB (LookupType 5/6) are approximated, not fully reordered.
2770
+ *
2771
+ * References:
2772
+ * - Unicode Standard §16.4 Khmer
2773
+ * - OpenType spec: Universal Shaping Engine; Khmer (khmr)
2774
+ * - ISO 15924 script code: Khmr
2775
+ */
2776
+
2777
+ /**
2778
+ * Shape a string of Khmer text into an array of positioned glyphs.
2779
+ *
2780
+ * @param str - Raw Khmer string
2781
+ * @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
2782
+ * @returns Array of positioned glyphs
2783
+ */
2784
+ declare function shapeKhmerText(str: string, fontData: FontData): ShapedGlyph[];
2785
+
2786
+ /**
2787
+ * pdfnative — Myanmar Mini-Shaper
2788
+ * ================================
2789
+ * Pure JS OpenType GSUB + GPOS shaping for the Myanmar (Burmese) script.
2790
+ * Zero external dependency.
2791
+ *
2792
+ * Myanmar is a USE-class (Universal Shaping Engine) script. This is a pragmatic
2793
+ * USE-lite implementation covering the common cases:
2794
+ * - Medial consonants: medial ya (U+103B), ra (U+103C), wa (U+103D),
2795
+ * ha (U+103E). Medial **ra** renders to the LEFT of its base (pre-base)
2796
+ * and is therefore emitted first.
2797
+ * - Virama / stacker (U+1039): C + U+1039 + C → stacked subscript consonant.
2798
+ * - Asat (U+103A, visible killer) is preserved.
2799
+ * - GSUB LigatureSubst for medial / stacked forms when the font provides
2800
+ * them; GPOS MarkToBase for above / below vowel signs and tone marks.
2801
+ *
2802
+ * Known limitations (documented):
2803
+ * - This is not a full USE implementation. Kinzi (U+1004 U+103A U+1039),
2804
+ * deep stacks beyond the font's ligature coverage, and contextual GSUB
2805
+ * (LookupType 5/6) are approximated, not fully reordered. Kinzi is rendered
2806
+ * via its stacking sequence rather than a dedicated reordering pass.
2807
+ *
2808
+ * References:
2809
+ * - Unicode Standard §16.3 Myanmar
2810
+ * - OpenType spec: Universal Shaping Engine; Myanmar (mymr)
2811
+ * - ISO 15924 script code: Mymr
2812
+ */
2813
+
2814
+ /**
2815
+ * Shape a string of Myanmar text into an array of positioned glyphs.
2816
+ *
2817
+ * @param str - Raw Myanmar string
2818
+ * @param fontData - Font data with cmap, ligatures, markAnchors, metrics, widths
2819
+ * @returns Array of positioned glyphs
2820
+ */
2821
+ declare function shapeMyanmarText(str: string, fontData: FontData): ShapedGlyph[];
2822
+
2203
2823
  /**
2204
2824
  * pdfnative — Devanagari Mini-Shaper
2205
2825
  * ====================================
@@ -2286,25 +2906,186 @@ interface BidiRun {
2286
2906
  readonly level: number;
2287
2907
  readonly start: number;
2288
2908
  }
2909
+ /**
2910
+ * UAX #9 explicit embedding normalization (v1.2.0, refined v1.3.0).
2911
+ *
2912
+ * Maps the legacy explicit *embedding* characters into their sealed-isolate
2913
+ * equivalents so the rest of the pipeline can process them via the existing
2914
+ * isolate machinery:
2915
+ *
2916
+ * - LRE (U+202A) → LRI (U+2066)
2917
+ * - RLE (U+202B) → RLI (U+2067)
2918
+ * - PDF (U+202C) → PDI (U+2069), but only when popping a matched LRE/RLE
2919
+ * from the stack (otherwise preserved or dropped, see below)
2920
+ *
2921
+ * The explicit *override* characters LRO (U+202D) / RLO (U+202E) and the
2922
+ * PDF (U+202C) that closes them are **preserved verbatim** — they carry
2923
+ * character-level type-override semantics (UAX #9 X4/X5) that the isolate
2924
+ * machinery cannot express. They are resolved separately by
2925
+ * {@link resolveBidiRuns} via the override pre-pass, which forces every
2926
+ * inner code point to L (LRO) or R (RLO). A PDF that would pop an override
2927
+ * frame is therefore left in place for that pre-pass to consume.
2928
+ *
2929
+ * This split keeps the ≥ 95 % common embedding cases on the fast isolate
2930
+ * path while giving LRO/RLO faithful character-level override behaviour.
2931
+ *
2932
+ * @param text - Raw input text in logical order
2933
+ * @returns Text with embeddings mapped to isolates; overrides preserved.
2934
+ */
2935
+ declare function normalizeBidiEmbeddings(text: string): string;
2289
2936
  /**
2290
2937
  * Resolve bidirectional text into ordered runs with embedding levels.
2291
2938
  *
2292
- * Implements UAX #9 with isolate support (LRI/RLI/FSI ... PDI). When the
2293
- * input contains matched isolate pairs, the inner content is resolved as
2294
- * a sealed sub-paragraph with its own forced or auto-detected direction,
2295
- * preventing the outer context from leaking into it (and vice versa).
2939
+ * Implements UAX #9 with isolate support (LRI/RLI/FSI ... PDI) and
2940
+ * explicit-embedding/override normalization (LRE/RLE/LRO/RLO/PDF
2941
+ * isolate-equivalent). When the input contains matched isolate pairs,
2942
+ * the inner content is resolved as a sealed sub-paragraph with its
2943
+ * own forced or auto-detected direction, preventing the outer context
2944
+ * from leaking into it (and vice versa).
2296
2945
  *
2297
2946
  * @param text - Input text in logical order
2298
2947
  * @returns Array of BidiRun objects in visual order
2299
2948
  */
2300
2949
  declare function resolveBidiRuns(text: string): BidiRun[];
2301
2950
  /**
2302
- * Check if text contains any RTL characters (Arabic or Hebrew).
2951
+ * Check if text contains any RTL characters (Arabic or Hebrew) or an explicit
2952
+ * directional override (LRO U+202D / RLO U+202E). The override markers are
2953
+ * included so a direct caller that has not yet stripped controls still routes
2954
+ * through the bidi resolver, where the X4/X5 override pass applies.
2303
2955
  *
2304
2956
  * @param text - Input text string
2305
- * @returns True if text contains R or AL bidi types
2957
+ * @returns True if text contains R/AL bidi types or an LRO/RLO override
2306
2958
  */
2307
2959
  declare function containsRTL(text: string): boolean;
2960
+ /**
2961
+ * Strip invisible Unicode bidirectional formatting characters.
2962
+ *
2963
+ * The BiDi resolver consumes these characters when it runs, but the
2964
+ * resolver is only invoked when `containsRTL()` is true. For pure-LTR
2965
+ * paragraphs that nonetheless contain directional formatters (e.g. an
2966
+ * orphan PDF U+202C left over after `normalizeBidiEmbeddings()`), the
2967
+ * marker would reach the font encoder as a regular codepoint and
2968
+ * render as `.notdef` (tofu) since no font ships a glyph for it.
2969
+ *
2970
+ * Stripped codepoints:
2971
+ * - LRM / RLM (U+200E, U+200F)
2972
+ * - LRE / RLE / PDF / LRO / RLO (U+202A–U+202E)
2973
+ * - LRI / RLI / FSI / PDI (U+2066–U+2069)
2974
+ *
2975
+ * Safe to call unconditionally — these characters carry no visible
2976
+ * width per UAX #9, so removing them never changes layout.
2977
+ *
2978
+ * @since 1.2.0
2979
+ */
2980
+ declare function stripBidiControls(text: string): string;
2981
+
2982
+ /**
2983
+ * pdfnative — Universal Shaping Engine (USE) lite
2984
+ * =================================================
2985
+ * Cluster classification utility for Indic and related complex scripts
2986
+ * (Devanagari, Bengali, Tamil, Gujarati, Gurmukhi, Telugu, Kannada,
2987
+ * Malayalam, Sinhala, Khmer, Myanmar, Tibetan).
2988
+ *
2989
+ * Based on the Universal Shaping Engine specification:
2990
+ * https://learn.microsoft.com/en-us/typography/script-development/use
2991
+ *
2992
+ * Scope (v1.3.0):
2993
+ * - Public API for cluster classification: callers can run their own
2994
+ * reordering / GSUB pipelines on top of the cluster categories.
2995
+ * - 11 cluster categories sufficient for the four scripts pdfnative
2996
+ * ships shaping for (Devanagari, Bengali, Tamil) plus a generic
2997
+ * fallback that classifies any USE-eligible code point.
2998
+ * - Marathi eyelash-ra (Ra + virama + ZWJ) is recognised as a distinct
2999
+ * reph variant (`UseCluster.eyelash`).
3000
+ * - The bundled Devanagari/Bengali/Tamil shapers consume
3001
+ * `classifyUseCategory` as the single source of truth for joiner
3002
+ * (ZWJ/ZWNJ) and half-form/eyelash decisions; their hand-tuned
3003
+ * happy-path reordering (pinned by the vitest suite) is preserved.
3004
+ *
3005
+ * Not in scope (deferred):
3006
+ * - State-table classification for Khmer/Myanmar/Tibetan/Sinhala/
3007
+ * other USE-required scripts not currently bundled.
3008
+ */
3009
+ /**
3010
+ * USE-lite cluster categories. A subset of the full USE category set
3011
+ * sufficient for the four scripts pdfnative ships shaping for.
3012
+ *
3013
+ * - `B` — Base consonant
3014
+ * - `V` — Independent vowel
3015
+ * - `N` — Number
3016
+ * - `H` — Halant / Virama
3017
+ * - `M` — Vowel sign / Matra (combining mark)
3018
+ * - `Mpre` — Pre-base matra (reorders before base in visual order)
3019
+ * - `Mabv` — Above-base matra
3020
+ * - `Mblw` — Below-base matra
3021
+ * - `Mpst` — Post-base matra
3022
+ * - `R` — Reph (the special "ra + virama" cluster head)
3023
+ * - `ZWJ` — Zero-width joiner (forms half / conjunct)
3024
+ * - `ZWNJ` — Zero-width non-joiner (breaks conjunct)
3025
+ * - `O` — Other (default)
3026
+ */
3027
+ type UseCategory = 'B' | 'V' | 'N' | 'H' | 'M' | 'Mpre' | 'Mabv' | 'Mblw' | 'Mpst' | 'R' | 'ZWJ' | 'ZWNJ' | 'O';
3028
+ /** Classified code point with its USE-lite category. */
3029
+ interface UseClassifiedCp {
3030
+ readonly cp: number;
3031
+ readonly category: UseCategory;
3032
+ }
3033
+ /** A USE-lite cluster: a base plus its prefixed/suffixed marks and signs. */
3034
+ interface UseCluster {
3035
+ /** Pre-base reordering elements (e.g. Devanagari ि matra). */
3036
+ readonly prebase: UseClassifiedCp[];
3037
+ /** The cluster base (consonant or vowel). */
3038
+ readonly base: UseClassifiedCp | null;
3039
+ /** Above-base marks. */
3040
+ readonly above: UseClassifiedCp[];
3041
+ /** Below-base marks. */
3042
+ readonly below: UseClassifiedCp[];
3043
+ /** Post-base marks. */
3044
+ readonly post: UseClassifiedCp[];
3045
+ /** Halant + consonant chains attached after the base (conjunct tail). */
3046
+ readonly tail: UseClassifiedCp[];
3047
+ /**
3048
+ * True when the cluster head is a Marathi eyelash-ra — `Ra + virama + ZWJ`
3049
+ * — which renders as the eyelash (rakar) form rather than a reph. The
3050
+ * leading `Ra` is still recorded in {@link prebase} with category `'R'`.
3051
+ */
3052
+ readonly eyelash?: boolean;
3053
+ }
3054
+ /**
3055
+ * Classify a single Unicode code point into a USE-lite category.
3056
+ * Dispatches to per-script tables; falls back to `'O'` for code points
3057
+ * outside the supported ranges.
3058
+ *
3059
+ * Special cases:
3060
+ * - U+200C ZWNJ → 'ZWNJ'
3061
+ * - U+200D ZWJ → 'ZWJ'
3062
+ *
3063
+ * @param cp - Unicode code point
3064
+ * @returns USE-lite category
3065
+ */
3066
+ declare function classifyUseCategory(cp: number): UseCategory;
3067
+ /**
3068
+ * Split a code-point sequence into USE-lite clusters. Each cluster
3069
+ * carries a single base (consonant or independent vowel) plus all its
3070
+ * attached marks classified by their position relative to the base.
3071
+ *
3072
+ * Reph detection: when the sequence starts with consonant + virama
3073
+ * (or contains a "Ra + virama + consonant" prefix where Ra is U+0930
3074
+ * for Devanagari or U+09B0 for Bengali), the leading Ra-virama is
3075
+ * collected as a special pre-base reph element (category 'R').
3076
+ *
3077
+ * @param codePoints - Logical-order code points
3078
+ * @returns Array of UseCluster objects
3079
+ *
3080
+ * @example
3081
+ * ```ts
3082
+ * import { classifyClusters } from 'pdfnative';
3083
+ * const cps = Array.from('प्रकार').map(c => c.codePointAt(0)!);
3084
+ * const clusters = classifyClusters(cps);
3085
+ * // → one cluster per visible aksara, with reph/conjunct info
3086
+ * ```
3087
+ */
3088
+ declare function classifyClusters(codePoints: readonly number[]): UseCluster[];
2308
3089
 
2309
3090
  /**
2310
3091
  * pdfnative — Arabic Text Shaper
@@ -2342,6 +3123,148 @@ declare function containsRTL(text: string): boolean;
2342
3123
  */
2343
3124
  declare function shapeArabicText(str: string, fontData: FontData): ShapedGlyph[];
2344
3125
 
3126
+ /**
3127
+ * pdfnative — TrueType `glyf` Outline Extractor
3128
+ * ==============================================
3129
+ * Pure-JS reader that turns a TrueType glyph outline into ordered contours
3130
+ * of quadratic on/off-curve points. Zero external dependency.
3131
+ *
3132
+ * Used by the colour-glyph renderer (COLR/CPAL) to fill a base glyph's
3133
+ * outline as a native PDF path. Handles both simple and composite glyphs
3134
+ * (the latter via recursive 2×2 + translate component transforms).
3135
+ *
3136
+ * References:
3137
+ * - ISO/IEC 14496-22 (OpenType) §5.3.3 `glyf`
3138
+ * - Apple TrueType Reference Manual — Glyph data format
3139
+ */
3140
+ /** A single outline point in font units. */
3141
+ interface OutlinePoint {
3142
+ readonly x: number;
3143
+ readonly y: number;
3144
+ /** True for on-curve points; false for quadratic control (off-curve). */
3145
+ readonly onCurve: boolean;
3146
+ }
3147
+ /** A closed contour: an ordered ring of on/off-curve points. */
3148
+ type Contour = OutlinePoint[];
3149
+ /** A parsed TrueType font exposing just enough to read glyph outlines. */
3150
+ interface GlyfFont {
3151
+ readonly view: DataView;
3152
+ readonly glyfOffset: number;
3153
+ readonly locaOffsets: number[];
3154
+ readonly unitsPerEm: number;
3155
+ }
3156
+ /**
3157
+ * Parse the table directory, `head`, `maxp` and `loca` so that subsequent
3158
+ * {@link extractGlyphContours} calls are O(1) lookups.
3159
+ *
3160
+ * @param bytes - Raw TrueType/OpenType (glyf-flavoured) font bytes.
3161
+ * @returns A {@link GlyfFont}, or `null` if the font has no `glyf` outlines
3162
+ * (e.g. a CFF font) or is structurally invalid.
3163
+ */
3164
+ declare function parseGlyfFont(bytes: Uint8Array): GlyfFont | null;
3165
+ /**
3166
+ * Extract the contours of a single glyph in font units. Composite glyphs are
3167
+ * flattened by recursively transforming their components.
3168
+ *
3169
+ * @param font - Parsed {@link GlyfFont}.
3170
+ * @param gid - Glyph id.
3171
+ * @param depth - Internal recursion guard for composite glyphs.
3172
+ * @returns Array of contours (empty for whitespace / empty glyphs).
3173
+ */
3174
+ declare function extractGlyphContours(font: GlyfFont, gid: number, depth?: number): Contour[];
3175
+
3176
+ /**
3177
+ * pdfnative — COLR / CPAL Colour-Font Parser
3178
+ * ===========================================
3179
+ * Pure-JS reader for the OpenType COLR (colour layers) and CPAL (colour
3180
+ * palette) tables. Resolves each base colour glyph into a flat list of
3181
+ * {@link ColorLayer}s (base outline + paint), painted back-to-front.
3182
+ *
3183
+ * Supported:
3184
+ * - COLR v0 — layered solid fills.
3185
+ * - COLR v1 — PaintColrLayers, PaintGlyph, PaintColrGlyph, PaintSolid,
3186
+ * PaintLinearGradient, PaintRadialGradient, PaintTransform,
3187
+ * PaintTranslate, PaintScale (+ around-center).
3188
+ *
3189
+ * Unsupported paints (sweep gradients, compositing, variable paints) cause
3190
+ * the affected glyph to be skipped so the caller can fall back to the
3191
+ * monochrome emoji font. This keeps output correct (never garbled) while
3192
+ * covering the overwhelming majority of Noto Color Emoji glyphs.
3193
+ *
3194
+ * Zero external dependency.
3195
+ *
3196
+ * References:
3197
+ * - ISO/IEC 14496-22 (OpenType) §5.7.11 COLR, §5.7.12 CPAL
3198
+ * - https://learn.microsoft.com/typography/opentype/spec/colr
3199
+ */
3200
+
3201
+ /**
3202
+ * Parse the CPAL table's first palette into an array of {@link CpalColor}s
3203
+ * (sRGB + alpha, each channel 0–255), indexed by palette entry.
3204
+ */
3205
+ declare function parseCpal(bytes: Uint8Array): CpalColor[] | null;
3206
+ /**
3207
+ * Parse the COLR + CPAL tables of a font into a colour-glyph map keyed by
3208
+ * base glyph id. Returns `null` when the font has no COLR table.
3209
+ *
3210
+ * @param bytes - Raw OpenType font bytes.
3211
+ */
3212
+ declare function parseColrCpal(bytes: Uint8Array): Record<number, ColorGlyph> | null;
3213
+
3214
+ /**
3215
+ * pdfnative — Colour Glyph Renderer (COLR/CPAL → native PDF)
3216
+ * ==========================================================
3217
+ * Renders a resolved {@link ColorGlyph} as a native PDF Form XObject: each
3218
+ * layer's base-glyph outline is emitted as a vector path and filled with a
3219
+ * flat colour or a `/Shading` gradient. No rasterisation, zero dependency.
3220
+ *
3221
+ * - Solid layers → `r g b rg … f` (with `/ca` ExtGState for alpha < 1).
3222
+ * - Linear gradients → `/Shading` Type 2 (axial) painted via `sh`,
3223
+ * clipped to the glyph outline.
3224
+ * - Radial gradients → `/Shading` Type 3, likewise.
3225
+ *
3226
+ * The Form XObject's user space is font units; the caller scales it onto the
3227
+ * page with a `cm` and draws it with `Do`.
3228
+ *
3229
+ * References:
3230
+ * - ISO 32000-1 §8.7.4.5 (Shadings), §7.10.2 (Type 2 functions),
3231
+ * §8.10 (Form XObjects)
3232
+ */
3233
+
3234
+ /** A rendered colour glyph ready to be assembled into a Form XObject. */
3235
+ interface ColorGlyphForm {
3236
+ /** Form XObject content stream (font-unit user space). */
3237
+ readonly content: string;
3238
+ /** Form BBox `[x0 y0 x1 y1]` in font units. */
3239
+ readonly bbox: readonly [number, number, number, number];
3240
+ /** Named `/Shading` resources referenced by the content stream. */
3241
+ readonly shadings: ReadonlyArray<{
3242
+ readonly name: string;
3243
+ readonly dict: string;
3244
+ }>;
3245
+ /** Named `/ExtGState` resources (constant alpha) referenced by content. */
3246
+ readonly extGStates: ReadonlyArray<{
3247
+ readonly name: string;
3248
+ readonly dict: string;
3249
+ }>;
3250
+ }
3251
+ /** Provider of glyph outlines (decoupled from the font parser for testing). */
3252
+ type OutlineProvider = (glyphId: number) => Contour[];
3253
+ type Mat = readonly [number, number, number, number, number, number];
3254
+ /**
3255
+ * Convert a set of TrueType quadratic contours into PDF path operators
3256
+ * (cubic Béziers), applying matrix `m`. Each contour is closed (`h`).
3257
+ */
3258
+ declare function contoursToPath(contours: Contour[], m?: Mat): string;
3259
+ /**
3260
+ * Render a colour glyph into a {@link ColorGlyphForm}.
3261
+ *
3262
+ * @param glyph - Resolved colour glyph (ordered layers).
3263
+ * @param outlines - Provides the contours for a given base glyph id.
3264
+ * @param unitsPerEm - Font units per em (defines the BBox).
3265
+ */
3266
+ declare function renderColorGlyph(glyph: ColorGlyph, outlines: OutlineProvider, unitsPerEm: number): ColorGlyphForm;
3267
+
2345
3268
  /**
2346
3269
  * pdfnative — PDF Token Scanner
2347
3270
  * ===============================
@@ -2430,11 +3353,11 @@ type PdfArray = PdfValue[];
2430
3353
  * ```
2431
3354
  */
2432
3355
  type PdfValue = null | boolean | number | string | PdfName | PdfRef | PdfArray | PdfDict | PdfStream;
2433
- declare function isRef(v: PdfValue): v is PdfRef;
3356
+ declare function isRef(v: PdfValue | undefined): v is PdfRef;
2434
3357
  declare function isName(v: PdfValue | undefined): v is PdfName;
2435
3358
  declare function isStream(v: PdfValue): v is PdfStream;
2436
3359
  declare function isDict(v: PdfValue): v is PdfDict;
2437
- declare function isArray(v: PdfValue): v is PdfArray;
3360
+ declare function isArray(v: PdfValue | undefined): v is PdfArray;
2438
3361
  declare function dictGet(dict: PdfDict, key: string): PdfValue | undefined;
2439
3362
  declare function dictGetName(dict: PdfDict, key: string): string | undefined;
2440
3363
  /** Extract the string value from a PdfName, or undefined if not a name. */
@@ -2608,6 +3531,18 @@ interface PdfModifier {
2608
3531
  * Returns the new object number.
2609
3532
  */
2610
3533
  addObject(value: PdfValue): number;
3534
+ /**
3535
+ * Allocate a new object number whose body is emitted **verbatim**
3536
+ * between `num gen obj` and `endobj`. The caller is responsible
3537
+ * for the body's PDF syntactic validity — used for objects that
3538
+ * need an exact byte layout the PdfValue serialiser cannot
3539
+ * express (e.g. signature `/Sig` dictionaries whose
3540
+ * `/Contents <00…>` and `/ByteRange [0 …]` placeholders must be
3541
+ * preserved byte-for-byte for `signPdfBytes()` to patch them).
3542
+ *
3543
+ * Returns the new object number.
3544
+ */
3545
+ addRawObject(body: string): number;
2611
3546
  /**
2612
3547
  * Get the current value of an object (modified or original).
2613
3548
  */
@@ -2630,6 +3565,44 @@ interface PdfModifier {
2630
3565
  */
2631
3566
  declare function createModifier(reader: PdfReader): PdfModifier;
2632
3567
 
3568
+ /**
3569
+ * pdfnative — PDF/UA structural validator (ISO 14289-1)
3570
+ * ======================================================
3571
+ * A lightweight, read-only conformance checker for tagged-PDF (PDF/UA)
3572
+ * structural prerequisites. It does **not** render or rasterise; it parses the
3573
+ * document with the native reader and inspects the catalog, structure tree and
3574
+ * per-page marked-content.
3575
+ *
3576
+ * Scope (what this validator can verify from structure alone):
3577
+ * - Catalog `/MarkInfo << /Marked true >>` (ISO 14289-1 §7.1)
3578
+ * - Catalog `/StructTreeRoot` (ISO 14289-1 §7.1)
3579
+ * - Catalog `/Metadata` (XMP) and `/Lang` (ISO 14289-1 §7.2, §7.3)
3580
+ * - `/StructTreeRoot /ParentTree` (ISO 32000-1 §14.7.4.4)
3581
+ * - MCID uniqueness within each page's content stream (ISO 32000-1 §14.7.4.3)
3582
+ *
3583
+ * It is intended as a fast developer-time gate, not a substitute for a full
3584
+ * reference validator (e.g. veraPDF) which also checks fonts, colour and
3585
+ * rendering. A `valid` result here means the structural prerequisites hold.
3586
+ *
3587
+ * @since 1.3.0
3588
+ */
3589
+ /** Result of a PDF/UA structural validation. */
3590
+ interface PdfUAValidationResult {
3591
+ /** True when no blocking errors were found. */
3592
+ readonly valid: boolean;
3593
+ /** Blocking conformance violations. */
3594
+ readonly errors: readonly string[];
3595
+ /** Non-blocking recommendations (PDF/UA best practices). */
3596
+ readonly warnings: readonly string[];
3597
+ }
3598
+ /**
3599
+ * Validate the PDF/UA (ISO 14289-1) structural prerequisites of a tagged PDF.
3600
+ *
3601
+ * @param bytes - Complete PDF file bytes (e.g. from `buildDocumentPDFBytes`).
3602
+ * @returns A structured result with `valid`, `errors` and `warnings`.
3603
+ */
3604
+ declare function validatePdfUA(bytes: Uint8Array): PdfUAValidationResult;
3605
+
2633
3606
  /**
2634
3607
  * pdfnative — DEFLATE Decompressor (FlateDecode reader)
2635
3608
  * ======================================================
@@ -2777,4 +3750,4 @@ declare function createPDF(pdfParams: PdfParams, options?: {
2777
3750
  layoutOptions?: Partial<PdfLayoutOptions>;
2778
3751
  }): Promise<Uint8Array>;
2779
3752
 
2780
- export { 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, PG_H, PG_W, type PageBreakBlock, type PageTemplate, type ParagraphBlock, type PdfArray as ParsedArray, type PdfDict as ParsedDict, type ParsedImage, type PdfAConfig, 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 SignatureAlgorithm, type SpacerBlock, type StreamOptions, type SvgBlock, type SvgRenderOptions, type SvgSegment, TH_H, TITLE_LN, type TableBlock, type TextRun, type TocBlock, type TokenType, 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, applyDecodeFilter, buildAcroFormDict, buildAppearanceStreamDict, buildCmsSignedData, buildDocumentPDF, buildDocumentPDFBytes, buildDocumentPDFStream, buildEmbeddedFiles, buildFormWidget, buildImageOperators, buildImageXObject, buildInternalLinkAnnotation, buildLinkAnnotation, buildPDF, buildPDFBytes, buildPDFStream, buildRadioGroupParent, buildSMaskXObject, buildSigDict, buildWatermarkState, chunkBinaryString, 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, 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, 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, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };
3753
+ export { type AddSignaturePlaceholderOptions, type Annotation, type Asn1Node, BAL_H, type BarcodeBlock, type BarcodeFormat, type BidiRun, type CmsSignOptions, type ColorGlyph, type ColorGlyphForm, type ColorLayer, type ColorPaint, type ColorStop, type ColumnDef, type Contour, type CpalColor, 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 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, MAX_PARSE_DEPTH, MAX_XREF_CHAIN, type OutlinePoint, type OutlineProvider, 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 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 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, 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, 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, isEthiopicCodepoint, isGeorgianCodepoint, isKhmerCodepoint, isLinkAnnotation, isMyanmarCodepoint, isName, isRef, isSelfSigned, isSinhalaCodepoint, isStream, isTamilCodepoint, isTeluguCodepoint, isTibetanCodepoint, isValidPdfRgb, loadFontData, 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, setDeflateImpl, setInflateImpl, setMaxInflateOutputSize, sha384, sha512, shapeArabicText, shapeBengaliText, shapeDevanagariText, shapeKhmerText, shapeMyanmarText, shapeSinhalaText, shapeTamilText, shapeTeluguText, shapeThaiText, shapeTibetanText, signPdfBytes, slugify, splitTextByFont, streamByteLength, stripBidiControls, toBytes, toWinAnsi, truncate, truncateToWidth, validateAttachments, validateDocumentStreamable, validatePdfUA, validateTableStreamable, validateURL, validateWatermark, verifyCertSignature, wrapText };