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/bundler/pdf_oxide_bg.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Horizontal-alignment enum shared by `textInRect`, buffered `table`, and
|
|
3
|
+
* `streamingTable`. Maps 1:1 onto [`crate::writer::TextAlign`] /
|
|
4
|
+
* [`crate::writer::CellAlign`]. Exported to JS as `Align` via `js_name`.
|
|
5
|
+
* @enum {0 | 1 | 2}
|
|
6
|
+
*/
|
|
7
|
+
export const Align = Object.freeze({
|
|
8
|
+
/**
|
|
9
|
+
* Align to the left edge.
|
|
10
|
+
*/
|
|
11
|
+
Left: 0, "0": "Left",
|
|
12
|
+
/**
|
|
13
|
+
* Center horizontally.
|
|
14
|
+
*/
|
|
15
|
+
Center: 1, "1": "Center",
|
|
16
|
+
/**
|
|
17
|
+
* Align to the right edge.
|
|
18
|
+
*/
|
|
19
|
+
Right: 2, "2": "Right",
|
|
20
|
+
});
|
|
21
|
+
|
|
1
22
|
/**
|
|
2
23
|
* Style configuration for header/footer text.
|
|
3
24
|
*/
|
|
@@ -65,6 +86,104 @@ export class ArtifactStyle {
|
|
|
65
86
|
}
|
|
66
87
|
if (Symbol.dispose) ArtifactStyle.prototype[Symbol.dispose] = ArtifactStyle.prototype.free;
|
|
67
88
|
|
|
89
|
+
/**
|
|
90
|
+
* WASM handle to a streaming-table building session. Created by
|
|
91
|
+
* `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
|
|
92
|
+
* and the session is sealed with `finish()`.
|
|
93
|
+
*
|
|
94
|
+
* Single-use: `finish()` twice throws, and `pushRow` after `finish()`
|
|
95
|
+
* throws. The rows are buffered and replayed against the real Rust
|
|
96
|
+
* `StreamingTable` at `WasmFluentPageBuilder.done()` commit time —
|
|
97
|
+
* preserving the FluentPageBuilder borrow-lifetime invariant that can't
|
|
98
|
+
* cross the wasm-bindgen boundary.
|
|
99
|
+
*/
|
|
100
|
+
export class StreamingTable {
|
|
101
|
+
static __wrap(ptr) {
|
|
102
|
+
ptr = ptr >>> 0;
|
|
103
|
+
const obj = Object.create(StreamingTable.prototype);
|
|
104
|
+
obj.__wbg_ptr = ptr;
|
|
105
|
+
StreamingTableFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
106
|
+
return obj;
|
|
107
|
+
}
|
|
108
|
+
__destroy_into_raw() {
|
|
109
|
+
const ptr = this.__wbg_ptr;
|
|
110
|
+
this.__wbg_ptr = 0;
|
|
111
|
+
StreamingTableFinalization.unregister(this);
|
|
112
|
+
return ptr;
|
|
113
|
+
}
|
|
114
|
+
free() {
|
|
115
|
+
const ptr = this.__destroy_into_raw();
|
|
116
|
+
wasm.__wbg_streamingtable_free(ptr, 0);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Number of columns configured on this streaming table.
|
|
120
|
+
* @returns {number}
|
|
121
|
+
*/
|
|
122
|
+
columnCount() {
|
|
123
|
+
const ret = wasm.streamingtable_columnCount(this.__wbg_ptr);
|
|
124
|
+
return ret >>> 0;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Seal the streaming table — the buffered rows are flushed onto the
|
|
128
|
+
* parent page's op queue, to be replayed against the real Rust
|
|
129
|
+
* `StreamingTable` at `done()` commit time. Calling `finish()` twice
|
|
130
|
+
* throws.
|
|
131
|
+
*/
|
|
132
|
+
finish() {
|
|
133
|
+
try {
|
|
134
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
+
wasm.streamingtable_finish(retptr, this.__wbg_ptr);
|
|
136
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
137
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
138
|
+
if (r1) {
|
|
139
|
+
throw takeObject(r0);
|
|
140
|
+
}
|
|
141
|
+
} finally {
|
|
142
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Push one row as an array of cell strings (all rowspan=1). Returns an
|
|
147
|
+
* error if the table has already been finished or if the row's cell count
|
|
148
|
+
* does not match the column count.
|
|
149
|
+
* @param {string[]} cells
|
|
150
|
+
*/
|
|
151
|
+
pushRow(cells) {
|
|
152
|
+
try {
|
|
153
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
+
const ptr0 = passArrayJsValueToWasm0(cells, wasm.__wbindgen_export);
|
|
155
|
+
const len0 = WASM_VECTOR_LEN;
|
|
156
|
+
wasm.streamingtable_pushRow(retptr, this.__wbg_ptr, ptr0, len0);
|
|
157
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
158
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
159
|
+
if (r1) {
|
|
160
|
+
throw takeObject(r0);
|
|
161
|
+
}
|
|
162
|
+
} finally {
|
|
163
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Push one row with per-cell rowspan values. `cells` is a JS array of
|
|
168
|
+
* `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
|
|
169
|
+
* @param {any} cells
|
|
170
|
+
*/
|
|
171
|
+
pushRowSpan(cells) {
|
|
172
|
+
try {
|
|
173
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
174
|
+
wasm.streamingtable_pushRowSpan(retptr, this.__wbg_ptr, addHeapObject(cells));
|
|
175
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
176
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
177
|
+
if (r1) {
|
|
178
|
+
throw takeObject(r0);
|
|
179
|
+
}
|
|
180
|
+
} finally {
|
|
181
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (Symbol.dispose) StreamingTable.prototype[Symbol.dispose] = StreamingTable.prototype.free;
|
|
186
|
+
|
|
68
187
|
/**
|
|
69
188
|
* A header or footer artifact definition.
|
|
70
189
|
*/
|
|
@@ -246,6 +365,59 @@ export class WasmCertificate {
|
|
|
246
365
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
247
366
|
}
|
|
248
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Load a signer certificate + private key from PEM strings.
|
|
370
|
+
* `certPem` must begin `-----BEGIN CERTIFICATE-----`.
|
|
371
|
+
* `keyPem` must begin `-----BEGIN PRIVATE KEY-----` or `-----BEGIN RSA PRIVATE KEY-----`.
|
|
372
|
+
* @param {string} cert_pem
|
|
373
|
+
* @param {string} key_pem
|
|
374
|
+
* @returns {WasmCertificate}
|
|
375
|
+
*/
|
|
376
|
+
static loadPem(cert_pem, key_pem) {
|
|
377
|
+
try {
|
|
378
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
379
|
+
const ptr0 = passStringToWasm0(cert_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
380
|
+
const len0 = WASM_VECTOR_LEN;
|
|
381
|
+
const ptr1 = passStringToWasm0(key_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
382
|
+
const len1 = WASM_VECTOR_LEN;
|
|
383
|
+
wasm.wasmcertificate_loadPem(retptr, ptr0, len0, ptr1, len1);
|
|
384
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
385
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
386
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
387
|
+
if (r2) {
|
|
388
|
+
throw takeObject(r1);
|
|
389
|
+
}
|
|
390
|
+
return WasmCertificate.__wrap(r0);
|
|
391
|
+
} finally {
|
|
392
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Load a signer certificate + private key from a PKCS#12 (.p12/.pfx) blob.
|
|
397
|
+
* `password` is the passphrase protecting the key bag.
|
|
398
|
+
* @param {Uint8Array} data
|
|
399
|
+
* @param {string} password
|
|
400
|
+
* @returns {WasmCertificate}
|
|
401
|
+
*/
|
|
402
|
+
static loadPkcs12(data, password) {
|
|
403
|
+
try {
|
|
404
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
405
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
406
|
+
const len0 = WASM_VECTOR_LEN;
|
|
407
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
408
|
+
const len1 = WASM_VECTOR_LEN;
|
|
409
|
+
wasm.wasmcertificate_loadPkcs12(retptr, ptr0, len0, ptr1, len1);
|
|
410
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
411
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
412
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
413
|
+
if (r2) {
|
|
414
|
+
throw takeObject(r1);
|
|
415
|
+
}
|
|
416
|
+
return WasmCertificate.__wrap(r0);
|
|
417
|
+
} finally {
|
|
418
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
249
421
|
/**
|
|
250
422
|
* Serial number as a hex string (no `0x` prefix).
|
|
251
423
|
* @returns {string}
|
|
@@ -474,6 +646,27 @@ export class WasmDocumentBuilder {
|
|
|
474
646
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
475
647
|
}
|
|
476
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Set the document's natural language tag (e.g. `"en-US"`).
|
|
651
|
+
*
|
|
652
|
+
* Emitted as `/Lang` in the catalog when `taggedPdfUa1()` is set.
|
|
653
|
+
* @param {string} lang
|
|
654
|
+
*/
|
|
655
|
+
language(lang) {
|
|
656
|
+
try {
|
|
657
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
658
|
+
const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
659
|
+
const len0 = WASM_VECTOR_LEN;
|
|
660
|
+
wasm.wasmdocumentbuilder_language(retptr, this.__wbg_ptr, ptr0, len0);
|
|
661
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
662
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
663
|
+
if (r1) {
|
|
664
|
+
throw takeObject(r0);
|
|
665
|
+
}
|
|
666
|
+
} finally {
|
|
667
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
477
670
|
/**
|
|
478
671
|
* Start a new US Letter page.
|
|
479
672
|
* @returns {WasmFluentPageBuilder}
|
|
@@ -504,6 +697,25 @@ export class WasmDocumentBuilder {
|
|
|
504
697
|
WasmDocumentBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
505
698
|
return this;
|
|
506
699
|
}
|
|
700
|
+
/**
|
|
701
|
+
* Run a JavaScript script when the document is opened (`/OpenAction`).
|
|
702
|
+
* @param {string} script
|
|
703
|
+
*/
|
|
704
|
+
onOpen(script) {
|
|
705
|
+
try {
|
|
706
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
707
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
708
|
+
const len0 = WASM_VECTOR_LEN;
|
|
709
|
+
wasm.wasmdocumentbuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
710
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
711
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
712
|
+
if (r1) {
|
|
713
|
+
throw takeObject(r0);
|
|
714
|
+
}
|
|
715
|
+
} finally {
|
|
716
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
507
719
|
/**
|
|
508
720
|
* Start a new page with custom dimensions in PDF points
|
|
509
721
|
* (72 pt = 1 inch).
|
|
@@ -548,6 +760,31 @@ export class WasmDocumentBuilder {
|
|
|
548
760
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
549
761
|
}
|
|
550
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* Add a role-map entry: custom structure type → standard PDF structure type.
|
|
765
|
+
*
|
|
766
|
+
* Emitted in `/RoleMap` inside the StructTreeRoot when `taggedPdfUa1()`
|
|
767
|
+
* is set. Multiple calls accumulate entries.
|
|
768
|
+
* @param {string} custom
|
|
769
|
+
* @param {string} standard
|
|
770
|
+
*/
|
|
771
|
+
roleMap(custom, standard) {
|
|
772
|
+
try {
|
|
773
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
774
|
+
const ptr0 = passStringToWasm0(custom, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
776
|
+
const ptr1 = passStringToWasm0(standard, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
777
|
+
const len1 = WASM_VECTOR_LEN;
|
|
778
|
+
wasm.wasmdocumentbuilder_roleMap(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
779
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
780
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
781
|
+
if (r1) {
|
|
782
|
+
throw takeObject(r0);
|
|
783
|
+
}
|
|
784
|
+
} finally {
|
|
785
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
551
788
|
/**
|
|
552
789
|
* Set document subject.
|
|
553
790
|
* @param {string} subject
|
|
@@ -567,6 +804,25 @@ export class WasmDocumentBuilder {
|
|
|
567
804
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
568
805
|
}
|
|
569
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* Enable PDF/UA-1 tagged PDF mode.
|
|
809
|
+
*
|
|
810
|
+
* When enabled, `build()` emits `/MarkInfo`, `/StructTreeRoot`, `/Lang`,
|
|
811
|
+
* and `/ViewerPreferences` in the catalog. Opt-in — no effect unless called.
|
|
812
|
+
*/
|
|
813
|
+
taggedPdfUa1() {
|
|
814
|
+
try {
|
|
815
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
816
|
+
wasm.wasmdocumentbuilder_taggedPdfUa1(retptr, this.__wbg_ptr);
|
|
817
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
818
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
819
|
+
if (r1) {
|
|
820
|
+
throw takeObject(r0);
|
|
821
|
+
}
|
|
822
|
+
} finally {
|
|
823
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
570
826
|
/**
|
|
571
827
|
* Set document title.
|
|
572
828
|
* @param {string} title
|
|
@@ -731,6 +987,54 @@ export class WasmFluentPageBuilder {
|
|
|
731
987
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
732
988
|
}
|
|
733
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* Place a 1-D barcode image at `(x, y, w, h)` on the page.
|
|
992
|
+
* `barcodeType`: 0=Code128 1=Code39 2=EAN13 3=EAN8 4=UPCA 5=ITF
|
|
993
|
+
* 6=Code93 7=Codabar.
|
|
994
|
+
* @param {number} barcode_type
|
|
995
|
+
* @param {string} data
|
|
996
|
+
* @param {number} x
|
|
997
|
+
* @param {number} y
|
|
998
|
+
* @param {number} w
|
|
999
|
+
* @param {number} h
|
|
1000
|
+
*/
|
|
1001
|
+
barcode1d(barcode_type, data, x, y, w, h) {
|
|
1002
|
+
try {
|
|
1003
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1004
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1005
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1006
|
+
wasm.wasmfluentpagebuilder_barcode1d(retptr, this.__wbg_ptr, barcode_type, ptr0, len0, x, y, w, h);
|
|
1007
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1008
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1009
|
+
if (r1) {
|
|
1010
|
+
throw takeObject(r0);
|
|
1011
|
+
}
|
|
1012
|
+
} finally {
|
|
1013
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Place a QR-code image at `(x, y, size, size)` on the page.
|
|
1018
|
+
* @param {string} data
|
|
1019
|
+
* @param {number} x
|
|
1020
|
+
* @param {number} y
|
|
1021
|
+
* @param {number} size
|
|
1022
|
+
*/
|
|
1023
|
+
barcodeQr(data, x, y, size) {
|
|
1024
|
+
try {
|
|
1025
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1026
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1027
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1028
|
+
wasm.wasmfluentpagebuilder_barcodeQr(retptr, this.__wbg_ptr, ptr0, len0, x, y, size);
|
|
1029
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1030
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1031
|
+
if (r1) {
|
|
1032
|
+
throw takeObject(r0);
|
|
1033
|
+
}
|
|
1034
|
+
} finally {
|
|
1035
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
734
1038
|
/**
|
|
735
1039
|
* @param {string} name
|
|
736
1040
|
* @param {number} x
|
|
@@ -754,6 +1058,28 @@ export class WasmFluentPageBuilder {
|
|
|
754
1058
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
755
1059
|
}
|
|
756
1060
|
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Lay out `text` as balanced multi-column flow (`columnCount` columns,
|
|
1063
|
+
* `gapPt` points between columns). Paragraphs in `text` are separated by `"\n\n"`.
|
|
1064
|
+
* @param {number} column_count
|
|
1065
|
+
* @param {number} gap_pt
|
|
1066
|
+
* @param {string} text
|
|
1067
|
+
*/
|
|
1068
|
+
columns(column_count, gap_pt, text) {
|
|
1069
|
+
try {
|
|
1070
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1071
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1072
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1073
|
+
wasm.wasmfluentpagebuilder_columns(retptr, this.__wbg_ptr, column_count, gap_pt, ptr0, len0);
|
|
1074
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1075
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1076
|
+
if (r1) {
|
|
1077
|
+
throw takeObject(r0);
|
|
1078
|
+
}
|
|
1079
|
+
} finally {
|
|
1080
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
757
1083
|
/**
|
|
758
1084
|
* Add a dropdown combo-box.
|
|
759
1085
|
* @param {string} name
|
|
@@ -809,6 +1135,78 @@ export class WasmFluentPageBuilder {
|
|
|
809
1135
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
810
1136
|
}
|
|
811
1137
|
}
|
|
1138
|
+
/**
|
|
1139
|
+
* @param {string} script
|
|
1140
|
+
*/
|
|
1141
|
+
fieldCalculate(script) {
|
|
1142
|
+
try {
|
|
1143
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1144
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1146
|
+
wasm.wasmfluentpagebuilder_fieldCalculate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1147
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1148
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1149
|
+
if (r1) {
|
|
1150
|
+
throw takeObject(r0);
|
|
1151
|
+
}
|
|
1152
|
+
} finally {
|
|
1153
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* @param {string} script
|
|
1158
|
+
*/
|
|
1159
|
+
fieldFormat(script) {
|
|
1160
|
+
try {
|
|
1161
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1162
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1164
|
+
wasm.wasmfluentpagebuilder_fieldFormat(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1165
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1166
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1167
|
+
if (r1) {
|
|
1168
|
+
throw takeObject(r0);
|
|
1169
|
+
}
|
|
1170
|
+
} finally {
|
|
1171
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* @param {string} script
|
|
1176
|
+
*/
|
|
1177
|
+
fieldKeystroke(script) {
|
|
1178
|
+
try {
|
|
1179
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1180
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1181
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1182
|
+
wasm.wasmfluentpagebuilder_fieldKeystroke(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1183
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1184
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1185
|
+
if (r1) {
|
|
1186
|
+
throw takeObject(r0);
|
|
1187
|
+
}
|
|
1188
|
+
} finally {
|
|
1189
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* @param {string} script
|
|
1194
|
+
*/
|
|
1195
|
+
fieldValidate(script) {
|
|
1196
|
+
try {
|
|
1197
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1198
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1200
|
+
wasm.wasmfluentpagebuilder_fieldValidate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1201
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1202
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1203
|
+
if (r1) {
|
|
1204
|
+
throw takeObject(r0);
|
|
1205
|
+
}
|
|
1206
|
+
} finally {
|
|
1207
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
812
1210
|
/**
|
|
813
1211
|
* Draw a filled rectangle. RGB channels in 0.0-1.0.
|
|
814
1212
|
* @param {number} x
|
|
@@ -836,12 +1234,255 @@ export class WasmFluentPageBuilder {
|
|
|
836
1234
|
* @param {string} name
|
|
837
1235
|
* @param {number} size
|
|
838
1236
|
*/
|
|
839
|
-
font(name, size) {
|
|
1237
|
+
font(name, size) {
|
|
1238
|
+
try {
|
|
1239
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1240
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1241
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1242
|
+
wasm.wasmfluentpagebuilder_font(retptr, this.__wbg_ptr, ptr0, len0, size);
|
|
1243
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1244
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1245
|
+
if (r1) {
|
|
1246
|
+
throw takeObject(r0);
|
|
1247
|
+
}
|
|
1248
|
+
} finally {
|
|
1249
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Add a footnote: inline `refMark` at the cursor and `noteText` body
|
|
1254
|
+
* near the page bottom with a separator artifact line.
|
|
1255
|
+
* @param {string} ref_mark
|
|
1256
|
+
* @param {string} note_text
|
|
1257
|
+
*/
|
|
1258
|
+
footnote(ref_mark, note_text) {
|
|
1259
|
+
try {
|
|
1260
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1261
|
+
const ptr0 = passStringToWasm0(ref_mark, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1262
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1263
|
+
const ptr1 = passStringToWasm0(note_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1264
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1265
|
+
wasm.wasmfluentpagebuilder_footnote(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1266
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1267
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1268
|
+
if (r1) {
|
|
1269
|
+
throw takeObject(r0);
|
|
1270
|
+
}
|
|
1271
|
+
} finally {
|
|
1272
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* @param {number} x
|
|
1277
|
+
* @param {number} y
|
|
1278
|
+
* @param {number} w
|
|
1279
|
+
* @param {number} h
|
|
1280
|
+
* @param {string} text
|
|
1281
|
+
*/
|
|
1282
|
+
freeText(x, y, w, h, text) {
|
|
1283
|
+
try {
|
|
1284
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1285
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1287
|
+
wasm.wasmfluentpagebuilder_freeText(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0);
|
|
1288
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1289
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1290
|
+
if (r1) {
|
|
1291
|
+
throw takeObject(r0);
|
|
1292
|
+
}
|
|
1293
|
+
} finally {
|
|
1294
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* @param {number} level
|
|
1299
|
+
* @param {string} text
|
|
1300
|
+
*/
|
|
1301
|
+
heading(level, text) {
|
|
1302
|
+
try {
|
|
1303
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1304
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1306
|
+
wasm.wasmfluentpagebuilder_heading(retptr, this.__wbg_ptr, level, ptr0, len0);
|
|
1307
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1308
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1309
|
+
if (r1) {
|
|
1310
|
+
throw takeObject(r0);
|
|
1311
|
+
}
|
|
1312
|
+
} finally {
|
|
1313
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* @param {number} r
|
|
1318
|
+
* @param {number} g
|
|
1319
|
+
* @param {number} b
|
|
1320
|
+
*/
|
|
1321
|
+
highlight(r, g, b) {
|
|
1322
|
+
try {
|
|
1323
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1324
|
+
wasm.wasmfluentpagebuilder_highlight(retptr, this.__wbg_ptr, r, g, b);
|
|
1325
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1326
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1327
|
+
if (r1) {
|
|
1328
|
+
throw takeObject(r0);
|
|
1329
|
+
}
|
|
1330
|
+
} finally {
|
|
1331
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
horizontalRule() {
|
|
1335
|
+
try {
|
|
1336
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1337
|
+
wasm.wasmfluentpagebuilder_horizontalRule(retptr, this.__wbg_ptr);
|
|
1338
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1339
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1340
|
+
if (r1) {
|
|
1341
|
+
throw takeObject(r0);
|
|
1342
|
+
}
|
|
1343
|
+
} finally {
|
|
1344
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Embed a decorative image (JPEG/PNG/WebP bytes) as an /Artifact (no alt text).
|
|
1349
|
+
* @param {Uint8Array} bytes
|
|
1350
|
+
* @param {number} x
|
|
1351
|
+
* @param {number} y
|
|
1352
|
+
* @param {number} w
|
|
1353
|
+
* @param {number} h
|
|
1354
|
+
*/
|
|
1355
|
+
imageArtifact(bytes, x, y, w, h) {
|
|
1356
|
+
try {
|
|
1357
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1358
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1359
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1360
|
+
wasm.wasmfluentpagebuilder_imageArtifact(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1361
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1362
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1363
|
+
if (r1) {
|
|
1364
|
+
throw takeObject(r0);
|
|
1365
|
+
}
|
|
1366
|
+
} finally {
|
|
1367
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Embed an image (JPEG/PNG/WebP bytes) with an accessibility alt text.
|
|
1372
|
+
* @param {Uint8Array} bytes
|
|
1373
|
+
* @param {number} x
|
|
1374
|
+
* @param {number} y
|
|
1375
|
+
* @param {number} w
|
|
1376
|
+
* @param {number} h
|
|
1377
|
+
* @param {string} alt_text
|
|
1378
|
+
*/
|
|
1379
|
+
imageWithAlt(bytes, x, y, w, h, alt_text) {
|
|
1380
|
+
try {
|
|
1381
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1382
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1383
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1384
|
+
const ptr1 = passStringToWasm0(alt_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1385
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1386
|
+
wasm.wasmfluentpagebuilder_imageWithAlt(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1);
|
|
1387
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1388
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1389
|
+
if (r1) {
|
|
1390
|
+
throw takeObject(r0);
|
|
1391
|
+
}
|
|
1392
|
+
} finally {
|
|
1393
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Emit `text` inline (advances cursorX only, not cursorY).
|
|
1398
|
+
* @param {string} text
|
|
1399
|
+
*/
|
|
1400
|
+
inline(text) {
|
|
1401
|
+
try {
|
|
1402
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1403
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1404
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1405
|
+
wasm.wasmfluentpagebuilder_inline(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1406
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1407
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1408
|
+
if (r1) {
|
|
1409
|
+
throw takeObject(r0);
|
|
1410
|
+
}
|
|
1411
|
+
} finally {
|
|
1412
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Inline bold run.
|
|
1417
|
+
* @param {string} text
|
|
1418
|
+
*/
|
|
1419
|
+
inlineBold(text) {
|
|
1420
|
+
try {
|
|
1421
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1422
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1424
|
+
wasm.wasmfluentpagebuilder_inlineBold(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1425
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1426
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1427
|
+
if (r1) {
|
|
1428
|
+
throw takeObject(r0);
|
|
1429
|
+
}
|
|
1430
|
+
} finally {
|
|
1431
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Inline colored run (RGB 0.0–1.0).
|
|
1436
|
+
* @param {number} r
|
|
1437
|
+
* @param {number} g
|
|
1438
|
+
* @param {number} b
|
|
1439
|
+
* @param {string} text
|
|
1440
|
+
*/
|
|
1441
|
+
inlineColor(r, g, b, text) {
|
|
1442
|
+
try {
|
|
1443
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1444
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1445
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1446
|
+
wasm.wasmfluentpagebuilder_inlineColor(retptr, this.__wbg_ptr, r, g, b, ptr0, len0);
|
|
1447
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1448
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1449
|
+
if (r1) {
|
|
1450
|
+
throw takeObject(r0);
|
|
1451
|
+
}
|
|
1452
|
+
} finally {
|
|
1453
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Inline italic run.
|
|
1458
|
+
* @param {string} text
|
|
1459
|
+
*/
|
|
1460
|
+
inlineItalic(text) {
|
|
1461
|
+
try {
|
|
1462
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1463
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1465
|
+
wasm.wasmfluentpagebuilder_inlineItalic(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1466
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1467
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1468
|
+
if (r1) {
|
|
1469
|
+
throw takeObject(r0);
|
|
1470
|
+
}
|
|
1471
|
+
} finally {
|
|
1472
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Draw a line from (x1, y1) to (x2, y2) with 1pt black stroke.
|
|
1477
|
+
* @param {number} x1
|
|
1478
|
+
* @param {number} y1
|
|
1479
|
+
* @param {number} x2
|
|
1480
|
+
* @param {number} y2
|
|
1481
|
+
*/
|
|
1482
|
+
line(x1, y1, x2, y2) {
|
|
840
1483
|
try {
|
|
841
1484
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
842
|
-
|
|
843
|
-
const len0 = WASM_VECTOR_LEN;
|
|
844
|
-
wasm.wasmfluentpagebuilder_font(retptr, this.__wbg_ptr, ptr0, len0, size);
|
|
1485
|
+
wasm.wasmfluentpagebuilder_line(retptr, this.__wbg_ptr, x1, y1, x2, y2);
|
|
845
1486
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
846
1487
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
847
1488
|
if (r1) {
|
|
@@ -852,18 +1493,14 @@ export class WasmFluentPageBuilder {
|
|
|
852
1493
|
}
|
|
853
1494
|
}
|
|
854
1495
|
/**
|
|
855
|
-
* @param {
|
|
856
|
-
* @param {number} y
|
|
857
|
-
* @param {number} w
|
|
858
|
-
* @param {number} h
|
|
859
|
-
* @param {string} text
|
|
1496
|
+
* @param {string} script
|
|
860
1497
|
*/
|
|
861
|
-
|
|
1498
|
+
linkJavascript(script) {
|
|
862
1499
|
try {
|
|
863
1500
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
864
|
-
const ptr0 = passStringToWasm0(
|
|
1501
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
865
1502
|
const len0 = WASM_VECTOR_LEN;
|
|
866
|
-
wasm.
|
|
1503
|
+
wasm.wasmfluentpagebuilder_linkJavascript(retptr, this.__wbg_ptr, ptr0, len0);
|
|
867
1504
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
868
1505
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
869
1506
|
if (r1) {
|
|
@@ -874,15 +1511,14 @@ export class WasmFluentPageBuilder {
|
|
|
874
1511
|
}
|
|
875
1512
|
}
|
|
876
1513
|
/**
|
|
877
|
-
* @param {
|
|
878
|
-
* @param {string} text
|
|
1514
|
+
* @param {string} destination
|
|
879
1515
|
*/
|
|
880
|
-
|
|
1516
|
+
linkNamed(destination) {
|
|
881
1517
|
try {
|
|
882
1518
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
883
|
-
const ptr0 = passStringToWasm0(
|
|
1519
|
+
const ptr0 = passStringToWasm0(destination, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
884
1520
|
const len0 = WASM_VECTOR_LEN;
|
|
885
|
-
wasm.
|
|
1521
|
+
wasm.wasmfluentpagebuilder_linkNamed(retptr, this.__wbg_ptr, ptr0, len0);
|
|
886
1522
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
887
1523
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
888
1524
|
if (r1) {
|
|
@@ -893,14 +1529,12 @@ export class WasmFluentPageBuilder {
|
|
|
893
1529
|
}
|
|
894
1530
|
}
|
|
895
1531
|
/**
|
|
896
|
-
* @param {number}
|
|
897
|
-
* @param {number} g
|
|
898
|
-
* @param {number} b
|
|
1532
|
+
* @param {number} page
|
|
899
1533
|
*/
|
|
900
|
-
|
|
1534
|
+
linkPage(page) {
|
|
901
1535
|
try {
|
|
902
1536
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
903
|
-
wasm.
|
|
1537
|
+
wasm.wasmfluentpagebuilder_linkPage(retptr, this.__wbg_ptr, page);
|
|
904
1538
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
905
1539
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
906
1540
|
if (r1) {
|
|
@@ -910,10 +1544,15 @@ export class WasmFluentPageBuilder {
|
|
|
910
1544
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
911
1545
|
}
|
|
912
1546
|
}
|
|
913
|
-
|
|
1547
|
+
/**
|
|
1548
|
+
* @param {string} url
|
|
1549
|
+
*/
|
|
1550
|
+
linkUrl(url) {
|
|
914
1551
|
try {
|
|
915
1552
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
916
|
-
wasm.
|
|
1553
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1554
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1555
|
+
wasm.wasmfluentpagebuilder_linkUrl(retptr, this.__wbg_ptr, ptr0, len0);
|
|
917
1556
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
918
1557
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
919
1558
|
if (r1) {
|
|
@@ -924,16 +1563,30 @@ export class WasmFluentPageBuilder {
|
|
|
924
1563
|
}
|
|
925
1564
|
}
|
|
926
1565
|
/**
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
1566
|
+
* Measure the rendered width of `text` in the builder's current font
|
|
1567
|
+
* and size, in PDF points. Pure query — does not mutate state.
|
|
1568
|
+
*
|
|
1569
|
+
* Thin JS view over [`crate::writer::FluentPageBuilder::measure`]. The
|
|
1570
|
+
* WASM class tracks the current font/size independently of the
|
|
1571
|
+
* buffered ops so this query is served without a live builder.
|
|
1572
|
+
* @param {string} text
|
|
1573
|
+
* @returns {number}
|
|
932
1574
|
*/
|
|
933
|
-
|
|
1575
|
+
measure(text) {
|
|
1576
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1577
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1578
|
+
const ret = wasm.wasmfluentpagebuilder_measure(this.__wbg_ptr, ptr0, len0);
|
|
1579
|
+
return ret;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Finish the current page and start a new one with the same page
|
|
1583
|
+
* size. Cursor resets to the top-left margin (72, height-72). The
|
|
1584
|
+
* builder's font carries over.
|
|
1585
|
+
*/
|
|
1586
|
+
newPageSameSize() {
|
|
934
1587
|
try {
|
|
935
1588
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
936
|
-
wasm.
|
|
1589
|
+
wasm.wasmfluentpagebuilder_newPageSameSize(retptr, this.__wbg_ptr);
|
|
937
1590
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
938
1591
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
939
1592
|
if (r1) {
|
|
@@ -944,14 +1597,12 @@ export class WasmFluentPageBuilder {
|
|
|
944
1597
|
}
|
|
945
1598
|
}
|
|
946
1599
|
/**
|
|
947
|
-
*
|
|
1600
|
+
* Advance cursorY by one line-height and reset cursorX to 72 pt.
|
|
948
1601
|
*/
|
|
949
|
-
|
|
1602
|
+
newline() {
|
|
950
1603
|
try {
|
|
951
1604
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
952
|
-
|
|
953
|
-
const len0 = WASM_VECTOR_LEN;
|
|
954
|
-
wasm.wasmfluentpagebuilder_linkNamed(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1605
|
+
wasm.wasmfluentpagebuilder_newline(retptr, this.__wbg_ptr);
|
|
955
1606
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
956
1607
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
957
1608
|
if (r1) {
|
|
@@ -962,12 +1613,14 @@ export class WasmFluentPageBuilder {
|
|
|
962
1613
|
}
|
|
963
1614
|
}
|
|
964
1615
|
/**
|
|
965
|
-
* @param {
|
|
1616
|
+
* @param {string} script
|
|
966
1617
|
*/
|
|
967
|
-
|
|
1618
|
+
onClose(script) {
|
|
968
1619
|
try {
|
|
969
1620
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
970
|
-
|
|
1621
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1622
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1623
|
+
wasm.wasmfluentpagebuilder_onClose(retptr, this.__wbg_ptr, ptr0, len0);
|
|
971
1624
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
972
1625
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
973
1626
|
if (r1) {
|
|
@@ -978,14 +1631,14 @@ export class WasmFluentPageBuilder {
|
|
|
978
1631
|
}
|
|
979
1632
|
}
|
|
980
1633
|
/**
|
|
981
|
-
* @param {string}
|
|
1634
|
+
* @param {string} script
|
|
982
1635
|
*/
|
|
983
|
-
|
|
1636
|
+
onOpen(script) {
|
|
984
1637
|
try {
|
|
985
1638
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
986
|
-
const ptr0 = passStringToWasm0(
|
|
1639
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
987
1640
|
const len0 = WASM_VECTOR_LEN;
|
|
988
|
-
wasm.
|
|
1641
|
+
wasm.wasmfluentpagebuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
989
1642
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
990
1643
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
991
1644
|
if (r1) {
|
|
@@ -1098,6 +1751,41 @@ export class WasmFluentPageBuilder {
|
|
|
1098
1751
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1099
1752
|
}
|
|
1100
1753
|
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Points remaining on the current page below the cursor (down to the
|
|
1756
|
+
* 72 pt bottom margin). Mirrors
|
|
1757
|
+
* [`crate::writer::FluentPageBuilder::remaining_space`] using the WASM
|
|
1758
|
+
* class's independently-tracked cursor — accurate after `at`, `text`,
|
|
1759
|
+
* `space`, `newPageSameSize`, `textInRect` and the table helpers.
|
|
1760
|
+
* @returns {number}
|
|
1761
|
+
*/
|
|
1762
|
+
remainingSpace() {
|
|
1763
|
+
const ret = wasm.wasmfluentpagebuilder_remainingSpace(this.__wbg_ptr);
|
|
1764
|
+
return ret;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Add an unsigned signature placeholder field at the given bounds.
|
|
1768
|
+
* @param {string} name
|
|
1769
|
+
* @param {number} x
|
|
1770
|
+
* @param {number} y
|
|
1771
|
+
* @param {number} w
|
|
1772
|
+
* @param {number} h
|
|
1773
|
+
*/
|
|
1774
|
+
signatureField(name, x, y, w, h) {
|
|
1775
|
+
try {
|
|
1776
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1777
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1778
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1779
|
+
wasm.wasmfluentpagebuilder_signatureField(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1780
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1781
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1782
|
+
if (r1) {
|
|
1783
|
+
throw takeObject(r0);
|
|
1784
|
+
}
|
|
1785
|
+
} finally {
|
|
1786
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1101
1789
|
/**
|
|
1102
1790
|
* @param {number} points
|
|
1103
1791
|
*/
|
|
@@ -1188,6 +1876,31 @@ export class WasmFluentPageBuilder {
|
|
|
1188
1876
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1189
1877
|
}
|
|
1190
1878
|
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Open a streaming table. Returns a `StreamingTable` handle the caller
|
|
1881
|
+
* pushes rows into; call `finish()` when done. The streamed rows are
|
|
1882
|
+
* buffered per-table and replayed against the real Rust
|
|
1883
|
+
* `StreamingTable` at `done()` commit time — avoiding the
|
|
1884
|
+
* FluentPageBuilder-lifetime problem that otherwise can't cross the
|
|
1885
|
+
* wasm-bindgen boundary.
|
|
1886
|
+
* @param {any} spec
|
|
1887
|
+
* @returns {StreamingTable}
|
|
1888
|
+
*/
|
|
1889
|
+
streamingTable(spec) {
|
|
1890
|
+
try {
|
|
1891
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1892
|
+
wasm.wasmfluentpagebuilder_streamingTable(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
1893
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1894
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1895
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1896
|
+
if (r2) {
|
|
1897
|
+
throw takeObject(r1);
|
|
1898
|
+
}
|
|
1899
|
+
return StreamingTable.__wrap(r0);
|
|
1900
|
+
} finally {
|
|
1901
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1191
1904
|
/**
|
|
1192
1905
|
* @param {number} r
|
|
1193
1906
|
* @param {number} g
|
|
@@ -1206,6 +1919,85 @@ export class WasmFluentPageBuilder {
|
|
|
1206
1919
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1207
1920
|
}
|
|
1208
1921
|
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Draw a straight line with explicit stroke width and RGB colour.
|
|
1924
|
+
* @param {number} x1
|
|
1925
|
+
* @param {number} y1
|
|
1926
|
+
* @param {number} x2
|
|
1927
|
+
* @param {number} y2
|
|
1928
|
+
* @param {number} width
|
|
1929
|
+
* @param {number} r
|
|
1930
|
+
* @param {number} g
|
|
1931
|
+
* @param {number} b
|
|
1932
|
+
*/
|
|
1933
|
+
strokeLine(x1, y1, x2, y2, width, r, g, b) {
|
|
1934
|
+
try {
|
|
1935
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1936
|
+
wasm.wasmfluentpagebuilder_strokeLine(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b);
|
|
1937
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1938
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1939
|
+
if (r1) {
|
|
1940
|
+
throw takeObject(r0);
|
|
1941
|
+
}
|
|
1942
|
+
} finally {
|
|
1943
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Draw a stroked rectangle with explicit stroke width and RGB colour.
|
|
1948
|
+
* @param {number} x
|
|
1949
|
+
* @param {number} y
|
|
1950
|
+
* @param {number} w
|
|
1951
|
+
* @param {number} h
|
|
1952
|
+
* @param {number} width
|
|
1953
|
+
* @param {number} r
|
|
1954
|
+
* @param {number} g
|
|
1955
|
+
* @param {number} b
|
|
1956
|
+
*/
|
|
1957
|
+
strokeRect(x, y, w, h, width, r, g, b) {
|
|
1958
|
+
try {
|
|
1959
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1960
|
+
wasm.wasmfluentpagebuilder_strokeRect(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b);
|
|
1961
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1962
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1963
|
+
if (r1) {
|
|
1964
|
+
throw takeObject(r0);
|
|
1965
|
+
}
|
|
1966
|
+
} finally {
|
|
1967
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Render a buffered table from a JS object:
|
|
1972
|
+
*
|
|
1973
|
+
* ```javascript
|
|
1974
|
+
* page.table({
|
|
1975
|
+
* columns: [
|
|
1976
|
+
* { header: "SKU", width: 100, align: Align.Left },
|
|
1977
|
+
* { header: "Qty", width: 60, align: Align.Right },
|
|
1978
|
+
* ],
|
|
1979
|
+
* rows: [["A-1","12"], ["B-2","3"]],
|
|
1980
|
+
* hasHeader: true,
|
|
1981
|
+
* });
|
|
1982
|
+
* ```
|
|
1983
|
+
*
|
|
1984
|
+
* Uses `serde-wasm-bindgen` for deserialisation. Replays against the
|
|
1985
|
+
* Rust `Table` builder at `done()` commit time.
|
|
1986
|
+
* @param {any} spec
|
|
1987
|
+
*/
|
|
1988
|
+
table(spec) {
|
|
1989
|
+
try {
|
|
1990
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1991
|
+
wasm.wasmfluentpagebuilder_table(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
1992
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1993
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1994
|
+
if (r1) {
|
|
1995
|
+
throw takeObject(r0);
|
|
1996
|
+
}
|
|
1997
|
+
} finally {
|
|
1998
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
1209
2001
|
/**
|
|
1210
2002
|
* @param {string} text
|
|
1211
2003
|
*/
|
|
@@ -1249,6 +2041,32 @@ export class WasmFluentPageBuilder {
|
|
|
1249
2041
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1250
2042
|
}
|
|
1251
2043
|
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Place wrapped text inside a rectangle with horizontal alignment.
|
|
2046
|
+
* `align` is the `Align` enum (0 = Left, 1 = Center, 2 = Right) — also
|
|
2047
|
+
* accepts a raw integer for JS callers that pre-date the enum import.
|
|
2048
|
+
* @param {number} x
|
|
2049
|
+
* @param {number} y
|
|
2050
|
+
* @param {number} w
|
|
2051
|
+
* @param {number} h
|
|
2052
|
+
* @param {string} text
|
|
2053
|
+
* @param {number} align
|
|
2054
|
+
*/
|
|
2055
|
+
textInRect(x, y, w, h, text, align) {
|
|
2056
|
+
try {
|
|
2057
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2058
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2059
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2060
|
+
wasm.wasmfluentpagebuilder_textInRect(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0, align);
|
|
2061
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2062
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2063
|
+
if (r1) {
|
|
2064
|
+
throw takeObject(r0);
|
|
2065
|
+
}
|
|
2066
|
+
} finally {
|
|
2067
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
1252
2070
|
/**
|
|
1253
2071
|
* @param {number} r
|
|
1254
2072
|
* @param {number} g
|
|
@@ -2721,6 +3539,28 @@ export class WasmPdfDocument {
|
|
|
2721
3539
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2722
3540
|
}
|
|
2723
3541
|
}
|
|
3542
|
+
/**
|
|
3543
|
+
* Return warnings collected during the last form-flattening save.
|
|
3544
|
+
*
|
|
3545
|
+
* Each entry names a widget field that had no `/AP` appearance stream;
|
|
3546
|
+
* flattening such a field produces a blank rectangle.
|
|
3547
|
+
*
|
|
3548
|
+
* @returns Array of warning strings
|
|
3549
|
+
* @returns {string[]}
|
|
3550
|
+
*/
|
|
3551
|
+
flattenWarnings() {
|
|
3552
|
+
try {
|
|
3553
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3554
|
+
wasm.wasmpdfdocument_flattenWarnings(retptr, this.__wbg_ptr);
|
|
3555
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3556
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3557
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3558
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3559
|
+
return v1;
|
|
3560
|
+
} finally {
|
|
3561
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
2724
3564
|
/**
|
|
2725
3565
|
* Get annotations from a page.
|
|
2726
3566
|
*
|
|
@@ -3297,6 +4137,37 @@ export class WasmPdfDocument {
|
|
|
3297
4137
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3298
4138
|
}
|
|
3299
4139
|
}
|
|
4140
|
+
/**
|
|
4141
|
+
* Save with options (compress, garbage_collect, linearize) and return bytes.
|
|
4142
|
+
*
|
|
4143
|
+
* @param {Object} [options] - Optional save options.
|
|
4144
|
+
* @param {boolean} [options.compress=true] - Compress raw streams with FlateDecode.
|
|
4145
|
+
* @param {boolean} [options.garbageCollect=true] - Remove unreachable objects.
|
|
4146
|
+
* @param {boolean} [options.linearize=false] - Linearize (reserved, no-op).
|
|
4147
|
+
* @returns Uint8Array containing the modified PDF
|
|
4148
|
+
* @param {boolean | null} [compress]
|
|
4149
|
+
* @param {boolean | null} [garbage_collect]
|
|
4150
|
+
* @param {boolean | null} [linearize]
|
|
4151
|
+
* @returns {Uint8Array}
|
|
4152
|
+
*/
|
|
4153
|
+
saveWithOptions(compress, garbage_collect, linearize) {
|
|
4154
|
+
try {
|
|
4155
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4156
|
+
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);
|
|
4157
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4158
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4159
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4160
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4161
|
+
if (r3) {
|
|
4162
|
+
throw takeObject(r2);
|
|
4163
|
+
}
|
|
4164
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
4165
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
4166
|
+
return v1;
|
|
4167
|
+
} finally {
|
|
4168
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
3300
4171
|
/**
|
|
3301
4172
|
* Search for text across all pages.
|
|
3302
4173
|
*
|
|
@@ -4550,10 +5421,51 @@ export function setLogLevel(level) {
|
|
|
4550
5421
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4551
5422
|
}
|
|
4552
5423
|
}
|
|
5424
|
+
|
|
5425
|
+
/**
|
|
5426
|
+
* Sign raw PDF bytes and return the signed PDF as a `Uint8Array`.
|
|
5427
|
+
*
|
|
5428
|
+
* `cert` must carry a private key (loaded via `Certificate.loadPem` or
|
|
5429
|
+
* `Certificate.loadPkcs12`).
|
|
5430
|
+
* @param {Uint8Array} pdf_data
|
|
5431
|
+
* @param {WasmCertificate} cert
|
|
5432
|
+
* @param {string | null} [reason]
|
|
5433
|
+
* @param {string | null} [location]
|
|
5434
|
+
* @returns {Uint8Array}
|
|
5435
|
+
*/
|
|
5436
|
+
export function signPdfBytes(pdf_data, cert, reason, location) {
|
|
5437
|
+
try {
|
|
5438
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5439
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
5440
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5441
|
+
_assertClass(cert, WasmCertificate);
|
|
5442
|
+
var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5443
|
+
var len1 = WASM_VECTOR_LEN;
|
|
5444
|
+
var ptr2 = isLikeNone(location) ? 0 : passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5445
|
+
var len2 = WASM_VECTOR_LEN;
|
|
5446
|
+
wasm.signPdfBytes(retptr, ptr0, len0, cert.__wbg_ptr, ptr1, len1, ptr2, len2);
|
|
5447
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5448
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5449
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
5450
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
5451
|
+
if (r3) {
|
|
5452
|
+
throw takeObject(r2);
|
|
5453
|
+
}
|
|
5454
|
+
var v4 = getArrayU8FromWasm0(r0, r1).slice();
|
|
5455
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
5456
|
+
return v4;
|
|
5457
|
+
} finally {
|
|
5458
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
4553
5461
|
export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
4554
5462
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4555
5463
|
return addHeapObject(ret);
|
|
4556
5464
|
}
|
|
5465
|
+
export function __wbg_Number_32bf70a599af1d4b(arg0) {
|
|
5466
|
+
const ret = Number(getObject(arg0));
|
|
5467
|
+
return ret;
|
|
5468
|
+
}
|
|
4557
5469
|
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
4558
5470
|
const ret = String(getObject(arg1));
|
|
4559
5471
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4561,6 +5473,12 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
4561
5473
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4562
5474
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4563
5475
|
}
|
|
5476
|
+
export function __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51(arg0, arg1) {
|
|
5477
|
+
const v = getObject(arg1);
|
|
5478
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
5479
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
5480
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
5481
|
+
}
|
|
4564
5482
|
export function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {
|
|
4565
5483
|
const v = getObject(arg0);
|
|
4566
5484
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
@@ -4573,6 +5491,14 @@ export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
|
|
|
4573
5491
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4574
5492
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4575
5493
|
}
|
|
5494
|
+
export function __wbg___wbindgen_in_a5d8b22e52b24dd1(arg0, arg1) {
|
|
5495
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
5496
|
+
return ret;
|
|
5497
|
+
}
|
|
5498
|
+
export function __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93(arg0) {
|
|
5499
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
5500
|
+
return ret;
|
|
5501
|
+
}
|
|
4576
5502
|
export function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {
|
|
4577
5503
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
4578
5504
|
return ret;
|
|
@@ -4594,6 +5520,10 @@ export function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {
|
|
|
4594
5520
|
const ret = getObject(arg0) === undefined;
|
|
4595
5521
|
return ret;
|
|
4596
5522
|
}
|
|
5523
|
+
export function __wbg___wbindgen_jsval_eq_d3465d8a07697228(arg0, arg1) {
|
|
5524
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
5525
|
+
return ret;
|
|
5526
|
+
}
|
|
4597
5527
|
export function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {
|
|
4598
5528
|
const ret = getObject(arg0) == getObject(arg1);
|
|
4599
5529
|
return ret;
|
|
@@ -4671,6 +5601,10 @@ export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
|
|
|
4671
5601
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
4672
5602
|
return addHeapObject(ret);
|
|
4673
5603
|
}
|
|
5604
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
5605
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
5606
|
+
return addHeapObject(ret);
|
|
5607
|
+
}
|
|
4674
5608
|
export function __wbg_info_e1c3400f7bf783dc(arg0, arg1, arg2, arg3) {
|
|
4675
5609
|
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
4676
5610
|
}
|
|
@@ -4698,6 +5632,10 @@ export function __wbg_isArray_c3109d14ffc06469(arg0) {
|
|
|
4698
5632
|
const ret = Array.isArray(getObject(arg0));
|
|
4699
5633
|
return ret;
|
|
4700
5634
|
}
|
|
5635
|
+
export function __wbg_isSafeInteger_4fc213d1989d6d2a(arg0) {
|
|
5636
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
5637
|
+
return ret;
|
|
5638
|
+
}
|
|
4701
5639
|
export function __wbg_iterator_013bc09ec998c2a7() {
|
|
4702
5640
|
const ret = Symbol.iterator;
|
|
4703
5641
|
return addHeapObject(ret);
|
|
@@ -4864,6 +5802,9 @@ const WasmPdfPageRegionFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
4864
5802
|
const WasmSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4865
5803
|
? { register: () => {}, unregister: () => {} }
|
|
4866
5804
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsignature_free(ptr >>> 0, 1));
|
|
5805
|
+
const StreamingTableFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5806
|
+
? { register: () => {}, unregister: () => {} }
|
|
5807
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamingtable_free(ptr >>> 0, 1));
|
|
4867
5808
|
const WasmTimestampFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4868
5809
|
? { register: () => {}, unregister: () => {} }
|
|
4869
5810
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtimestamp_free(ptr >>> 0, 1));
|