@pdfluent/sdk-wasm 1.0.0-beta.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/xfa_wasm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* @ts-self-types="./xfa_wasm.d.ts" */
2
- import { __pdfluent_error_ctor } from './snippets/xfa-wasm-312742e1abcfad9e/inline0.js';
2
+ import { __pdfluent_error_ctor } from './snippets/xfa-wasm-d1985887593da269/inline0.js';
3
3
 
4
4
 
5
5
  /**
@@ -25,77 +25,6 @@ export const ChromaSampling = Object.freeze({
25
25
  Cs400: 3, "3": "Cs400",
26
26
  });
27
27
 
28
- /**
29
- * Status of the currently-active license.
30
- */
31
- export class LicenseStatus {
32
- static __wrap(ptr) {
33
- const obj = Object.create(LicenseStatus.prototype);
34
- obj.__wbg_ptr = ptr;
35
- LicenseStatusFinalization.register(obj, obj.__wbg_ptr, obj);
36
- return obj;
37
- }
38
- __destroy_into_raw() {
39
- const ptr = this.__wbg_ptr;
40
- this.__wbg_ptr = 0;
41
- LicenseStatusFinalization.unregister(this);
42
- return ptr;
43
- }
44
- free() {
45
- const ptr = this.__destroy_into_raw();
46
- wasm.__wbg_licensestatus_free(ptr, 0);
47
- }
48
- /**
49
- * Whether output is marked via `/Producer` metadata (Trial tier).
50
- * @returns {boolean}
51
- */
52
- get outputIsMarked() {
53
- const ret = wasm.licensestatus_outputIsMarked(this.__wbg_ptr);
54
- return ret !== 0;
55
- }
56
- /**
57
- * Source: `"Default" | "EnvVar" | "Explicit"`.
58
- * @returns {string}
59
- */
60
- get source() {
61
- let deferred1_0;
62
- let deferred1_1;
63
- try {
64
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
65
- wasm.licensestatus_source(retptr, this.__wbg_ptr);
66
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
67
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
68
- deferred1_0 = r0;
69
- deferred1_1 = r1;
70
- return getStringFromWasm0(r0, r1);
71
- } finally {
72
- wasm.__wbindgen_add_to_stack_pointer(16);
73
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
74
- }
75
- }
76
- /**
77
- * Tier name: `"Trial" | "Developer" | "Team" | "Business" | "Enterprise"`.
78
- * @returns {string}
79
- */
80
- get tier() {
81
- let deferred1_0;
82
- let deferred1_1;
83
- try {
84
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
85
- wasm.licensestatus_tier(retptr, this.__wbg_ptr);
86
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
87
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
88
- deferred1_0 = r0;
89
- deferred1_1 = r1;
90
- return getStringFromWasm0(r0, r1);
91
- } finally {
92
- wasm.__wbindgen_add_to_stack_pointer(16);
93
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
94
- }
95
- }
96
- }
97
- if (Symbol.dispose) LicenseStatus.prototype[Symbol.dispose] = LicenseStatus.prototype.free;
98
-
99
28
  /**
100
29
  * PDF document handle for analysis and text extraction.
101
30
  *
@@ -239,6 +168,8 @@ export class PdfDoc {
239
168
  /**
240
169
  * Apply a diagonal text watermark to every page.
241
170
  * `opacity` in 0.0..=1.0. Default rotation 45 deg, default colour gray.
171
+ *
172
+ * Kept for compatibility; `addWatermark` takes the full set of options.
242
173
  * @param {string} text
243
174
  * @param {number} opacity
244
175
  * @returns {Uint8Array}
@@ -263,6 +194,31 @@ export class PdfDoc {
263
194
  wasm.__wbindgen_add_to_stack_pointer(16);
264
195
  }
265
196
  }
197
+ /**
198
+ * Apply a text watermark with full control over text or preset, size,
199
+ * rotation, opacity, colour, position, layer, tiling and pages. Returns
200
+ * the new PDF bytes. Text only: there is no image watermark.
201
+ * @param {WatermarkOptions} options
202
+ * @returns {Uint8Array}
203
+ */
204
+ addWatermark(options) {
205
+ try {
206
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
+ wasm.pdfdoc_addWatermark(retptr, this.__wbg_ptr, addHeapObject(options));
208
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
209
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
210
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
211
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
212
+ if (r3) {
213
+ throw takeObject(r2);
214
+ }
215
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
216
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
217
+ return v1;
218
+ } finally {
219
+ wasm.__wbindgen_add_to_stack_pointer(16);
220
+ }
221
+ }
266
222
  /**
267
223
  * Re-encode all content streams with deflate compression. Removes
268
224
  * no-op overhead. Returns the optimised PDF as a `Uint8Array`.
@@ -359,6 +315,139 @@ export class PdfDoc {
359
315
  wasm.__wbindgen_add_to_stack_pointer(16);
360
316
  }
361
317
  }
318
+ /**
319
+ * The document's blocks as JSON, in reading order (#573).
320
+ *
321
+ * Preview: output quality is still improving and the API may change in a minor release.
322
+ *
323
+ * `{"blocks": [...]}`, one entry per paragraph, heading, list item, table
324
+ * cell and running head, each with its kind, page, box, text, spans and
325
+ * place in the reading order. `docs/STRUCTURED_EXTRACTION.md` is the key
326
+ * to every field.
327
+ *
328
+ * A JSON string and not a structured value, which is what every other
329
+ * structured reader in this binding hands back: one shape crosses the
330
+ * boundary, `JSON.parse` is what the caller already does for
331
+ * `getTextPositions` and the annotations, and a `serde` mirror of the
332
+ * block model would be a second definition of it to keep in step.
333
+ *
334
+ * An XFA form is read from its flattened form, for the reason
335
+ * `extractMarkdown` above gives.
336
+ * @param {number | null} [first_page]
337
+ * @param {number | null} [page_count]
338
+ * @returns {string}
339
+ */
340
+ extractBlocks(first_page, page_count) {
341
+ let deferred2_0;
342
+ let deferred2_1;
343
+ try {
344
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
345
+ wasm.pdfdoc_extractBlocks(retptr, this.__wbg_ptr, isLikeNone(first_page) ? Number.MAX_SAFE_INTEGER : (first_page) >>> 0, isLikeNone(page_count) ? Number.MAX_SAFE_INTEGER : (page_count) >>> 0);
346
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
347
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
348
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
349
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
350
+ var ptr1 = r0;
351
+ var len1 = r1;
352
+ if (r3) {
353
+ ptr1 = 0; len1 = 0;
354
+ throw takeObject(r2);
355
+ }
356
+ deferred2_0 = ptr1;
357
+ deferred2_1 = len1;
358
+ return getStringFromWasm0(ptr1, len1);
359
+ } finally {
360
+ wasm.__wbindgen_add_to_stack_pointer(16);
361
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
362
+ }
363
+ }
364
+ /**
365
+ * The document as a Docling `DoclingDocument`, as JSON (#629).
366
+ *
367
+ * Preview: output quality is still improving and the API may change in a minor release.
368
+ *
369
+ * The schema version the engine pins, which docling-core's
370
+ * `DoclingDocument.model_validate_json` loads as it is. `name` is
371
+ * `DoclingDocument.name`, which Docling fills with the file's stem;
372
+ * absent means `"document"`. An XFA form is read from its flattened form,
373
+ * for the reason `extractMarkdown` above gives.
374
+ * @param {number | null} [first_page]
375
+ * @param {number | null} [page_count]
376
+ * @param {string | null} [name]
377
+ * @returns {string}
378
+ */
379
+ extractDocling(first_page, page_count, name) {
380
+ let deferred3_0;
381
+ let deferred3_1;
382
+ try {
383
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
384
+ var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
385
+ var len0 = WASM_VECTOR_LEN;
386
+ wasm.pdfdoc_extractDocling(retptr, this.__wbg_ptr, isLikeNone(first_page) ? Number.MAX_SAFE_INTEGER : (first_page) >>> 0, isLikeNone(page_count) ? Number.MAX_SAFE_INTEGER : (page_count) >>> 0, ptr0, len0);
387
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
388
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
389
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
390
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
391
+ var ptr2 = r0;
392
+ var len2 = r1;
393
+ if (r3) {
394
+ ptr2 = 0; len2 = 0;
395
+ throw takeObject(r2);
396
+ }
397
+ deferred3_0 = ptr2;
398
+ deferred3_1 = len2;
399
+ return getStringFromWasm0(ptr2, len2);
400
+ } finally {
401
+ wasm.__wbindgen_add_to_stack_pointer(16);
402
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
403
+ }
404
+ }
405
+ /**
406
+ * The document as markdown, in reading order (#573).
407
+ *
408
+ * Preview: output quality is still improving and the API may change in a minor release.
409
+ *
410
+ * Headings become `#` to `###`, list items `-` and `1.`, a table a pipe
411
+ * table or an HTML one where markdown cannot hold its shape, and a change
412
+ * of page an HTML comment. The running heads a document repeats are not in
413
+ * it; they are in `extractBlocks`.
414
+ *
415
+ * `firstPage` and `pageCount` choose a window of pages; leave both out for
416
+ * the whole document. The document is read whole whatever the window is,
417
+ * because what a block IS is decided against the rest of the document.
418
+ *
419
+ * AN XFA FORM IS READ FROM ITS FLATTENED FORM, the way `text` and
420
+ * `getTextPositions` read one: a dynamic XFA document draws its fields
421
+ * from a template rather than from page content, so the blocks of the
422
+ * unflattened file are the blocks of an empty page.
423
+ * @param {number | null} [first_page]
424
+ * @param {number | null} [page_count]
425
+ * @returns {string}
426
+ */
427
+ extractMarkdown(first_page, page_count) {
428
+ let deferred2_0;
429
+ let deferred2_1;
430
+ try {
431
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
432
+ wasm.pdfdoc_extractMarkdown(retptr, this.__wbg_ptr, isLikeNone(first_page) ? Number.MAX_SAFE_INTEGER : (first_page) >>> 0, isLikeNone(page_count) ? Number.MAX_SAFE_INTEGER : (page_count) >>> 0);
433
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
434
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
435
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
436
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
437
+ var ptr1 = r0;
438
+ var len1 = r1;
439
+ if (r3) {
440
+ ptr1 = 0; len1 = 0;
441
+ throw takeObject(r2);
442
+ }
443
+ deferred2_0 = ptr1;
444
+ deferred2_1 = len1;
445
+ return getStringFromWasm0(ptr1, len1);
446
+ } finally {
447
+ wasm.__wbindgen_add_to_stack_pointer(16);
448
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
449
+ }
450
+ }
362
451
  /**
363
452
  * Extract the listed pages (0-based) into a new document.
364
453
  * Used to implement "split" workflows in the browser.
@@ -659,6 +748,37 @@ export class PdfDoc {
659
748
  wasm.__wbindgen_add_to_stack_pointer(16);
660
749
  }
661
750
  }
751
+ /**
752
+ * Replace this document's content with new bytes in-place.
753
+ *
754
+ * Call this after [`PdfDocMut.save`] to update the render handle with
755
+ * the mutated PDF bytes so that subsequent [`renderPage`] calls reflect
756
+ * the changes, without needing to create a new `PdfDoc` object.
757
+ *
758
+ * ```js
759
+ * const handle = PdfDocMut.open(bytes);
760
+ * handle.replaceTextSpan(1, "old", "new");
761
+ * const newBytes = handle.save();
762
+ * doc.refresh(newBytes); // engine now renders the edited content
763
+ * doc.renderPage(0, 1.5); // ← shows "new" instead of "old"
764
+ * ```
765
+ * @param {Uint8Array} data
766
+ */
767
+ refresh(data) {
768
+ try {
769
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
770
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
771
+ const len0 = WASM_VECTOR_LEN;
772
+ wasm.pdfdoc_refresh(retptr, this.__wbg_ptr, ptr0, len0);
773
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
774
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
775
+ if (r1) {
776
+ throw takeObject(r0);
777
+ }
778
+ } finally {
779
+ wasm.__wbindgen_add_to_stack_pointer(16);
780
+ }
781
+ }
662
782
  /**
663
783
  * Render a page to RGBA pixels.
664
784
  *
@@ -824,7 +944,14 @@ export class PdfDoc {
824
944
  }
825
945
  }
826
946
  /**
827
- * Set a single AcroForm text-field value. Returns the new PDF bytes.
947
+ * Set a single AcroForm **text** field value. Returns the new PDF bytes.
948
+ *
949
+ * Updates `/V` (ASCII literal or UTF-16BE+BOM), per-widget `/AS`, and
950
+ * regenerates the `/AP` appearance stream so the fill is visible without
951
+ * `/NeedAppearances` processing. Read-only fields throw.
952
+ *
953
+ * **Text fields only.** For checkbox, radio, and choice fields use
954
+ * `PdfDocMut.setFormField`, which runs the full type-aware dispatch.
828
955
  * @param {string} path
829
956
  * @param {string} value
830
957
  * @returns {Uint8Array}
@@ -852,7 +979,7 @@ export class PdfDoc {
852
979
  }
853
980
  }
854
981
  /**
855
- * Bulk-set multiple AcroForm text fields from a JSON object
982
+ * Bulk-set multiple AcroForm **text** fields from a JSON object
856
983
  * `{"field.path": "value", ...}`. Returns the new PDF bytes.
857
984
  * @param {string} fields_json
858
985
  * @returns {Uint8Array}
@@ -921,6 +1048,79 @@ export class PdfDoc {
921
1048
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
922
1049
  }
923
1050
  }
1051
+ /**
1052
+ * Convert this PDF to a Word `.docx` package.
1053
+ *
1054
+ * Returns the package as a `Uint8Array`.
1055
+ *
1056
+ * The browser SDK could not do this until 23-08-2026: the conversion
1057
+ * crates were excluded from wasm32 by a comment that applied to the
1058
+ * renderer, not to them.
1059
+ * @returns {Uint8Array}
1060
+ */
1061
+ toDocx() {
1062
+ try {
1063
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1064
+ wasm.pdfdoc_toDocx(retptr, this.__wbg_ptr);
1065
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1066
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1067
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1068
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1069
+ if (r3) {
1070
+ throw takeObject(r2);
1071
+ }
1072
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1073
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1074
+ return v1;
1075
+ } finally {
1076
+ wasm.__wbindgen_add_to_stack_pointer(16);
1077
+ }
1078
+ }
1079
+ /**
1080
+ * Convert this PDF to a PowerPoint `.pptx` deck, one slide per page.
1081
+ * See [`Self::to_docx`].
1082
+ * @returns {Uint8Array}
1083
+ */
1084
+ toPptx() {
1085
+ try {
1086
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1087
+ wasm.pdfdoc_toPptx(retptr, this.__wbg_ptr);
1088
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1089
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1090
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1091
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1092
+ if (r3) {
1093
+ throw takeObject(r2);
1094
+ }
1095
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1096
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1097
+ return v1;
1098
+ } finally {
1099
+ wasm.__wbindgen_add_to_stack_pointer(16);
1100
+ }
1101
+ }
1102
+ /**
1103
+ * Convert this PDF to an Excel `.xlsx` workbook. See [`Self::to_docx`].
1104
+ * @returns {Uint8Array}
1105
+ */
1106
+ toXlsx() {
1107
+ try {
1108
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1109
+ wasm.pdfdoc_toXlsx(retptr, this.__wbg_ptr);
1110
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1111
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1112
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1113
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1114
+ if (r3) {
1115
+ throw takeObject(r2);
1116
+ }
1117
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1118
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1119
+ return v1;
1120
+ } finally {
1121
+ wasm.__wbindgen_add_to_stack_pointer(16);
1122
+ }
1123
+ }
924
1124
  /**
925
1125
  * Validate against a PDF/A level. Returns compliance report as JSON.
926
1126
  * @param {string} level
@@ -1478,13 +1678,12 @@ export class PdfDocMut {
1478
1678
  }
1479
1679
  }
1480
1680
  /**
1481
- * Set a single AcroForm text-field value.
1681
+ * Set a single AcroForm field value (text, checkbox, radio, or choice).
1482
1682
  *
1483
- * Note: pdfluent's high-level `PdfFormMut` requires a
1484
- * `pdfluent::PdfDocument`. To stay in-place on this handle, we use
1485
- * the lower-level lopdf walk via the `pdf-forms` engine. For 1.0,
1486
- * this supports flat top-level field hierarchies (no `/Kids`
1487
- * recursion) — same constraint as the Rust core.
1683
+ * Delegates to [`pdf_forms::apply_field_value`] — the single SDK
1684
+ * writeback chain. It keeps `/V` (ASCII literal else UTF-16BE+BOM),
1685
+ * per-widget `/AS`, and regenerated `/AP` streams consistent, resolves
1686
+ * fully-qualified names through `/Kids`, and rejects read-only fields.
1488
1687
  * @param {string} path
1489
1688
  * @param {string} value
1490
1689
  */
@@ -1506,7 +1705,7 @@ export class PdfDocMut {
1506
1705
  }
1507
1706
  }
1508
1707
  /**
1509
- * Bulk-set multiple AcroForm text fields from a JSON object
1708
+ * Bulk-set multiple AcroForm fields from a JSON object
1510
1709
  * `{"field.path": "value", ...}`.
1511
1710
  * @param {string} fields_json
1512
1711
  */
@@ -1525,6 +1724,35 @@ export class PdfDocMut {
1525
1724
  wasm.__wbindgen_add_to_stack_pointer(16);
1526
1725
  }
1527
1726
  }
1727
+ /**
1728
+ * Select multiple options on a multi-select list box.
1729
+ *
1730
+ * Delegates to [`pdf_forms::apply_choice_multi`]: writes `/V` as an array
1731
+ * of text strings and rebuilds `/I` (the sorted selected-index cache) to
1732
+ * match what Adobe Acrobat produces. `values` is a JS array of strings;
1733
+ * pass an empty array to clear the selection. The field must be a
1734
+ * multi-select list box (`/Ff` MultiSelect flag); for non-editable list
1735
+ * boxes every value must be one of the field's `/Opt` options.
1736
+ * @param {string} path
1737
+ * @param {string[]} values
1738
+ */
1739
+ setMultiSelect(path, values) {
1740
+ try {
1741
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1742
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1743
+ const len0 = WASM_VECTOR_LEN;
1744
+ const ptr1 = passArrayJsValueToWasm0(values, wasm.__wbindgen_export);
1745
+ const len1 = WASM_VECTOR_LEN;
1746
+ wasm.pdfdocmut_setMultiSelect(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1747
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1748
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1749
+ if (r1) {
1750
+ throw takeObject(r0);
1751
+ }
1752
+ } finally {
1753
+ wasm.__wbindgen_add_to_stack_pointer(16);
1754
+ }
1755
+ }
1528
1756
  /**
1529
1757
  * Apply bold/italic style to a text run on `page_num` (1-based).
1530
1758
  * @param {number} page_num
@@ -1563,6 +1791,215 @@ export class PdfDocMut {
1563
1791
  }
1564
1792
  if (Symbol.dispose) PdfDocMut.prototype[Symbol.dispose] = PdfDocMut.prototype.free;
1565
1793
 
1794
+ /**
1795
+ * Find-and-replace editor over a PDF document (SDK surface).
1796
+ */
1797
+ export class TextEditor {
1798
+ static __wrap(ptr) {
1799
+ const obj = Object.create(TextEditor.prototype);
1800
+ obj.__wbg_ptr = ptr;
1801
+ TextEditorFinalization.register(obj, obj.__wbg_ptr, obj);
1802
+ return obj;
1803
+ }
1804
+ __destroy_into_raw() {
1805
+ const ptr = this.__wbg_ptr;
1806
+ this.__wbg_ptr = 0;
1807
+ TextEditorFinalization.unregister(this);
1808
+ return ptr;
1809
+ }
1810
+ free() {
1811
+ const ptr = this.__destroy_into_raw();
1812
+ wasm.__wbg_texteditor_free(ptr, 0);
1813
+ }
1814
+ /**
1815
+ * Find text occurrences. `query_json` is a JSON object:
1816
+ *
1817
+ * ```json
1818
+ * {
1819
+ * "text": "Acme B.V.", // required
1820
+ * "caseInsensitive": false, // optional
1821
+ * "pages": [1, 5], // optional inclusive 1-based range
1822
+ * "region": { // optional
1823
+ * "page": 1,
1824
+ * "rect": [x0, y0, x1, y1],
1825
+ * "relation": "intersects" // or "contained"
1826
+ * },
1827
+ * "limit": 100 // optional
1828
+ * }
1829
+ * ```
1830
+ *
1831
+ * Returns a JSON array of matches; each match carries an opaque `id`
1832
+ * token valid until the next applied edit on this document.
1833
+ * @param {string} query_json
1834
+ * @returns {string}
1835
+ */
1836
+ findText(query_json) {
1837
+ let deferred3_0;
1838
+ let deferred3_1;
1839
+ try {
1840
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1841
+ const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1842
+ const len0 = WASM_VECTOR_LEN;
1843
+ wasm.texteditor_findText(retptr, this.__wbg_ptr, ptr0, len0);
1844
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1845
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1846
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1847
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1848
+ var ptr2 = r0;
1849
+ var len2 = r1;
1850
+ if (r3) {
1851
+ ptr2 = 0; len2 = 0;
1852
+ throw takeObject(r2);
1853
+ }
1854
+ deferred3_0 = ptr2;
1855
+ deferred3_1 = len2;
1856
+ return getStringFromWasm0(ptr2, len2);
1857
+ } finally {
1858
+ wasm.__wbindgen_add_to_stack_pointer(16);
1859
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1860
+ }
1861
+ }
1862
+ /**
1863
+ * Open a PDF from raw bytes.
1864
+ * @param {Uint8Array} data
1865
+ * @returns {TextEditor}
1866
+ */
1867
+ static open(data) {
1868
+ try {
1869
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1870
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1871
+ const len0 = WASM_VECTOR_LEN;
1872
+ wasm.texteditor_open(retptr, ptr0, len0);
1873
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1874
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1875
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1876
+ if (r2) {
1877
+ throw takeObject(r1);
1878
+ }
1879
+ return TextEditor.__wrap(r0);
1880
+ } finally {
1881
+ wasm.__wbindgen_add_to_stack_pointer(16);
1882
+ }
1883
+ }
1884
+ /**
1885
+ * Number of pages.
1886
+ * @returns {number}
1887
+ */
1888
+ pageCount() {
1889
+ const ret = wasm.texteditor_pageCount(this.__wbg_ptr);
1890
+ return ret >>> 0;
1891
+ }
1892
+ /**
1893
+ * Apply per-match replacements located earlier with `findText`.
1894
+ *
1895
+ * `edits_json` is a JSON array of `{"id": "<match token>", "text":
1896
+ * "<replacement>"}`. All edits commit in one atomic transaction under
1897
+ * `options_json` (see [`TextEditor::replace_text`]); the default is
1898
+ * all-or-nothing. Returns the JSON replacement report.
1899
+ * @param {string} edits_json
1900
+ * @param {string} options_json
1901
+ * @returns {string}
1902
+ */
1903
+ replaceMatches(edits_json, options_json) {
1904
+ let deferred4_0;
1905
+ let deferred4_1;
1906
+ try {
1907
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1908
+ const ptr0 = passStringToWasm0(edits_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1909
+ const len0 = WASM_VECTOR_LEN;
1910
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1911
+ const len1 = WASM_VECTOR_LEN;
1912
+ wasm.texteditor_replaceMatches(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1913
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1914
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1915
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1916
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1917
+ var ptr3 = r0;
1918
+ var len3 = r1;
1919
+ if (r3) {
1920
+ ptr3 = 0; len3 = 0;
1921
+ throw takeObject(r2);
1922
+ }
1923
+ deferred4_0 = ptr3;
1924
+ deferred4_1 = len3;
1925
+ return getStringFromWasm0(ptr3, len3);
1926
+ } finally {
1927
+ wasm.__wbindgen_add_to_stack_pointer(16);
1928
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
1929
+ }
1930
+ }
1931
+ /**
1932
+ * Find and replace in one call. Returns the JSON replacement report.
1933
+ *
1934
+ * `options_json` may be empty/`"{}"` for defaults, or:
1935
+ *
1936
+ * ```json
1937
+ * {
1938
+ * "fontFallback": "deny" | "injectStandard" | {"explicit": "F1"},
1939
+ * "signaturePolicy": "reject" | "allowPostSignatureChange",
1940
+ * "commitPolicy": "allOrNothing" | "bestEffort"
1941
+ * }
1942
+ * ```
1943
+ * @param {string} query_json
1944
+ * @param {string} replacement
1945
+ * @param {string} options_json
1946
+ * @returns {string}
1947
+ */
1948
+ replaceText(query_json, replacement, options_json) {
1949
+ let deferred5_0;
1950
+ let deferred5_1;
1951
+ try {
1952
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1953
+ const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1954
+ const len0 = WASM_VECTOR_LEN;
1955
+ const ptr1 = passStringToWasm0(replacement, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1956
+ const len1 = WASM_VECTOR_LEN;
1957
+ const ptr2 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1958
+ const len2 = WASM_VECTOR_LEN;
1959
+ wasm.texteditor_replaceText(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1960
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1961
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1962
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1963
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1964
+ var ptr4 = r0;
1965
+ var len4 = r1;
1966
+ if (r3) {
1967
+ ptr4 = 0; len4 = 0;
1968
+ throw takeObject(r2);
1969
+ }
1970
+ deferred5_0 = ptr4;
1971
+ deferred5_1 = len4;
1972
+ return getStringFromWasm0(ptr4, len4);
1973
+ } finally {
1974
+ wasm.__wbindgen_add_to_stack_pointer(16);
1975
+ wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
1976
+ }
1977
+ }
1978
+ /**
1979
+ * Serialize the (possibly edited) document to PDF bytes.
1980
+ * @returns {Uint8Array}
1981
+ */
1982
+ save() {
1983
+ try {
1984
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1985
+ wasm.texteditor_save(retptr, this.__wbg_ptr);
1986
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1987
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1988
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1989
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1990
+ if (r3) {
1991
+ throw takeObject(r2);
1992
+ }
1993
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1994
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1995
+ return v1;
1996
+ } finally {
1997
+ wasm.__wbindgen_add_to_stack_pointer(16);
1998
+ }
1999
+ }
2000
+ }
2001
+ if (Symbol.dispose) TextEditor.prototype[Symbol.dispose] = TextEditor.prototype.free;
2002
+
1566
2003
  /**
1567
2004
  * The main XFA processing engine for WASM.
1568
2005
  *
@@ -1834,44 +2271,152 @@ export class XfaEngine {
1834
2271
  if (Symbol.dispose) XfaEngine.prototype[Symbol.dispose] = XfaEngine.prototype.free;
1835
2272
 
1836
2273
  /**
1837
- * Activate the process-global license from a key string.
2274
+ * Remove the password from a PDF whose password you know, and return the
2275
+ * unprotected bytes; open them with `PdfDoc.open`.
1838
2276
  *
1839
- * Throws on invalid key or if the process has already been activated to a
1840
- * different tier this session.
1841
- * @param {string} key
2277
+ * The owner password always works. The user password works only when the
2278
+ * file has no permission restrictions. Throws `PdfluentError` with
2279
+ * `E-SECURITY-DECRYPTION-FAILED` for a password that does not entitle the
2280
+ * caller, and `E-WASM-INVALID-ARGUMENT` for a PDF without a password.
2281
+ * @param {Uint8Array} bytes
2282
+ * @param {string} password
2283
+ * @returns {Uint8Array}
1842
2284
  */
1843
- export function activateLicenseKey(key) {
2285
+ export function decryptPdf(bytes, password) {
1844
2286
  try {
1845
2287
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1846
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2288
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1847
2289
  const len0 = WASM_VECTOR_LEN;
1848
- wasm.activateLicenseKey(retptr, ptr0, len0);
2290
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2291
+ const len1 = WASM_VECTOR_LEN;
2292
+ wasm.decryptPdf(retptr, ptr0, len0, ptr1, len1);
1849
2293
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1850
2294
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1851
- if (r1) {
1852
- throw takeObject(r0);
2295
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2296
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2297
+ if (r3) {
2298
+ throw takeObject(r2);
2299
+ }
2300
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2301
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2302
+ return v3;
2303
+ } finally {
2304
+ wasm.__wbindgen_add_to_stack_pointer(16);
2305
+ }
2306
+ }
2307
+
2308
+ /**
2309
+ * Encrypt a PDF with AES-256 and return the encrypted bytes.
2310
+ *
2311
+ * `userPassword` is needed to open the file (may be empty: then anyone can
2312
+ * open it, and the permissions apply); `ownerPassword` lifts the permissions
2313
+ * (empty: the user password serves as both). Refuses a PDF that is already
2314
+ * encrypted. Throws `PdfluentError` with `E-WASM-INVALID-ARGUMENT` or
2315
+ * `E-PARSE-INVALID-PDF`.
2316
+ * @param {Uint8Array} bytes
2317
+ * @param {string} user_password
2318
+ * @param {string} owner_password
2319
+ * @param {EncryptPermissions | null} [permissions]
2320
+ * @returns {Uint8Array}
2321
+ */
2322
+ export function encryptPdf(bytes, user_password, owner_password, permissions) {
2323
+ try {
2324
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2325
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2326
+ const len0 = WASM_VECTOR_LEN;
2327
+ const ptr1 = passStringToWasm0(user_password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2328
+ const len1 = WASM_VECTOR_LEN;
2329
+ const ptr2 = passStringToWasm0(owner_password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2330
+ const len2 = WASM_VECTOR_LEN;
2331
+ wasm.encryptPdf(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(permissions) ? 0 : addHeapObject(permissions));
2332
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2333
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2334
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2335
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2336
+ if (r3) {
2337
+ throw takeObject(r2);
2338
+ }
2339
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
2340
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2341
+ return v4;
2342
+ } finally {
2343
+ wasm.__wbindgen_add_to_stack_pointer(16);
2344
+ }
2345
+ }
2346
+
2347
+ /**
2348
+ * Extract the images of a PDF as PNG or JPEG files.
2349
+ *
2350
+ * Returns `{ images, skipped }`. An image that could not be exported exactly
2351
+ * as it looks -- JPEG 2000, JBIG2 or fax compression, a transparency mask, a
2352
+ * Decode array, CMYK, an ICC profile other than sRGB -- is listed in `skipped`
2353
+ * with the reason, never emitted wrong. Each image is listed once, on the
2354
+ * first page (0-based) that uses it.
2355
+ * @param {Uint8Array} bytes
2356
+ * @returns {ImageExtraction}
2357
+ */
2358
+ export function extractImages(bytes) {
2359
+ try {
2360
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2361
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2362
+ const len0 = WASM_VECTOR_LEN;
2363
+ wasm.extractImages(retptr, ptr0, len0);
2364
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2365
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2366
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2367
+ if (r2) {
2368
+ throw takeObject(r1);
1853
2369
  }
2370
+ return takeObject(r0);
1854
2371
  } finally {
1855
2372
  wasm.__wbindgen_add_to_stack_pointer(16);
1856
2373
  }
1857
2374
  }
1858
2375
 
1859
2376
  /**
1860
- * Return the current license status. Always succeeds; defaults to Trial.
1861
- * @returns {LicenseStatus}
2377
+ * Sign a PDF with your own certificate (a .p12/.pfx file and its password)
2378
+ * and return the signed bytes. The private key never leaves the page.
2379
+ *
2380
+ * This is a cryptographic PAdES signature (ETSI.CAdES.detached), appended as
2381
+ * an incremental update so earlier signatures stay valid. Without a
2382
+ * timestamp authority: no TSA or LTV in the browser. A self-signed
2383
+ * certificate verifies, but readers such as Acrobat show its validity as
2384
+ * unknown because they do not trust the issuer. Throws `PdfluentError` with
2385
+ * `E-SECURITY-DECRYPTION-FAILED` for a wrong certificate password.
2386
+ * @param {Uint8Array} bytes
2387
+ * @param {Uint8Array} pkcs12
2388
+ * @param {string} password
2389
+ * @param {SignPdfOptions | null} [options]
2390
+ * @returns {Uint8Array}
1862
2391
  */
1863
- export function licenseStatus() {
1864
- const ret = wasm.licenseStatus();
1865
- return LicenseStatus.__wrap(ret);
2392
+ export function signPdf(bytes, pkcs12, password, options) {
2393
+ try {
2394
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2395
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2396
+ const len0 = WASM_VECTOR_LEN;
2397
+ const ptr1 = passArray8ToWasm0(pkcs12, wasm.__wbindgen_export);
2398
+ const len1 = WASM_VECTOR_LEN;
2399
+ const ptr2 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2400
+ const len2 = WASM_VECTOR_LEN;
2401
+ wasm.signPdf(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(options) ? 0 : addHeapObject(options));
2402
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2403
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2404
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2405
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2406
+ if (r3) {
2407
+ throw takeObject(r2);
2408
+ }
2409
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
2410
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2411
+ return v4;
2412
+ } finally {
2413
+ wasm.__wbindgen_add_to_stack_pointer(16);
2414
+ }
1866
2415
  }
1867
2416
  function __wbg_get_imports() {
1868
2417
  const import0 = {
1869
2418
  __proto__: null,
1870
- __wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
1871
- const ret = Error(getStringFromWasm0(arg0, arg1));
1872
- return addHeapObject(ret);
1873
- },
1874
- __wbg___pdfluent_error_ctor_eea54aa1c0fd64d9: function() {
2419
+ __wbg___pdfluent_error_ctor_17e86bb485874967: function() {
1875
2420
  const ret = __pdfluent_error_ctor();
1876
2421
  return addHeapObject(ret);
1877
2422
  },
@@ -1886,6 +2431,22 @@ function __wbg_get_imports() {
1886
2431
  const ret = typeof(getObject(arg0)) === 'function';
1887
2432
  return ret;
1888
2433
  },
2434
+ __wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
2435
+ const ret = getObject(arg0) === null;
2436
+ return ret;
2437
+ },
2438
+ __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
2439
+ const ret = getObject(arg0) === undefined;
2440
+ return ret;
2441
+ },
2442
+ __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
2443
+ const obj = getObject(arg1);
2444
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2445
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2446
+ var len1 = WASM_VECTOR_LEN;
2447
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2448
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2449
+ },
1889
2450
  __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
1890
2451
  throw new Error(getStringFromWasm0(arg0, arg1));
1891
2452
  },
@@ -1921,7 +2482,7 @@ function __wbg_get_imports() {
1921
2482
  const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
1922
2483
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1923
2484
  }, arguments); },
1924
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
2485
+ __wbg_getRandomValues_76dfc69825c9c552: function() { return handleError(function (arg0, arg1) {
1925
2486
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1926
2487
  }, arguments); },
1927
2488
  __wbg_instanceof_CanvasRenderingContext2d_d4be74cff7165c1e: function(arg0) {
@@ -1943,6 +2504,10 @@ function __wbg_get_imports() {
1943
2504
  __wbg_moveTo_11bf5a977e6b8610: function(arg0, arg1, arg2) {
1944
2505
  getObject(arg0).moveTo(arg1, arg2);
1945
2506
  },
2507
+ __wbg_new_02d162bc6cf02f60: function() {
2508
+ const ret = new Object();
2509
+ return addHeapObject(ret);
2510
+ },
1946
2511
  __wbg_new_1f236d63ba0c4784: function(arg0, arg1) {
1947
2512
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1948
2513
  return addHeapObject(ret);
@@ -1951,10 +2516,18 @@ function __wbg_get_imports() {
1951
2516
  const ret = new Array();
1952
2517
  return addHeapObject(ret);
1953
2518
  },
2519
+ __wbg_new_from_slice_269e35316ed2d061: function(arg0, arg1) {
2520
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2521
+ return addHeapObject(ret);
2522
+ },
1954
2523
  __wbg_new_with_u8_clamped_array_and_sh_13504c3c5394c7c9: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1955
2524
  const ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
1956
2525
  return addHeapObject(ret);
1957
2526
  }, arguments); },
2527
+ __wbg_now_81363d44c96dd239: function() {
2528
+ const ret = Date.now();
2529
+ return ret;
2530
+ },
1958
2531
  __wbg_push_b77c476b01548d0a: function(arg0, arg1) {
1959
2532
  const ret = getObject(arg0).push(getObject(arg1));
1960
2533
  return ret;
@@ -2020,6 +2593,10 @@ function __wbg_get_imports() {
2020
2593
  __wbg_set_width_25112eb6bf1148df: function(arg0, arg1) {
2021
2594
  getObject(arg0).width = arg1 >>> 0;
2022
2595
  },
2596
+ __wbg_stringify_ef0c105b1ccc3849: function() { return handleError(function (arg0) {
2597
+ const ret = JSON.stringify(getObject(arg0));
2598
+ return addHeapObject(ret);
2599
+ }, arguments); },
2023
2600
  __wbg_strokeRect_3430a0df4158ba67: function(arg0, arg1, arg2, arg3, arg4) {
2024
2601
  getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);
2025
2602
  },
@@ -2056,15 +2633,15 @@ function __wbg_get_imports() {
2056
2633
  }
2057
2634
 
2058
2635
  const __wbindgen_enum_CanvasWindingRule = ["nonzero", "evenodd"];
2059
- const LicenseStatusFinalization = (typeof FinalizationRegistry === 'undefined')
2060
- ? { register: () => {}, unregister: () => {} }
2061
- : new FinalizationRegistry(ptr => wasm.__wbg_licensestatus_free(ptr, 1));
2062
2636
  const PdfDocFinalization = (typeof FinalizationRegistry === 'undefined')
2063
2637
  ? { register: () => {}, unregister: () => {} }
2064
2638
  : new FinalizationRegistry(ptr => wasm.__wbg_pdfdoc_free(ptr, 1));
2065
2639
  const PdfDocMutFinalization = (typeof FinalizationRegistry === 'undefined')
2066
2640
  ? { register: () => {}, unregister: () => {} }
2067
2641
  : new FinalizationRegistry(ptr => wasm.__wbg_pdfdocmut_free(ptr, 1));
2642
+ const TextEditorFinalization = (typeof FinalizationRegistry === 'undefined')
2643
+ ? { register: () => {}, unregister: () => {} }
2644
+ : new FinalizationRegistry(ptr => wasm.__wbg_texteditor_free(ptr, 1));
2068
2645
  const XfaEngineFinalization = (typeof FinalizationRegistry === 'undefined')
2069
2646
  ? { register: () => {}, unregister: () => {} }
2070
2647
  : new FinalizationRegistry(ptr => wasm.__wbg_xfaengine_free(ptr, 1));
@@ -2234,6 +2811,16 @@ function passArray8ToWasm0(arg, malloc) {
2234
2811
  return ptr;
2235
2812
  }
2236
2813
 
2814
+ function passArrayJsValueToWasm0(array, malloc) {
2815
+ const ptr = malloc(array.length * 4, 4) >>> 0;
2816
+ const mem = getDataViewMemory0();
2817
+ for (let i = 0; i < array.length; i++) {
2818
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
2819
+ }
2820
+ WASM_VECTOR_LEN = array.length;
2821
+ return ptr;
2822
+ }
2823
+
2237
2824
  function passStringToWasm0(arg, malloc, realloc) {
2238
2825
  if (realloc === undefined) {
2239
2826
  const buf = cachedTextEncoder.encode(arg);