pdf-oxide-wasm 0.3.38 → 0.3.39
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/bundler/pdf_oxide.d.ts +244 -0
- package/bundler/pdf_oxide.js +1 -1
- package/bundler/pdf_oxide_bg.js +984 -43
- package/bundler/pdf_oxide_bg.wasm +0 -0
- package/bundler/pdf_oxide_bg.wasm.d.ts +42 -1
- package/nodejs/pdf_oxide.d.ts +244 -0
- package/nodejs/pdf_oxide.js +987 -43
- package/nodejs/pdf_oxide_bg.wasm +0 -0
- package/nodejs/pdf_oxide_bg.wasm.d.ts +42 -1
- package/package.json +1 -1
- package/web/pdf_oxide.d.ts +286 -1
- package/web/pdf_oxide.js +984 -43
- package/web/pdf_oxide_bg.wasm +0 -0
- package/web/pdf_oxide_bg.wasm.d.ts +42 -1
package/nodejs/pdf_oxide.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
/* @ts-self-types="./pdf_oxide.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Horizontal-alignment enum shared by `textInRect`, buffered `table`, and
|
|
5
|
+
* `streamingTable`. Maps 1:1 onto [`crate::writer::TextAlign`] /
|
|
6
|
+
* [`crate::writer::CellAlign`]. Exported to JS as `Align` via `js_name`.
|
|
7
|
+
* @enum {0 | 1 | 2}
|
|
8
|
+
*/
|
|
9
|
+
const Align = Object.freeze({
|
|
10
|
+
/**
|
|
11
|
+
* Align to the left edge.
|
|
12
|
+
*/
|
|
13
|
+
Left: 0, "0": "Left",
|
|
14
|
+
/**
|
|
15
|
+
* Center horizontally.
|
|
16
|
+
*/
|
|
17
|
+
Center: 1, "1": "Center",
|
|
18
|
+
/**
|
|
19
|
+
* Align to the right edge.
|
|
20
|
+
*/
|
|
21
|
+
Right: 2, "2": "Right",
|
|
22
|
+
});
|
|
23
|
+
exports.Align = Align;
|
|
24
|
+
|
|
3
25
|
/**
|
|
4
26
|
* Style configuration for header/footer text.
|
|
5
27
|
*/
|
|
@@ -68,6 +90,105 @@ class ArtifactStyle {
|
|
|
68
90
|
if (Symbol.dispose) ArtifactStyle.prototype[Symbol.dispose] = ArtifactStyle.prototype.free;
|
|
69
91
|
exports.ArtifactStyle = ArtifactStyle;
|
|
70
92
|
|
|
93
|
+
/**
|
|
94
|
+
* WASM handle to a streaming-table building session. Created by
|
|
95
|
+
* `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
|
|
96
|
+
* and the session is sealed with `finish()`.
|
|
97
|
+
*
|
|
98
|
+
* Single-use: `finish()` twice throws, and `pushRow` after `finish()`
|
|
99
|
+
* throws. The rows are buffered and replayed against the real Rust
|
|
100
|
+
* `StreamingTable` at `WasmFluentPageBuilder.done()` commit time —
|
|
101
|
+
* preserving the FluentPageBuilder borrow-lifetime invariant that can't
|
|
102
|
+
* cross the wasm-bindgen boundary.
|
|
103
|
+
*/
|
|
104
|
+
class StreamingTable {
|
|
105
|
+
static __wrap(ptr) {
|
|
106
|
+
ptr = ptr >>> 0;
|
|
107
|
+
const obj = Object.create(StreamingTable.prototype);
|
|
108
|
+
obj.__wbg_ptr = ptr;
|
|
109
|
+
StreamingTableFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
110
|
+
return obj;
|
|
111
|
+
}
|
|
112
|
+
__destroy_into_raw() {
|
|
113
|
+
const ptr = this.__wbg_ptr;
|
|
114
|
+
this.__wbg_ptr = 0;
|
|
115
|
+
StreamingTableFinalization.unregister(this);
|
|
116
|
+
return ptr;
|
|
117
|
+
}
|
|
118
|
+
free() {
|
|
119
|
+
const ptr = this.__destroy_into_raw();
|
|
120
|
+
wasm.__wbg_streamingtable_free(ptr, 0);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Number of columns configured on this streaming table.
|
|
124
|
+
* @returns {number}
|
|
125
|
+
*/
|
|
126
|
+
columnCount() {
|
|
127
|
+
const ret = wasm.streamingtable_columnCount(this.__wbg_ptr);
|
|
128
|
+
return ret >>> 0;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Seal the streaming table — the buffered rows are flushed onto the
|
|
132
|
+
* parent page's op queue, to be replayed against the real Rust
|
|
133
|
+
* `StreamingTable` at `done()` commit time. Calling `finish()` twice
|
|
134
|
+
* throws.
|
|
135
|
+
*/
|
|
136
|
+
finish() {
|
|
137
|
+
try {
|
|
138
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
139
|
+
wasm.streamingtable_finish(retptr, this.__wbg_ptr);
|
|
140
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
141
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
142
|
+
if (r1) {
|
|
143
|
+
throw takeObject(r0);
|
|
144
|
+
}
|
|
145
|
+
} finally {
|
|
146
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Push one row as an array of cell strings (all rowspan=1). Returns an
|
|
151
|
+
* error if the table has already been finished or if the row's cell count
|
|
152
|
+
* does not match the column count.
|
|
153
|
+
* @param {string[]} cells
|
|
154
|
+
*/
|
|
155
|
+
pushRow(cells) {
|
|
156
|
+
try {
|
|
157
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
158
|
+
const ptr0 = passArrayJsValueToWasm0(cells, wasm.__wbindgen_export);
|
|
159
|
+
const len0 = WASM_VECTOR_LEN;
|
|
160
|
+
wasm.streamingtable_pushRow(retptr, this.__wbg_ptr, ptr0, len0);
|
|
161
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
162
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
163
|
+
if (r1) {
|
|
164
|
+
throw takeObject(r0);
|
|
165
|
+
}
|
|
166
|
+
} finally {
|
|
167
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Push one row with per-cell rowspan values. `cells` is a JS array of
|
|
172
|
+
* `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
|
|
173
|
+
* @param {any} cells
|
|
174
|
+
*/
|
|
175
|
+
pushRowSpan(cells) {
|
|
176
|
+
try {
|
|
177
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
178
|
+
wasm.streamingtable_pushRowSpan(retptr, this.__wbg_ptr, addHeapObject(cells));
|
|
179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
|
+
if (r1) {
|
|
182
|
+
throw takeObject(r0);
|
|
183
|
+
}
|
|
184
|
+
} finally {
|
|
185
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (Symbol.dispose) StreamingTable.prototype[Symbol.dispose] = StreamingTable.prototype.free;
|
|
190
|
+
exports.StreamingTable = StreamingTable;
|
|
191
|
+
|
|
71
192
|
/**
|
|
72
193
|
* A header or footer artifact definition.
|
|
73
194
|
*/
|
|
@@ -250,6 +371,59 @@ class WasmCertificate {
|
|
|
250
371
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
251
372
|
}
|
|
252
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Load a signer certificate + private key from PEM strings.
|
|
376
|
+
* `certPem` must begin `-----BEGIN CERTIFICATE-----`.
|
|
377
|
+
* `keyPem` must begin `-----BEGIN PRIVATE KEY-----` or `-----BEGIN RSA PRIVATE KEY-----`.
|
|
378
|
+
* @param {string} cert_pem
|
|
379
|
+
* @param {string} key_pem
|
|
380
|
+
* @returns {WasmCertificate}
|
|
381
|
+
*/
|
|
382
|
+
static loadPem(cert_pem, key_pem) {
|
|
383
|
+
try {
|
|
384
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
|
+
const ptr0 = passStringToWasm0(cert_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
386
|
+
const len0 = WASM_VECTOR_LEN;
|
|
387
|
+
const ptr1 = passStringToWasm0(key_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
388
|
+
const len1 = WASM_VECTOR_LEN;
|
|
389
|
+
wasm.wasmcertificate_loadPem(retptr, ptr0, len0, ptr1, len1);
|
|
390
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
391
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
392
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
393
|
+
if (r2) {
|
|
394
|
+
throw takeObject(r1);
|
|
395
|
+
}
|
|
396
|
+
return WasmCertificate.__wrap(r0);
|
|
397
|
+
} finally {
|
|
398
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Load a signer certificate + private key from a PKCS#12 (.p12/.pfx) blob.
|
|
403
|
+
* `password` is the passphrase protecting the key bag.
|
|
404
|
+
* @param {Uint8Array} data
|
|
405
|
+
* @param {string} password
|
|
406
|
+
* @returns {WasmCertificate}
|
|
407
|
+
*/
|
|
408
|
+
static loadPkcs12(data, password) {
|
|
409
|
+
try {
|
|
410
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
411
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
413
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
414
|
+
const len1 = WASM_VECTOR_LEN;
|
|
415
|
+
wasm.wasmcertificate_loadPkcs12(retptr, ptr0, len0, ptr1, len1);
|
|
416
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
417
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
418
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
419
|
+
if (r2) {
|
|
420
|
+
throw takeObject(r1);
|
|
421
|
+
}
|
|
422
|
+
return WasmCertificate.__wrap(r0);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
253
427
|
/**
|
|
254
428
|
* Serial number as a hex string (no `0x` prefix).
|
|
255
429
|
* @returns {string}
|
|
@@ -479,6 +653,27 @@ class WasmDocumentBuilder {
|
|
|
479
653
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
480
654
|
}
|
|
481
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Set the document's natural language tag (e.g. `"en-US"`).
|
|
658
|
+
*
|
|
659
|
+
* Emitted as `/Lang` in the catalog when `taggedPdfUa1()` is set.
|
|
660
|
+
* @param {string} lang
|
|
661
|
+
*/
|
|
662
|
+
language(lang) {
|
|
663
|
+
try {
|
|
664
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
665
|
+
const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
666
|
+
const len0 = WASM_VECTOR_LEN;
|
|
667
|
+
wasm.wasmdocumentbuilder_language(retptr, this.__wbg_ptr, ptr0, len0);
|
|
668
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
669
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
670
|
+
if (r1) {
|
|
671
|
+
throw takeObject(r0);
|
|
672
|
+
}
|
|
673
|
+
} finally {
|
|
674
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
482
677
|
/**
|
|
483
678
|
* Start a new US Letter page.
|
|
484
679
|
* @returns {WasmFluentPageBuilder}
|
|
@@ -509,6 +704,25 @@ class WasmDocumentBuilder {
|
|
|
509
704
|
WasmDocumentBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
510
705
|
return this;
|
|
511
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Run a JavaScript script when the document is opened (`/OpenAction`).
|
|
709
|
+
* @param {string} script
|
|
710
|
+
*/
|
|
711
|
+
onOpen(script) {
|
|
712
|
+
try {
|
|
713
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
714
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
715
|
+
const len0 = WASM_VECTOR_LEN;
|
|
716
|
+
wasm.wasmdocumentbuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
717
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
718
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
719
|
+
if (r1) {
|
|
720
|
+
throw takeObject(r0);
|
|
721
|
+
}
|
|
722
|
+
} finally {
|
|
723
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
512
726
|
/**
|
|
513
727
|
* Start a new page with custom dimensions in PDF points
|
|
514
728
|
* (72 pt = 1 inch).
|
|
@@ -553,6 +767,31 @@ class WasmDocumentBuilder {
|
|
|
553
767
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
554
768
|
}
|
|
555
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* Add a role-map entry: custom structure type → standard PDF structure type.
|
|
772
|
+
*
|
|
773
|
+
* Emitted in `/RoleMap` inside the StructTreeRoot when `taggedPdfUa1()`
|
|
774
|
+
* is set. Multiple calls accumulate entries.
|
|
775
|
+
* @param {string} custom
|
|
776
|
+
* @param {string} standard
|
|
777
|
+
*/
|
|
778
|
+
roleMap(custom, standard) {
|
|
779
|
+
try {
|
|
780
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
781
|
+
const ptr0 = passStringToWasm0(custom, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
782
|
+
const len0 = WASM_VECTOR_LEN;
|
|
783
|
+
const ptr1 = passStringToWasm0(standard, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
784
|
+
const len1 = WASM_VECTOR_LEN;
|
|
785
|
+
wasm.wasmdocumentbuilder_roleMap(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
786
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
787
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
788
|
+
if (r1) {
|
|
789
|
+
throw takeObject(r0);
|
|
790
|
+
}
|
|
791
|
+
} finally {
|
|
792
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
556
795
|
/**
|
|
557
796
|
* Set document subject.
|
|
558
797
|
* @param {string} subject
|
|
@@ -572,6 +811,25 @@ class WasmDocumentBuilder {
|
|
|
572
811
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
573
812
|
}
|
|
574
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* Enable PDF/UA-1 tagged PDF mode.
|
|
816
|
+
*
|
|
817
|
+
* When enabled, `build()` emits `/MarkInfo`, `/StructTreeRoot`, `/Lang`,
|
|
818
|
+
* and `/ViewerPreferences` in the catalog. Opt-in — no effect unless called.
|
|
819
|
+
*/
|
|
820
|
+
taggedPdfUa1() {
|
|
821
|
+
try {
|
|
822
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
823
|
+
wasm.wasmdocumentbuilder_taggedPdfUa1(retptr, this.__wbg_ptr);
|
|
824
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
825
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
826
|
+
if (r1) {
|
|
827
|
+
throw takeObject(r0);
|
|
828
|
+
}
|
|
829
|
+
} finally {
|
|
830
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
575
833
|
/**
|
|
576
834
|
* Set document title.
|
|
577
835
|
* @param {string} title
|
|
@@ -738,6 +996,54 @@ class WasmFluentPageBuilder {
|
|
|
738
996
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
739
997
|
}
|
|
740
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* Place a 1-D barcode image at `(x, y, w, h)` on the page.
|
|
1001
|
+
* `barcodeType`: 0=Code128 1=Code39 2=EAN13 3=EAN8 4=UPCA 5=ITF
|
|
1002
|
+
* 6=Code93 7=Codabar.
|
|
1003
|
+
* @param {number} barcode_type
|
|
1004
|
+
* @param {string} data
|
|
1005
|
+
* @param {number} x
|
|
1006
|
+
* @param {number} y
|
|
1007
|
+
* @param {number} w
|
|
1008
|
+
* @param {number} h
|
|
1009
|
+
*/
|
|
1010
|
+
barcode1d(barcode_type, data, x, y, w, h) {
|
|
1011
|
+
try {
|
|
1012
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1013
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1014
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1015
|
+
wasm.wasmfluentpagebuilder_barcode1d(retptr, this.__wbg_ptr, barcode_type, ptr0, len0, x, y, w, h);
|
|
1016
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1017
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1018
|
+
if (r1) {
|
|
1019
|
+
throw takeObject(r0);
|
|
1020
|
+
}
|
|
1021
|
+
} finally {
|
|
1022
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Place a QR-code image at `(x, y, size, size)` on the page.
|
|
1027
|
+
* @param {string} data
|
|
1028
|
+
* @param {number} x
|
|
1029
|
+
* @param {number} y
|
|
1030
|
+
* @param {number} size
|
|
1031
|
+
*/
|
|
1032
|
+
barcodeQr(data, x, y, size) {
|
|
1033
|
+
try {
|
|
1034
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1035
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1036
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1037
|
+
wasm.wasmfluentpagebuilder_barcodeQr(retptr, this.__wbg_ptr, ptr0, len0, x, y, size);
|
|
1038
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1039
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1040
|
+
if (r1) {
|
|
1041
|
+
throw takeObject(r0);
|
|
1042
|
+
}
|
|
1043
|
+
} finally {
|
|
1044
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
741
1047
|
/**
|
|
742
1048
|
* @param {string} name
|
|
743
1049
|
* @param {number} x
|
|
@@ -761,6 +1067,28 @@ class WasmFluentPageBuilder {
|
|
|
761
1067
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
762
1068
|
}
|
|
763
1069
|
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Lay out `text` as balanced multi-column flow (`columnCount` columns,
|
|
1072
|
+
* `gapPt` points between columns). Paragraphs in `text` are separated by `"\n\n"`.
|
|
1073
|
+
* @param {number} column_count
|
|
1074
|
+
* @param {number} gap_pt
|
|
1075
|
+
* @param {string} text
|
|
1076
|
+
*/
|
|
1077
|
+
columns(column_count, gap_pt, text) {
|
|
1078
|
+
try {
|
|
1079
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1080
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1081
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1082
|
+
wasm.wasmfluentpagebuilder_columns(retptr, this.__wbg_ptr, column_count, gap_pt, ptr0, len0);
|
|
1083
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1084
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1085
|
+
if (r1) {
|
|
1086
|
+
throw takeObject(r0);
|
|
1087
|
+
}
|
|
1088
|
+
} finally {
|
|
1089
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
764
1092
|
/**
|
|
765
1093
|
* Add a dropdown combo-box.
|
|
766
1094
|
* @param {string} name
|
|
@@ -816,6 +1144,78 @@ class WasmFluentPageBuilder {
|
|
|
816
1144
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
817
1145
|
}
|
|
818
1146
|
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @param {string} script
|
|
1149
|
+
*/
|
|
1150
|
+
fieldCalculate(script) {
|
|
1151
|
+
try {
|
|
1152
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1153
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1154
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1155
|
+
wasm.wasmfluentpagebuilder_fieldCalculate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1156
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1157
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1158
|
+
if (r1) {
|
|
1159
|
+
throw takeObject(r0);
|
|
1160
|
+
}
|
|
1161
|
+
} finally {
|
|
1162
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* @param {string} script
|
|
1167
|
+
*/
|
|
1168
|
+
fieldFormat(script) {
|
|
1169
|
+
try {
|
|
1170
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1171
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1173
|
+
wasm.wasmfluentpagebuilder_fieldFormat(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1174
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1175
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1176
|
+
if (r1) {
|
|
1177
|
+
throw takeObject(r0);
|
|
1178
|
+
}
|
|
1179
|
+
} finally {
|
|
1180
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @param {string} script
|
|
1185
|
+
*/
|
|
1186
|
+
fieldKeystroke(script) {
|
|
1187
|
+
try {
|
|
1188
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1189
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1190
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1191
|
+
wasm.wasmfluentpagebuilder_fieldKeystroke(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1192
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1193
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1194
|
+
if (r1) {
|
|
1195
|
+
throw takeObject(r0);
|
|
1196
|
+
}
|
|
1197
|
+
} finally {
|
|
1198
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* @param {string} script
|
|
1203
|
+
*/
|
|
1204
|
+
fieldValidate(script) {
|
|
1205
|
+
try {
|
|
1206
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1207
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1209
|
+
wasm.wasmfluentpagebuilder_fieldValidate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1210
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1211
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1212
|
+
if (r1) {
|
|
1213
|
+
throw takeObject(r0);
|
|
1214
|
+
}
|
|
1215
|
+
} finally {
|
|
1216
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
819
1219
|
/**
|
|
820
1220
|
* Draw a filled rectangle. RGB channels in 0.0-1.0.
|
|
821
1221
|
* @param {number} x
|
|
@@ -843,12 +1243,255 @@ class WasmFluentPageBuilder {
|
|
|
843
1243
|
* @param {string} name
|
|
844
1244
|
* @param {number} size
|
|
845
1245
|
*/
|
|
846
|
-
font(name, size) {
|
|
1246
|
+
font(name, size) {
|
|
1247
|
+
try {
|
|
1248
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1249
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1251
|
+
wasm.wasmfluentpagebuilder_font(retptr, this.__wbg_ptr, ptr0, len0, size);
|
|
1252
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1253
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1254
|
+
if (r1) {
|
|
1255
|
+
throw takeObject(r0);
|
|
1256
|
+
}
|
|
1257
|
+
} finally {
|
|
1258
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Add a footnote: inline `refMark` at the cursor and `noteText` body
|
|
1263
|
+
* near the page bottom with a separator artifact line.
|
|
1264
|
+
* @param {string} ref_mark
|
|
1265
|
+
* @param {string} note_text
|
|
1266
|
+
*/
|
|
1267
|
+
footnote(ref_mark, note_text) {
|
|
1268
|
+
try {
|
|
1269
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1270
|
+
const ptr0 = passStringToWasm0(ref_mark, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1271
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1272
|
+
const ptr1 = passStringToWasm0(note_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1273
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1274
|
+
wasm.wasmfluentpagebuilder_footnote(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1275
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1276
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1277
|
+
if (r1) {
|
|
1278
|
+
throw takeObject(r0);
|
|
1279
|
+
}
|
|
1280
|
+
} finally {
|
|
1281
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @param {number} x
|
|
1286
|
+
* @param {number} y
|
|
1287
|
+
* @param {number} w
|
|
1288
|
+
* @param {number} h
|
|
1289
|
+
* @param {string} text
|
|
1290
|
+
*/
|
|
1291
|
+
freeText(x, y, w, h, text) {
|
|
1292
|
+
try {
|
|
1293
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1294
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1296
|
+
wasm.wasmfluentpagebuilder_freeText(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0);
|
|
1297
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1298
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1299
|
+
if (r1) {
|
|
1300
|
+
throw takeObject(r0);
|
|
1301
|
+
}
|
|
1302
|
+
} finally {
|
|
1303
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* @param {number} level
|
|
1308
|
+
* @param {string} text
|
|
1309
|
+
*/
|
|
1310
|
+
heading(level, text) {
|
|
1311
|
+
try {
|
|
1312
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1313
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1314
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1315
|
+
wasm.wasmfluentpagebuilder_heading(retptr, this.__wbg_ptr, level, ptr0, len0);
|
|
1316
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1317
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1318
|
+
if (r1) {
|
|
1319
|
+
throw takeObject(r0);
|
|
1320
|
+
}
|
|
1321
|
+
} finally {
|
|
1322
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* @param {number} r
|
|
1327
|
+
* @param {number} g
|
|
1328
|
+
* @param {number} b
|
|
1329
|
+
*/
|
|
1330
|
+
highlight(r, g, b) {
|
|
1331
|
+
try {
|
|
1332
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1333
|
+
wasm.wasmfluentpagebuilder_highlight(retptr, this.__wbg_ptr, r, g, b);
|
|
1334
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1335
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1336
|
+
if (r1) {
|
|
1337
|
+
throw takeObject(r0);
|
|
1338
|
+
}
|
|
1339
|
+
} finally {
|
|
1340
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
horizontalRule() {
|
|
1344
|
+
try {
|
|
1345
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1346
|
+
wasm.wasmfluentpagebuilder_horizontalRule(retptr, this.__wbg_ptr);
|
|
1347
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1348
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1349
|
+
if (r1) {
|
|
1350
|
+
throw takeObject(r0);
|
|
1351
|
+
}
|
|
1352
|
+
} finally {
|
|
1353
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Embed a decorative image (JPEG/PNG/WebP bytes) as an /Artifact (no alt text).
|
|
1358
|
+
* @param {Uint8Array} bytes
|
|
1359
|
+
* @param {number} x
|
|
1360
|
+
* @param {number} y
|
|
1361
|
+
* @param {number} w
|
|
1362
|
+
* @param {number} h
|
|
1363
|
+
*/
|
|
1364
|
+
imageArtifact(bytes, x, y, w, h) {
|
|
1365
|
+
try {
|
|
1366
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1367
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1368
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1369
|
+
wasm.wasmfluentpagebuilder_imageArtifact(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1370
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1371
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1372
|
+
if (r1) {
|
|
1373
|
+
throw takeObject(r0);
|
|
1374
|
+
}
|
|
1375
|
+
} finally {
|
|
1376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Embed an image (JPEG/PNG/WebP bytes) with an accessibility alt text.
|
|
1381
|
+
* @param {Uint8Array} bytes
|
|
1382
|
+
* @param {number} x
|
|
1383
|
+
* @param {number} y
|
|
1384
|
+
* @param {number} w
|
|
1385
|
+
* @param {number} h
|
|
1386
|
+
* @param {string} alt_text
|
|
1387
|
+
*/
|
|
1388
|
+
imageWithAlt(bytes, x, y, w, h, alt_text) {
|
|
1389
|
+
try {
|
|
1390
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1391
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1393
|
+
const ptr1 = passStringToWasm0(alt_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1395
|
+
wasm.wasmfluentpagebuilder_imageWithAlt(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1);
|
|
1396
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1397
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1398
|
+
if (r1) {
|
|
1399
|
+
throw takeObject(r0);
|
|
1400
|
+
}
|
|
1401
|
+
} finally {
|
|
1402
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Emit `text` inline (advances cursorX only, not cursorY).
|
|
1407
|
+
* @param {string} text
|
|
1408
|
+
*/
|
|
1409
|
+
inline(text) {
|
|
1410
|
+
try {
|
|
1411
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1412
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1413
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1414
|
+
wasm.wasmfluentpagebuilder_inline(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1415
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1416
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1417
|
+
if (r1) {
|
|
1418
|
+
throw takeObject(r0);
|
|
1419
|
+
}
|
|
1420
|
+
} finally {
|
|
1421
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Inline bold run.
|
|
1426
|
+
* @param {string} text
|
|
1427
|
+
*/
|
|
1428
|
+
inlineBold(text) {
|
|
1429
|
+
try {
|
|
1430
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1431
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1433
|
+
wasm.wasmfluentpagebuilder_inlineBold(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1434
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1435
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1436
|
+
if (r1) {
|
|
1437
|
+
throw takeObject(r0);
|
|
1438
|
+
}
|
|
1439
|
+
} finally {
|
|
1440
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Inline colored run (RGB 0.0–1.0).
|
|
1445
|
+
* @param {number} r
|
|
1446
|
+
* @param {number} g
|
|
1447
|
+
* @param {number} b
|
|
1448
|
+
* @param {string} text
|
|
1449
|
+
*/
|
|
1450
|
+
inlineColor(r, g, b, text) {
|
|
1451
|
+
try {
|
|
1452
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1453
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1454
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1455
|
+
wasm.wasmfluentpagebuilder_inlineColor(retptr, this.__wbg_ptr, r, g, b, ptr0, len0);
|
|
1456
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1457
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1458
|
+
if (r1) {
|
|
1459
|
+
throw takeObject(r0);
|
|
1460
|
+
}
|
|
1461
|
+
} finally {
|
|
1462
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Inline italic run.
|
|
1467
|
+
* @param {string} text
|
|
1468
|
+
*/
|
|
1469
|
+
inlineItalic(text) {
|
|
1470
|
+
try {
|
|
1471
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1472
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1474
|
+
wasm.wasmfluentpagebuilder_inlineItalic(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1475
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1476
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1477
|
+
if (r1) {
|
|
1478
|
+
throw takeObject(r0);
|
|
1479
|
+
}
|
|
1480
|
+
} finally {
|
|
1481
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Draw a line from (x1, y1) to (x2, y2) with 1pt black stroke.
|
|
1486
|
+
* @param {number} x1
|
|
1487
|
+
* @param {number} y1
|
|
1488
|
+
* @param {number} x2
|
|
1489
|
+
* @param {number} y2
|
|
1490
|
+
*/
|
|
1491
|
+
line(x1, y1, x2, y2) {
|
|
847
1492
|
try {
|
|
848
1493
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
849
|
-
|
|
850
|
-
const len0 = WASM_VECTOR_LEN;
|
|
851
|
-
wasm.wasmfluentpagebuilder_font(retptr, this.__wbg_ptr, ptr0, len0, size);
|
|
1494
|
+
wasm.wasmfluentpagebuilder_line(retptr, this.__wbg_ptr, x1, y1, x2, y2);
|
|
852
1495
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
853
1496
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
854
1497
|
if (r1) {
|
|
@@ -859,18 +1502,14 @@ class WasmFluentPageBuilder {
|
|
|
859
1502
|
}
|
|
860
1503
|
}
|
|
861
1504
|
/**
|
|
862
|
-
* @param {
|
|
863
|
-
* @param {number} y
|
|
864
|
-
* @param {number} w
|
|
865
|
-
* @param {number} h
|
|
866
|
-
* @param {string} text
|
|
1505
|
+
* @param {string} script
|
|
867
1506
|
*/
|
|
868
|
-
|
|
1507
|
+
linkJavascript(script) {
|
|
869
1508
|
try {
|
|
870
1509
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
871
|
-
const ptr0 = passStringToWasm0(
|
|
1510
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
872
1511
|
const len0 = WASM_VECTOR_LEN;
|
|
873
|
-
wasm.
|
|
1512
|
+
wasm.wasmfluentpagebuilder_linkJavascript(retptr, this.__wbg_ptr, ptr0, len0);
|
|
874
1513
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
875
1514
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
876
1515
|
if (r1) {
|
|
@@ -881,15 +1520,14 @@ class WasmFluentPageBuilder {
|
|
|
881
1520
|
}
|
|
882
1521
|
}
|
|
883
1522
|
/**
|
|
884
|
-
* @param {
|
|
885
|
-
* @param {string} text
|
|
1523
|
+
* @param {string} destination
|
|
886
1524
|
*/
|
|
887
|
-
|
|
1525
|
+
linkNamed(destination) {
|
|
888
1526
|
try {
|
|
889
1527
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
890
|
-
const ptr0 = passStringToWasm0(
|
|
1528
|
+
const ptr0 = passStringToWasm0(destination, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
891
1529
|
const len0 = WASM_VECTOR_LEN;
|
|
892
|
-
wasm.
|
|
1530
|
+
wasm.wasmfluentpagebuilder_linkNamed(retptr, this.__wbg_ptr, ptr0, len0);
|
|
893
1531
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
894
1532
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
895
1533
|
if (r1) {
|
|
@@ -900,14 +1538,12 @@ class WasmFluentPageBuilder {
|
|
|
900
1538
|
}
|
|
901
1539
|
}
|
|
902
1540
|
/**
|
|
903
|
-
* @param {number}
|
|
904
|
-
* @param {number} g
|
|
905
|
-
* @param {number} b
|
|
1541
|
+
* @param {number} page
|
|
906
1542
|
*/
|
|
907
|
-
|
|
1543
|
+
linkPage(page) {
|
|
908
1544
|
try {
|
|
909
1545
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
910
|
-
wasm.
|
|
1546
|
+
wasm.wasmfluentpagebuilder_linkPage(retptr, this.__wbg_ptr, page);
|
|
911
1547
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
912
1548
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
913
1549
|
if (r1) {
|
|
@@ -917,10 +1553,15 @@ class WasmFluentPageBuilder {
|
|
|
917
1553
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
918
1554
|
}
|
|
919
1555
|
}
|
|
920
|
-
|
|
1556
|
+
/**
|
|
1557
|
+
* @param {string} url
|
|
1558
|
+
*/
|
|
1559
|
+
linkUrl(url) {
|
|
921
1560
|
try {
|
|
922
1561
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
923
|
-
wasm.
|
|
1562
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1563
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1564
|
+
wasm.wasmfluentpagebuilder_linkUrl(retptr, this.__wbg_ptr, ptr0, len0);
|
|
924
1565
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
925
1566
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
926
1567
|
if (r1) {
|
|
@@ -931,16 +1572,30 @@ class WasmFluentPageBuilder {
|
|
|
931
1572
|
}
|
|
932
1573
|
}
|
|
933
1574
|
/**
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
1575
|
+
* Measure the rendered width of `text` in the builder's current font
|
|
1576
|
+
* and size, in PDF points. Pure query — does not mutate state.
|
|
1577
|
+
*
|
|
1578
|
+
* Thin JS view over [`crate::writer::FluentPageBuilder::measure`]. The
|
|
1579
|
+
* WASM class tracks the current font/size independently of the
|
|
1580
|
+
* buffered ops so this query is served without a live builder.
|
|
1581
|
+
* @param {string} text
|
|
1582
|
+
* @returns {number}
|
|
939
1583
|
*/
|
|
940
|
-
|
|
1584
|
+
measure(text) {
|
|
1585
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1587
|
+
const ret = wasm.wasmfluentpagebuilder_measure(this.__wbg_ptr, ptr0, len0);
|
|
1588
|
+
return ret;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Finish the current page and start a new one with the same page
|
|
1592
|
+
* size. Cursor resets to the top-left margin (72, height-72). The
|
|
1593
|
+
* builder's font carries over.
|
|
1594
|
+
*/
|
|
1595
|
+
newPageSameSize() {
|
|
941
1596
|
try {
|
|
942
1597
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
943
|
-
wasm.
|
|
1598
|
+
wasm.wasmfluentpagebuilder_newPageSameSize(retptr, this.__wbg_ptr);
|
|
944
1599
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
945
1600
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
946
1601
|
if (r1) {
|
|
@@ -951,14 +1606,12 @@ class WasmFluentPageBuilder {
|
|
|
951
1606
|
}
|
|
952
1607
|
}
|
|
953
1608
|
/**
|
|
954
|
-
*
|
|
1609
|
+
* Advance cursorY by one line-height and reset cursorX to 72 pt.
|
|
955
1610
|
*/
|
|
956
|
-
|
|
1611
|
+
newline() {
|
|
957
1612
|
try {
|
|
958
1613
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
959
|
-
|
|
960
|
-
const len0 = WASM_VECTOR_LEN;
|
|
961
|
-
wasm.wasmfluentpagebuilder_linkNamed(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1614
|
+
wasm.wasmfluentpagebuilder_newline(retptr, this.__wbg_ptr);
|
|
962
1615
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
963
1616
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
964
1617
|
if (r1) {
|
|
@@ -969,12 +1622,14 @@ class WasmFluentPageBuilder {
|
|
|
969
1622
|
}
|
|
970
1623
|
}
|
|
971
1624
|
/**
|
|
972
|
-
* @param {
|
|
1625
|
+
* @param {string} script
|
|
973
1626
|
*/
|
|
974
|
-
|
|
1627
|
+
onClose(script) {
|
|
975
1628
|
try {
|
|
976
1629
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
977
|
-
|
|
1630
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1632
|
+
wasm.wasmfluentpagebuilder_onClose(retptr, this.__wbg_ptr, ptr0, len0);
|
|
978
1633
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
979
1634
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
980
1635
|
if (r1) {
|
|
@@ -985,14 +1640,14 @@ class WasmFluentPageBuilder {
|
|
|
985
1640
|
}
|
|
986
1641
|
}
|
|
987
1642
|
/**
|
|
988
|
-
* @param {string}
|
|
1643
|
+
* @param {string} script
|
|
989
1644
|
*/
|
|
990
|
-
|
|
1645
|
+
onOpen(script) {
|
|
991
1646
|
try {
|
|
992
1647
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
993
|
-
const ptr0 = passStringToWasm0(
|
|
1648
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
994
1649
|
const len0 = WASM_VECTOR_LEN;
|
|
995
|
-
wasm.
|
|
1650
|
+
wasm.wasmfluentpagebuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
996
1651
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
997
1652
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
998
1653
|
if (r1) {
|
|
@@ -1105,6 +1760,41 @@ class WasmFluentPageBuilder {
|
|
|
1105
1760
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1106
1761
|
}
|
|
1107
1762
|
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Points remaining on the current page below the cursor (down to the
|
|
1765
|
+
* 72 pt bottom margin). Mirrors
|
|
1766
|
+
* [`crate::writer::FluentPageBuilder::remaining_space`] using the WASM
|
|
1767
|
+
* class's independently-tracked cursor — accurate after `at`, `text`,
|
|
1768
|
+
* `space`, `newPageSameSize`, `textInRect` and the table helpers.
|
|
1769
|
+
* @returns {number}
|
|
1770
|
+
*/
|
|
1771
|
+
remainingSpace() {
|
|
1772
|
+
const ret = wasm.wasmfluentpagebuilder_remainingSpace(this.__wbg_ptr);
|
|
1773
|
+
return ret;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Add an unsigned signature placeholder field at the given bounds.
|
|
1777
|
+
* @param {string} name
|
|
1778
|
+
* @param {number} x
|
|
1779
|
+
* @param {number} y
|
|
1780
|
+
* @param {number} w
|
|
1781
|
+
* @param {number} h
|
|
1782
|
+
*/
|
|
1783
|
+
signatureField(name, x, y, w, h) {
|
|
1784
|
+
try {
|
|
1785
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1786
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1787
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1788
|
+
wasm.wasmfluentpagebuilder_signatureField(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1789
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1790
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1791
|
+
if (r1) {
|
|
1792
|
+
throw takeObject(r0);
|
|
1793
|
+
}
|
|
1794
|
+
} finally {
|
|
1795
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1108
1798
|
/**
|
|
1109
1799
|
* @param {number} points
|
|
1110
1800
|
*/
|
|
@@ -1195,6 +1885,31 @@ class WasmFluentPageBuilder {
|
|
|
1195
1885
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1196
1886
|
}
|
|
1197
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Open a streaming table. Returns a `StreamingTable` handle the caller
|
|
1890
|
+
* pushes rows into; call `finish()` when done. The streamed rows are
|
|
1891
|
+
* buffered per-table and replayed against the real Rust
|
|
1892
|
+
* `StreamingTable` at `done()` commit time — avoiding the
|
|
1893
|
+
* FluentPageBuilder-lifetime problem that otherwise can't cross the
|
|
1894
|
+
* wasm-bindgen boundary.
|
|
1895
|
+
* @param {any} spec
|
|
1896
|
+
* @returns {StreamingTable}
|
|
1897
|
+
*/
|
|
1898
|
+
streamingTable(spec) {
|
|
1899
|
+
try {
|
|
1900
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1901
|
+
wasm.wasmfluentpagebuilder_streamingTable(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
1902
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1903
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1904
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1905
|
+
if (r2) {
|
|
1906
|
+
throw takeObject(r1);
|
|
1907
|
+
}
|
|
1908
|
+
return StreamingTable.__wrap(r0);
|
|
1909
|
+
} finally {
|
|
1910
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1198
1913
|
/**
|
|
1199
1914
|
* @param {number} r
|
|
1200
1915
|
* @param {number} g
|
|
@@ -1213,6 +1928,85 @@ class WasmFluentPageBuilder {
|
|
|
1213
1928
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1214
1929
|
}
|
|
1215
1930
|
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Draw a straight line with explicit stroke width and RGB colour.
|
|
1933
|
+
* @param {number} x1
|
|
1934
|
+
* @param {number} y1
|
|
1935
|
+
* @param {number} x2
|
|
1936
|
+
* @param {number} y2
|
|
1937
|
+
* @param {number} width
|
|
1938
|
+
* @param {number} r
|
|
1939
|
+
* @param {number} g
|
|
1940
|
+
* @param {number} b
|
|
1941
|
+
*/
|
|
1942
|
+
strokeLine(x1, y1, x2, y2, width, r, g, b) {
|
|
1943
|
+
try {
|
|
1944
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1945
|
+
wasm.wasmfluentpagebuilder_strokeLine(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b);
|
|
1946
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1947
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1948
|
+
if (r1) {
|
|
1949
|
+
throw takeObject(r0);
|
|
1950
|
+
}
|
|
1951
|
+
} finally {
|
|
1952
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Draw a stroked rectangle with explicit stroke width and RGB colour.
|
|
1957
|
+
* @param {number} x
|
|
1958
|
+
* @param {number} y
|
|
1959
|
+
* @param {number} w
|
|
1960
|
+
* @param {number} h
|
|
1961
|
+
* @param {number} width
|
|
1962
|
+
* @param {number} r
|
|
1963
|
+
* @param {number} g
|
|
1964
|
+
* @param {number} b
|
|
1965
|
+
*/
|
|
1966
|
+
strokeRect(x, y, w, h, width, r, g, b) {
|
|
1967
|
+
try {
|
|
1968
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1969
|
+
wasm.wasmfluentpagebuilder_strokeRect(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b);
|
|
1970
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1971
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1972
|
+
if (r1) {
|
|
1973
|
+
throw takeObject(r0);
|
|
1974
|
+
}
|
|
1975
|
+
} finally {
|
|
1976
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Render a buffered table from a JS object:
|
|
1981
|
+
*
|
|
1982
|
+
* ```javascript
|
|
1983
|
+
* page.table({
|
|
1984
|
+
* columns: [
|
|
1985
|
+
* { header: "SKU", width: 100, align: Align.Left },
|
|
1986
|
+
* { header: "Qty", width: 60, align: Align.Right },
|
|
1987
|
+
* ],
|
|
1988
|
+
* rows: [["A-1","12"], ["B-2","3"]],
|
|
1989
|
+
* hasHeader: true,
|
|
1990
|
+
* });
|
|
1991
|
+
* ```
|
|
1992
|
+
*
|
|
1993
|
+
* Uses `serde-wasm-bindgen` for deserialisation. Replays against the
|
|
1994
|
+
* Rust `Table` builder at `done()` commit time.
|
|
1995
|
+
* @param {any} spec
|
|
1996
|
+
*/
|
|
1997
|
+
table(spec) {
|
|
1998
|
+
try {
|
|
1999
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2000
|
+
wasm.wasmfluentpagebuilder_table(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
2001
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2002
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2003
|
+
if (r1) {
|
|
2004
|
+
throw takeObject(r0);
|
|
2005
|
+
}
|
|
2006
|
+
} finally {
|
|
2007
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
1216
2010
|
/**
|
|
1217
2011
|
* @param {string} text
|
|
1218
2012
|
*/
|
|
@@ -1256,6 +2050,32 @@ class WasmFluentPageBuilder {
|
|
|
1256
2050
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1257
2051
|
}
|
|
1258
2052
|
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Place wrapped text inside a rectangle with horizontal alignment.
|
|
2055
|
+
* `align` is the `Align` enum (0 = Left, 1 = Center, 2 = Right) — also
|
|
2056
|
+
* accepts a raw integer for JS callers that pre-date the enum import.
|
|
2057
|
+
* @param {number} x
|
|
2058
|
+
* @param {number} y
|
|
2059
|
+
* @param {number} w
|
|
2060
|
+
* @param {number} h
|
|
2061
|
+
* @param {string} text
|
|
2062
|
+
* @param {number} align
|
|
2063
|
+
*/
|
|
2064
|
+
textInRect(x, y, w, h, text, align) {
|
|
2065
|
+
try {
|
|
2066
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2067
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2068
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2069
|
+
wasm.wasmfluentpagebuilder_textInRect(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0, align);
|
|
2070
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2071
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2072
|
+
if (r1) {
|
|
2073
|
+
throw takeObject(r0);
|
|
2074
|
+
}
|
|
2075
|
+
} finally {
|
|
2076
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
1259
2079
|
/**
|
|
1260
2080
|
* @param {number} r
|
|
1261
2081
|
* @param {number} g
|
|
@@ -2735,6 +3555,28 @@ class WasmPdfDocument {
|
|
|
2735
3555
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2736
3556
|
}
|
|
2737
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Return warnings collected during the last form-flattening save.
|
|
3560
|
+
*
|
|
3561
|
+
* Each entry names a widget field that had no `/AP` appearance stream;
|
|
3562
|
+
* flattening such a field produces a blank rectangle.
|
|
3563
|
+
*
|
|
3564
|
+
* @returns Array of warning strings
|
|
3565
|
+
* @returns {string[]}
|
|
3566
|
+
*/
|
|
3567
|
+
flattenWarnings() {
|
|
3568
|
+
try {
|
|
3569
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3570
|
+
wasm.wasmpdfdocument_flattenWarnings(retptr, this.__wbg_ptr);
|
|
3571
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3572
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3573
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3574
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3575
|
+
return v1;
|
|
3576
|
+
} finally {
|
|
3577
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
2738
3580
|
/**
|
|
2739
3581
|
* Get annotations from a page.
|
|
2740
3582
|
*
|
|
@@ -3311,6 +4153,37 @@ class WasmPdfDocument {
|
|
|
3311
4153
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3312
4154
|
}
|
|
3313
4155
|
}
|
|
4156
|
+
/**
|
|
4157
|
+
* Save with options (compress, garbage_collect, linearize) and return bytes.
|
|
4158
|
+
*
|
|
4159
|
+
* @param {Object} [options] - Optional save options.
|
|
4160
|
+
* @param {boolean} [options.compress=true] - Compress raw streams with FlateDecode.
|
|
4161
|
+
* @param {boolean} [options.garbageCollect=true] - Remove unreachable objects.
|
|
4162
|
+
* @param {boolean} [options.linearize=false] - Linearize (reserved, no-op).
|
|
4163
|
+
* @returns Uint8Array containing the modified PDF
|
|
4164
|
+
* @param {boolean | null} [compress]
|
|
4165
|
+
* @param {boolean | null} [garbage_collect]
|
|
4166
|
+
* @param {boolean | null} [linearize]
|
|
4167
|
+
* @returns {Uint8Array}
|
|
4168
|
+
*/
|
|
4169
|
+
saveWithOptions(compress, garbage_collect, linearize) {
|
|
4170
|
+
try {
|
|
4171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4172
|
+
wasm.wasmpdfdocument_saveWithOptions(retptr, this.__wbg_ptr, isLikeNone(compress) ? 0xFFFFFF : compress ? 1 : 0, isLikeNone(garbage_collect) ? 0xFFFFFF : garbage_collect ? 1 : 0, isLikeNone(linearize) ? 0xFFFFFF : linearize ? 1 : 0);
|
|
4173
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4174
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4175
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4176
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4177
|
+
if (r3) {
|
|
4178
|
+
throw takeObject(r2);
|
|
4179
|
+
}
|
|
4180
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
4181
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
4182
|
+
return v1;
|
|
4183
|
+
} finally {
|
|
4184
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
3314
4187
|
/**
|
|
3315
4188
|
* Search for text across all pages.
|
|
3316
4189
|
*
|
|
@@ -4570,6 +5443,44 @@ function setLogLevel(level) {
|
|
|
4570
5443
|
}
|
|
4571
5444
|
}
|
|
4572
5445
|
exports.setLogLevel = setLogLevel;
|
|
5446
|
+
|
|
5447
|
+
/**
|
|
5448
|
+
* Sign raw PDF bytes and return the signed PDF as a `Uint8Array`.
|
|
5449
|
+
*
|
|
5450
|
+
* `cert` must carry a private key (loaded via `Certificate.loadPem` or
|
|
5451
|
+
* `Certificate.loadPkcs12`).
|
|
5452
|
+
* @param {Uint8Array} pdf_data
|
|
5453
|
+
* @param {WasmCertificate} cert
|
|
5454
|
+
* @param {string | null} [reason]
|
|
5455
|
+
* @param {string | null} [location]
|
|
5456
|
+
* @returns {Uint8Array}
|
|
5457
|
+
*/
|
|
5458
|
+
function signPdfBytes(pdf_data, cert, reason, location) {
|
|
5459
|
+
try {
|
|
5460
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5461
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
5462
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5463
|
+
_assertClass(cert, WasmCertificate);
|
|
5464
|
+
var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5465
|
+
var len1 = WASM_VECTOR_LEN;
|
|
5466
|
+
var ptr2 = isLikeNone(location) ? 0 : passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5467
|
+
var len2 = WASM_VECTOR_LEN;
|
|
5468
|
+
wasm.signPdfBytes(retptr, ptr0, len0, cert.__wbg_ptr, ptr1, len1, ptr2, len2);
|
|
5469
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5470
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5471
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
5472
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
5473
|
+
if (r3) {
|
|
5474
|
+
throw takeObject(r2);
|
|
5475
|
+
}
|
|
5476
|
+
var v4 = getArrayU8FromWasm0(r0, r1).slice();
|
|
5477
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
5478
|
+
return v4;
|
|
5479
|
+
} finally {
|
|
5480
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
exports.signPdfBytes = signPdfBytes;
|
|
4573
5484
|
function __wbg_get_imports() {
|
|
4574
5485
|
const import0 = {
|
|
4575
5486
|
__proto__: null,
|
|
@@ -4577,6 +5488,10 @@ function __wbg_get_imports() {
|
|
|
4577
5488
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4578
5489
|
return addHeapObject(ret);
|
|
4579
5490
|
},
|
|
5491
|
+
__wbg_Number_32bf70a599af1d4b: function(arg0) {
|
|
5492
|
+
const ret = Number(getObject(arg0));
|
|
5493
|
+
return ret;
|
|
5494
|
+
},
|
|
4580
5495
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
4581
5496
|
const ret = String(getObject(arg1));
|
|
4582
5497
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4584,6 +5499,12 @@ function __wbg_get_imports() {
|
|
|
4584
5499
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4585
5500
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4586
5501
|
},
|
|
5502
|
+
__wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
|
|
5503
|
+
const v = getObject(arg1);
|
|
5504
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
5505
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
5506
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
5507
|
+
},
|
|
4587
5508
|
__wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
|
|
4588
5509
|
const v = getObject(arg0);
|
|
4589
5510
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
@@ -4596,6 +5517,14 @@ function __wbg_get_imports() {
|
|
|
4596
5517
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4597
5518
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4598
5519
|
},
|
|
5520
|
+
__wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
|
|
5521
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
5522
|
+
return ret;
|
|
5523
|
+
},
|
|
5524
|
+
__wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
|
|
5525
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
5526
|
+
return ret;
|
|
5527
|
+
},
|
|
4599
5528
|
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
4600
5529
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
4601
5530
|
return ret;
|
|
@@ -4617,6 +5546,10 @@ function __wbg_get_imports() {
|
|
|
4617
5546
|
const ret = getObject(arg0) === undefined;
|
|
4618
5547
|
return ret;
|
|
4619
5548
|
},
|
|
5549
|
+
__wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
|
|
5550
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
5551
|
+
return ret;
|
|
5552
|
+
},
|
|
4620
5553
|
__wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
|
|
4621
5554
|
const ret = getObject(arg0) == getObject(arg1);
|
|
4622
5555
|
return ret;
|
|
@@ -4694,6 +5627,10 @@ function __wbg_get_imports() {
|
|
|
4694
5627
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
4695
5628
|
return addHeapObject(ret);
|
|
4696
5629
|
},
|
|
5630
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
5631
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
5632
|
+
return addHeapObject(ret);
|
|
5633
|
+
},
|
|
4697
5634
|
__wbg_info_e1c3400f7bf783dc: function(arg0, arg1, arg2, arg3) {
|
|
4698
5635
|
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
4699
5636
|
},
|
|
@@ -4721,6 +5658,10 @@ function __wbg_get_imports() {
|
|
|
4721
5658
|
const ret = Array.isArray(getObject(arg0));
|
|
4722
5659
|
return ret;
|
|
4723
5660
|
},
|
|
5661
|
+
__wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
|
|
5662
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
5663
|
+
return ret;
|
|
5664
|
+
},
|
|
4724
5665
|
__wbg_iterator_013bc09ec998c2a7: function() {
|
|
4725
5666
|
const ret = Symbol.iterator;
|
|
4726
5667
|
return addHeapObject(ret);
|
|
@@ -4894,6 +5835,9 @@ const WasmPdfPageRegionFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
4894
5835
|
const WasmSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4895
5836
|
? { register: () => {}, unregister: () => {} }
|
|
4896
5837
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsignature_free(ptr >>> 0, 1));
|
|
5838
|
+
const StreamingTableFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5839
|
+
? { register: () => {}, unregister: () => {} }
|
|
5840
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamingtable_free(ptr >>> 0, 1));
|
|
4897
5841
|
const WasmTimestampFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4898
5842
|
? { register: () => {}, unregister: () => {} }
|
|
4899
5843
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtimestamp_free(ptr >>> 0, 1));
|