@hufe921/jsofd 1.0.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.
@@ -0,0 +1,1127 @@
1
+ /**
2
+ * jsOFD public type definitions.
3
+ */
4
+ /** RGB color (0-255) */
5
+ type RGB = [number, number, number];
6
+ /** Paper format: a name ('a4', 'letter', ...) or [width, height] in the active unit */
7
+ type PageFormat = string | [number, number] | number[];
8
+ /** Page orientation */
9
+ type Orientation = 'p' | 'portrait' | 'l' | 'landscape';
10
+ /** Measurement unit */
11
+ type Unit = 'pt' | 'mm' | 'cm' | 'in' | 'inch' | 'px' | 'pc' | 'em' | 'ex';
12
+ /** Constructor options */
13
+ interface jsOFDOptions {
14
+ /** Page orientation, default 'p' (portrait) */
15
+ orientation?: Orientation;
16
+ /** Measurement unit, default 'mm' */
17
+ unit?: Unit;
18
+ /** Paper format, default 'a4'; may be a [width, height] array */
19
+ format?: PageFormat;
20
+ /** Number serialization precision (decimals), default 4 */
21
+ floatPrecision?: number;
22
+ }
23
+ interface EmbeddedFontFile {
24
+ /** Raw TTF/OTF bytes written into `Doc_0/Res/`. */
25
+ data: Uint8Array;
26
+ /** File extension: `ttf` or `otf`. */
27
+ ext: string;
28
+ }
29
+ /** Font style */
30
+ type FontStyle = 'normal' | 'bold' | 'italic' | 'bolditalic';
31
+ /** Text alignment */
32
+ type TextAlign = 'left' | 'center' | 'right' | 'justify';
33
+ /** Text baseline */
34
+ type TextBaseline = 'alphabetic' | 'top' | 'middle' | 'bottom' | 'hanging';
35
+ /** Text rendering mode */
36
+ type TextRenderingMode = 'fill' | 'stroke' | 'fillThenStroke' | 'invisible';
37
+ /** doc.text() options */
38
+ interface TextOptions {
39
+ /** Horizontal alignment, default 'left'; 'justify' requires maxWidth */
40
+ align?: TextAlign;
41
+ /** Rotation in degrees, clockwise around the x,y anchor */
42
+ angle?: number;
43
+ /** Baseline position, default 'alphabetic' (x,y marks the baseline) */
44
+ baseline?: TextBaseline;
45
+ /** Extra spacing between glyphs (active unit) */
46
+ charSpace?: number;
47
+ /** Line height factor, default 1.15 */
48
+ lineHeightFactor?: number;
49
+ /** Maximum line width before wrapping (active unit) */
50
+ maxWidth?: number;
51
+ /** Rendering mode (string or PDF Tr number 0-7) */
52
+ renderingMode?: TextRenderingMode | number | boolean;
53
+ /** Opacity 0-1 */
54
+ opacity?: number;
55
+ /** Font size override in points (jsPDF semantics) */
56
+ fontSize?: number;
57
+ /** Horizontal scale; 1 is unscaled (jsPDF horizontalScale) */
58
+ horizontalScale?: number;
59
+ /** Render right-to-left (jsPDF R2L) */
60
+ R2L?: boolean;
61
+ }
62
+ /** Link options */
63
+ interface LinkOptions {
64
+ /** External URL */
65
+ url?: string;
66
+ /** In-document target page number (1-based) */
67
+ pageNumber?: number;
68
+ /** Jump magnification */
69
+ magFactor?: 'fit' | 'fitH' | 'fitV' | number | string;
70
+ }
71
+ /** Document properties */
72
+ interface DocProperties {
73
+ title?: string;
74
+ subject?: string;
75
+ author?: string;
76
+ keywords?: string;
77
+ creator?: string;
78
+ creatorVersion?: string;
79
+ }
80
+ /** addFont options */
81
+ interface AddFontOptions {
82
+ /** Display family name (defaults to fontName) */
83
+ familyName?: string;
84
+ /** Whether the font is serif */
85
+ serif?: boolean;
86
+ /** Whether the font is monospaced */
87
+ fixed?: boolean;
88
+ /** Whether the font covers CJK (full-width approximation) */
89
+ cjk?: boolean;
90
+ /** Ascent (1/1000 em, default 800) */
91
+ ascent?: number;
92
+ /** Descent (1/1000 em, negative, default -200) */
93
+ descent?: number;
94
+ /** Custom width table (ASCII 32..126, 1/1000 em) */
95
+ widths?: Partial<Record<FontStyle, number[]>>;
96
+ /** Alias for setFont lookups */
97
+ alias?: string;
98
+ /** Embedded font file extension override (`ttf` default, `otf` for CFF). */
99
+ fontExt?: string;
100
+ }
101
+ /** Bookmark options */
102
+ interface OutlineOptions {
103
+ /** Target page number (1-based, default 1) */
104
+ pageNumber?: number;
105
+ /** Jump position */
106
+ left?: number;
107
+ top?: number;
108
+ zoom?: number;
109
+ }
110
+ /** Bookmark node returned by doc.outline.add; pass back as parent to nest */
111
+ interface OutlineNode {
112
+ title: string;
113
+ parent: OutlineNode | null;
114
+ children: OutlineNode[];
115
+ options: OutlineOptions;
116
+ }
117
+ /** Attachment options */
118
+ interface AttachmentOptions {
119
+ /** Attachment format description */
120
+ format?: string;
121
+ /** Description */
122
+ description?: string;
123
+ }
124
+ /** Accepted addImage inputs */
125
+ type ImageInput = string | Uint8Array | ArrayBuffer | HTMLImageElement | HTMLCanvasElement;
126
+ /** Image properties returned by getImageProperties */
127
+ interface ImageProperties {
128
+ fileType: string;
129
+ width: number | null;
130
+ height: number | null;
131
+ bytes: number;
132
+ data: Uint8Array;
133
+ }
134
+ /** addImage object-signature options */
135
+ interface AddImageOptions {
136
+ /** Placement and size (active unit) */
137
+ x: number;
138
+ y: number;
139
+ w?: number;
140
+ h?: number;
141
+ /** Format PNG/JPEG/GIF/BMP/TIFF (optional for data URLs) */
142
+ format?: string;
143
+ /** Alias; identical data shares one resource */
144
+ alias?: string;
145
+ /** Rotation in degrees around the image center */
146
+ rotation?: number;
147
+ /** Opacity 0-1 (reserved) */
148
+ opacity?: number;
149
+ }
150
+ /** Graphics state */
151
+ interface GState {
152
+ /** Opacity 0-1 */
153
+ opacity?: number;
154
+ }
155
+ /** Reader interface preferences (jsPDF viewerPreferences) */
156
+ interface ViewerPreferences {
157
+ HideToolbar?: boolean;
158
+ HideMenubar?: boolean;
159
+ HideWindowUI?: boolean;
160
+ FitWindow?: boolean;
161
+ }
162
+ /** Initial view (setDisplayMode) */
163
+ interface DisplayMode {
164
+ zoom: number | string;
165
+ layout: string;
166
+ pageMode: string;
167
+ }
168
+ /** output() return type ('dataurlnewwindow' returns null after opening a window) */
169
+ type OutputResult = ArrayBuffer | Uint8Array | string | Blob | null;
170
+ /** Active font info (getFont) */
171
+ interface FontInfo {
172
+ fontName: string;
173
+ fontStyle: FontStyle;
174
+ key: string;
175
+ }
176
+
177
+ /**
178
+ * Internal page object model (points; converted to mm at serialisation time).
179
+ */
180
+
181
+ interface PageData {
182
+ /** Page width in points */
183
+ width: number;
184
+ /** Page height in points */
185
+ height: number;
186
+ objects: PageObject[];
187
+ }
188
+ type PageObject = TextRun | PathRun | ImageRun | LinkRun;
189
+ interface TextRun {
190
+ t: 'text';
191
+ /** Baseline start X in points */
192
+ x: number;
193
+ /** Baseline start Y in points */
194
+ y: number;
195
+ text: string;
196
+ /** Font size in points */
197
+ size: number;
198
+ fontKey: string;
199
+ style: FontStyle;
200
+ color: RGB;
201
+ charSpace: number;
202
+ /** Rotation in degrees */
203
+ angle: number;
204
+ ascent: number;
205
+ descent: number;
206
+ renderingMode: string;
207
+ opacity: number | null;
208
+ /** Justification target width in points; null disables stretching */
209
+ justifyWidth: number | null;
210
+ /** Horizontal scale (jsPDF horizontalScale; 1 is unscaled) */
211
+ hScale: number;
212
+ /** Per-glyph advances in points (PDF import); falls back to font metrics */
213
+ glyphWs?: number[];
214
+ }
215
+ type PathOp = {
216
+ op: 'M';
217
+ x: number;
218
+ y: number;
219
+ } | {
220
+ op: 'L';
221
+ x: number;
222
+ y: number;
223
+ } | {
224
+ op: 'C';
225
+ x1: number;
226
+ y1: number;
227
+ x2: number;
228
+ y2: number;
229
+ x: number;
230
+ y: number;
231
+ } | {
232
+ op: 'Z';
233
+ };
234
+ interface DashState {
235
+ pattern: number[];
236
+ phase: number;
237
+ }
238
+ interface PathRun {
239
+ t: 'path';
240
+ ops: PathOp[];
241
+ fill: boolean;
242
+ stroke: boolean;
243
+ fillColor: RGB;
244
+ strokeColor: RGB;
245
+ /** Stroke width in points */
246
+ lineWidth: number;
247
+ dash: DashState | null;
248
+ cap: number;
249
+ join: number;
250
+ /** Miter limit in points (emitted when > 1) */
251
+ miterLimit: number;
252
+ opacity: number | null;
253
+ }
254
+ interface AttachmentData {
255
+ name: string;
256
+ data: Uint8Array;
257
+ format: string;
258
+ description: string;
259
+ creationDate: Date;
260
+ }
261
+ /** Registered image resources (deduplicated). */
262
+ interface ImageResource {
263
+ alias: string;
264
+ data: Uint8Array;
265
+ /** OFD MultiMedia Format value (PNG/JPEG/GIF/BMP/TIFF) */
266
+ format: string;
267
+ /** File extension (lowercase) */
268
+ ext: string;
269
+ width: number | null;
270
+ height: number | null;
271
+ /** Resource ID assigned at serialisation time */
272
+ resId: number;
273
+ }
274
+ interface ImageRun {
275
+ t: 'image';
276
+ x: number;
277
+ y: number;
278
+ w: number;
279
+ h: number;
280
+ /** Image resource reference */
281
+ imageRef: ImageResource;
282
+ angle: number;
283
+ opacity: number | null;
284
+ }
285
+ interface LinkRun {
286
+ t: 'link';
287
+ x: number;
288
+ y: number;
289
+ w: number;
290
+ h: number;
291
+ url: string | null;
292
+ pageNumber: number | null;
293
+ magFactor: string | number | null;
294
+ }
295
+
296
+ /**
297
+ * Font registry and text metrics.
298
+ *
299
+ * Width tables come from the public Adobe Core 14 AFM metrics (Helvetica/Times/Courier, ASCII 32..126);
300
+ * Chinese fonts (Song/Hei/Kai/FangSong) are approximated as full-width 1000, half-width 500.
301
+ * No font files are embedded; FontName references the reader's local fonts.
302
+ */
303
+
304
+ interface FontWidths {
305
+ normal?: number[];
306
+ bold?: number[];
307
+ italic?: number[];
308
+ bolditalic?: number[];
309
+ }
310
+ interface FontDef {
311
+ /** PostScript/reference name (written to FontName) */
312
+ familyName: string;
313
+ /** Display name (written to FamilyName) */
314
+ displayName: string;
315
+ serif: boolean;
316
+ fixed: boolean;
317
+ /** Whether the font covers CJK (full-width CJK, half-width ASCII when true) */
318
+ cjk: boolean;
319
+ /** Ascent (1/1000 em) */
320
+ ascent: number;
321
+ /** Descent (1/1000 em, negative) */
322
+ descent: number;
323
+ widths: FontWidths | null;
324
+ /** Per-code-point widths in 1/1000 em (embedded fonts, exact metrics). */
325
+ unicodeWidths?: Map<number, number>;
326
+ /** Embedded font file; when present readers never fall back to local fonts. */
327
+ fontFile?: EmbeddedFontFile;
328
+ }
329
+ declare const BUILTIN_FONTS: Record<string, FontDef>;
330
+ declare const FONT_ALIASES: Record<string, string>;
331
+
332
+ /** Interactive annotations: link areas and file attachments. */
333
+
334
+ declare const AnnotationApi: {
335
+ /**
336
+ * Add a clickable rectangular area.
337
+ *
338
+ * Pass `url` for an external target or `pageNumber` (1-based) for an
339
+ * in-document jump. The area itself is invisible.
340
+ */
341
+ link(this: jsOFD, x: number, y: number, w: number, h: number, options?: LinkOptions): jsOFD;
342
+ /**
343
+ * Embed a file as an OFD attachment.
344
+ *
345
+ * @param data UTF-8 text, a base64 data URL, or binary bytes
346
+ */
347
+ addFileAsAttachment(this: jsOFD, filename: string, data: string | Uint8Array | ArrayBuffer, options?: AttachmentOptions): jsOFD;
348
+ };
349
+ type AnnotationApi = typeof AnnotationApi;
350
+ declare module '../jsofd' {
351
+ interface jsOFD extends AnnotationApi {
352
+ }
353
+ }
354
+
355
+ /**
356
+ * Visual annotations: highlight, underline, strikeout, squiggly, freehand
357
+ * ink, free text and stamp-like boxes.
358
+ *
359
+ * They are emitted as ordinary page objects (translucent fills, strokes,
360
+ * text), so every OFD reader renders them without needing the optional
361
+ * annotation sidecar of the standard.
362
+ */
363
+
364
+ type AnnotationType = 'highlight' | 'underline' | 'strikeout' | 'squiggly' | 'ink' | 'freetext' | 'box';
365
+ interface AnnotationOptions {
366
+ /** Annotation color (default per type) */
367
+ color?: RGB;
368
+ /** Opacity 0-1 (default 0.35 for highlight, 1 otherwise) */
369
+ opacity?: number;
370
+ /** Line thickness (active unit, default 0.6) */
371
+ lineWidth?: number;
372
+ /** Font size in pt for freetext (default 11) */
373
+ fontSize?: number;
374
+ /** Font key for freetext (default: current font) */
375
+ fontKey?: string;
376
+ /** Text for freetext */
377
+ text?: string;
378
+ /** Fill color for box (default: transparent — stroke only) */
379
+ fill?: RGB;
380
+ /** Freehand point list for `ink` (active units) */
381
+ points?: [number, number][];
382
+ }
383
+ declare const AnnotationVisualApi: {
384
+ /**
385
+ * Draw a visual annotation over the rectangle `(x, y, w, h)` and return the
386
+ * doc for chaining.
387
+ *
388
+ * - `highlight` translucent marker behind/over text (default yellow)
389
+ * - `underline` straight line at the bottom edge
390
+ * - `strikeout` line through the vertical middle
391
+ * - `squiggly` hand-drawn style zigzag along the bottom edge
392
+ * - `box` rectangle outline (optionally filled via `options.fill`)
393
+ * - `ink` `options.points` as a freehand polyline (`[[x,y],…]`)
394
+ * - `freetext` `options.text` wrapped inside the rectangle
395
+ */
396
+ addAnnotation(this: jsOFD, type: AnnotationType, x: number, y: number, w: number, h: number, options?: AnnotationOptions): jsOFD;
397
+ };
398
+ type AnnotationVisualApi = typeof AnnotationVisualApi;
399
+ declare module '../jsofd' {
400
+ interface jsOFD extends AnnotationVisualApi {
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Page-flow helpers: automatic multi-page text flow (`autoPaging`) and
406
+ * header/footer hooks applied to every page (`headerFooter`).
407
+ */
408
+
409
+ /** Info passed to page hooks. */
410
+ interface PageInfo {
411
+ /** One-based page number */
412
+ pageNumber: number;
413
+ /** Total page count at the time of the call */
414
+ pageCount: number;
415
+ }
416
+ type PageHook = (doc: jsOFD, info: PageInfo) => void;
417
+ interface HeaderFooterOptions {
418
+ /** Drawn on every page in `startPage..end` */
419
+ header?: PageHook;
420
+ /** Drawn on every page in `startPage..end` */
421
+ footer?: PageHook;
422
+ /** First one-based page to draw on (default 1) */
423
+ startPage?: number;
424
+ /** Last one-based page to draw on (default: last page) */
425
+ endPage?: number;
426
+ }
427
+ interface AutoPagingOptions {
428
+ /** Left edge of the text block (active unit) */
429
+ x?: number;
430
+ /** First baseline (active unit); defaults to `topMargin` + first line */
431
+ y?: number;
432
+ /** Wrap width (active unit); defaults to page width − `x` − `rightMargin` */
433
+ maxWidth?: number;
434
+ /** Page top margin used when a new page starts (active unit, default 20) */
435
+ topMargin?: number;
436
+ /** Page bottom margin; flow breaks before crossing it (default 20) */
437
+ bottomMargin?: number;
438
+ /** Right margin when `maxWidth` is omitted (default 20) */
439
+ rightMargin?: number;
440
+ /** Line height factor (default: current global) */
441
+ lineHeightFactor?: number;
442
+ /** Alignment of every line (default 'left') */
443
+ align?: 'left' | 'center' | 'right' | 'justify';
444
+ /** Called after each automatic `addPage()` */
445
+ onNewPage?: PageHook;
446
+ }
447
+ declare const FlowApi: {
448
+ /**
449
+ * Flow long text across as many pages as needed.
450
+ *
451
+ * Lines wrap at `maxWidth` (same CJK/Latin rules as `text()`); when the
452
+ * next line would cross the bottom margin a new page is appended and
453
+ * `onNewPage` fires (for headers, page numbers, …).
454
+ *
455
+ * @returns the Y coordinate (active unit) after the last line — chain more
456
+ * content from there
457
+ */
458
+ autoPaging(this: jsOFD, text: string, options?: AutoPagingOptions): number;
459
+ /**
460
+ * Draw headers and footers on a page range.
461
+ *
462
+ * Hooks receive the document (positioned on the target page — use
463
+ * `text`/`line`/… normally) and `{ pageNumber, pageCount }`. Common use:
464
+ *
465
+ * ```ts
466
+ * doc.headerFooter({
467
+ * header: (d, { pageNumber }) => d.text('季度报告', 20, 12),
468
+ * footer: (d, { pageNumber, pageCount }) =>
469
+ * d.text(`第 ${pageNumber} 页 / 共 ${pageCount} 页`, 105, 285, { align: 'center' }),
470
+ * });
471
+ * ```
472
+ */
473
+ headerFooter(this: jsOFD, options: HeaderFooterOptions): jsOFD;
474
+ };
475
+ type FlowApi = typeof FlowApi;
476
+ declare module '../jsofd' {
477
+ interface jsOFD extends FlowApi {
478
+ }
479
+ }
480
+
481
+ /**
482
+ * `doc.html()` — render simple HTML into the document.
483
+ *
484
+ * A dependency-free tag-stream parser (works in Node and browsers) walks the
485
+ * markup and lays out block elements — headings, paragraphs, lists, breaks —
486
+ * flowing across pages at the bottom margin. Inline styling covers bold and
487
+ * italic (`b`, `strong`, `i`, `em`), entities are decoded.
488
+ *
489
+ * This is deliberately not a CSS engine: layout attributes come from the tag
490
+ * semantics, not stylesheets.
491
+ */
492
+
493
+ interface HtmlOptions {
494
+ /** Left edge of the text block (active unit, default 20) */
495
+ x?: number;
496
+ /** Top of the content (active unit, default 20) */
497
+ y?: number;
498
+ /** Wrap width (default: page width − x − `rightMargin`) */
499
+ width?: number;
500
+ /** Bottom margin of the flow area (default 20) */
501
+ bottomMargin?: number;
502
+ /** Top margin used on continuation pages (default 20) */
503
+ topMargin?: number;
504
+ /** Base font size in pt (default 11) */
505
+ fontSize?: number;
506
+ /** Heading scale factor per level: h1 = base × 2, h2 = × 1.5, … */
507
+ headingScale?: number;
508
+ /** Line height factor (default 1.5) */
509
+ lineHeightFactor?: number;
510
+ /** Called after each automatic page break */
511
+ onNewPage?: (doc: jsOFD, info: {
512
+ pageNumber: number;
513
+ pageCount: number;
514
+ }) => void;
515
+ }
516
+ declare const HtmlApi: {
517
+ /**
518
+ * Render an HTML fragment and return the final Y (active unit).
519
+ *
520
+ * Supported: `h1–h6`, `p`, `div`, `br`, `ul/ol` + `li`, `b/strong`,
521
+ * `i/em`, entities. Inline `span` text is preserved. Attributes and CSS
522
+ * are ignored by design.
523
+ */
524
+ html(this: jsOFD, html: string, options?: HtmlOptions): number;
525
+ };
526
+ type HtmlApi = typeof HtmlApi;
527
+ declare module '../jsofd' {
528
+ interface jsOFD extends HtmlApi {
529
+ }
530
+ }
531
+
532
+ /** Image embedding and inspection. */
533
+
534
+ declare const ImageApi: {
535
+ /**
536
+ * Embed an image and place it on the current page.
537
+ *
538
+ * Binary data (PNG/JPEG/GIF/BMP/TIFF) is embedded byte-for-byte; data URLs,
539
+ * bare base64 strings (with `format`), `HTMLImageElement` and
540
+ * `HTMLCanvasElement` inputs are also accepted.
541
+ *
542
+ * When `w`/`h` are omitted the natural size at 72 dpi is used. Identical
543
+ * data is stored once and referenced multiple times.
544
+ */
545
+ addImage(this: jsOFD, a: unknown, b: unknown, c?: unknown, d?: unknown, e?: unknown, f?: unknown, g?: unknown, h?: unknown, i?: unknown): jsOFD;
546
+ /**
547
+ * Inspect an image without embedding it.
548
+ *
549
+ * @returns format, pixel dimensions, byte count and the raw data
550
+ */
551
+ getImageProperties(this: jsOFD, imageData: ImageInput): ImageProperties;
552
+ };
553
+ /** Structural type of the mixin (merged into jsOFD via declaration merging). */
554
+ type ImageApi = typeof ImageApi;
555
+ declare module '../jsofd' {
556
+ interface jsOFD extends ImageApi {
557
+ }
558
+ }
559
+
560
+ /** Vector shape primitives: lines, polylines, curves and closed shapes. */
561
+
562
+ declare const ShapeApi: {
563
+ /**
564
+ * @internal Push a path onto the current page using the active graphics
565
+ * state. All public shape helpers funnel through this single entry point.
566
+ */
567
+ _pushPath(this: jsOFD, ops: PathOp[], style?: string): jsOFD;
568
+ /** Draw a straight line from `(x1, y1)` to `(x2, y2)`. */
569
+ line(this: jsOFD, x1: number, y1: number, x2: number, y2: number, style?: string): jsOFD;
570
+ /**
571
+ * Draw a polyline or curve through relative segments (jsPDF `lines`).
572
+ *
573
+ * The path starts with `M` at the anchor `(x, y)`. Each segment is a
574
+ * cumulative delta relative to the current point:
575
+ * `[dx, dy]` draws a straight line, `[x1, y1, x2, y2, x3, y3]` a cubic
576
+ * Bézier through three delta points.
577
+ *
578
+ * Supports the legacy signature `lines(x, y, lines, scale, style, closed)`.
579
+ */
580
+ lines(this: jsOFD, linesOrX: number[][] | number, xOrY: number | number[][], yOrLines?: number | number[][], scale1OrStyle?: number | number[] | string, scale2?: number | string, styleOrClosed?: string | boolean, _closedArg?: boolean): jsOFD;
581
+ /** Draw a triangle through three vertices. */
582
+ triangle(this: jsOFD, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, style?: string): jsOFD;
583
+ /** Draw a rectangle; `(x, y)` is the top-left corner. */
584
+ rect(this: jsOFD, x: number, y: number, w: number, h: number, style?: string): jsOFD;
585
+ /**
586
+ * Draw a rounded rectangle; `(x, y)` is the top-left corner.
587
+ *
588
+ * `ry` defaults to `rx`. Corners are quarter circles approximated with
589
+ * cubic Béziers (κ = 0.5523).
590
+ */
591
+ roundedRect(this: jsOFD, x: number, y: number, w: number, h: number, rx: number, ry?: number, style?: string): jsOFD;
592
+ /** Draw an ellipse centered at `(x, y)`. */
593
+ ellipse(this: jsOFD, x: number, y: number, rx: number, ry: number, style?: string): jsOFD;
594
+ /** Draw a circle centered at `(x, y)` with radius `r`. */
595
+ circle(this: jsOFD, x: number, y: number, r: number, style?: string): jsOFD;
596
+ };
597
+ type ShapeApi = typeof ShapeApi;
598
+ declare module '../jsofd' {
599
+ interface jsOFD extends ShapeApi {
600
+ }
601
+ }
602
+
603
+ /** Document state accessors: fonts, colors and graphics state. */
604
+
605
+ declare const StateApi: {
606
+ /** Resolve a font key to its definition (custom → builtin → Helvetica). */
607
+ getFontDef(this: jsOFD, key: string): FontDef;
608
+ /**
609
+ * Register a custom font.
610
+ *
611
+ * Fonts are referenced by `FontName` and resolved by the reader's local
612
+ * font table — no font file is embedded.
613
+ *
614
+ * @param postScriptName unique registry key
615
+ * @param fontName family name written to the OFD font declaration
616
+ * @param fontStyle `normal` / `bold` / `italic` / `bolditalic`
617
+ * @param opts metrics (ascent/descent/widths) and aliases
618
+ */
619
+ addFont(this: jsOFD, postScriptName: string, fontName: string, fontStyle: string, opts?: AddFontOptions): string;
620
+ /**
621
+ * Register a font with an embedded file (recommended for CJK documents).
622
+ *
623
+ * Parses the font for exact metrics (units per em, ascent/descent, per-glyph
624
+ * advance widths via cmap/hmtx) and writes the bytes into the OFD package as
625
+ * `FontFile`. Embedded fonts render identically in every reader — unembedded
626
+ * fonts depend on the reader's local font table and may show garbage glyphs.
627
+ *
628
+ * Registering a key that matches a built-in (`'simsun'`, `'simhei'`, ...)
629
+ * overrides it, so existing code keeps working while gaining embedding.
630
+ *
631
+ * @param postScriptName registry key, e.g. `'simsun'` or `'MyFont'`
632
+ * @param fontName family name written to the OFD font declaration
633
+ * @param ttfData TTF/OTF (or TTC) file bytes
634
+ */
635
+ addFontTtf(this: jsOFD, postScriptName: string, fontName: string, ttfData: Uint8Array, opts?: AddFontOptions): string;
636
+ /**
637
+ * Select the active font.
638
+ *
639
+ * Accepts PostScript names (`Helvetica-Bold`), family names (`helvetica`,
640
+ * `times`), common Chinese names (`宋体`, `黑体`, `楷体`, `仿宋`) and any
641
+ * previously registered custom key or alias.
642
+ */
643
+ setFont(this: jsOFD, fontName: string, fontStyle?: string): jsOFD;
644
+ /** Set the font size in points (independent of the document unit, like jsPDF). */
645
+ setFontSize(this: jsOFD, size: number): jsOFD;
646
+ /** Active font size in points (default 16, like jsPDF). */
647
+ getFontSize(this: jsOFD): number;
648
+ /** Set extra spacing between glyphs, in the active unit. */
649
+ setCharSpace(this: jsOFD, space: number): jsOFD;
650
+ /** Active character spacing in the active unit. */
651
+ getCharSpace(this: jsOFD): number;
652
+ /** Set the line height factor (default 1.15, like jsPDF). */
653
+ setLineHeightFactor(this: jsOFD, f: number): jsOFD;
654
+ /** Registered font keys, built-in first. */
655
+ getFontList(this: jsOFD): string[];
656
+ /** Information about the active font (jsPDF `getFont()`). */
657
+ getFont(this: jsOFD): FontInfo;
658
+ /** Set the text fill color (`r` may also be a color name or hex string). */
659
+ setTextColor(this: jsOFD, r: number | string, g?: number, b?: number): jsOFD;
660
+ /** Active text color as `#rrggbb` (jsPDF getter semantics). */
661
+ getTextColor(this: jsOFD): string;
662
+ /** Set the stroke color used by shape outlines. */
663
+ setDrawColor(this: jsOFD, r: number | string, g?: number, b?: number): jsOFD;
664
+ /** Active stroke color as `#rrggbb`. */
665
+ getDrawColor(this: jsOFD): string;
666
+ /** Set the fill color used by filled shapes. */
667
+ setFillColor(this: jsOFD, r: number | string, g?: number, b?: number): jsOFD;
668
+ /** Active fill color as `#rrggbb`. */
669
+ getFillColor(this: jsOFD): string;
670
+ /** Set the stroke width in the active unit. */
671
+ setLineWidth(this: jsOFD, width: number): jsOFD;
672
+ /** Active stroke width in the active unit. */
673
+ getLineWidth(this: jsOFD): number;
674
+ /** Set the dash pattern (active unit); an empty array clears dashing. */
675
+ setLineDashPattern(this: jsOFD, dashArray: number[], dashPhase?: number): jsOFD;
676
+ /** Active dash pattern in the active unit. */
677
+ getLineDashPattern(this: jsOFD): number[];
678
+ /** Set the line cap: 0 butt, 1 round, 2 square (names accepted). */
679
+ setLineCap(this: jsOFD, style: number | "butt" | "round" | "square"): jsOFD;
680
+ /** Active line cap (0-2). */
681
+ getLineCap(this: jsOFD): number;
682
+ /** Set the line join: 0 miter, 1 round, 2 bevel (names accepted). */
683
+ setLineJoin(this: jsOFD, style: number | "miter" | "round" | "bevel"): jsOFD;
684
+ /** Active line join (0-2). */
685
+ getLineJoin(this: jsOFD): number;
686
+ /** Set the miter limit (active unit); values ≤ 1 omit the attribute. */
687
+ setLineMiterLimit(this: jsOFD, limit: number): jsOFD;
688
+ /** Active miter limit in the active unit. */
689
+ getLineMiterLimit(this: jsOFD): number;
690
+ /** Line height in points: font size × line height factor. */
691
+ getLineHeight(this: jsOFD): number;
692
+ /** Enable or disable right-to-left rendering. */
693
+ setR2L(this: jsOFD, value: boolean): jsOFD;
694
+ /** Whether right-to-left rendering is active. */
695
+ getR2L(this: jsOFD): boolean;
696
+ /**
697
+ * Apply a graphics state.
698
+ *
699
+ * Only `opacity` is supported; other GState keys are ignored (OFD models
700
+ * blend modes differently from PDF).
701
+ */
702
+ setGState(this: jsOFD, gs: GState): jsOFD;
703
+ /** Set the rendering opacity for subsequent objects (0-1). */
704
+ setOpacity(this: jsOFD, opacity: number): jsOFD;
705
+ };
706
+ type StateApi = typeof StateApi;
707
+ declare module '../jsofd' {
708
+ interface jsOFD extends StateApi {
709
+ }
710
+ }
711
+
712
+ /**
713
+ * `doc.svg()` — embed an SVG by rasterizing it through the browser canvas.
714
+ *
715
+ * The SVG is loaded into an `Image` via a blob URL, drawn to a canvas at a
716
+ * 2× device scale for crispness, and embedded as PNG. Requires a browser
717
+ * (jsPDF's `addSvgAsImage` has the same constraint); Node throws a clear
718
+ * error suggesting pre-rasterized bytes via `addImage`.
719
+ */
720
+
721
+ interface SvgOptions {
722
+ x: number;
723
+ y: number;
724
+ /** Width (active unit); defaults to the intrinsic size at 72dpi */
725
+ w?: number;
726
+ /** Height (active unit); defaults to w scaled by the viewBox ratio */
727
+ h?: number;
728
+ /** Raster scale factor (default 2 — retina-crisp) */
729
+ scale?: number;
730
+ rotation?: number;
731
+ opacity?: number;
732
+ /** Background color painted behind transparent areas (CSS color) */
733
+ background?: string;
734
+ }
735
+ declare const SvgApi: {
736
+ /**
737
+ * Rasterize an SVG markup string and embed it as a PNG image.
738
+ *
739
+ * Browser only (uses `Image` + canvas). The SVG is rendered at `scale`
740
+ * (default 2×) for crisp output. Use `addImage` when you already have
741
+ * raster bytes.
742
+ */
743
+ svg(this: jsOFD, svgMarkup: string, options: SvgOptions): Promise<void>;
744
+ };
745
+ type SvgApi = typeof SvgApi;
746
+ declare module '../jsofd' {
747
+ interface jsOFD extends SvgApi {
748
+ }
749
+ }
750
+
751
+ /**
752
+ * `doc.table()` — a lightweight table engine in the spirit of jspdf-autotable:
753
+ * grid lines, header row with fill, per-column width/align, zebra striping and
754
+ * automatic pagination with a repeated header.
755
+ *
756
+ * All internal computation uses points (the model unit); public inputs and the
757
+ * return value use the active unit.
758
+ */
759
+
760
+ interface TableColumn {
761
+ /** Header caption */
762
+ header?: string;
763
+ /** Column width (active unit); omitted columns share the remaining width */
764
+ width?: number;
765
+ /** Cell text alignment (default 'left') */
766
+ align?: 'left' | 'center' | 'right';
767
+ }
768
+ interface TableCell {
769
+ text: string;
770
+ bold?: boolean;
771
+ align?: TableColumn['align'];
772
+ /** Horizontal span (skip the covered cells in the row data) */
773
+ colSpan?: number;
774
+ }
775
+ type TableCellInput = string | TableCell;
776
+ interface TableStyle {
777
+ /** Body font size (pt) */
778
+ fontSize?: number;
779
+ /** Header font size (pt); defaults to fontSize */
780
+ headFontSize?: number;
781
+ /** Header fill; null disables the fill (default: blue) */
782
+ headFill?: RGB | null;
783
+ /** Header text color (default white) */
784
+ headColor?: RGB;
785
+ /** Body text color (default: current text color) */
786
+ textColor?: RGB;
787
+ /** Grid line color (default light gray); null disables all grid lines */
788
+ borderColor?: RGB | null;
789
+ /** Grid line width (active unit, default 0.2) */
790
+ lineWidth?: number;
791
+ /** Cell padding (active unit, default 2) */
792
+ cellPadding?: number;
793
+ /** Fixed row height (active unit); default: fits the tallest cell */
794
+ rowHeight?: number;
795
+ /** Alternating [even, odd] row fills; enables zebra striping */
796
+ zebra?: [RGB, RGB] | null;
797
+ }
798
+ interface TableOptions {
799
+ columns: TableColumn[];
800
+ rows?: TableCellInput[][];
801
+ style?: TableStyle;
802
+ /** Append pages as needed, repeating the header row (default true) */
803
+ autoPage?: boolean;
804
+ /** Page margin of the flow area when autoPage (active unit, default 20) */
805
+ bottomMargin?: number;
806
+ /** Called after each automatic page break */
807
+ onNewPage?: (doc: jsOFD, info: {
808
+ pageNumber: number;
809
+ pageCount: number;
810
+ }) => void;
811
+ }
812
+ declare const TableApi: {
813
+ /**
814
+ * Render a table at `(x, y)` and return the bottom Y (active unit).
815
+ *
816
+ * Column widths: explicit `width`, otherwise the remaining page width is
817
+ * shared equally. With `autoPage` (default) rows that would cross the
818
+ * bottom margin continue on a fresh page under a repeated header.
819
+ */
820
+ table(this: jsOFD, x: number, y: number, options: TableOptions): number;
821
+ };
822
+ type TableApi = typeof TableApi;
823
+ declare module '../jsofd' {
824
+ interface jsOFD extends TableApi {
825
+ }
826
+ }
827
+
828
+ /** Text layout and rendering: measurement, line breaking and `text()`. */
829
+
830
+ declare const TextApi: {
831
+ /**
832
+ * Measure the width of `text` in points for an explicit font and size.
833
+ *
834
+ * Exposed publicly because jsPDF relies on `doc.measure`-style hooks for
835
+ * plugins such as autotable.
836
+ */
837
+ measure(this: jsOFD, text: string, fontDef: FontDef, style: FontStyle, sizePt: number, charSpacePt: number): number;
838
+ /** String width in font units (jsPDF `getStringUnitWidth`). */
839
+ getStringUnitWidth(this: jsOFD, text: string): number;
840
+ /**
841
+ * Per-character widths in points (jsPDF `getCharWidthsArray`).
842
+ *
843
+ * @param options override `fontSize` (default: active) and `charSpace`
844
+ */
845
+ getCharWidthsArray(this: jsOFD, text: string, options?: {
846
+ fontSize?: number;
847
+ charSpace?: number;
848
+ }): number[];
849
+ /** Width of `text` at the active font and size, in the active unit. */
850
+ getTextWidth(this: jsOFD, text: string): number;
851
+ /** Split `text` into lines that fit `maxWidth` (active unit). */
852
+ splitTextToSize(this: jsOFD, text: string, maxWidth: number): string[];
853
+ /**
854
+ * Line-breaking core.
855
+ *
856
+ * Breaks Latin text at spaces, CJK text between any two characters, and
857
+ * hard-splits words longer than the line width (jsPDF behaviour).
858
+ *
859
+ * @internal maxWidthPt is in points
860
+ */
861
+ _splitCore(this: jsOFD, text: string, maxWidthPt: number, fontDef: FontDef, style: FontStyle): string[];
862
+ /**
863
+ * Write text at `(x, y)`.
864
+ *
865
+ * The anchor is the left end of the baseline unless changed through the
866
+ * `baseline` option. Multi-line input is accepted as `\n` separated text
867
+ * or an array of lines; `maxWidth` enables automatic wrapping.
868
+ *
869
+ * Supports the legacy jsPDF argument order `text(x, y, text, options)`.
870
+ */
871
+ text(this: jsOFD, text: string | string[] | number, x: number | string | string[], y: number | string | TextOptions, optionsOrNothing?: TextOptions): jsOFD;
872
+ /**
873
+ * Write text wrapped in a clickable link annotation.
874
+ *
875
+ * Pass `url` for an external target or `pageNumber` for an in-document jump.
876
+ */
877
+ textWithLink(this: jsOFD, text: string, x: number, y: number, options?: TextOptions & LinkOptions): jsOFD;
878
+ };
879
+ /** Structural type of the mixin (merged into jsOFD via declaration merging). */
880
+ type TextApi = typeof TextApi;
881
+ declare module '../jsofd' {
882
+ interface jsOFD extends TextApi {
883
+ }
884
+ }
885
+
886
+ /**
887
+ * Dependency-free ZIP writer (STORE method).
888
+ *
889
+ * An OFD package is a ZIP container; stored (uncompressed) entries are accepted by every
890
+ * unzip implementation and keep output() synchronous. OFD.xml is written as the first entry.
891
+ */
892
+ interface ZipEntry {
893
+ name: string;
894
+ data: Uint8Array;
895
+ }
896
+
897
+ declare const ViewApi: {
898
+ /** Set document metadata (title, subject, author, keywords, creator). */
899
+ setProperties(this: jsOFD, properties: DocProperties): jsOFD;
900
+ /** Override the document creation date. */
901
+ setCreationDate(this: jsOFD, date: Date | string | number): jsOFD;
902
+ /**
903
+ * Read the creation date.
904
+ *
905
+ * @param type `'array'` returns `[y, m, d, h, min, s]`; anything else
906
+ * returns a `Date` (jsPDF `'jsDate'` semantics)
907
+ */
908
+ getCreationDate(this: jsOFD, type?: "jsDate" | "array"): Date | number[];
909
+ /**
910
+ * Configure the initial viewer presentation.
911
+ *
912
+ * @param zoom numeric multiplier, `'N%'`, or `'fullwidth'` /
913
+ * `'fullheight'` / `'fullpage'` / `'original'`
914
+ * @param layout `'continuous'` / `'single'` / `'twoleft'` / `'tworight'` / `'two'`
915
+ * @param pageMode `'UseNone'` / `'UseOutlines'` / `'UseThumbs'` / `'FullScreen'`
916
+ * @throws on unrecognized values, mirroring jsPDF
917
+ */
918
+ setDisplayMode(this: jsOFD, zoom?: number | string, layout?: "continuous" | "single" | "twoleft" | "tworight" | "two" | string, pageMode?: string): jsOFD;
919
+ /**
920
+ * Set reader interface preferences.
921
+ *
922
+ * Supported flags: `HideToolbar`, `HideMenubar`, `HideWindowUI`, `FitWindow`.
923
+ * Pass `doReset` to clear previously set flags first.
924
+ */
925
+ viewerPreferences(this: jsOFD, options: ViewerPreferences, doReset?: boolean): jsOFD;
926
+ /**
927
+ * Register a total-page-count placeholder (jsPDF `putTotalPages`).
928
+ *
929
+ * At output time every occurrence of `pageIndicator` in text objects is
930
+ * replaced with the page count.
931
+ */
932
+ putTotalPages(this: jsOFD, pageIndicator?: string): jsOFD;
933
+ /** API-compatibility no-op (OFD carries no language field). */
934
+ setLanguage(this: jsOFD): jsOFD;
935
+ /**
936
+ * @internal Serialize to OFD ZIP entries (`OFD.xml` first).
937
+ *
938
+ * Applies the `putTotalPages` substitution on a copy, leaving the live
939
+ * document untouched so `output()` stays repeatable.
940
+ */
941
+ _buildFiles(this: jsOFD): ZipEntry[];
942
+ /**
943
+ * Serialize the document.
944
+ *
945
+ * @param type `'arraybuffer'` (default) / `'uint8array'` / `'blob'` /
946
+ * `'dataurlstring'` / `'dataurlnewwindow'` / `'binarystring'` /
947
+ * `'bloburl'`
948
+ */
949
+ output(this: jsOFD, type?: string): OutputResult;
950
+ /** Shorthand for `output('dataurlstring')`. */
951
+ getDataUrl(this: jsOFD): string;
952
+ /**
953
+ * Save the document to a file.
954
+ *
955
+ * Browser: triggers a download. Node (CJS): writes into the working
956
+ * directory. Node ESM has no synchronous `require` — use
957
+ * `output('arraybuffer')` and write the bytes yourself.
958
+ */
959
+ save(this: jsOFD, filename?: string): jsOFD;
960
+ };
961
+ type ViewApi = typeof ViewApi;
962
+ declare module '../jsofd' {
963
+ interface jsOFD extends ViewApi {
964
+ }
965
+ }
966
+
967
+ /**
968
+ * jsOFD document class.
969
+ *
970
+ * The public API mirrors jsPDF while the serialized output follows the Chinese
971
+ * national fixed-layout document standard GB/T 33190-2016 (OFD).
972
+ *
973
+ * This module holds document state, the constructor, page management and the
974
+ * graphics-state helpers. Feature methods are contributed by the mixins in
975
+ * `src/modules/` and merged onto the prototype at the bottom of this file:
976
+ *
977
+ * - {@link modules/state.ts} fonts, colors, metrics, graphics state
978
+ * - {@link modules/text.ts} measurement, line breaking, `text()`
979
+ * - {@link modules/shapes.ts} vector primitives
980
+ * - {@link modules/images.ts} image embedding
981
+ * - {@link modules/annotations.ts} links and attachments
982
+ * - {@link modules/view.ts} metadata, viewer preferences, output
983
+ */
984
+
985
+ declare const JSOFD_VERSION = "1.0.0";
986
+ type OrientationResolved = 'p' | 'l';
987
+ declare class jsOFD {
988
+ #private;
989
+ /** Active measurement unit. */
990
+ readonly unit: string;
991
+ /** Unit → point scale factor (jsPDF-compatible `internal.scaleFactor`). */
992
+ readonly scaleFactor: number;
993
+ /** Decimal places used when serializing numbers. */
994
+ readonly floatPrecision: number;
995
+ /** @internal Default orientation for `addPage()` without arguments. */
996
+ readonly defaultOrientation: OrientationResolved;
997
+ /** Pages in the document (internal coordinates are points). */
998
+ pages: PageData[];
999
+ /** Zero-based index of the current page. */
1000
+ page: number;
1001
+ /** User-registered fonts. */
1002
+ customFonts: Record<string, FontDef>;
1003
+ /** Image resources, keyed by alias, plus insertion order. */
1004
+ images: Record<string, ImageRun['imageRef']>;
1005
+ imageList: ImageRun['imageRef'][];
1006
+ /** Embedded file attachments. */
1007
+ attachments: AttachmentData[];
1008
+ /** Bookmark tree root. */
1009
+ outlineRoot: {
1010
+ children: OutlineNode[];
1011
+ };
1012
+ /** Document metadata (see `setProperties`). */
1013
+ properties: {
1014
+ title: string;
1015
+ subject: string;
1016
+ author: string;
1017
+ keywords: string;
1018
+ creator: string;
1019
+ creatorVersion: string;
1020
+ };
1021
+ /** Random document identifier. */
1022
+ docID: string;
1023
+ creationDate: Date;
1024
+ modDate: Date | null;
1025
+ displayMode: {
1026
+ zoom: number | string;
1027
+ layout: string;
1028
+ pageMode?: string;
1029
+ } | null;
1030
+ viewerPrefs: Record<string, boolean>;
1031
+ /** Placeholder (e.g. `{total}`) replaced at output time, see `putTotalPages`. */
1032
+ totalPagesPattern: string | null;
1033
+ activeFontKey: string;
1034
+ activeFontStyle: 'normal' | 'bold' | 'italic' | 'bolditalic';
1035
+ /** Font size in points. Like jsPDF, the size is always in pt regardless of unit. */
1036
+ fontSize: number;
1037
+ textColor: RGB;
1038
+ drawColor: RGB;
1039
+ fillColor: RGB;
1040
+ lineWidth: number;
1041
+ lineDash: {
1042
+ pattern: number[];
1043
+ phase: number;
1044
+ } | null;
1045
+ lineCap: number;
1046
+ lineJoin: number;
1047
+ /** Miter limit in points; 0 omits the attribute. */
1048
+ miterLimit: number;
1049
+ charSpace: number;
1050
+ lineHeightFactor: number;
1051
+ opacity: number | null;
1052
+ r2l: boolean;
1053
+ /** @internal Paper format used by `addPage()` without arguments. */
1054
+ _lastFormat: PageFormat;
1055
+ /** jsPDF-style introspection surface. */
1056
+ readonly internal: {
1057
+ version: string;
1058
+ scaleFactor: number;
1059
+ pageSize: {
1060
+ getWidth(): number;
1061
+ getHeight(): number;
1062
+ };
1063
+ numberOfPages: number;
1064
+ pages: PageData[];
1065
+ getFileId(): string;
1066
+ };
1067
+ /** Bookmark API: `doc.outline.add(parent, title, options)`. */
1068
+ readonly outline: {
1069
+ add(parent: OutlineNode | null, title: string, options?: OutlineOptions): OutlineNode;
1070
+ };
1071
+ /**
1072
+ * Canvas-style drawing context (subset of `CanvasRenderingContext2D`).
1073
+ * Draw calls land on the current page as vector objects.
1074
+ */
1075
+ get context2d(): CanvasRenderingContext2D;
1076
+ constructor(options?: jsOFDOptions | Orientation | string, unitArg?: string, formatArg?: PageFormat);
1077
+ /** @internal Resolve a named or `[w, h]` format to a pt size pair. */
1078
+ _resolveFormat(format: PageFormat, orientation: OrientationResolved): [number, number];
1079
+ /** @internal Convert a coordinate in the active unit to points. */
1080
+ _u(v: number): number;
1081
+ /** @internal Append a page sized in points and make it current. */
1082
+ _addPageWithSize(wPt: number, hPt: number): this;
1083
+ /** Append a page, optionally with a different format and orientation. */
1084
+ addPage(format?: PageFormat, orientation?: string): this;
1085
+ /** Switch to a one-based page number. */
1086
+ setPage(n: number): this;
1087
+ /** Insert an empty page before the given one-based position. */
1088
+ insertPage(beforePage?: number): this;
1089
+ /** Move a page (default: the current one) to before another position. */
1090
+ movePage(targetPage?: number, beforePage?: number): this;
1091
+ /** Delete a page (the last page is replaced by an empty one). */
1092
+ deletePage(target?: number): this;
1093
+ /** Number of pages in the document. */
1094
+ getNumberOfPages(): number;
1095
+ /** Width of the current page in the active unit. */
1096
+ getPageWidth(): number;
1097
+ /** Height of the current page in the active unit. */
1098
+ getPageHeight(): number;
1099
+ }
1100
+
1101
+ /**
1102
+ * Paper sizes (millimetres) and measurement units.
1103
+ *
1104
+ * Paper sizes are stored in mm because OFD coordinates are natively mm;
1105
+ * serialising (pt to mm) then yields exact sizes (A4 is exactly 210x297).
1106
+ */
1107
+
1108
+ declare const PAGE_FORMATS_MM: Record<string, [number, number]>;
1109
+ /** Points per unit. */
1110
+ declare const UNIT_FACTORS: Record<Unit, number>;
1111
+
1112
+ /**
1113
+ * XML generation helpers (GB/T 33190 uses the `ofd:` namespace prefix).
1114
+ */
1115
+
1116
+ declare const OFD_NAMESPACE = "http://www.ofdspec.org/2016";
1117
+
1118
+ /**
1119
+ * jsOFD - generate OFD fixed-layout documents (GB/T 33190-2016) with JavaScript/TypeScript.
1120
+ *
1121
+ * The API mirrors jsPDF (https://github.com/parallax/jsPDF);
1122
+ * the output target is the Chinese national standard OFD (Open Fixed-layout Document) instead of PDF.
1123
+ */
1124
+
1125
+ declare const version = "1.0.0";
1126
+
1127
+ export { type AddFontOptions, type AddImageOptions, type AnnotationOptions, type AnnotationType, type AttachmentData, type AttachmentOptions, type AutoPagingOptions, BUILTIN_FONTS, type DashState, type DisplayMode, type DocProperties, type EmbeddedFontFile, FONT_ALIASES, type FontDef, type FontInfo, type FontStyle, type FontWidths, type GState, type HeaderFooterOptions, type HtmlOptions, type ImageInput, type ImageProperties, type ImageResource, type ImageRun, JSOFD_VERSION, type LinkOptions, type LinkRun, OFD_NAMESPACE, type Orientation, type OutlineNode, type OutlineOptions, type OutputResult, PAGE_FORMATS_MM, type PageData, type PageFormat, type PageInfo, type PageObject, type PathOp, type PathRun, type RGB, type SvgOptions, type TableCell, type TableCellInput, type TableColumn, type TableOptions, type TableStyle, type TextAlign, type TextBaseline, type TextOptions, type TextRenderingMode, type TextRun, UNIT_FACTORS, type Unit, type ViewerPreferences, jsOFD as default, jsOFD, type jsOFDOptions, version };