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