@laminapdf/wasm 0.0.0-stage → 0.2.0-alpha.3

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,1450 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /** A page's text as `WasmPage.text` returns it. */
5
+ export interface PageTextJs {
6
+ /** The text by line, in content order (runs on one baseline, joined; trimmed). */
7
+ lines: string[];
8
+ /** The runs, in content order. */
9
+ runs: TextRunJs[];
10
+ /** Each glyph's quad in page space: 8 numbers per glyph (x0, y0 … x3, y3). */
11
+ quads: Float32Array;
12
+ /** Every glyph's text, concatenated. */
13
+ glyphText: string;
14
+ /** UTF-16 offsets into glyphText: glyph i is glyphText.slice(glyphOffsets[i], glyphOffsets[i + 1]). */
15
+ glyphOffsets: Uint32Array;
16
+ /** Glyphs whose Unicode is unknown (U+FFFD). */
17
+ unmapped: number;
18
+ }
19
+
20
+
21
+
22
+ /** An error or warning (ADR 0026 §1). Errors are thrown as this object. */
23
+ export interface Diagnostic {
24
+ code: string;
25
+ kind: "input" | "io" | "unsupported" | "limit" | "security" | "usage" | "state" | "cancelled" | "internal";
26
+ message: string;
27
+ hint?: string;
28
+ didYouMean?: string[];
29
+ location?: { offset?: number; object?: number; streamOffset?: number; pageIndex?: number; id?: string };
30
+ data?: Record<string, unknown>;
31
+ docsUrl: string;
32
+ }
33
+
34
+
35
+ /**
36
+ * A conformance profile.
37
+ */
38
+ export type ProfileInit = "PDF/UA-1" | "PDF/A-2b" | "PDF/A-2u" | "PDF/A-3b";
39
+
40
+ /**
41
+ * A job's progress (`laminapdf::Step::Progress`).
42
+ */
43
+ export interface ProgressJs {
44
+ /**
45
+ * Work done so far (units of the phase).
46
+ */
47
+ done: number;
48
+ /**
49
+ * The total, when known.
50
+ */
51
+ total?: number;
52
+ /**
53
+ * The phase (`parse`, `layout`, `extract`, `render`, `write`, `sign`).
54
+ */
55
+ phase: string;
56
+ }
57
+
58
+ /**
59
+ * A list of ops with its schema version ([ADR 0006] §6): `{ "v": 1, "ops": [ … ] }`, used
60
+ * for saved op logs, batch processing and sync messages. Unknown fields are rejected, and so
61
+ * is a `v` this reader does not know; [`OpLog::from_json`] checks `v` before reading any op.
62
+ *
63
+ * ```
64
+ * use laminapdf_ops::OpLog;
65
+ *
66
+ * let log = OpLog::from_json(r#"{ "v": 1, "ops": [{ "op": "rotatePage", "args": { "page": "p3.0", "rotate": 180 } }] }"#)?;
67
+ * assert_eq!(log.ops().len(), 1);
68
+ * assert_eq!(OpLog::from_json(r#"{ "v": 2, "ops": [] }"#).map_err(|e| e.code()), Err("unsupported-version"));
69
+ * # Ok::<(), laminapdf_ops::Error>(())
70
+ * ```
71
+ *
72
+ * [ADR 0006]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0006-op-log-and-undo.md
73
+ */
74
+ export interface OpLog {
75
+ v: 1;
76
+ ops: Op[];
77
+ }
78
+
79
+ /**
80
+ * A page-label numbering style.
81
+ */
82
+ export type LabelStyleInit = "decimal" | "upperRoman" | "lowerRoman" | "upperLetters" | "lowerLetters";
83
+
84
+ /**
85
+ * An attached file's options.
86
+ */
87
+ export interface AttachmentInit {
88
+ /**
89
+ * How the file relates to the document (default `unspecified`).
90
+ */
91
+ relationship?: AfRelationshipInit;
92
+ /**
93
+ * `/Desc`, shown next to the file.
94
+ */
95
+ description?: string;
96
+ /**
97
+ * When the file last changed, a PDF date (default: the document's creation date).
98
+ */
99
+ modDate?: string;
100
+ }
101
+
102
+ /**
103
+ * An editing operation ([ADR 0006] §1): typed and semantic (it names things by
104
+ * [`LaminaPdfId`](laminapdf_model::LaminaPdfId), never by object reference), serialisable, and free
105
+ * of ambient inputs (a modification date is in the payload), so the same op on the same
106
+ * document gives the same result on every platform.
107
+ *
108
+ * Apply it inside a transaction ([`Tx::apply`](crate::Tx::apply)); its JSON form is
109
+ * adjacently tagged, `{ "op": "rotatePage", "args": { … } }`, and unknown ops and fields
110
+ * are rejected, never skipped.
111
+ *
112
+ * ```
113
+ * use laminapdf_ops::Op;
114
+ *
115
+ * let op: Op = serde_json::from_str(r#"{ "op": "rotatePage", "args": { "page": "p3.0", "rotate": 90 } }"#)?;
116
+ * assert_eq!(serde_json::to_string(&op)?, r#"{"op":"rotatePage","args":{"page":"p3.0","rotate":90}}"#);
117
+ * assert!(serde_json::from_str::<Op>(r#"{ "op": "explode", "args": {} }"#).is_err());
118
+ * # Ok::<(), serde_json::Error>(())
119
+ * ```
120
+ *
121
+ * [ADR 0006]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0006-op-log-and-undo.md
122
+ */
123
+ export type Op = { op: "setInfo"; args: SetInfo } | { op: "rotatePage"; args: RotatePage };
124
+
125
+ /**
126
+ * Changes to the Info dictionary's text entries. For each field, `None` leaves the entry
127
+ * alone, `Some(None)` removes it and `Some(Some(text))` sets it (encoded as
128
+ * PDFDocEncoding when it can be, else UTF-16BE, §7.9.2.2).
129
+ *
130
+ * On the wire an absent field is left alone and `null` clears: `{ "title": "Report",
131
+ * "author": null }`.
132
+ */
133
+ export interface InfoPatch {
134
+ /**
135
+ * `/Title`.
136
+ */
137
+ title?: string | null;
138
+ /**
139
+ * `/Author`.
140
+ */
141
+ author?: string | null;
142
+ /**
143
+ * `/Subject`.
144
+ */
145
+ subject?: string | null;
146
+ /**
147
+ * `/Keywords`.
148
+ */
149
+ keywords?: string | null;
150
+ /**
151
+ * `/Creator`: the application that created the original document.
152
+ */
153
+ creator?: string | null;
154
+ /**
155
+ * `/Producer`: the application that converted it to PDF.
156
+ */
157
+ producer?: string | null;
158
+ }
159
+
160
+ /**
161
+ * Edits the Info dictionary: applies `patch` and, when `at` is given, sets `/ModDate` to it.
162
+ * The date is part of the op, never read from a clock, so the same op gives the same bytes
163
+ * everywhere (ADR 0006 §1).
164
+ *
165
+ * An Info dictionary written directly in the trailer, or missing, becomes a new indirect
166
+ * object that the trailer's `/Info` points to (the first time the op changes something).
167
+ */
168
+ export interface SetInfo {
169
+ /**
170
+ * The entries to set or clear.
171
+ */
172
+ patch?: InfoPatch;
173
+ /**
174
+ * The modification date to record as `/ModDate`.
175
+ */
176
+ at?: string;
177
+ }
178
+
179
+ /**
180
+ * How a destination shows its page (§12.3.2.2).
181
+ */
182
+ export type FitInit = { type: "page" } | { type: "width"; top?: number } | { type: "height"; left?: number } | { type: "xyz"; left?: number; top?: number; zoom?: number } | { type: "rect"; x: number; y: number; width: number; height: number } | { type: "bounds" };
183
+
184
+ /**
185
+ * How a viewer lays pages out.
186
+ */
187
+ export type PageLayoutInit = "singlePage" | "oneColumn" | "twoColumnLeft" | "twoColumnRight" | "twoPageLeft" | "twoPageRight";
188
+
189
+ /**
190
+ * How an attached file relates to the document (`/AFRelationship`).
191
+ */
192
+ export type AfRelationshipInit = "source" | "data" | "alternative" | "supplement" | "unspecified";
193
+
194
+ /**
195
+ * How an undo or redo went (`laminapdf::UndoOutcome`).
196
+ */
197
+ export type UndoOutcomeJs = "applied" | "partial" | "skipped";
198
+
199
+ /**
200
+ * How the Markdown is cut into chunks.
201
+ */
202
+ export interface ChunkInit {
203
+ /**
204
+ * A chunk's budget in approximate tokens (characters / 4); 512 by default.
205
+ */
206
+ maxTokens?: number;
207
+ /**
208
+ * Approximate tokens of whole blocks repeated from the chunk before; 0 by default.
209
+ */
210
+ overlap?: number;
211
+ /**
212
+ * Where chunks may start; `"headings"` by default.
213
+ */
214
+ splitOn?: SplitOnName;
215
+ }
216
+
217
+ /**
218
+ * How viewers present the document when it opens.
219
+ */
220
+ export interface ViewerPreferencesInit {
221
+ /**
222
+ * Show the title, not the file name.
223
+ */
224
+ displayDocTitle?: boolean;
225
+ /**
226
+ * The panel shown.
227
+ */
228
+ pageMode?: PageModeInit;
229
+ /**
230
+ * The page layout.
231
+ */
232
+ pageLayout?: PageLayoutInit;
233
+ }
234
+
235
+ /**
236
+ * Object numbering in a full rewrite.
237
+ */
238
+ export type RenumberJs = "keep" | "compact";
239
+
240
+ /**
241
+ * One outline item and its children.
242
+ */
243
+ export interface OutlineEntryInit {
244
+ /**
245
+ * The title shown.
246
+ */
247
+ title: string;
248
+ /**
249
+ * Where it goes (none: a heading).
250
+ */
251
+ target?: LinkTargetInit;
252
+ /**
253
+ * Its children.
254
+ */
255
+ children?: OutlineEntryInit[];
256
+ /**
257
+ * Shown expanded.
258
+ */
259
+ open?: boolean;
260
+ /**
261
+ * The title's colour, RGB 0 to 1.
262
+ */
263
+ color?: [number, number, number];
264
+ /**
265
+ * Bold title.
266
+ */
267
+ bold?: boolean;
268
+ /**
269
+ * Italic title.
270
+ */
271
+ italic?: boolean;
272
+ }
273
+
274
+ /**
275
+ * One page's facts (`laminapdf::PageInfo`).
276
+ */
277
+ export interface PageInfoJs {
278
+ /**
279
+ * The 0-based index.
280
+ */
281
+ index: number;
282
+ /**
283
+ * The stable page ID (`p12.0`).
284
+ */
285
+ id: string;
286
+ /**
287
+ * Displayed width in points.
288
+ */
289
+ width: number;
290
+ /**
291
+ * Displayed height in points.
292
+ */
293
+ height: number;
294
+ /**
295
+ * `/Rotate` in degrees.
296
+ */
297
+ rotation: number;
298
+ /**
299
+ * The page label, when the document defines one (document text).
300
+ */
301
+ label?: string;
302
+ }
303
+
304
+ /**
305
+ * One page-label range, from page `start` (0-based) on.
306
+ */
307
+ export interface PageLabelInit {
308
+ /**
309
+ * The first page of the range.
310
+ */
311
+ start: number;
312
+ /**
313
+ * The numbering style (none: prefix only).
314
+ */
315
+ style?: LabelStyleInit;
316
+ /**
317
+ * A prefix.
318
+ */
319
+ prefix?: string;
320
+ /**
321
+ * The first number (default 1).
322
+ */
323
+ first?: number;
324
+ }
325
+
326
+ /**
327
+ * One text run (`laminapdf::extract::PageTextRun`): glyphs of one font, size, direction and marked
328
+ * content on one baseline, in logical order.
329
+ */
330
+ export interface TextRunJs {
331
+ /**
332
+ * The run's text in logical order (document text).
333
+ */
334
+ text: string;
335
+ /**
336
+ * The font's `/BaseFont` (document text).
337
+ */
338
+ font: string;
339
+ /**
340
+ * Font size in user-space units, the text matrix applied.
341
+ */
342
+ size: number;
343
+ /**
344
+ * Vertical writing.
345
+ */
346
+ vertical: boolean;
347
+ /**
348
+ * The marked-content ID the run is in, if any.
349
+ */
350
+ mcid?: number;
351
+ /**
352
+ * The text comes from an `/ActualText` span.
353
+ */
354
+ actualText: boolean;
355
+ /**
356
+ * Drawn invisibly (`Tr` 3 or 7).
357
+ */
358
+ invisible: boolean;
359
+ /**
360
+ * The bounds of the run's glyph quads, in page space (ADR 0027).
361
+ */
362
+ bounds: [number, number, number, number];
363
+ /**
364
+ * The run's glyphs: `[start, end)` into the page's glyph arrays.
365
+ */
366
+ glyphs: [number, number];
367
+ }
368
+
369
+ /**
370
+ * Options for `WasmDocument.extract`.
371
+ */
372
+ export interface ExtractInit {
373
+ /**
374
+ * What to return.
375
+ */
376
+ format: ExtractFormat;
377
+ /**
378
+ * The 0-based page indices to extract, in this order; every page by default.
379
+ */
380
+ pages?: number[];
381
+ /**
382
+ * Where the reading order comes from; `"auto"` by default.
383
+ */
384
+ readingOrder?: ReadingOrderName;
385
+ /**
386
+ * What happens to hidden text.
387
+ */
388
+ drop?: DropInit;
389
+ /**
390
+ * Which table detectors run; `"lattice"` by default.
391
+ */
392
+ tables?: TableModeName;
393
+ /**
394
+ * Join words hyphenated across lines; on by default.
395
+ */
396
+ dehyphenate?: boolean;
397
+ /**
398
+ * Write `<!-- page N -->` before each page's first block (Markdown, chunks and JSON).
399
+ */
400
+ pageMarkers?: boolean;
401
+ /**
402
+ * How chunks are cut (`chunks`, and `json` to include them).
403
+ */
404
+ chunk?: ChunkInit;
405
+ }
406
+
407
+ /**
408
+ * Options for `WasmDocument.openBytes`.
409
+ */
410
+ export interface OpenOptionsInit {
411
+ /**
412
+ * The user or owner password of an encrypted document.
413
+ */
414
+ password?: string;
415
+ /**
416
+ * Refuse files that need repair (`strict`).
417
+ */
418
+ strict?: boolean;
419
+ /**
420
+ * Resource limits (ADR 0003 §3); each one left out keeps its default.
421
+ */
422
+ limits?: LimitsInit;
423
+ }
424
+
425
+ /**
426
+ * Options for `WasmPage.text`.
427
+ */
428
+ export interface TextOptionsInit {
429
+ /**
430
+ * Leave out text drawn invisibly (rendering modes 3 and 7: OCR layers, hidden text).
431
+ */
432
+ skipInvisible?: boolean;
433
+ }
434
+
435
+ /**
436
+ * Options for a new document: everything that would come from the environment is given,
437
+ * so the same calls give the same bytes.
438
+ */
439
+ export interface BuildOptionsInit {
440
+ /**
441
+ * The header version (default 1.7).
442
+ */
443
+ version?: PdfVersionInit;
444
+ /**
445
+ * The first `/ID` entry: 16 bytes as 32 hex digits (default: a content hash).
446
+ */
447
+ id?: string;
448
+ /**
449
+ * `/Producer`.
450
+ */
451
+ producer?: string;
452
+ /**
453
+ * `/CreationDate`, a PDF date (`D:20261030120000Z`).
454
+ */
455
+ creationDate?: string;
456
+ /**
457
+ * Flate-compress content streams (default `true`).
458
+ */
459
+ compress?: boolean;
460
+ /**
461
+ * A tagged document (structure tree, `/MarkInfo`) even before any element (default
462
+ * `false`; a page using `beginTag` or `beginArtifact` makes it tagged either way).
463
+ */
464
+ tagged?: boolean;
465
+ /**
466
+ * Conformance profiles: `PDF/UA-1` with at most one PDF/A profile. `finish` then fails
467
+ * with a coded error for each machine-checkable rule the document breaks.
468
+ */
469
+ profiles?: ProfileInit[];
470
+ }
471
+
472
+ /**
473
+ * Options for saving.
474
+ */
475
+ export interface SaveOptionsInit {
476
+ /**
477
+ * The mode (default `auto`).
478
+ */
479
+ mode?: SaveModeJs;
480
+ /**
481
+ * Save even when it invalidates signatures (removing them from the output).
482
+ */
483
+ invalidateSignatures?: boolean;
484
+ /**
485
+ * Write an encrypted document as a plaintext full rewrite.
486
+ */
487
+ removeEncryption?: boolean;
488
+ /**
489
+ * What an incremental save returns.
490
+ */
491
+ output?: OutputJs;
492
+ /**
493
+ * Numbering in a full rewrite.
494
+ */
495
+ renumber?: RenumberJs;
496
+ /**
497
+ * The cross-reference form.
498
+ */
499
+ xref?: XrefJs;
500
+ }
501
+
502
+ /**
503
+ * Sets a page's rotation to `rotate` (absolute, not relative to the current value).
504
+ *
505
+ * `/Rotate` is written on the page object itself, so a value inherited from a `/Pages`
506
+ * node is materialised on this page and its siblings keep theirs; an existing own entry
507
+ * keeps its position in the dictionary. The page object is changed, never replaced, so the
508
+ * page keeps its [`PageId`] and object number ([ADR 0005] §5). Nothing is written when the
509
+ * page already displays at `rotate` without an own entry.
510
+ *
511
+ * On the wire: `{ "op": "rotatePage", "args": { "page": "p12.0", "rotate": 90 } }`.
512
+ *
513
+ * [ADR 0005]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0005-document-model.md
514
+ */
515
+ export interface RotatePage {
516
+ /**
517
+ * The page.
518
+ */
519
+ page: string;
520
+ /**
521
+ * The rotation in degrees clockwise: 0, 90, 180 or 270.
522
+ */
523
+ rotate: 0 | 90 | 180 | 270;
524
+ }
525
+
526
+ /**
527
+ * The Info dictionary's text entries; absent ones are left out (document text).
528
+ */
529
+ export interface DocumentInfoJs {
530
+ /**
531
+ * `/Title`.
532
+ */
533
+ title?: string;
534
+ /**
535
+ * `/Author`.
536
+ */
537
+ author?: string;
538
+ /**
539
+ * `/Subject`.
540
+ */
541
+ subject?: string;
542
+ /**
543
+ * `/Keywords`.
544
+ */
545
+ keywords?: string;
546
+ /**
547
+ * `/Creator`.
548
+ */
549
+ creator?: string;
550
+ /**
551
+ * `/Producer`.
552
+ */
553
+ producer?: string;
554
+ }
555
+
556
+ /**
557
+ * The PDF version of a new document.
558
+ */
559
+ export type PdfVersionInit = "1.4" | "1.5" | "1.6" | "1.7" | "2.0";
560
+
561
+ /**
562
+ * The cross-reference form.
563
+ */
564
+ export type XrefJs = "stream" | "classic";
565
+
566
+ /**
567
+ * The document metadata (Info and XMP from the same values).
568
+ */
569
+ export interface MetadataInit {
570
+ /**
571
+ * Title.
572
+ */
573
+ title?: string;
574
+ /**
575
+ * Author.
576
+ */
577
+ author?: string;
578
+ /**
579
+ * Subject.
580
+ */
581
+ subject?: string;
582
+ /**
583
+ * Keywords.
584
+ */
585
+ keywords?: string;
586
+ /**
587
+ * Creator (the application that made the content).
588
+ */
589
+ creator?: string;
590
+ /**
591
+ * Producer.
592
+ */
593
+ producer?: string;
594
+ /**
595
+ * Creation date, a PDF date.
596
+ */
597
+ creationDate?: string;
598
+ /**
599
+ * Modification date, a PDF date.
600
+ */
601
+ modDate?: string;
602
+ }
603
+
604
+ /**
605
+ * The kind of change an op makes. The save planner checks it against `DocMDP` / `FieldMDP`
606
+ * permissions and the document's `SaveConstraint` ([ADR 0007]).
607
+ *
608
+ * [ADR 0007]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0007-save-planner.md
609
+ */
610
+ export type ModificationClass = "metadata" | "formFill" | "annotation" | "signature" | "pageStructure" | "content" | "document";
611
+
612
+ /**
613
+ * The pages an edit touched.
614
+ */
615
+ export interface EditedJs {
616
+ /**
617
+ * IDs of the pages whose content or attributes changed.
618
+ */
619
+ touchedPages: string[];
620
+ }
621
+
622
+ /**
623
+ * The panel a viewer opens with.
624
+ */
625
+ export type PageModeInit = "none" | "outlines" | "thumbnails" | "fullScreen" | "optionalContent" | "attachments";
626
+
627
+ /**
628
+ * The save mode (ADR 0007 §3).
629
+ */
630
+ export type SaveModeJs = "auto" | "incremental" | "fullRewrite";
631
+
632
+ /**
633
+ * What `WasmDocument.extract` returns.
634
+ */
635
+ export type ExtractFormat = "markdown" | "json" | "text" | "chunks";
636
+
637
+ /**
638
+ * What a save wrote (`laminapdf::SaveReport`).
639
+ */
640
+ export interface SaveReportJs {
641
+ /**
642
+ * Bytes written.
643
+ */
644
+ bytesWritten: number;
645
+ /**
646
+ * The mode used (`incremental` or `fullRewrite`).
647
+ */
648
+ mode: SaveModeJs;
649
+ /**
650
+ * Old → new object numbers, when a full rewrite renumbered.
651
+ */
652
+ renumbered?: Record<string, number>;
653
+ /**
654
+ * Where the appended revision starts, for an incremental save.
655
+ */
656
+ appendOffset?: number;
657
+ /**
658
+ * How many signatures the save invalidated (with `invalidateSignatures`).
659
+ */
660
+ invalidatedSignatures: number;
661
+ /**
662
+ * Whether encryption was removed.
663
+ */
664
+ encryptionRemoved: boolean;
665
+ }
666
+
667
+ /**
668
+ * What an incremental save returns.
669
+ */
670
+ export type OutputJs = "whole" | "appendedOnly";
671
+
672
+ /**
673
+ * What happens to hidden text and page furniture.
674
+ */
675
+ export interface DropInit {
676
+ /**
677
+ * Keep each dropped run's text in its `dropped` entry (JSON only), for auditing a file.
678
+ */
679
+ keepSpans?: boolean;
680
+ /**
681
+ * Drop running headers, footers, page numbers and artifact-marked text too, listing them
682
+ * in `dropped`; on by default.
683
+ */
684
+ furniture?: boolean;
685
+ }
686
+
687
+ /**
688
+ * Where a link or outline item goes.
689
+ */
690
+ export type LinkTargetInit = { type: "uri"; uri: string } | { type: "page"; index: number; fit?: FitInit } | { type: "named"; name: string };
691
+
692
+ /**
693
+ * Where chunks may start.
694
+ */
695
+ export type SplitOnName = "headings" | "blocks" | "pages";
696
+
697
+ /**
698
+ * Where the reading order comes from.
699
+ */
700
+ export type ReadingOrderName = "auto" | "tagged" | "layout" | "content-stream";
701
+
702
+ /**
703
+ * Which table detectors run.
704
+ */
705
+ export type TableModeName = "off" | "lattice" | "lattice-and-stream";
706
+
707
+ /**
708
+ * `Limits` with every field optional (ADR 0003 §3; names as in Rust, camelCase).
709
+ */
710
+ export interface LimitsInit {
711
+ /**
712
+ *
713
+ */
714
+ maxNestingDepth?: number;
715
+ /**
716
+ *
717
+ */
718
+ maxStreamDecoded?: number;
719
+ /**
720
+ *
721
+ */
722
+ maxDecodedTotal?: number;
723
+ /**
724
+ *
725
+ */
726
+ maxFilterChain?: number;
727
+ /**
728
+ *
729
+ */
730
+ maxResolveDepth?: number;
731
+ /**
732
+ *
733
+ */
734
+ maxPageTreeDepth?: number;
735
+ /**
736
+ *
737
+ */
738
+ maxTreeDepth?: number;
739
+ /**
740
+ *
741
+ */
742
+ maxStringLength?: number;
743
+ /**
744
+ *
745
+ */
746
+ maxXrefSections?: number;
747
+ /**
748
+ *
749
+ */
750
+ maxObjectNumber?: number;
751
+ /**
752
+ *
753
+ */
754
+ maxWarnings?: number;
755
+ /**
756
+ *
757
+ */
758
+ maxContentOperators?: number;
759
+ /**
760
+ *
761
+ */
762
+ maxXobjectDepth?: number;
763
+ /**
764
+ *
765
+ */
766
+ maxImagePixels?: number;
767
+ /**
768
+ *
769
+ */
770
+ maxReadWindow?: number;
771
+ }
772
+
773
+
774
+ /**
775
+ * Builds a new document: pages, navigation and metadata, then [`WasmBuilder::finish`]
776
+ * gives a [`WasmDocument`] (unsaved; its save is a full rewrite).
777
+ */
778
+ export class WasmBuilder {
779
+ free(): void;
780
+ [Symbol.dispose](): void;
781
+ /**
782
+ * Attaches a file (`/EmbeddedFiles`, the catalog's `/AF`): `name`, its bytes and its MIME
783
+ * type. The same name again replaces the file.
784
+ *
785
+ * # Errors
786
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date); `unknown-option`.
787
+ */
788
+ attach(name: string, bytes: Uint8Array, mime: string, options: AttachmentInit | undefined): void;
789
+ /**
790
+ * Defines the named destination `name`: page `index` shown as `fit` (default: the page).
791
+ *
792
+ * # Errors
793
+ * `builder-finished`; `invalid-argument` for a bad `fit`.
794
+ */
795
+ destination(name: string, index: number, fit: FitInit | undefined): void;
796
+ /**
797
+ * Writes the fonts, links, page tree, outline and metadata, and returns the document.
798
+ * The builder is finished afterwards, and so are its unfinished pages.
799
+ *
800
+ * # Errors
801
+ * `builder-finished`; `page-index-out-of-range`, `unknown-destination`,
802
+ * `invalid-page-labels`, `invalid-geometry`, `subset-failed`.
803
+ */
804
+ finish(): WasmDocument;
805
+ /**
806
+ * The natural language (`/Lang`), a BCP 47 tag.
807
+ *
808
+ * # Errors
809
+ * `builder-finished`.
810
+ */
811
+ lang(lang: string): void;
812
+ /**
813
+ * The metadata, written as the Info dictionary and an XMP packet.
814
+ *
815
+ * # Errors
816
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date).
817
+ */
818
+ metadata(metadata: MetadataInit): void;
819
+ /**
820
+ * A builder for a new, empty document.
821
+ *
822
+ * # Errors
823
+ * `invalid-argument` / `unknown-option` for bad options.
824
+ */
825
+ constructor(options: BuildOptionsInit | undefined);
826
+ /**
827
+ * Adds outline items (with their children); returns their IDs in pre-order.
828
+ *
829
+ * # Errors
830
+ * `builder-finished`; `invalid-argument`; `limit-exceeded`.
831
+ */
832
+ outline(entries: OutlineEntryInit[]): string[];
833
+ /**
834
+ * The page labels, ranges by first page (checked at [`WasmBuilder::finish`]).
835
+ *
836
+ * # Errors
837
+ * `builder-finished`; `invalid-argument`.
838
+ */
839
+ pageLabels(ranges: PageLabelInit[]): void;
840
+ /**
841
+ * A page of `width` × `height` points, written by [`WasmPageBuilder::finish`].
842
+ */
843
+ page(width: number, height: number): WasmPageBuilder;
844
+ /**
845
+ * How viewers present the document when it opens.
846
+ *
847
+ * # Errors
848
+ * `builder-finished`; `invalid-argument`.
849
+ */
850
+ viewerPreferences(prefs: ViewerPreferencesInit): void;
851
+ }
852
+
853
+ /**
854
+ * An open PDF: read it, edit it with ops (with undo), save it. The binding of
855
+ * `laminapdf::Document`, method for method (F12).
856
+ */
857
+ export class WasmDocument {
858
+ private constructor();
859
+ free(): void;
860
+ [Symbol.dispose](): void;
861
+ /**
862
+ * Applies an op log (`{ "v": 1, "ops": [ … ] }`) as one transaction.
863
+ *
864
+ * # Errors
865
+ * `invalid-op-log`, `unsupported-version`; as [`WasmDocument::apply`].
866
+ */
867
+ applyLog(json: string): EditedJs;
868
+ /**
869
+ * Applies `ops` (the op JSON of ADR 0006 §6) in order, as one transaction.
870
+ *
871
+ * # Errors
872
+ * `invalid-argument` / `unknown-option` for a value that isn't an op; the first op's
873
+ * error (nothing is applied).
874
+ */
875
+ apply(ops: Op[]): EditedJs;
876
+ /**
877
+ * The document's text for retrieval and LLMs, as one string: Markdown, plain text, the
878
+ * `laminapdf.extract/1` JSON, or the chunks as a JSON array (the extract and text modules).
879
+ *
880
+ * # Errors
881
+ * `page-index-out-of-range` for a page in `pages` past the end; `data-pending` and the
882
+ * reading errors; `unknown-option` / `invalid-argument` for bad options.
883
+ */
884
+ extract(options: ExtractInit): string;
885
+ /**
886
+ * Whether there are changes no save has written yet.
887
+ */
888
+ hasUnsavedChanges(): boolean;
889
+ /**
890
+ * The Info dictionary's text entries.
891
+ *
892
+ * # Errors
893
+ * Reading errors.
894
+ */
895
+ info(): DocumentInfoJs;
896
+ /**
897
+ * Opens a document from its bytes.
898
+ *
899
+ * # Errors
900
+ * The §1 object: `not-pdf`, `password-required`, `wrong-password`, `limit-exceeded`, …;
901
+ * `invalid-argument` / `unknown-option` for bad options.
902
+ */
903
+ static openBytes(bytes: Uint8Array, options: OpenOptionsInit | undefined): WasmDocument;
904
+ /**
905
+ * Opens a document over a sparse source whose bytes arrive later. Until the source holds
906
+ * what a call needs, the call throws `data-pending` with `data.ranges` (`[offset, length]`
907
+ * pairs): supply them and call again. Lazy reads on the document can do the same.
908
+ *
909
+ * # Errors
910
+ * As `openBytes`, and `data-pending`.
911
+ */
912
+ static openSource(source: WasmSparseSource, options: OpenOptionsInit | undefined): WasmDocument;
913
+ /**
914
+ * A handle on the page with `id` (`p12.0`).
915
+ *
916
+ * # Errors
917
+ * `invalid-argument` for a malformed ID; `unknown-page`.
918
+ */
919
+ pageById(id: string): WasmPage;
920
+ /**
921
+ * The number of pages.
922
+ *
923
+ * # Errors
924
+ * Reading errors.
925
+ */
926
+ pageCount(): number;
927
+ /**
928
+ * Page `index`'s facts.
929
+ *
930
+ * # Errors
931
+ * `page-index-out-of-range`; reading errors.
932
+ */
933
+ pageInfo(index: number): PageInfoJs;
934
+ /**
935
+ * Every page's facts, in order (one page-tree walk).
936
+ *
937
+ * # Errors
938
+ * Reading errors.
939
+ */
940
+ pageInfos(): PageInfoJs[];
941
+ /**
942
+ * A handle on page `index` that follows the page by its ID (F2).
943
+ *
944
+ * # Errors
945
+ * `page-index-out-of-range`; reading errors.
946
+ */
947
+ page(index: number): WasmPage;
948
+ /**
949
+ * Rebases onto `bytes`, the output of a save whose rebase failed (`not-rebased`).
950
+ *
951
+ * # Errors
952
+ * `no-pending-save`; reading errors in `bytes`.
953
+ */
954
+ rebase(bytes: Uint8Array): void;
955
+ /**
956
+ * Redoes the newest undone transaction; `undefined` when there is nothing to redo.
957
+ *
958
+ * # Errors
959
+ * As [`WasmDocument::undo`].
960
+ */
961
+ redo(): UndoOutcomeJs | undefined;
962
+ /**
963
+ * A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
964
+ *
965
+ * # Errors
966
+ * `invalid-argument` / `unknown-option` for bad options.
967
+ */
968
+ saveJob(options: SaveOptionsInit | undefined): WasmSaveJob;
969
+ /**
970
+ * Saves and rebases onto the output, running to completion: `{ bytes, report }`.
971
+ *
972
+ * # Errors
973
+ * The save's errors (`would-invalidate-signatures`, `requires-rewrite`, …).
974
+ */
975
+ save(options: SaveOptionsInit | undefined): { bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
976
+ /**
977
+ * Undoes the newest transaction; `undefined` when there is nothing to undo.
978
+ *
979
+ * # Errors
980
+ * `nested-transaction`, `saved-not-rebased`; reading errors.
981
+ */
982
+ undo(): UndoOutcomeJs | undefined;
983
+ /**
984
+ * A cursor over the warnings so far (build warnings first), each as the §1 object.
985
+ */
986
+ warnings(): WasmWarningCursor;
987
+ }
988
+
989
+ /**
990
+ * An image to draw (decoded or passed through once, shared by every use).
991
+ */
992
+ export class WasmImage {
993
+ private constructor();
994
+ free(): void;
995
+ [Symbol.dispose](): void;
996
+ /**
997
+ * A JPEG, passed through (`DCTDecode`).
998
+ *
999
+ * # Errors
1000
+ * `invalid-image`, `unsupported-image`.
1001
+ */
1002
+ static jpeg(bytes: Uint8Array): WasmImage;
1003
+ /**
1004
+ * A PNG (alpha as an `/SMask`).
1005
+ *
1006
+ * # Errors
1007
+ * `invalid-image`, `unsupported-image`, `image-too-large`.
1008
+ */
1009
+ static png(bytes: Uint8Array): WasmImage;
1010
+ /**
1011
+ * Raw 8-bit RGBA pixels, row by row.
1012
+ *
1013
+ * # Errors
1014
+ * `invalid-image` when the length isn't `width × height × 4`.
1015
+ */
1016
+ static rgba(width: number, height: number, rgba: Uint8Array): WasmImage;
1017
+ /**
1018
+ * Height in pixels.
1019
+ */
1020
+ readonly height: number;
1021
+ /**
1022
+ * Width in pixels.
1023
+ */
1024
+ readonly width: number;
1025
+ }
1026
+
1027
+ /**
1028
+ * A page of a [`WasmDocument`], held by its ID (F2): moving pages doesn't retarget it.
1029
+ */
1030
+ export class WasmPage {
1031
+ private constructor();
1032
+ free(): void;
1033
+ [Symbol.dispose](): void;
1034
+ /**
1035
+ * The page's current 0-based index.
1036
+ *
1037
+ * # Errors
1038
+ * `unknown-page` when the page is gone; `disposed` when its document is freed; reading
1039
+ * errors.
1040
+ */
1041
+ index(): number;
1042
+ /**
1043
+ * The page's facts now.
1044
+ *
1045
+ * # Errors
1046
+ * As [`WasmPage::index`].
1047
+ */
1048
+ info(): PageInfoJs;
1049
+ /**
1050
+ * The page's text: lines, runs, glyph quads and glyph text (the extract and text modules).
1051
+ *
1052
+ * # Errors
1053
+ * `unknown-page` when the page is gone; `disposed` when its document is freed;
1054
+ * `data-pending` and the reading errors; `unknown-option` / `invalid-argument` for bad
1055
+ * options.
1056
+ */
1057
+ text(options: TextOptionsInit | undefined): PageTextJs;
1058
+ /**
1059
+ * The page's stable ID (`p12.0`).
1060
+ */
1061
+ readonly id: string;
1062
+ }
1063
+
1064
+ /**
1065
+ * One page being drawn, in page space (points from the top-left, y down; ADR 0027).
1066
+ * Invalid geometry is reported by [`WasmPageBuilder::finish`] (`invalid-geometry`).
1067
+ */
1068
+ export class WasmPageBuilder {
1069
+ private constructor();
1070
+ free(): void;
1071
+ [Symbol.dispose](): void;
1072
+ /**
1073
+ * Opens an artifact until the matching `endTag`: `kind` is `layout`, `page`, `pagination`
1074
+ * or `background`.
1075
+ *
1076
+ * # Errors
1077
+ * `invalid-argument` for another kind.
1078
+ */
1079
+ beginArtifact(kind: string): void;
1080
+ /**
1081
+ * Opens a structure element until the matching `endTag`: `kind` names a standard type
1082
+ * (`Document`, `Part`, `Sect`, `H1`–`H6`, `P`, `L`, `LI`, `Lbl`, `LBody`, `Table`, `TR`,
1083
+ * `TH`, `TD`, `Figure`, `Caption`, `Link`, `Span`, `Quote`, `Note`, `Code`), the role of
1084
+ * `custom` when given; `/Alt`, `/ActualText`, `/Lang`, `/E`; `scope` is `row`, `column` or
1085
+ * `both` when given.
1086
+ *
1087
+ * # Errors
1088
+ * `invalid-argument` for an unknown `kind` or `scope`.
1089
+ */
1090
+ beginTag(kind: string, custom?: string | null, alt?: string | null, actualText?: string | null, lang?: string | null, expansion?: string | null, scope?: string | null): void;
1091
+ /**
1092
+ * The blend mode, camelCase (`multiply`, `colorDodge`, …).
1093
+ *
1094
+ * # Errors
1095
+ * `invalid-argument` for an unknown mode.
1096
+ */
1097
+ blendMode(mode: string): void;
1098
+ /**
1099
+ * Clips to `path` (with `rule`) until the next `restore`.
1100
+ *
1101
+ * # Errors
1102
+ * As [`WasmPageBuilder::fill_path`].
1103
+ */
1104
+ clipPath(path: Float64Array, rule: string): void;
1105
+ /**
1106
+ * Ends the innermost open element or artifact (none open: nothing happens).
1107
+ *
1108
+ * # Errors
1109
+ * `builder-finished`.
1110
+ */
1111
+ endTag(): void;
1112
+ /**
1113
+ * The fill colour as `#rrggbb` or `#rgb` (`DeviceRGB`).
1114
+ *
1115
+ * # Errors
1116
+ * `invalid-color`.
1117
+ */
1118
+ fillColorHex(hex: string): void;
1119
+ /**
1120
+ * The colour fills use: 1 (gray), 3 (RGB) or 4 (CMYK) components, 0 to 1.
1121
+ *
1122
+ * # Errors
1123
+ * `invalid-argument` for another number of components.
1124
+ */
1125
+ fillColor(components: Float64Array): void;
1126
+ /**
1127
+ * Fills `path` (the flat path encoding) with `rule` (`nonZero` or `evenOdd`).
1128
+ *
1129
+ * # Errors
1130
+ * `invalid-argument` for a bad path or rule.
1131
+ */
1132
+ fillPath(path: Float64Array, rule: string): void;
1133
+ /**
1134
+ * Fills `path` with `rule`, then strokes it with the current stroke style.
1135
+ *
1136
+ * # Errors
1137
+ * As [`WasmPageBuilder::fill_path`].
1138
+ */
1139
+ fillStrokePath(path: Float64Array, rule: string): void;
1140
+ /**
1141
+ * Writes the page into its builder: content stream, resources and page dictionary.
1142
+ * Returns its page ID. The page is finished afterwards: every later call on it fails
1143
+ * with `builder-finished`.
1144
+ *
1145
+ * # Errors
1146
+ * `builder-finished` (the page or its builder already finished); `invalid-geometry` for
1147
+ * the first invalid value drawn; `unknown-font` for a font from another builder.
1148
+ */
1149
+ finish(): string;
1150
+ /**
1151
+ * Draws `image` scaled into the rectangle.
1152
+ *
1153
+ * # Errors
1154
+ * `builder-finished`.
1155
+ */
1156
+ image(image: WasmImage, x: number, y: number, width: number, height: number): void;
1157
+ /**
1158
+ * A link annotation over the rectangle, with `contents` as its alternate text.
1159
+ *
1160
+ * # Errors
1161
+ * `invalid-argument` / `unknown-option` for a bad target.
1162
+ */
1163
+ link(x: number, y: number, width: number, height: number, target: LinkTargetInit, contents?: string | null): void;
1164
+ /**
1165
+ * Fill and stroke opacity, 0 to 1 (an `ExtGState`).
1166
+ *
1167
+ * # Errors
1168
+ * `builder-finished`.
1169
+ */
1170
+ opacity(fill: number, stroke: number): void;
1171
+ /**
1172
+ * Restores the graphics state (`Q`); one without a matching save is ignored.
1173
+ *
1174
+ * # Errors
1175
+ * `builder-finished`.
1176
+ */
1177
+ restore(): void;
1178
+ /**
1179
+ * `/Rotate`: 0, 90, 180 or 270 degrees.
1180
+ *
1181
+ * # Errors
1182
+ * `invalid-argument` for another angle.
1183
+ */
1184
+ rotate(degrees: number): void;
1185
+ /**
1186
+ * Saves the graphics state (`q`).
1187
+ *
1188
+ * # Errors
1189
+ * `builder-finished` after [`WasmPageBuilder::finish`] (so does every drawing method).
1190
+ */
1191
+ save(): void;
1192
+ /**
1193
+ * `/CropBox`, `/BleedBox`, `/TrimBox` or `/ArtBox` (`kind`: `crop`, `bleed`, `trim`,
1194
+ * `art`), in the media box's page space.
1195
+ *
1196
+ * # Errors
1197
+ * `invalid-argument` for another kind.
1198
+ */
1199
+ setBox(kind: "crop" | "bleed" | "trim" | "art", x: number, y: number, width: number, height: number): void;
1200
+ /**
1201
+ * The stroke colour as `#rrggbb` or `#rgb`.
1202
+ *
1203
+ * # Errors
1204
+ * `invalid-color`.
1205
+ */
1206
+ strokeColorHex(hex: string): void;
1207
+ /**
1208
+ * The colour strokes use (as [`WasmPageBuilder::fill_color`]).
1209
+ *
1210
+ * # Errors
1211
+ * As [`WasmPageBuilder::fill_color`].
1212
+ */
1213
+ strokeColor(components: Float64Array): void;
1214
+ /**
1215
+ * Strokes `path` with the current stroke style.
1216
+ *
1217
+ * # Errors
1218
+ * `invalid-argument` for a bad path.
1219
+ */
1220
+ strokePath(path: Float64Array): void;
1221
+ /**
1222
+ * The style later strokes use: `width` (points), `cap` (`butt`, `round`, `square`),
1223
+ * `join` (`miter`, `round`, `bevel`), the miter limit and a dash pattern (empty: solid).
1224
+ *
1225
+ * # Errors
1226
+ * `invalid-argument` for an unknown cap or join.
1227
+ */
1228
+ strokeStyle(width: number, cap: string, join: string, miterLimit: number, dash: Float64Array, dashPhase: number): void;
1229
+ /**
1230
+ * Applies `[a, b, c, d, e, f]` (page space) to what is drawn next.
1231
+ *
1232
+ * # Errors
1233
+ * `invalid-argument` unless there are 6 numbers.
1234
+ */
1235
+ transform(m: Float64Array): void;
1236
+ /**
1237
+ * `/UserUnit`, for pages larger than 14,400 units.
1238
+ */
1239
+ userUnit(unit: number): void;
1240
+ }
1241
+
1242
+ /**
1243
+ * A save in progress (F10). Each `step` checks that the document is unchanged since the
1244
+ * job was created (`document-changed`).
1245
+ */
1246
+ export class WasmSaveJob {
1247
+ private constructor();
1248
+ free(): void;
1249
+ [Symbol.dispose](): void;
1250
+ /**
1251
+ * Stops the job: its next step fails with `cancelled`.
1252
+ */
1253
+ cancel(): void;
1254
+ /**
1255
+ * Runs at most `budget` work units: `{ state: "progress", done, total?, phase }` or
1256
+ * `{ state: "done", bytes, report }`.
1257
+ *
1258
+ * # Errors
1259
+ * `cancelled`, `document-changed`, `job-finished`, `disposed` when the document is freed,
1260
+ * or the save's own errors.
1261
+ */
1262
+ step(budget: number): ({ state: "progress" } & ProgressJs) | { state: "done"; bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
1263
+ }
1264
+
1265
+ /**
1266
+ * A PDF of known size whose bytes arrive later: give it to `WasmDocument.openSource`, and
1267
+ * after a `data-pending` error `supply` the ranges in its `data.ranges` and call again.
1268
+ */
1269
+ export class WasmSparseSource {
1270
+ free(): void;
1271
+ [Symbol.dispose](): void;
1272
+ /**
1273
+ * An empty source of `size` bytes holding at most `budget` bytes (no limit when omitted).
1274
+ *
1275
+ * # Errors
1276
+ * `invalid-argument` when a number isn't a whole number of bytes.
1277
+ */
1278
+ constructor(size: number, budget?: number | null);
1279
+ /**
1280
+ * Adds `bytes` at `offset` (bytes already held win over overlapping ones).
1281
+ *
1282
+ * # Errors
1283
+ * `invalid-argument` past the end; `source-budget-exceeded` over the budget.
1284
+ */
1285
+ supply(offset: number, bytes: Uint8Array): void;
1286
+ /**
1287
+ * What to fetch for the ranges a `data-pending` asked for (flat `[start, end, …]`): each
1288
+ * widened to blocks of `block` bytes (0: as asked) plus `readahead`, merged, minus what is
1289
+ * held, in the same flat form. The planning step of `laminapdf-source`'s `retry`, so every
1290
+ * loop plans the same way.
1291
+ *
1292
+ * # Errors
1293
+ * `invalid-argument` for an odd length or a value that isn't a whole number of bytes.
1294
+ */
1295
+ toFetch(asked: Float64Array, block: number, readahead: number): Float64Array;
1296
+ /**
1297
+ * The source's size in bytes.
1298
+ */
1299
+ readonly size: number;
1300
+ }
1301
+
1302
+ /**
1303
+ * The warnings of a document, read in batches (F8).
1304
+ */
1305
+ export class WasmWarningCursor {
1306
+ private constructor();
1307
+ free(): void;
1308
+ [Symbol.dispose](): void;
1309
+ /**
1310
+ * Up to `max` more warnings, each as the ADR 0026 §1 object; empty at the end.
1311
+ */
1312
+ nextBatch(max: number): Diagnostic[];
1313
+ /**
1314
+ * How many warnings are left.
1315
+ */
1316
+ remaining(): number;
1317
+ }
1318
+
1319
+ export function __wbg_reset_state(): void;
1320
+
1321
+ /**
1322
+ * Whether the most recent allocation failed: after a trap, `true` means the module ran out of
1323
+ * memory.
1324
+ */
1325
+ export function allocationFailed(): boolean;
1326
+
1327
+ /**
1328
+ * Whether this module is the text module (fonts, `text`, `textBox`).
1329
+ */
1330
+ export function hasText(): boolean;
1331
+
1332
+ /**
1333
+ * The crate version (`@laminapdf/wasm`'s).
1334
+ */
1335
+ export function version(): string;
1336
+
1337
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1338
+
1339
+ export interface InitOutput {
1340
+ readonly memory: WebAssembly.Memory;
1341
+ readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
1342
+ readonly __wbg_wasmdocument_free: (a: number, b: number) => void;
1343
+ readonly __wbg_wasmimage_free: (a: number, b: number) => void;
1344
+ readonly __wbg_wasmpage_free: (a: number, b: number) => void;
1345
+ readonly __wbg_wasmpagebuilder_free: (a: number, b: number) => void;
1346
+ readonly __wbg_wasmsavejob_free: (a: number, b: number) => void;
1347
+ readonly __wbg_wasmsparsesource_free: (a: number, b: number) => void;
1348
+ readonly __wbg_wasmwarningcursor_free: (a: number, b: number) => void;
1349
+ readonly allocationFailed: () => number;
1350
+ readonly hasText: () => number;
1351
+ readonly version: () => [number, number];
1352
+ readonly wasmbuilder_attach: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number];
1353
+ readonly wasmbuilder_destination: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1354
+ readonly wasmbuilder_finish: (a: number) => [number, number, number];
1355
+ readonly wasmbuilder_lang: (a: number, b: number, c: number) => [number, number];
1356
+ readonly wasmbuilder_metadata: (a: number, b: any) => [number, number];
1357
+ readonly wasmbuilder_new: (a: any) => [number, number, number];
1358
+ readonly wasmbuilder_outline: (a: number, b: any) => [number, number, number];
1359
+ readonly wasmbuilder_page: (a: number, b: number, c: number) => number;
1360
+ readonly wasmbuilder_pageLabels: (a: number, b: any) => [number, number];
1361
+ readonly wasmbuilder_viewerPreferences: (a: number, b: any) => [number, number];
1362
+ readonly wasmdocument_apply: (a: number, b: any) => [number, number, number];
1363
+ readonly wasmdocument_applyLog: (a: number, b: number, c: number) => [number, number, number];
1364
+ readonly wasmdocument_extract: (a: number, b: any) => [number, number, number, number];
1365
+ readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
1366
+ readonly wasmdocument_info: (a: number) => [number, number, number];
1367
+ readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
1368
+ readonly wasmdocument_openSource: (a: number, b: any) => [number, number, number];
1369
+ readonly wasmdocument_page: (a: number, b: number) => [number, number, number];
1370
+ readonly wasmdocument_pageById: (a: number, b: number, c: number) => [number, number, number];
1371
+ readonly wasmdocument_pageCount: (a: number) => [number, number, number];
1372
+ readonly wasmdocument_pageInfo: (a: number, b: number) => [number, number, number];
1373
+ readonly wasmdocument_pageInfos: (a: number) => [number, number, number];
1374
+ readonly wasmdocument_rebase: (a: number, b: number, c: number) => [number, number];
1375
+ readonly wasmdocument_redo: (a: number) => [number, number, number];
1376
+ readonly wasmdocument_save: (a: number, b: any) => [number, number, number];
1377
+ readonly wasmdocument_saveJob: (a: number, b: any) => [number, number, number];
1378
+ readonly wasmdocument_undo: (a: number) => [number, number, number];
1379
+ readonly wasmdocument_warnings: (a: number) => number;
1380
+ readonly wasmimage_height: (a: number) => number;
1381
+ readonly wasmimage_jpeg: (a: number, b: number) => [number, number, number];
1382
+ readonly wasmimage_png: (a: number, b: number) => [number, number, number];
1383
+ readonly wasmimage_rgba: (a: number, b: number, c: number, d: number) => [number, number, number];
1384
+ readonly wasmimage_width: (a: number) => number;
1385
+ readonly wasmpage_id: (a: number) => [number, number];
1386
+ readonly wasmpage_index: (a: number) => [number, number, number];
1387
+ readonly wasmpage_info: (a: number) => [number, number, number];
1388
+ readonly wasmpage_text: (a: number, b: any) => [number, number, number];
1389
+ readonly wasmpagebuilder_beginArtifact: (a: number, b: number, c: number) => [number, number];
1390
+ readonly wasmpagebuilder_beginTag: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => [number, number];
1391
+ readonly wasmpagebuilder_blendMode: (a: number, b: number, c: number) => [number, number];
1392
+ readonly wasmpagebuilder_clipPath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1393
+ readonly wasmpagebuilder_endTag: (a: number) => [number, number];
1394
+ readonly wasmpagebuilder_fillColor: (a: number, b: number, c: number) => [number, number];
1395
+ readonly wasmpagebuilder_fillColorHex: (a: number, b: number, c: number) => [number, number];
1396
+ readonly wasmpagebuilder_fillPath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1397
+ readonly wasmpagebuilder_fillStrokePath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1398
+ readonly wasmpagebuilder_finish: (a: number) => [number, number, number, number];
1399
+ readonly wasmpagebuilder_image: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1400
+ readonly wasmpagebuilder_link: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => [number, number];
1401
+ readonly wasmpagebuilder_opacity: (a: number, b: number, c: number) => [number, number];
1402
+ readonly wasmpagebuilder_restore: (a: number) => [number, number];
1403
+ readonly wasmpagebuilder_rotate: (a: number, b: number) => [number, number];
1404
+ readonly wasmpagebuilder_save: (a: number) => [number, number];
1405
+ readonly wasmpagebuilder_setBox: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1406
+ readonly wasmpagebuilder_strokeColor: (a: number, b: number, c: number) => [number, number];
1407
+ readonly wasmpagebuilder_strokeColorHex: (a: number, b: number, c: number) => [number, number];
1408
+ readonly wasmpagebuilder_strokePath: (a: number, b: number, c: number) => [number, number];
1409
+ readonly wasmpagebuilder_strokeStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1410
+ readonly wasmpagebuilder_transform: (a: number, b: number, c: number) => [number, number];
1411
+ readonly wasmpagebuilder_userUnit: (a: number, b: number) => void;
1412
+ readonly wasmsavejob_cancel: (a: number) => void;
1413
+ readonly wasmsavejob_step: (a: number, b: number) => [number, number, number];
1414
+ readonly wasmsparsesource_new: (a: number, b: number, c: number) => [number, number, number];
1415
+ readonly wasmsparsesource_size: (a: number) => number;
1416
+ readonly wasmsparsesource_supply: (a: number, b: number, c: number, d: number) => [number, number];
1417
+ readonly wasmsparsesource_toFetch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
1418
+ readonly wasmwarningcursor_nextBatch: (a: number, b: number) => any;
1419
+ readonly wasmwarningcursor_remaining: (a: number) => number;
1420
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
1421
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1422
+ readonly __wbindgen_exn_store: (a: number) => void;
1423
+ readonly __externref_table_alloc: () => number;
1424
+ readonly __wbindgen_externrefs: WebAssembly.Table;
1425
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1426
+ readonly __externref_table_dealloc: (a: number) => void;
1427
+ readonly __wbindgen_start: () => void;
1428
+ }
1429
+
1430
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
1431
+
1432
+ /**
1433
+ * Instantiates the given `module`, which can either be bytes or
1434
+ * a precompiled `WebAssembly.Module`.
1435
+ *
1436
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
1437
+ *
1438
+ * @returns {InitOutput}
1439
+ */
1440
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
1441
+
1442
+ /**
1443
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1444
+ * for everything else, calls `WebAssembly.instantiate` directly.
1445
+ *
1446
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
1447
+ *
1448
+ * @returns {Promise<InitOutput>}
1449
+ */
1450
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;