pdf-oxide-wasm 0.3.37 → 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/README.md +1 -1
- package/bundler/package.json +1 -0
- package/{pdf_oxide.d.ts → bundler/pdf_oxide.d.ts} +590 -10
- package/bundler/pdf_oxide.js +9 -0
- package/bundler/pdf_oxide_bg.js +6094 -0
- package/bundler/pdf_oxide_bg.wasm +0 -0
- package/{pdf_oxide_bg.wasm.d.ts → bundler/pdf_oxide_bg.wasm.d.ts} +119 -0
- package/nodejs/package.json +1 -0
- package/nodejs/pdf_oxide.d.ts +1399 -0
- package/{pdf_oxide.js → nodejs/pdf_oxide.js} +2796 -175
- package/nodejs/pdf_oxide_bg.wasm +0 -0
- package/nodejs/pdf_oxide_bg.wasm.d.ts +276 -0
- package/package.json +29 -7
- package/web/package.json +1 -0
- package/web/pdf_oxide.d.ts +1700 -0
- package/web/pdf_oxide.js +6195 -0
- package/web/pdf_oxide_bg.wasm +0 -0
- package/web/pdf_oxide_bg.wasm.d.ts +276 -0
- package/pdf_oxide_bg.wasm +0 -0
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
/* @ts-self-types="./pdf_oxide.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Horizontal-alignment enum shared by `textInRect`, buffered `table`, and
|
|
5
|
+
* `streamingTable`. Maps 1:1 onto [`crate::writer::TextAlign`] /
|
|
6
|
+
* [`crate::writer::CellAlign`]. Exported to JS as `Align` via `js_name`.
|
|
7
|
+
* @enum {0 | 1 | 2}
|
|
8
|
+
*/
|
|
9
|
+
const Align = Object.freeze({
|
|
10
|
+
/**
|
|
11
|
+
* Align to the left edge.
|
|
12
|
+
*/
|
|
13
|
+
Left: 0, "0": "Left",
|
|
14
|
+
/**
|
|
15
|
+
* Center horizontally.
|
|
16
|
+
*/
|
|
17
|
+
Center: 1, "1": "Center",
|
|
18
|
+
/**
|
|
19
|
+
* Align to the right edge.
|
|
20
|
+
*/
|
|
21
|
+
Right: 2, "2": "Right",
|
|
22
|
+
});
|
|
23
|
+
exports.Align = Align;
|
|
24
|
+
|
|
3
25
|
/**
|
|
4
26
|
* Style configuration for header/footer text.
|
|
5
27
|
*/
|
|
@@ -69,28 +91,103 @@ if (Symbol.dispose) ArtifactStyle.prototype[Symbol.dispose] = ArtifactStyle.prot
|
|
|
69
91
|
exports.ArtifactStyle = ArtifactStyle;
|
|
70
92
|
|
|
71
93
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
94
|
+
* WASM handle to a streaming-table building session. Created by
|
|
95
|
+
* `FluentPageBuilder.streamingTable()`; rows are pushed via `pushRow`,
|
|
96
|
+
* and the session is sealed with `finish()`.
|
|
97
|
+
*
|
|
98
|
+
* Single-use: `finish()` twice throws, and `pushRow` after `finish()`
|
|
99
|
+
* throws. The rows are buffered and replayed against the real Rust
|
|
100
|
+
* `StreamingTable` at `WasmFluentPageBuilder.done()` commit time —
|
|
101
|
+
* preserving the FluentPageBuilder borrow-lifetime invariant that can't
|
|
102
|
+
* cross the wasm-bindgen boundary.
|
|
74
103
|
*/
|
|
75
|
-
|
|
104
|
+
class StreamingTable {
|
|
105
|
+
static __wrap(ptr) {
|
|
106
|
+
ptr = ptr >>> 0;
|
|
107
|
+
const obj = Object.create(StreamingTable.prototype);
|
|
108
|
+
obj.__wbg_ptr = ptr;
|
|
109
|
+
StreamingTableFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
110
|
+
return obj;
|
|
111
|
+
}
|
|
112
|
+
__destroy_into_raw() {
|
|
113
|
+
const ptr = this.__wbg_ptr;
|
|
114
|
+
this.__wbg_ptr = 0;
|
|
115
|
+
StreamingTableFinalization.unregister(this);
|
|
116
|
+
return ptr;
|
|
117
|
+
}
|
|
118
|
+
free() {
|
|
119
|
+
const ptr = this.__destroy_into_raw();
|
|
120
|
+
wasm.__wbg_streamingtable_free(ptr, 0);
|
|
121
|
+
}
|
|
76
122
|
/**
|
|
77
|
-
*
|
|
123
|
+
* Number of columns configured on this streaming table.
|
|
124
|
+
* @returns {number}
|
|
78
125
|
*/
|
|
79
|
-
|
|
126
|
+
columnCount() {
|
|
127
|
+
const ret = wasm.streamingtable_columnCount(this.__wbg_ptr);
|
|
128
|
+
return ret >>> 0;
|
|
129
|
+
}
|
|
80
130
|
/**
|
|
81
|
-
*
|
|
131
|
+
* Seal the streaming table — the buffered rows are flushed onto the
|
|
132
|
+
* parent page's op queue, to be replayed against the real Rust
|
|
133
|
+
* `StreamingTable` at `done()` commit time. Calling `finish()` twice
|
|
134
|
+
* throws.
|
|
82
135
|
*/
|
|
83
|
-
|
|
136
|
+
finish() {
|
|
137
|
+
try {
|
|
138
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
139
|
+
wasm.streamingtable_finish(retptr, this.__wbg_ptr);
|
|
140
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
141
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
142
|
+
if (r1) {
|
|
143
|
+
throw takeObject(r0);
|
|
144
|
+
}
|
|
145
|
+
} finally {
|
|
146
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
84
149
|
/**
|
|
85
|
-
*
|
|
150
|
+
* Push one row as an array of cell strings (all rowspan=1). Returns an
|
|
151
|
+
* error if the table has already been finished or if the row's cell count
|
|
152
|
+
* does not match the column count.
|
|
153
|
+
* @param {string[]} cells
|
|
86
154
|
*/
|
|
87
|
-
|
|
155
|
+
pushRow(cells) {
|
|
156
|
+
try {
|
|
157
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
158
|
+
const ptr0 = passArrayJsValueToWasm0(cells, wasm.__wbindgen_export);
|
|
159
|
+
const len0 = WASM_VECTOR_LEN;
|
|
160
|
+
wasm.streamingtable_pushRow(retptr, this.__wbg_ptr, ptr0, len0);
|
|
161
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
162
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
163
|
+
if (r1) {
|
|
164
|
+
throw takeObject(r0);
|
|
165
|
+
}
|
|
166
|
+
} finally {
|
|
167
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
88
170
|
/**
|
|
89
|
-
*
|
|
171
|
+
* Push one row with per-cell rowspan values. `cells` is a JS array of
|
|
172
|
+
* `[text, rowspan]` two-element arrays. `rowspan == 1` is a normal cell.
|
|
173
|
+
* @param {any} cells
|
|
90
174
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
175
|
+
pushRowSpan(cells) {
|
|
176
|
+
try {
|
|
177
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
178
|
+
wasm.streamingtable_pushRowSpan(retptr, this.__wbg_ptr, addHeapObject(cells));
|
|
179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
|
+
if (r1) {
|
|
182
|
+
throw takeObject(r0);
|
|
183
|
+
}
|
|
184
|
+
} finally {
|
|
185
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (Symbol.dispose) StreamingTable.prototype[Symbol.dispose] = StreamingTable.prototype.free;
|
|
190
|
+
exports.StreamingTable = StreamingTable;
|
|
94
191
|
|
|
95
192
|
/**
|
|
96
193
|
* A header or footer artifact definition.
|
|
@@ -125,60 +222,1925 @@ class WasmArtifact {
|
|
|
125
222
|
return WasmArtifact.__wrap(ret);
|
|
126
223
|
}
|
|
127
224
|
/**
|
|
128
|
-
* Create a left-aligned artifact.
|
|
225
|
+
* Create a left-aligned artifact.
|
|
226
|
+
* @param {string} text
|
|
227
|
+
* @returns {WasmArtifact}
|
|
228
|
+
*/
|
|
229
|
+
static left(text) {
|
|
230
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
231
|
+
const len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ret = wasm.wasmartifact_left(ptr0, len0);
|
|
233
|
+
return WasmArtifact.__wrap(ret);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Create a new artifact.
|
|
237
|
+
*/
|
|
238
|
+
constructor() {
|
|
239
|
+
const ret = wasm.wasmartifact_new();
|
|
240
|
+
this.__wbg_ptr = ret >>> 0;
|
|
241
|
+
WasmArtifactFinalization.register(this, this.__wbg_ptr, this);
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Create a right-aligned artifact.
|
|
246
|
+
* @param {string} text
|
|
247
|
+
* @returns {WasmArtifact}
|
|
248
|
+
*/
|
|
249
|
+
static right(text) {
|
|
250
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
252
|
+
const ret = wasm.wasmartifact_right(ptr0, len0);
|
|
253
|
+
return WasmArtifact.__wrap(ret);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Set vertical offset for the artifact.
|
|
257
|
+
* @param {number} offset
|
|
258
|
+
* @returns {WasmArtifact}
|
|
259
|
+
*/
|
|
260
|
+
withOffset(offset) {
|
|
261
|
+
const ptr = this.__destroy_into_raw();
|
|
262
|
+
const ret = wasm.wasmartifact_withOffset(ptr, offset);
|
|
263
|
+
return WasmArtifact.__wrap(ret);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Set style for the artifact.
|
|
267
|
+
* @param {ArtifactStyle} style
|
|
268
|
+
* @returns {WasmArtifact}
|
|
269
|
+
*/
|
|
270
|
+
withStyle(style) {
|
|
271
|
+
const ptr = this.__destroy_into_raw();
|
|
272
|
+
_assertClass(style, ArtifactStyle);
|
|
273
|
+
const ret = wasm.wasmartifact_withStyle(ptr, style.__wbg_ptr);
|
|
274
|
+
return WasmArtifact.__wrap(ret);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (Symbol.dispose) WasmArtifact.prototype[Symbol.dispose] = WasmArtifact.prototype.free;
|
|
278
|
+
exports.WasmArtifact = WasmArtifact;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* X.509 certificate parsed from a raw DER blob. Mirrors the C#,
|
|
282
|
+
* Node, Python, and Go `Certificate` surfaces — `subject` / `issuer`
|
|
283
|
+
* / `serial` / `validity` / `isValid` getters only.
|
|
284
|
+
*/
|
|
285
|
+
class WasmCertificate {
|
|
286
|
+
static __wrap(ptr) {
|
|
287
|
+
ptr = ptr >>> 0;
|
|
288
|
+
const obj = Object.create(WasmCertificate.prototype);
|
|
289
|
+
obj.__wbg_ptr = ptr;
|
|
290
|
+
WasmCertificateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
291
|
+
return obj;
|
|
292
|
+
}
|
|
293
|
+
__destroy_into_raw() {
|
|
294
|
+
const ptr = this.__wbg_ptr;
|
|
295
|
+
this.__wbg_ptr = 0;
|
|
296
|
+
WasmCertificateFinalization.unregister(this);
|
|
297
|
+
return ptr;
|
|
298
|
+
}
|
|
299
|
+
free() {
|
|
300
|
+
const ptr = this.__destroy_into_raw();
|
|
301
|
+
wasm.__wbg_wasmcertificate_free(ptr, 0);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Whether the certificate is currently within its validity
|
|
305
|
+
* window. Does NOT verify chain, trust-root, or revocation.
|
|
306
|
+
* @returns {boolean}
|
|
307
|
+
*/
|
|
308
|
+
get isValid() {
|
|
309
|
+
try {
|
|
310
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
311
|
+
wasm.wasmcertificate_isValid(retptr, this.__wbg_ptr);
|
|
312
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
313
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
314
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
315
|
+
if (r2) {
|
|
316
|
+
throw takeObject(r1);
|
|
317
|
+
}
|
|
318
|
+
return r0 !== 0;
|
|
319
|
+
} finally {
|
|
320
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Issuer distinguished name.
|
|
325
|
+
* @returns {string}
|
|
326
|
+
*/
|
|
327
|
+
get issuer() {
|
|
328
|
+
let deferred2_0;
|
|
329
|
+
let deferred2_1;
|
|
330
|
+
try {
|
|
331
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
332
|
+
wasm.wasmcertificate_issuer(retptr, this.__wbg_ptr);
|
|
333
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
334
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
335
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
336
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
337
|
+
var ptr1 = r0;
|
|
338
|
+
var len1 = r1;
|
|
339
|
+
if (r3) {
|
|
340
|
+
ptr1 = 0; len1 = 0;
|
|
341
|
+
throw takeObject(r2);
|
|
342
|
+
}
|
|
343
|
+
deferred2_0 = ptr1;
|
|
344
|
+
deferred2_1 = len1;
|
|
345
|
+
return getStringFromWasm0(ptr1, len1);
|
|
346
|
+
} finally {
|
|
347
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
348
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Load a certificate from a DER-encoded X.509 blob. Throws if
|
|
353
|
+
* the DER doesn't parse.
|
|
354
|
+
* @param {Uint8Array} data
|
|
355
|
+
* @returns {WasmCertificate}
|
|
356
|
+
*/
|
|
357
|
+
static load(data) {
|
|
358
|
+
try {
|
|
359
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
360
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
361
|
+
const len0 = WASM_VECTOR_LEN;
|
|
362
|
+
wasm.wasmcertificate_load(retptr, ptr0, len0);
|
|
363
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
364
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
365
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
366
|
+
if (r2) {
|
|
367
|
+
throw takeObject(r1);
|
|
368
|
+
}
|
|
369
|
+
return WasmCertificate.__wrap(r0);
|
|
370
|
+
} finally {
|
|
371
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Load a signer certificate + private key from PEM strings.
|
|
376
|
+
* `certPem` must begin `-----BEGIN CERTIFICATE-----`.
|
|
377
|
+
* `keyPem` must begin `-----BEGIN PRIVATE KEY-----` or `-----BEGIN RSA PRIVATE KEY-----`.
|
|
378
|
+
* @param {string} cert_pem
|
|
379
|
+
* @param {string} key_pem
|
|
380
|
+
* @returns {WasmCertificate}
|
|
381
|
+
*/
|
|
382
|
+
static loadPem(cert_pem, key_pem) {
|
|
383
|
+
try {
|
|
384
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
|
+
const ptr0 = passStringToWasm0(cert_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
386
|
+
const len0 = WASM_VECTOR_LEN;
|
|
387
|
+
const ptr1 = passStringToWasm0(key_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
388
|
+
const len1 = WASM_VECTOR_LEN;
|
|
389
|
+
wasm.wasmcertificate_loadPem(retptr, ptr0, len0, ptr1, len1);
|
|
390
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
391
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
392
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
393
|
+
if (r2) {
|
|
394
|
+
throw takeObject(r1);
|
|
395
|
+
}
|
|
396
|
+
return WasmCertificate.__wrap(r0);
|
|
397
|
+
} finally {
|
|
398
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Load a signer certificate + private key from a PKCS#12 (.p12/.pfx) blob.
|
|
403
|
+
* `password` is the passphrase protecting the key bag.
|
|
404
|
+
* @param {Uint8Array} data
|
|
405
|
+
* @param {string} password
|
|
406
|
+
* @returns {WasmCertificate}
|
|
407
|
+
*/
|
|
408
|
+
static loadPkcs12(data, password) {
|
|
409
|
+
try {
|
|
410
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
411
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
413
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
414
|
+
const len1 = WASM_VECTOR_LEN;
|
|
415
|
+
wasm.wasmcertificate_loadPkcs12(retptr, ptr0, len0, ptr1, len1);
|
|
416
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
417
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
418
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
419
|
+
if (r2) {
|
|
420
|
+
throw takeObject(r1);
|
|
421
|
+
}
|
|
422
|
+
return WasmCertificate.__wrap(r0);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Serial number as a hex string (no `0x` prefix).
|
|
429
|
+
* @returns {string}
|
|
430
|
+
*/
|
|
431
|
+
get serial() {
|
|
432
|
+
let deferred2_0;
|
|
433
|
+
let deferred2_1;
|
|
434
|
+
try {
|
|
435
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
436
|
+
wasm.wasmcertificate_serial(retptr, this.__wbg_ptr);
|
|
437
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
438
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
439
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
440
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
441
|
+
var ptr1 = r0;
|
|
442
|
+
var len1 = r1;
|
|
443
|
+
if (r3) {
|
|
444
|
+
ptr1 = 0; len1 = 0;
|
|
445
|
+
throw takeObject(r2);
|
|
446
|
+
}
|
|
447
|
+
deferred2_0 = ptr1;
|
|
448
|
+
deferred2_1 = len1;
|
|
449
|
+
return getStringFromWasm0(ptr1, len1);
|
|
450
|
+
} finally {
|
|
451
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
452
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Subject distinguished name.
|
|
457
|
+
* @returns {string}
|
|
458
|
+
*/
|
|
459
|
+
get subject() {
|
|
460
|
+
let deferred2_0;
|
|
461
|
+
let deferred2_1;
|
|
462
|
+
try {
|
|
463
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
464
|
+
wasm.wasmcertificate_subject(retptr, this.__wbg_ptr);
|
|
465
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
466
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
467
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
468
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
469
|
+
var ptr1 = r0;
|
|
470
|
+
var len1 = r1;
|
|
471
|
+
if (r3) {
|
|
472
|
+
ptr1 = 0; len1 = 0;
|
|
473
|
+
throw takeObject(r2);
|
|
474
|
+
}
|
|
475
|
+
deferred2_0 = ptr1;
|
|
476
|
+
deferred2_1 = len1;
|
|
477
|
+
return getStringFromWasm0(ptr1, len1);
|
|
478
|
+
} finally {
|
|
479
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
480
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Validity window as `[notBefore, notAfter]` Unix epoch seconds.
|
|
485
|
+
* JavaScript: `new Date(notBefore * 1000)` for a Date.
|
|
486
|
+
* @returns {BigInt64Array}
|
|
487
|
+
*/
|
|
488
|
+
get validity() {
|
|
489
|
+
try {
|
|
490
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
491
|
+
wasm.wasmcertificate_validity(retptr, this.__wbg_ptr);
|
|
492
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
493
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
494
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
495
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
496
|
+
if (r3) {
|
|
497
|
+
throw takeObject(r2);
|
|
498
|
+
}
|
|
499
|
+
var v1 = getArrayI64FromWasm0(r0, r1).slice();
|
|
500
|
+
wasm.__wbindgen_export4(r0, r1 * 8, 8);
|
|
501
|
+
return v1;
|
|
502
|
+
} finally {
|
|
503
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (Symbol.dispose) WasmCertificate.prototype[Symbol.dispose] = WasmCertificate.prototype.free;
|
|
508
|
+
exports.WasmCertificate = WasmCertificate;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* WASM wrapper for [`crate::writer::DocumentBuilder`]. Fluent API for
|
|
512
|
+
* programmatic multi-page PDF construction with embedded fonts and
|
|
513
|
+
* annotations.
|
|
514
|
+
*
|
|
515
|
+
* The terminal methods (`build`, `toBytesEncrypted`) **consume** the
|
|
516
|
+
* builder; subsequent calls throw `Error: DocumentBuilder already
|
|
517
|
+
* consumed`.
|
|
518
|
+
*/
|
|
519
|
+
class WasmDocumentBuilder {
|
|
520
|
+
__destroy_into_raw() {
|
|
521
|
+
const ptr = this.__wbg_ptr;
|
|
522
|
+
this.__wbg_ptr = 0;
|
|
523
|
+
WasmDocumentBuilderFinalization.unregister(this);
|
|
524
|
+
return ptr;
|
|
525
|
+
}
|
|
526
|
+
free() {
|
|
527
|
+
const ptr = this.__destroy_into_raw();
|
|
528
|
+
wasm.__wbg_wasmdocumentbuilder_free(ptr, 0);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Start a new A4 page. Returns a `FluentPageBuilder` that must be
|
|
532
|
+
* committed with `.done()` before calling another page method or a
|
|
533
|
+
* terminal (`build`, etc.).
|
|
534
|
+
* @returns {WasmFluentPageBuilder}
|
|
535
|
+
*/
|
|
536
|
+
a4Page() {
|
|
537
|
+
try {
|
|
538
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
539
|
+
wasm.wasmdocumentbuilder_a4Page(retptr, this.__wbg_ptr);
|
|
540
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
541
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
542
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
543
|
+
if (r2) {
|
|
544
|
+
throw takeObject(r1);
|
|
545
|
+
}
|
|
546
|
+
return WasmFluentPageBuilder.__wrap(r0);
|
|
547
|
+
} finally {
|
|
548
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Set document author.
|
|
553
|
+
* @param {string} author
|
|
554
|
+
*/
|
|
555
|
+
author(author) {
|
|
556
|
+
try {
|
|
557
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
558
|
+
const ptr0 = passStringToWasm0(author, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
559
|
+
const len0 = WASM_VECTOR_LEN;
|
|
560
|
+
wasm.wasmdocumentbuilder_author(retptr, this.__wbg_ptr, ptr0, len0);
|
|
561
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
562
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
563
|
+
if (r1) {
|
|
564
|
+
throw takeObject(r0);
|
|
565
|
+
}
|
|
566
|
+
} finally {
|
|
567
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Build the PDF and return it as a `Uint8Array`. **Consumes** the
|
|
572
|
+
* builder.
|
|
573
|
+
* @returns {Uint8Array}
|
|
574
|
+
*/
|
|
575
|
+
build() {
|
|
576
|
+
try {
|
|
577
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
578
|
+
wasm.wasmdocumentbuilder_build(retptr, this.__wbg_ptr);
|
|
579
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
580
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
581
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
582
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
583
|
+
if (r3) {
|
|
584
|
+
throw takeObject(r2);
|
|
585
|
+
}
|
|
586
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
587
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
588
|
+
return v1;
|
|
589
|
+
} finally {
|
|
590
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Commit a completed `FluentPageBuilder` back to this builder.
|
|
595
|
+
* Takes the place of the Rust `page.done()` re-parenting.
|
|
596
|
+
*
|
|
597
|
+
* JS users typically don't call this directly — the ergonomic
|
|
598
|
+
* pattern is `builder.a4Page();` for each page, then
|
|
599
|
+
* `builder.commitPage(page)` once ops are queued. For more fluent
|
|
600
|
+
* code, see the `FluentPageBuilder.done(builder)` helper which
|
|
601
|
+
* delegates to this method.
|
|
602
|
+
* @param {WasmFluentPageBuilder} page
|
|
603
|
+
*/
|
|
604
|
+
commitPage(page) {
|
|
605
|
+
try {
|
|
606
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
607
|
+
_assertClass(page, WasmFluentPageBuilder);
|
|
608
|
+
wasm.wasmdocumentbuilder_commitPage(retptr, this.__wbg_ptr, page.__wbg_ptr);
|
|
609
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
610
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
611
|
+
if (r1) {
|
|
612
|
+
throw takeObject(r0);
|
|
613
|
+
}
|
|
614
|
+
} finally {
|
|
615
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Set the creator application name recorded in the PDF.
|
|
620
|
+
* @param {string} creator
|
|
621
|
+
*/
|
|
622
|
+
creator(creator) {
|
|
623
|
+
try {
|
|
624
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
625
|
+
const ptr0 = passStringToWasm0(creator, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
626
|
+
const len0 = WASM_VECTOR_LEN;
|
|
627
|
+
wasm.wasmdocumentbuilder_creator(retptr, this.__wbg_ptr, ptr0, len0);
|
|
628
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
629
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
630
|
+
if (r1) {
|
|
631
|
+
throw takeObject(r0);
|
|
632
|
+
}
|
|
633
|
+
} finally {
|
|
634
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Set document keywords (comma-separated per PDF convention).
|
|
639
|
+
* @param {string} keywords
|
|
640
|
+
*/
|
|
641
|
+
keywords(keywords) {
|
|
642
|
+
try {
|
|
643
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
644
|
+
const ptr0 = passStringToWasm0(keywords, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
645
|
+
const len0 = WASM_VECTOR_LEN;
|
|
646
|
+
wasm.wasmdocumentbuilder_keywords(retptr, this.__wbg_ptr, ptr0, len0);
|
|
647
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
648
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
649
|
+
if (r1) {
|
|
650
|
+
throw takeObject(r0);
|
|
651
|
+
}
|
|
652
|
+
} finally {
|
|
653
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Set the document's natural language tag (e.g. `"en-US"`).
|
|
658
|
+
*
|
|
659
|
+
* Emitted as `/Lang` in the catalog when `taggedPdfUa1()` is set.
|
|
660
|
+
* @param {string} lang
|
|
661
|
+
*/
|
|
662
|
+
language(lang) {
|
|
663
|
+
try {
|
|
664
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
665
|
+
const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
666
|
+
const len0 = WASM_VECTOR_LEN;
|
|
667
|
+
wasm.wasmdocumentbuilder_language(retptr, this.__wbg_ptr, ptr0, len0);
|
|
668
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
669
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
670
|
+
if (r1) {
|
|
671
|
+
throw takeObject(r0);
|
|
672
|
+
}
|
|
673
|
+
} finally {
|
|
674
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Start a new US Letter page.
|
|
679
|
+
* @returns {WasmFluentPageBuilder}
|
|
680
|
+
*/
|
|
681
|
+
letterPage() {
|
|
682
|
+
try {
|
|
683
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
684
|
+
wasm.wasmdocumentbuilder_letterPage(retptr, this.__wbg_ptr);
|
|
685
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
686
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
687
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
688
|
+
if (r2) {
|
|
689
|
+
throw takeObject(r1);
|
|
690
|
+
}
|
|
691
|
+
return WasmFluentPageBuilder.__wrap(r0);
|
|
692
|
+
} finally {
|
|
693
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Create a new empty document builder. Equivalent to the Rust
|
|
698
|
+
* [`crate::writer::DocumentBuilder::new`] — every other method
|
|
699
|
+
* chains off the instance returned here.
|
|
700
|
+
*/
|
|
701
|
+
constructor() {
|
|
702
|
+
const ret = wasm.wasmdocumentbuilder_new();
|
|
703
|
+
this.__wbg_ptr = ret >>> 0;
|
|
704
|
+
WasmDocumentBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
705
|
+
return this;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Run a JavaScript script when the document is opened (`/OpenAction`).
|
|
709
|
+
* @param {string} script
|
|
710
|
+
*/
|
|
711
|
+
onOpen(script) {
|
|
712
|
+
try {
|
|
713
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
714
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
715
|
+
const len0 = WASM_VECTOR_LEN;
|
|
716
|
+
wasm.wasmdocumentbuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
717
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
718
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
719
|
+
if (r1) {
|
|
720
|
+
throw takeObject(r0);
|
|
721
|
+
}
|
|
722
|
+
} finally {
|
|
723
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Start a new page with custom dimensions in PDF points
|
|
728
|
+
* (72 pt = 1 inch).
|
|
729
|
+
* @param {number} width
|
|
730
|
+
* @param {number} height
|
|
731
|
+
* @returns {WasmFluentPageBuilder}
|
|
732
|
+
*/
|
|
733
|
+
page(width, height) {
|
|
734
|
+
try {
|
|
735
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
736
|
+
wasm.wasmdocumentbuilder_page(retptr, this.__wbg_ptr, width, height);
|
|
737
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
738
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
739
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
740
|
+
if (r2) {
|
|
741
|
+
throw takeObject(r1);
|
|
742
|
+
}
|
|
743
|
+
return WasmFluentPageBuilder.__wrap(r0);
|
|
744
|
+
} finally {
|
|
745
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Register a TTF / OTF font the pages can reference by name.
|
|
750
|
+
* **Consumes** `font` — reusing the `WasmEmbeddedFont` throws.
|
|
751
|
+
* @param {string} name
|
|
752
|
+
* @param {WasmEmbeddedFont} font
|
|
753
|
+
*/
|
|
754
|
+
registerEmbeddedFont(name, font) {
|
|
755
|
+
try {
|
|
756
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
757
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
758
|
+
const len0 = WASM_VECTOR_LEN;
|
|
759
|
+
_assertClass(font, WasmEmbeddedFont);
|
|
760
|
+
wasm.wasmdocumentbuilder_registerEmbeddedFont(retptr, this.__wbg_ptr, ptr0, len0, font.__wbg_ptr);
|
|
761
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
762
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
763
|
+
if (r1) {
|
|
764
|
+
throw takeObject(r0);
|
|
765
|
+
}
|
|
766
|
+
} finally {
|
|
767
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Add a role-map entry: custom structure type → standard PDF structure type.
|
|
772
|
+
*
|
|
773
|
+
* Emitted in `/RoleMap` inside the StructTreeRoot when `taggedPdfUa1()`
|
|
774
|
+
* is set. Multiple calls accumulate entries.
|
|
775
|
+
* @param {string} custom
|
|
776
|
+
* @param {string} standard
|
|
777
|
+
*/
|
|
778
|
+
roleMap(custom, standard) {
|
|
779
|
+
try {
|
|
780
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
781
|
+
const ptr0 = passStringToWasm0(custom, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
782
|
+
const len0 = WASM_VECTOR_LEN;
|
|
783
|
+
const ptr1 = passStringToWasm0(standard, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
784
|
+
const len1 = WASM_VECTOR_LEN;
|
|
785
|
+
wasm.wasmdocumentbuilder_roleMap(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
786
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
787
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
788
|
+
if (r1) {
|
|
789
|
+
throw takeObject(r0);
|
|
790
|
+
}
|
|
791
|
+
} finally {
|
|
792
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Set document subject.
|
|
797
|
+
* @param {string} subject
|
|
798
|
+
*/
|
|
799
|
+
subject(subject) {
|
|
800
|
+
try {
|
|
801
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
802
|
+
const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
803
|
+
const len0 = WASM_VECTOR_LEN;
|
|
804
|
+
wasm.wasmdocumentbuilder_subject(retptr, this.__wbg_ptr, ptr0, len0);
|
|
805
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
806
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
807
|
+
if (r1) {
|
|
808
|
+
throw takeObject(r0);
|
|
809
|
+
}
|
|
810
|
+
} finally {
|
|
811
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Enable PDF/UA-1 tagged PDF mode.
|
|
816
|
+
*
|
|
817
|
+
* When enabled, `build()` emits `/MarkInfo`, `/StructTreeRoot`, `/Lang`,
|
|
818
|
+
* and `/ViewerPreferences` in the catalog. Opt-in — no effect unless called.
|
|
819
|
+
*/
|
|
820
|
+
taggedPdfUa1() {
|
|
821
|
+
try {
|
|
822
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
823
|
+
wasm.wasmdocumentbuilder_taggedPdfUa1(retptr, this.__wbg_ptr);
|
|
824
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
825
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
826
|
+
if (r1) {
|
|
827
|
+
throw takeObject(r0);
|
|
828
|
+
}
|
|
829
|
+
} finally {
|
|
830
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Set document title.
|
|
835
|
+
* @param {string} title
|
|
836
|
+
*/
|
|
837
|
+
title(title) {
|
|
838
|
+
try {
|
|
839
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
840
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
841
|
+
const len0 = WASM_VECTOR_LEN;
|
|
842
|
+
wasm.wasmdocumentbuilder_title(retptr, this.__wbg_ptr, ptr0, len0);
|
|
843
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
844
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
845
|
+
if (r1) {
|
|
846
|
+
throw takeObject(r0);
|
|
847
|
+
}
|
|
848
|
+
} finally {
|
|
849
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Build the PDF with AES-256 encryption and return it as a
|
|
854
|
+
* `Uint8Array`. Granted permissions default to all. **Consumes**
|
|
855
|
+
* the builder.
|
|
856
|
+
* @param {string} user_password
|
|
857
|
+
* @param {string} owner_password
|
|
858
|
+
* @returns {Uint8Array}
|
|
859
|
+
*/
|
|
860
|
+
toBytesEncrypted(user_password, owner_password) {
|
|
861
|
+
try {
|
|
862
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
863
|
+
const ptr0 = passStringToWasm0(user_password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
864
|
+
const len0 = WASM_VECTOR_LEN;
|
|
865
|
+
const ptr1 = passStringToWasm0(owner_password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
866
|
+
const len1 = WASM_VECTOR_LEN;
|
|
867
|
+
wasm.wasmdocumentbuilder_toBytesEncrypted(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
868
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
869
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
870
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
871
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
872
|
+
if (r3) {
|
|
873
|
+
throw takeObject(r2);
|
|
874
|
+
}
|
|
875
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
876
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
877
|
+
return v3;
|
|
878
|
+
} finally {
|
|
879
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (Symbol.dispose) WasmDocumentBuilder.prototype[Symbol.dispose] = WasmDocumentBuilder.prototype.free;
|
|
884
|
+
exports.WasmDocumentBuilder = WasmDocumentBuilder;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Embedded TTF/OTF font usable by `WasmDocumentBuilder`. Single-use: once
|
|
888
|
+
* passed to `registerEmbeddedFont`, the underlying Rust `EmbeddedFont` is
|
|
889
|
+
* moved into the builder and this handle becomes empty.
|
|
890
|
+
*/
|
|
891
|
+
class WasmEmbeddedFont {
|
|
892
|
+
static __wrap(ptr) {
|
|
893
|
+
ptr = ptr >>> 0;
|
|
894
|
+
const obj = Object.create(WasmEmbeddedFont.prototype);
|
|
895
|
+
obj.__wbg_ptr = ptr;
|
|
896
|
+
WasmEmbeddedFontFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
897
|
+
return obj;
|
|
898
|
+
}
|
|
899
|
+
__destroy_into_raw() {
|
|
900
|
+
const ptr = this.__wbg_ptr;
|
|
901
|
+
this.__wbg_ptr = 0;
|
|
902
|
+
WasmEmbeddedFontFinalization.unregister(this);
|
|
903
|
+
return ptr;
|
|
904
|
+
}
|
|
905
|
+
free() {
|
|
906
|
+
const ptr = this.__destroy_into_raw();
|
|
907
|
+
wasm.__wbg_wasmembeddedfont_free(ptr, 0);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Load an embedded font from raw TTF/OTF bytes. Pass `name` to
|
|
911
|
+
* override the PostScript name baked into the font file.
|
|
912
|
+
* @param {Uint8Array} data
|
|
913
|
+
* @param {string | null} [name]
|
|
914
|
+
* @returns {WasmEmbeddedFont}
|
|
915
|
+
*/
|
|
916
|
+
static fromBytes(data, name) {
|
|
917
|
+
try {
|
|
918
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
919
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
920
|
+
const len0 = WASM_VECTOR_LEN;
|
|
921
|
+
var ptr1 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
922
|
+
var len1 = WASM_VECTOR_LEN;
|
|
923
|
+
wasm.wasmembeddedfont_fromBytes(retptr, ptr0, len0, ptr1, len1);
|
|
924
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
925
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
926
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
927
|
+
if (r2) {
|
|
928
|
+
throw takeObject(r1);
|
|
929
|
+
}
|
|
930
|
+
return WasmEmbeddedFont.__wrap(r0);
|
|
931
|
+
} finally {
|
|
932
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* The font's PostScript name (or the override). Empty once consumed.
|
|
937
|
+
* @returns {string}
|
|
938
|
+
*/
|
|
939
|
+
get name() {
|
|
940
|
+
let deferred1_0;
|
|
941
|
+
let deferred1_1;
|
|
942
|
+
try {
|
|
943
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
944
|
+
wasm.wasmembeddedfont_name(retptr, this.__wbg_ptr);
|
|
945
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
946
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
947
|
+
deferred1_0 = r0;
|
|
948
|
+
deferred1_1 = r1;
|
|
949
|
+
return getStringFromWasm0(r0, r1);
|
|
950
|
+
} finally {
|
|
951
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
952
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
if (Symbol.dispose) WasmEmbeddedFont.prototype[Symbol.dispose] = WasmEmbeddedFont.prototype.free;
|
|
957
|
+
exports.WasmEmbeddedFont = WasmEmbeddedFont;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Per-page fluent builder. Buffers operations until `done(builder)` is
|
|
961
|
+
* called, which commits them to the parent `WasmDocumentBuilder`. Each
|
|
962
|
+
* instance is single-use — `done()` twice throws.
|
|
963
|
+
*/
|
|
964
|
+
class WasmFluentPageBuilder {
|
|
965
|
+
static __wrap(ptr) {
|
|
966
|
+
ptr = ptr >>> 0;
|
|
967
|
+
const obj = Object.create(WasmFluentPageBuilder.prototype);
|
|
968
|
+
obj.__wbg_ptr = ptr;
|
|
969
|
+
WasmFluentPageBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
970
|
+
return obj;
|
|
971
|
+
}
|
|
972
|
+
__destroy_into_raw() {
|
|
973
|
+
const ptr = this.__wbg_ptr;
|
|
974
|
+
this.__wbg_ptr = 0;
|
|
975
|
+
WasmFluentPageBuilderFinalization.unregister(this);
|
|
976
|
+
return ptr;
|
|
977
|
+
}
|
|
978
|
+
free() {
|
|
979
|
+
const ptr = this.__destroy_into_raw();
|
|
980
|
+
wasm.__wbg_wasmfluentpagebuilder_free(ptr, 0);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* @param {number} x
|
|
984
|
+
* @param {number} y
|
|
985
|
+
*/
|
|
986
|
+
at(x, y) {
|
|
987
|
+
try {
|
|
988
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
989
|
+
wasm.wasmfluentpagebuilder_at(retptr, this.__wbg_ptr, x, y);
|
|
990
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
991
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
992
|
+
if (r1) {
|
|
993
|
+
throw takeObject(r0);
|
|
994
|
+
}
|
|
995
|
+
} finally {
|
|
996
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Place a 1-D barcode image at `(x, y, w, h)` on the page.
|
|
1001
|
+
* `barcodeType`: 0=Code128 1=Code39 2=EAN13 3=EAN8 4=UPCA 5=ITF
|
|
1002
|
+
* 6=Code93 7=Codabar.
|
|
1003
|
+
* @param {number} barcode_type
|
|
1004
|
+
* @param {string} data
|
|
1005
|
+
* @param {number} x
|
|
1006
|
+
* @param {number} y
|
|
1007
|
+
* @param {number} w
|
|
1008
|
+
* @param {number} h
|
|
1009
|
+
*/
|
|
1010
|
+
barcode1d(barcode_type, data, x, y, w, h) {
|
|
1011
|
+
try {
|
|
1012
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1013
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1014
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1015
|
+
wasm.wasmfluentpagebuilder_barcode1d(retptr, this.__wbg_ptr, barcode_type, ptr0, len0, x, y, w, h);
|
|
1016
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1017
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1018
|
+
if (r1) {
|
|
1019
|
+
throw takeObject(r0);
|
|
1020
|
+
}
|
|
1021
|
+
} finally {
|
|
1022
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Place a QR-code image at `(x, y, size, size)` on the page.
|
|
1027
|
+
* @param {string} data
|
|
1028
|
+
* @param {number} x
|
|
1029
|
+
* @param {number} y
|
|
1030
|
+
* @param {number} size
|
|
1031
|
+
*/
|
|
1032
|
+
barcodeQr(data, x, y, size) {
|
|
1033
|
+
try {
|
|
1034
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1035
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1036
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1037
|
+
wasm.wasmfluentpagebuilder_barcodeQr(retptr, this.__wbg_ptr, ptr0, len0, x, y, size);
|
|
1038
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1039
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1040
|
+
if (r1) {
|
|
1041
|
+
throw takeObject(r0);
|
|
1042
|
+
}
|
|
1043
|
+
} finally {
|
|
1044
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* @param {string} name
|
|
1049
|
+
* @param {number} x
|
|
1050
|
+
* @param {number} y
|
|
1051
|
+
* @param {number} w
|
|
1052
|
+
* @param {number} h
|
|
1053
|
+
* @param {boolean} checked
|
|
1054
|
+
*/
|
|
1055
|
+
checkbox(name, x, y, w, h, checked) {
|
|
1056
|
+
try {
|
|
1057
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1058
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1059
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1060
|
+
wasm.wasmfluentpagebuilder_checkbox(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, checked);
|
|
1061
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1062
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1063
|
+
if (r1) {
|
|
1064
|
+
throw takeObject(r0);
|
|
1065
|
+
}
|
|
1066
|
+
} finally {
|
|
1067
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Lay out `text` as balanced multi-column flow (`columnCount` columns,
|
|
1072
|
+
* `gapPt` points between columns). Paragraphs in `text` are separated by `"\n\n"`.
|
|
1073
|
+
* @param {number} column_count
|
|
1074
|
+
* @param {number} gap_pt
|
|
1075
|
+
* @param {string} text
|
|
1076
|
+
*/
|
|
1077
|
+
columns(column_count, gap_pt, text) {
|
|
1078
|
+
try {
|
|
1079
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1080
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1081
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1082
|
+
wasm.wasmfluentpagebuilder_columns(retptr, this.__wbg_ptr, column_count, gap_pt, ptr0, len0);
|
|
1083
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1084
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1085
|
+
if (r1) {
|
|
1086
|
+
throw takeObject(r0);
|
|
1087
|
+
}
|
|
1088
|
+
} finally {
|
|
1089
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Add a dropdown combo-box.
|
|
1094
|
+
* @param {string} name
|
|
1095
|
+
* @param {number} x
|
|
1096
|
+
* @param {number} y
|
|
1097
|
+
* @param {number} w
|
|
1098
|
+
* @param {number} h
|
|
1099
|
+
* @param {string[]} options
|
|
1100
|
+
* @param {string | null} [selected]
|
|
1101
|
+
*/
|
|
1102
|
+
comboBox(name, x, y, w, h, options, selected) {
|
|
1103
|
+
try {
|
|
1104
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1105
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1106
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1107
|
+
const ptr1 = passArrayJsValueToWasm0(options, wasm.__wbindgen_export);
|
|
1108
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1109
|
+
var ptr2 = isLikeNone(selected) ? 0 : passStringToWasm0(selected, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1110
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1111
|
+
wasm.wasmfluentpagebuilder_comboBox(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1, ptr2, len2);
|
|
1112
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1113
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1114
|
+
if (r1) {
|
|
1115
|
+
throw takeObject(r0);
|
|
1116
|
+
}
|
|
1117
|
+
} finally {
|
|
1118
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Convenience: commit this page's buffered ops to `builder`. Same
|
|
1123
|
+
* as `builder.commitPage(this)` but lets JS users keep the
|
|
1124
|
+
* chain-like flow:
|
|
1125
|
+
*
|
|
1126
|
+
* ```javascript
|
|
1127
|
+
* const page = builder.a4Page();
|
|
1128
|
+
* page.at(72, 720); page.text("Hi");
|
|
1129
|
+
* page.done(builder);
|
|
1130
|
+
* ```
|
|
1131
|
+
* @param {WasmDocumentBuilder} builder
|
|
1132
|
+
*/
|
|
1133
|
+
done(builder) {
|
|
1134
|
+
try {
|
|
1135
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1136
|
+
_assertClass(builder, WasmDocumentBuilder);
|
|
1137
|
+
wasm.wasmfluentpagebuilder_done(retptr, this.__wbg_ptr, builder.__wbg_ptr);
|
|
1138
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1139
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1140
|
+
if (r1) {
|
|
1141
|
+
throw takeObject(r0);
|
|
1142
|
+
}
|
|
1143
|
+
} finally {
|
|
1144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @param {string} script
|
|
1149
|
+
*/
|
|
1150
|
+
fieldCalculate(script) {
|
|
1151
|
+
try {
|
|
1152
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1153
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1154
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1155
|
+
wasm.wasmfluentpagebuilder_fieldCalculate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1156
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1157
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1158
|
+
if (r1) {
|
|
1159
|
+
throw takeObject(r0);
|
|
1160
|
+
}
|
|
1161
|
+
} finally {
|
|
1162
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* @param {string} script
|
|
1167
|
+
*/
|
|
1168
|
+
fieldFormat(script) {
|
|
1169
|
+
try {
|
|
1170
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1171
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1173
|
+
wasm.wasmfluentpagebuilder_fieldFormat(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1174
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1175
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1176
|
+
if (r1) {
|
|
1177
|
+
throw takeObject(r0);
|
|
1178
|
+
}
|
|
1179
|
+
} finally {
|
|
1180
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @param {string} script
|
|
1185
|
+
*/
|
|
1186
|
+
fieldKeystroke(script) {
|
|
1187
|
+
try {
|
|
1188
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1189
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1190
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1191
|
+
wasm.wasmfluentpagebuilder_fieldKeystroke(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1192
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1193
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1194
|
+
if (r1) {
|
|
1195
|
+
throw takeObject(r0);
|
|
1196
|
+
}
|
|
1197
|
+
} finally {
|
|
1198
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* @param {string} script
|
|
1203
|
+
*/
|
|
1204
|
+
fieldValidate(script) {
|
|
1205
|
+
try {
|
|
1206
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1207
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1209
|
+
wasm.wasmfluentpagebuilder_fieldValidate(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1210
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1211
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1212
|
+
if (r1) {
|
|
1213
|
+
throw takeObject(r0);
|
|
1214
|
+
}
|
|
1215
|
+
} finally {
|
|
1216
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Draw a filled rectangle. RGB channels in 0.0-1.0.
|
|
1221
|
+
* @param {number} x
|
|
1222
|
+
* @param {number} y
|
|
1223
|
+
* @param {number} w
|
|
1224
|
+
* @param {number} h
|
|
1225
|
+
* @param {number} r
|
|
1226
|
+
* @param {number} g
|
|
1227
|
+
* @param {number} b
|
|
1228
|
+
*/
|
|
1229
|
+
filledRect(x, y, w, h, r, g, b) {
|
|
1230
|
+
try {
|
|
1231
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1232
|
+
wasm.wasmfluentpagebuilder_filledRect(retptr, this.__wbg_ptr, x, y, w, h, r, g, b);
|
|
1233
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1234
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1235
|
+
if (r1) {
|
|
1236
|
+
throw takeObject(r0);
|
|
1237
|
+
}
|
|
1238
|
+
} finally {
|
|
1239
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* @param {string} name
|
|
1244
|
+
* @param {number} size
|
|
1245
|
+
*/
|
|
1246
|
+
font(name, size) {
|
|
1247
|
+
try {
|
|
1248
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1249
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1251
|
+
wasm.wasmfluentpagebuilder_font(retptr, this.__wbg_ptr, ptr0, len0, size);
|
|
1252
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1253
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1254
|
+
if (r1) {
|
|
1255
|
+
throw takeObject(r0);
|
|
1256
|
+
}
|
|
1257
|
+
} finally {
|
|
1258
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Add a footnote: inline `refMark` at the cursor and `noteText` body
|
|
1263
|
+
* near the page bottom with a separator artifact line.
|
|
1264
|
+
* @param {string} ref_mark
|
|
1265
|
+
* @param {string} note_text
|
|
1266
|
+
*/
|
|
1267
|
+
footnote(ref_mark, note_text) {
|
|
1268
|
+
try {
|
|
1269
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1270
|
+
const ptr0 = passStringToWasm0(ref_mark, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1271
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1272
|
+
const ptr1 = passStringToWasm0(note_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1273
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1274
|
+
wasm.wasmfluentpagebuilder_footnote(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1275
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1276
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1277
|
+
if (r1) {
|
|
1278
|
+
throw takeObject(r0);
|
|
1279
|
+
}
|
|
1280
|
+
} finally {
|
|
1281
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @param {number} x
|
|
1286
|
+
* @param {number} y
|
|
1287
|
+
* @param {number} w
|
|
1288
|
+
* @param {number} h
|
|
1289
|
+
* @param {string} text
|
|
1290
|
+
*/
|
|
1291
|
+
freeText(x, y, w, h, text) {
|
|
1292
|
+
try {
|
|
1293
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1294
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1296
|
+
wasm.wasmfluentpagebuilder_freeText(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0);
|
|
1297
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1298
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1299
|
+
if (r1) {
|
|
1300
|
+
throw takeObject(r0);
|
|
1301
|
+
}
|
|
1302
|
+
} finally {
|
|
1303
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* @param {number} level
|
|
1308
|
+
* @param {string} text
|
|
1309
|
+
*/
|
|
1310
|
+
heading(level, text) {
|
|
1311
|
+
try {
|
|
1312
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1313
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1314
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1315
|
+
wasm.wasmfluentpagebuilder_heading(retptr, this.__wbg_ptr, level, ptr0, len0);
|
|
1316
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1317
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1318
|
+
if (r1) {
|
|
1319
|
+
throw takeObject(r0);
|
|
1320
|
+
}
|
|
1321
|
+
} finally {
|
|
1322
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* @param {number} r
|
|
1327
|
+
* @param {number} g
|
|
1328
|
+
* @param {number} b
|
|
1329
|
+
*/
|
|
1330
|
+
highlight(r, g, b) {
|
|
1331
|
+
try {
|
|
1332
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1333
|
+
wasm.wasmfluentpagebuilder_highlight(retptr, this.__wbg_ptr, r, g, b);
|
|
1334
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1335
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1336
|
+
if (r1) {
|
|
1337
|
+
throw takeObject(r0);
|
|
1338
|
+
}
|
|
1339
|
+
} finally {
|
|
1340
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
horizontalRule() {
|
|
1344
|
+
try {
|
|
1345
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1346
|
+
wasm.wasmfluentpagebuilder_horizontalRule(retptr, this.__wbg_ptr);
|
|
1347
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1348
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1349
|
+
if (r1) {
|
|
1350
|
+
throw takeObject(r0);
|
|
1351
|
+
}
|
|
1352
|
+
} finally {
|
|
1353
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Embed a decorative image (JPEG/PNG/WebP bytes) as an /Artifact (no alt text).
|
|
1358
|
+
* @param {Uint8Array} bytes
|
|
1359
|
+
* @param {number} x
|
|
1360
|
+
* @param {number} y
|
|
1361
|
+
* @param {number} w
|
|
1362
|
+
* @param {number} h
|
|
1363
|
+
*/
|
|
1364
|
+
imageArtifact(bytes, x, y, w, h) {
|
|
1365
|
+
try {
|
|
1366
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1367
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1368
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1369
|
+
wasm.wasmfluentpagebuilder_imageArtifact(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1370
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1371
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1372
|
+
if (r1) {
|
|
1373
|
+
throw takeObject(r0);
|
|
1374
|
+
}
|
|
1375
|
+
} finally {
|
|
1376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Embed an image (JPEG/PNG/WebP bytes) with an accessibility alt text.
|
|
1381
|
+
* @param {Uint8Array} bytes
|
|
1382
|
+
* @param {number} x
|
|
1383
|
+
* @param {number} y
|
|
1384
|
+
* @param {number} w
|
|
1385
|
+
* @param {number} h
|
|
1386
|
+
* @param {string} alt_text
|
|
1387
|
+
*/
|
|
1388
|
+
imageWithAlt(bytes, x, y, w, h, alt_text) {
|
|
1389
|
+
try {
|
|
1390
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1391
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1393
|
+
const ptr1 = passStringToWasm0(alt_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1395
|
+
wasm.wasmfluentpagebuilder_imageWithAlt(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1);
|
|
1396
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1397
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1398
|
+
if (r1) {
|
|
1399
|
+
throw takeObject(r0);
|
|
1400
|
+
}
|
|
1401
|
+
} finally {
|
|
1402
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Emit `text` inline (advances cursorX only, not cursorY).
|
|
1407
|
+
* @param {string} text
|
|
1408
|
+
*/
|
|
1409
|
+
inline(text) {
|
|
1410
|
+
try {
|
|
1411
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1412
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1413
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1414
|
+
wasm.wasmfluentpagebuilder_inline(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1415
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1416
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1417
|
+
if (r1) {
|
|
1418
|
+
throw takeObject(r0);
|
|
1419
|
+
}
|
|
1420
|
+
} finally {
|
|
1421
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Inline bold run.
|
|
1426
|
+
* @param {string} text
|
|
1427
|
+
*/
|
|
1428
|
+
inlineBold(text) {
|
|
1429
|
+
try {
|
|
1430
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1431
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1433
|
+
wasm.wasmfluentpagebuilder_inlineBold(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1434
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1435
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1436
|
+
if (r1) {
|
|
1437
|
+
throw takeObject(r0);
|
|
1438
|
+
}
|
|
1439
|
+
} finally {
|
|
1440
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Inline colored run (RGB 0.0–1.0).
|
|
1445
|
+
* @param {number} r
|
|
1446
|
+
* @param {number} g
|
|
1447
|
+
* @param {number} b
|
|
1448
|
+
* @param {string} text
|
|
1449
|
+
*/
|
|
1450
|
+
inlineColor(r, g, b, text) {
|
|
1451
|
+
try {
|
|
1452
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1453
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1454
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1455
|
+
wasm.wasmfluentpagebuilder_inlineColor(retptr, this.__wbg_ptr, r, g, b, ptr0, len0);
|
|
1456
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1457
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1458
|
+
if (r1) {
|
|
1459
|
+
throw takeObject(r0);
|
|
1460
|
+
}
|
|
1461
|
+
} finally {
|
|
1462
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Inline italic run.
|
|
1467
|
+
* @param {string} text
|
|
1468
|
+
*/
|
|
1469
|
+
inlineItalic(text) {
|
|
1470
|
+
try {
|
|
1471
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1472
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1474
|
+
wasm.wasmfluentpagebuilder_inlineItalic(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1475
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1476
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1477
|
+
if (r1) {
|
|
1478
|
+
throw takeObject(r0);
|
|
1479
|
+
}
|
|
1480
|
+
} finally {
|
|
1481
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Draw a line from (x1, y1) to (x2, y2) with 1pt black stroke.
|
|
1486
|
+
* @param {number} x1
|
|
1487
|
+
* @param {number} y1
|
|
1488
|
+
* @param {number} x2
|
|
1489
|
+
* @param {number} y2
|
|
1490
|
+
*/
|
|
1491
|
+
line(x1, y1, x2, y2) {
|
|
1492
|
+
try {
|
|
1493
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1494
|
+
wasm.wasmfluentpagebuilder_line(retptr, this.__wbg_ptr, x1, y1, x2, y2);
|
|
1495
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1496
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1497
|
+
if (r1) {
|
|
1498
|
+
throw takeObject(r0);
|
|
1499
|
+
}
|
|
1500
|
+
} finally {
|
|
1501
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* @param {string} script
|
|
1506
|
+
*/
|
|
1507
|
+
linkJavascript(script) {
|
|
1508
|
+
try {
|
|
1509
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1510
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1511
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1512
|
+
wasm.wasmfluentpagebuilder_linkJavascript(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1513
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1514
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1515
|
+
if (r1) {
|
|
1516
|
+
throw takeObject(r0);
|
|
1517
|
+
}
|
|
1518
|
+
} finally {
|
|
1519
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* @param {string} destination
|
|
1524
|
+
*/
|
|
1525
|
+
linkNamed(destination) {
|
|
1526
|
+
try {
|
|
1527
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1528
|
+
const ptr0 = passStringToWasm0(destination, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1530
|
+
wasm.wasmfluentpagebuilder_linkNamed(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1531
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1532
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1533
|
+
if (r1) {
|
|
1534
|
+
throw takeObject(r0);
|
|
1535
|
+
}
|
|
1536
|
+
} finally {
|
|
1537
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* @param {number} page
|
|
1542
|
+
*/
|
|
1543
|
+
linkPage(page) {
|
|
1544
|
+
try {
|
|
1545
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1546
|
+
wasm.wasmfluentpagebuilder_linkPage(retptr, this.__wbg_ptr, page);
|
|
1547
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1548
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1549
|
+
if (r1) {
|
|
1550
|
+
throw takeObject(r0);
|
|
1551
|
+
}
|
|
1552
|
+
} finally {
|
|
1553
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* @param {string} url
|
|
1558
|
+
*/
|
|
1559
|
+
linkUrl(url) {
|
|
1560
|
+
try {
|
|
1561
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1562
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1563
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1564
|
+
wasm.wasmfluentpagebuilder_linkUrl(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1565
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1566
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1567
|
+
if (r1) {
|
|
1568
|
+
throw takeObject(r0);
|
|
1569
|
+
}
|
|
1570
|
+
} finally {
|
|
1571
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Measure the rendered width of `text` in the builder's current font
|
|
1576
|
+
* and size, in PDF points. Pure query — does not mutate state.
|
|
1577
|
+
*
|
|
1578
|
+
* Thin JS view over [`crate::writer::FluentPageBuilder::measure`]. The
|
|
1579
|
+
* WASM class tracks the current font/size independently of the
|
|
1580
|
+
* buffered ops so this query is served without a live builder.
|
|
1581
|
+
* @param {string} text
|
|
1582
|
+
* @returns {number}
|
|
1583
|
+
*/
|
|
1584
|
+
measure(text) {
|
|
1585
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1587
|
+
const ret = wasm.wasmfluentpagebuilder_measure(this.__wbg_ptr, ptr0, len0);
|
|
1588
|
+
return ret;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Finish the current page and start a new one with the same page
|
|
1592
|
+
* size. Cursor resets to the top-left margin (72, height-72). The
|
|
1593
|
+
* builder's font carries over.
|
|
1594
|
+
*/
|
|
1595
|
+
newPageSameSize() {
|
|
1596
|
+
try {
|
|
1597
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1598
|
+
wasm.wasmfluentpagebuilder_newPageSameSize(retptr, this.__wbg_ptr);
|
|
1599
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1600
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1601
|
+
if (r1) {
|
|
1602
|
+
throw takeObject(r0);
|
|
1603
|
+
}
|
|
1604
|
+
} finally {
|
|
1605
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Advance cursorY by one line-height and reset cursorX to 72 pt.
|
|
1610
|
+
*/
|
|
1611
|
+
newline() {
|
|
1612
|
+
try {
|
|
1613
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1614
|
+
wasm.wasmfluentpagebuilder_newline(retptr, this.__wbg_ptr);
|
|
1615
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1616
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1617
|
+
if (r1) {
|
|
1618
|
+
throw takeObject(r0);
|
|
1619
|
+
}
|
|
1620
|
+
} finally {
|
|
1621
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* @param {string} script
|
|
1626
|
+
*/
|
|
1627
|
+
onClose(script) {
|
|
1628
|
+
try {
|
|
1629
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1630
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1632
|
+
wasm.wasmfluentpagebuilder_onClose(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1633
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1634
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1635
|
+
if (r1) {
|
|
1636
|
+
throw takeObject(r0);
|
|
1637
|
+
}
|
|
1638
|
+
} finally {
|
|
1639
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* @param {string} script
|
|
1644
|
+
*/
|
|
1645
|
+
onOpen(script) {
|
|
1646
|
+
try {
|
|
1647
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1648
|
+
const ptr0 = passStringToWasm0(script, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1649
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1650
|
+
wasm.wasmfluentpagebuilder_onOpen(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1651
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1652
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1653
|
+
if (r1) {
|
|
1654
|
+
throw takeObject(r0);
|
|
1655
|
+
}
|
|
1656
|
+
} finally {
|
|
1657
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* @param {string} text
|
|
1662
|
+
*/
|
|
1663
|
+
paragraph(text) {
|
|
1664
|
+
try {
|
|
1665
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1666
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1667
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1668
|
+
wasm.wasmfluentpagebuilder_paragraph(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1669
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1670
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1671
|
+
if (r1) {
|
|
1672
|
+
throw takeObject(r0);
|
|
1673
|
+
}
|
|
1674
|
+
} finally {
|
|
1675
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Add a clickable push button with a visible caption.
|
|
1680
|
+
* @param {string} name
|
|
1681
|
+
* @param {number} x
|
|
1682
|
+
* @param {number} y
|
|
1683
|
+
* @param {number} w
|
|
1684
|
+
* @param {number} h
|
|
1685
|
+
* @param {string} caption
|
|
1686
|
+
*/
|
|
1687
|
+
pushButton(name, x, y, w, h, caption) {
|
|
1688
|
+
try {
|
|
1689
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1690
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1691
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1692
|
+
const ptr1 = passStringToWasm0(caption, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1693
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1694
|
+
wasm.wasmfluentpagebuilder_pushButton(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1);
|
|
1695
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1696
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1697
|
+
if (r1) {
|
|
1698
|
+
throw takeObject(r0);
|
|
1699
|
+
}
|
|
1700
|
+
} finally {
|
|
1701
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Add a radio-button group. `values`, `xs`, `ys`, `ws`, `hs` are
|
|
1706
|
+
* parallel arrays of length N describing each option's export
|
|
1707
|
+
* value and rectangle. `selected` picks the initial value.
|
|
1708
|
+
* @param {string} name
|
|
1709
|
+
* @param {string[]} values
|
|
1710
|
+
* @param {Float32Array} xs
|
|
1711
|
+
* @param {Float32Array} ys
|
|
1712
|
+
* @param {Float32Array} ws
|
|
1713
|
+
* @param {Float32Array} hs
|
|
1714
|
+
* @param {string | null} [selected]
|
|
1715
|
+
*/
|
|
1716
|
+
radioGroup(name, values, xs, ys, ws, hs, selected) {
|
|
1717
|
+
try {
|
|
1718
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1719
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1720
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1721
|
+
const ptr1 = passArrayJsValueToWasm0(values, wasm.__wbindgen_export);
|
|
1722
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1723
|
+
const ptr2 = passArrayF32ToWasm0(xs, wasm.__wbindgen_export);
|
|
1724
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1725
|
+
const ptr3 = passArrayF32ToWasm0(ys, wasm.__wbindgen_export);
|
|
1726
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1727
|
+
const ptr4 = passArrayF32ToWasm0(ws, wasm.__wbindgen_export);
|
|
1728
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1729
|
+
const ptr5 = passArrayF32ToWasm0(hs, wasm.__wbindgen_export);
|
|
1730
|
+
const len5 = WASM_VECTOR_LEN;
|
|
1731
|
+
var ptr6 = isLikeNone(selected) ? 0 : passStringToWasm0(selected, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1732
|
+
var len6 = WASM_VECTOR_LEN;
|
|
1733
|
+
wasm.wasmfluentpagebuilder_radioGroup(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
1734
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1735
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1736
|
+
if (r1) {
|
|
1737
|
+
throw takeObject(r0);
|
|
1738
|
+
}
|
|
1739
|
+
} finally {
|
|
1740
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Draw a stroked rectangle outline (1pt black).
|
|
1745
|
+
* @param {number} x
|
|
1746
|
+
* @param {number} y
|
|
1747
|
+
* @param {number} w
|
|
1748
|
+
* @param {number} h
|
|
1749
|
+
*/
|
|
1750
|
+
rect(x, y, w, h) {
|
|
1751
|
+
try {
|
|
1752
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1753
|
+
wasm.wasmfluentpagebuilder_rect(retptr, this.__wbg_ptr, x, y, w, h);
|
|
1754
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1755
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1756
|
+
if (r1) {
|
|
1757
|
+
throw takeObject(r0);
|
|
1758
|
+
}
|
|
1759
|
+
} finally {
|
|
1760
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Points remaining on the current page below the cursor (down to the
|
|
1765
|
+
* 72 pt bottom margin). Mirrors
|
|
1766
|
+
* [`crate::writer::FluentPageBuilder::remaining_space`] using the WASM
|
|
1767
|
+
* class's independently-tracked cursor — accurate after `at`, `text`,
|
|
1768
|
+
* `space`, `newPageSameSize`, `textInRect` and the table helpers.
|
|
1769
|
+
* @returns {number}
|
|
1770
|
+
*/
|
|
1771
|
+
remainingSpace() {
|
|
1772
|
+
const ret = wasm.wasmfluentpagebuilder_remainingSpace(this.__wbg_ptr);
|
|
1773
|
+
return ret;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Add an unsigned signature placeholder field at the given bounds.
|
|
1777
|
+
* @param {string} name
|
|
1778
|
+
* @param {number} x
|
|
1779
|
+
* @param {number} y
|
|
1780
|
+
* @param {number} w
|
|
1781
|
+
* @param {number} h
|
|
1782
|
+
*/
|
|
1783
|
+
signatureField(name, x, y, w, h) {
|
|
1784
|
+
try {
|
|
1785
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1786
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1787
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1788
|
+
wasm.wasmfluentpagebuilder_signatureField(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h);
|
|
1789
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1790
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1791
|
+
if (r1) {
|
|
1792
|
+
throw takeObject(r0);
|
|
1793
|
+
}
|
|
1794
|
+
} finally {
|
|
1795
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* @param {number} points
|
|
1800
|
+
*/
|
|
1801
|
+
space(points) {
|
|
1802
|
+
try {
|
|
1803
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1804
|
+
wasm.wasmfluentpagebuilder_space(retptr, this.__wbg_ptr, points);
|
|
1805
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1806
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1807
|
+
if (r1) {
|
|
1808
|
+
throw takeObject(r0);
|
|
1809
|
+
}
|
|
1810
|
+
} finally {
|
|
1811
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* @param {number} r
|
|
1816
|
+
* @param {number} g
|
|
1817
|
+
* @param {number} b
|
|
1818
|
+
*/
|
|
1819
|
+
squiggly(r, g, b) {
|
|
1820
|
+
try {
|
|
1821
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1822
|
+
wasm.wasmfluentpagebuilder_squiggly(retptr, this.__wbg_ptr, r, g, b);
|
|
1823
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1824
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1825
|
+
if (r1) {
|
|
1826
|
+
throw takeObject(r0);
|
|
1827
|
+
}
|
|
1828
|
+
} finally {
|
|
1829
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* @param {string} name
|
|
1834
|
+
*/
|
|
1835
|
+
stamp(name) {
|
|
1836
|
+
try {
|
|
1837
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1838
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1839
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1840
|
+
wasm.wasmfluentpagebuilder_stamp(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1841
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1842
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1843
|
+
if (r1) {
|
|
1844
|
+
throw takeObject(r0);
|
|
1845
|
+
}
|
|
1846
|
+
} finally {
|
|
1847
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* @param {string} text
|
|
1852
|
+
*/
|
|
1853
|
+
stickyNote(text) {
|
|
1854
|
+
try {
|
|
1855
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1856
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1857
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1858
|
+
wasm.wasmfluentpagebuilder_stickyNote(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1859
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1860
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1861
|
+
if (r1) {
|
|
1862
|
+
throw takeObject(r0);
|
|
1863
|
+
}
|
|
1864
|
+
} finally {
|
|
1865
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* @param {number} x
|
|
1870
|
+
* @param {number} y
|
|
1871
|
+
* @param {string} text
|
|
1872
|
+
*/
|
|
1873
|
+
stickyNoteAt(x, y, text) {
|
|
1874
|
+
try {
|
|
1875
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1876
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1877
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1878
|
+
wasm.wasmfluentpagebuilder_stickyNoteAt(retptr, this.__wbg_ptr, x, y, ptr0, len0);
|
|
1879
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1880
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1881
|
+
if (r1) {
|
|
1882
|
+
throw takeObject(r0);
|
|
1883
|
+
}
|
|
1884
|
+
} finally {
|
|
1885
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Open a streaming table. Returns a `StreamingTable` handle the caller
|
|
1890
|
+
* pushes rows into; call `finish()` when done. The streamed rows are
|
|
1891
|
+
* buffered per-table and replayed against the real Rust
|
|
1892
|
+
* `StreamingTable` at `done()` commit time — avoiding the
|
|
1893
|
+
* FluentPageBuilder-lifetime problem that otherwise can't cross the
|
|
1894
|
+
* wasm-bindgen boundary.
|
|
1895
|
+
* @param {any} spec
|
|
1896
|
+
* @returns {StreamingTable}
|
|
1897
|
+
*/
|
|
1898
|
+
streamingTable(spec) {
|
|
1899
|
+
try {
|
|
1900
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1901
|
+
wasm.wasmfluentpagebuilder_streamingTable(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
1902
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1903
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1904
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1905
|
+
if (r2) {
|
|
1906
|
+
throw takeObject(r1);
|
|
1907
|
+
}
|
|
1908
|
+
return StreamingTable.__wrap(r0);
|
|
1909
|
+
} finally {
|
|
1910
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* @param {number} r
|
|
1915
|
+
* @param {number} g
|
|
1916
|
+
* @param {number} b
|
|
1917
|
+
*/
|
|
1918
|
+
strikeout(r, g, b) {
|
|
1919
|
+
try {
|
|
1920
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1921
|
+
wasm.wasmfluentpagebuilder_strikeout(retptr, this.__wbg_ptr, r, g, b);
|
|
1922
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1923
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1924
|
+
if (r1) {
|
|
1925
|
+
throw takeObject(r0);
|
|
1926
|
+
}
|
|
1927
|
+
} finally {
|
|
1928
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Draw a straight line with explicit stroke width and RGB colour.
|
|
1933
|
+
* @param {number} x1
|
|
1934
|
+
* @param {number} y1
|
|
1935
|
+
* @param {number} x2
|
|
1936
|
+
* @param {number} y2
|
|
1937
|
+
* @param {number} width
|
|
1938
|
+
* @param {number} r
|
|
1939
|
+
* @param {number} g
|
|
1940
|
+
* @param {number} b
|
|
1941
|
+
*/
|
|
1942
|
+
strokeLine(x1, y1, x2, y2, width, r, g, b) {
|
|
1943
|
+
try {
|
|
1944
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1945
|
+
wasm.wasmfluentpagebuilder_strokeLine(retptr, this.__wbg_ptr, x1, y1, x2, y2, width, r, g, b);
|
|
1946
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1947
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1948
|
+
if (r1) {
|
|
1949
|
+
throw takeObject(r0);
|
|
1950
|
+
}
|
|
1951
|
+
} finally {
|
|
1952
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Draw a stroked rectangle with explicit stroke width and RGB colour.
|
|
1957
|
+
* @param {number} x
|
|
1958
|
+
* @param {number} y
|
|
1959
|
+
* @param {number} w
|
|
1960
|
+
* @param {number} h
|
|
1961
|
+
* @param {number} width
|
|
1962
|
+
* @param {number} r
|
|
1963
|
+
* @param {number} g
|
|
1964
|
+
* @param {number} b
|
|
1965
|
+
*/
|
|
1966
|
+
strokeRect(x, y, w, h, width, r, g, b) {
|
|
1967
|
+
try {
|
|
1968
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1969
|
+
wasm.wasmfluentpagebuilder_strokeRect(retptr, this.__wbg_ptr, x, y, w, h, width, r, g, b);
|
|
1970
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1971
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1972
|
+
if (r1) {
|
|
1973
|
+
throw takeObject(r0);
|
|
1974
|
+
}
|
|
1975
|
+
} finally {
|
|
1976
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Render a buffered table from a JS object:
|
|
1981
|
+
*
|
|
1982
|
+
* ```javascript
|
|
1983
|
+
* page.table({
|
|
1984
|
+
* columns: [
|
|
1985
|
+
* { header: "SKU", width: 100, align: Align.Left },
|
|
1986
|
+
* { header: "Qty", width: 60, align: Align.Right },
|
|
1987
|
+
* ],
|
|
1988
|
+
* rows: [["A-1","12"], ["B-2","3"]],
|
|
1989
|
+
* hasHeader: true,
|
|
1990
|
+
* });
|
|
1991
|
+
* ```
|
|
1992
|
+
*
|
|
1993
|
+
* Uses `serde-wasm-bindgen` for deserialisation. Replays against the
|
|
1994
|
+
* Rust `Table` builder at `done()` commit time.
|
|
1995
|
+
* @param {any} spec
|
|
1996
|
+
*/
|
|
1997
|
+
table(spec) {
|
|
1998
|
+
try {
|
|
1999
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2000
|
+
wasm.wasmfluentpagebuilder_table(retptr, this.__wbg_ptr, addHeapObject(spec));
|
|
2001
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2002
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2003
|
+
if (r1) {
|
|
2004
|
+
throw takeObject(r0);
|
|
2005
|
+
}
|
|
2006
|
+
} finally {
|
|
2007
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
129
2011
|
* @param {string} text
|
|
130
|
-
* @returns {WasmArtifact}
|
|
131
2012
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
2013
|
+
text(text) {
|
|
2014
|
+
try {
|
|
2015
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2016
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2017
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2018
|
+
wasm.wasmfluentpagebuilder_text(retptr, this.__wbg_ptr, ptr0, len0);
|
|
2019
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2020
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2021
|
+
if (r1) {
|
|
2022
|
+
throw takeObject(r0);
|
|
2023
|
+
}
|
|
2024
|
+
} finally {
|
|
2025
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2026
|
+
}
|
|
137
2027
|
}
|
|
138
2028
|
/**
|
|
139
|
-
*
|
|
2029
|
+
* @param {string} name
|
|
2030
|
+
* @param {number} x
|
|
2031
|
+
* @param {number} y
|
|
2032
|
+
* @param {number} w
|
|
2033
|
+
* @param {number} h
|
|
2034
|
+
* @param {string | null} [default_value]
|
|
140
2035
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
2036
|
+
textField(name, x, y, w, h, default_value) {
|
|
2037
|
+
try {
|
|
2038
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2039
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2040
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2041
|
+
var ptr1 = isLikeNone(default_value) ? 0 : passStringToWasm0(default_value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2042
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2043
|
+
wasm.wasmfluentpagebuilder_textField(retptr, this.__wbg_ptr, ptr0, len0, x, y, w, h, ptr1, len1);
|
|
2044
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2045
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2046
|
+
if (r1) {
|
|
2047
|
+
throw takeObject(r0);
|
|
2048
|
+
}
|
|
2049
|
+
} finally {
|
|
2050
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2051
|
+
}
|
|
146
2052
|
}
|
|
147
2053
|
/**
|
|
148
|
-
*
|
|
2054
|
+
* Place wrapped text inside a rectangle with horizontal alignment.
|
|
2055
|
+
* `align` is the `Align` enum (0 = Left, 1 = Center, 2 = Right) — also
|
|
2056
|
+
* accepts a raw integer for JS callers that pre-date the enum import.
|
|
2057
|
+
* @param {number} x
|
|
2058
|
+
* @param {number} y
|
|
2059
|
+
* @param {number} w
|
|
2060
|
+
* @param {number} h
|
|
149
2061
|
* @param {string} text
|
|
150
|
-
* @
|
|
2062
|
+
* @param {number} align
|
|
151
2063
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
2064
|
+
textInRect(x, y, w, h, text, align) {
|
|
2065
|
+
try {
|
|
2066
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2067
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2068
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2069
|
+
wasm.wasmfluentpagebuilder_textInRect(retptr, this.__wbg_ptr, x, y, w, h, ptr0, len0, align);
|
|
2070
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2071
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2072
|
+
if (r1) {
|
|
2073
|
+
throw takeObject(r0);
|
|
2074
|
+
}
|
|
2075
|
+
} finally {
|
|
2076
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2077
|
+
}
|
|
157
2078
|
}
|
|
158
2079
|
/**
|
|
159
|
-
*
|
|
160
|
-
* @param {number}
|
|
161
|
-
* @
|
|
2080
|
+
* @param {number} r
|
|
2081
|
+
* @param {number} g
|
|
2082
|
+
* @param {number} b
|
|
162
2083
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
2084
|
+
underline(r, g, b) {
|
|
2085
|
+
try {
|
|
2086
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2087
|
+
wasm.wasmfluentpagebuilder_underline(retptr, this.__wbg_ptr, r, g, b);
|
|
2088
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2089
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2090
|
+
if (r1) {
|
|
2091
|
+
throw takeObject(r0);
|
|
2092
|
+
}
|
|
2093
|
+
} finally {
|
|
2094
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2095
|
+
}
|
|
167
2096
|
}
|
|
168
2097
|
/**
|
|
169
|
-
*
|
|
170
|
-
* @param {ArtifactStyle} style
|
|
171
|
-
* @returns {WasmArtifact}
|
|
2098
|
+
* @param {string} text
|
|
172
2099
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
2100
|
+
watermark(text) {
|
|
2101
|
+
try {
|
|
2102
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2103
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2104
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2105
|
+
wasm.wasmfluentpagebuilder_watermark(retptr, this.__wbg_ptr, ptr0, len0);
|
|
2106
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2107
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2108
|
+
if (r1) {
|
|
2109
|
+
throw takeObject(r0);
|
|
2110
|
+
}
|
|
2111
|
+
} finally {
|
|
2112
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
watermarkConfidential() {
|
|
2116
|
+
try {
|
|
2117
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2118
|
+
wasm.wasmfluentpagebuilder_watermarkConfidential(retptr, this.__wbg_ptr);
|
|
2119
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2120
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2121
|
+
if (r1) {
|
|
2122
|
+
throw takeObject(r0);
|
|
2123
|
+
}
|
|
2124
|
+
} finally {
|
|
2125
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
watermarkDraft() {
|
|
2129
|
+
try {
|
|
2130
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2131
|
+
wasm.wasmfluentpagebuilder_watermarkDraft(retptr, this.__wbg_ptr);
|
|
2132
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2133
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2134
|
+
if (r1) {
|
|
2135
|
+
throw takeObject(r0);
|
|
2136
|
+
}
|
|
2137
|
+
} finally {
|
|
2138
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2139
|
+
}
|
|
178
2140
|
}
|
|
179
2141
|
}
|
|
180
|
-
if (Symbol.dispose)
|
|
181
|
-
exports.
|
|
2142
|
+
if (Symbol.dispose) WasmFluentPageBuilder.prototype[Symbol.dispose] = WasmFluentPageBuilder.prototype.free;
|
|
2143
|
+
exports.WasmFluentPageBuilder = WasmFluentPageBuilder;
|
|
182
2144
|
|
|
183
2145
|
/**
|
|
184
2146
|
* A footer definition.
|
|
@@ -543,6 +2505,72 @@ class WasmPdf {
|
|
|
543
2505
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
544
2506
|
}
|
|
545
2507
|
}
|
|
2508
|
+
/**
|
|
2509
|
+
* Render `html` with `css` applied, embedding `font_bytes` for the
|
|
2510
|
+
* body text. The font must cover every codepoint used by `html` or
|
|
2511
|
+
* unknown glyphs fall back to `.notdef`. See
|
|
2512
|
+
* [`Self::from_html_css_with_fonts`] for a multi-font cascade.
|
|
2513
|
+
* @param {string} html
|
|
2514
|
+
* @param {string} css
|
|
2515
|
+
* @param {Uint8Array} font_bytes
|
|
2516
|
+
* @returns {WasmPdf}
|
|
2517
|
+
*/
|
|
2518
|
+
static fromHtmlCss(html, css, font_bytes) {
|
|
2519
|
+
try {
|
|
2520
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2521
|
+
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2523
|
+
const ptr1 = passStringToWasm0(css, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2524
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2525
|
+
const ptr2 = passArray8ToWasm0(font_bytes, wasm.__wbindgen_export);
|
|
2526
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2527
|
+
wasm.wasmpdf_fromHtmlCss(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2528
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2529
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2530
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2531
|
+
if (r2) {
|
|
2532
|
+
throw takeObject(r1);
|
|
2533
|
+
}
|
|
2534
|
+
return WasmPdf.__wrap(r0);
|
|
2535
|
+
} finally {
|
|
2536
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Render `html` + `css` with a multi-font cascade. `families` and
|
|
2541
|
+
* `fonts` are parallel arrays: `families[i]` names the CSS
|
|
2542
|
+
* `font-family` that resolves to `fonts[i]` bytes. The first entry
|
|
2543
|
+
* is the default used whenever a CSS `font-family` doesn't match a
|
|
2544
|
+
* registered family.
|
|
2545
|
+
* @param {string} html
|
|
2546
|
+
* @param {string} css
|
|
2547
|
+
* @param {string[]} families
|
|
2548
|
+
* @param {Uint8Array[]} fonts
|
|
2549
|
+
* @returns {WasmPdf}
|
|
2550
|
+
*/
|
|
2551
|
+
static fromHtmlCssWithFonts(html, css, families, fonts) {
|
|
2552
|
+
try {
|
|
2553
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2554
|
+
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2555
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2556
|
+
const ptr1 = passStringToWasm0(css, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2557
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2558
|
+
const ptr2 = passArrayJsValueToWasm0(families, wasm.__wbindgen_export);
|
|
2559
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2560
|
+
const ptr3 = passArrayJsValueToWasm0(fonts, wasm.__wbindgen_export);
|
|
2561
|
+
const len3 = WASM_VECTOR_LEN;
|
|
2562
|
+
wasm.wasmpdf_fromHtmlCssWithFonts(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2563
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2564
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2565
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2566
|
+
if (r2) {
|
|
2567
|
+
throw takeObject(r1);
|
|
2568
|
+
}
|
|
2569
|
+
return WasmPdf.__wrap(r0);
|
|
2570
|
+
} finally {
|
|
2571
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
546
2574
|
/**
|
|
547
2575
|
* Create a PDF from image bytes (PNG, JPEG, etc.).
|
|
548
2576
|
*
|
|
@@ -1527,6 +3555,28 @@ class WasmPdfDocument {
|
|
|
1527
3555
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1528
3556
|
}
|
|
1529
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Return warnings collected during the last form-flattening save.
|
|
3560
|
+
*
|
|
3561
|
+
* Each entry names a widget field that had no `/AP` appearance stream;
|
|
3562
|
+
* flattening such a field produces a blank rectangle.
|
|
3563
|
+
*
|
|
3564
|
+
* @returns Array of warning strings
|
|
3565
|
+
* @returns {string[]}
|
|
3566
|
+
*/
|
|
3567
|
+
flattenWarnings() {
|
|
3568
|
+
try {
|
|
3569
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3570
|
+
wasm.wasmpdfdocument_flattenWarnings(retptr, this.__wbg_ptr);
|
|
3571
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3572
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3573
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3574
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3575
|
+
return v1;
|
|
3576
|
+
} finally {
|
|
3577
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
1530
3580
|
/**
|
|
1531
3581
|
* Get annotations from a page.
|
|
1532
3582
|
*
|
|
@@ -1692,6 +3742,27 @@ class WasmPdfDocument {
|
|
|
1692
3742
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1693
3743
|
}
|
|
1694
3744
|
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Move a page within the document. Zero-based; `from_index` and
|
|
3747
|
+
* `to_index` refer to positions **before** the move, matching the
|
|
3748
|
+
* Python (`PyPdfDocument.move_page`) / Go (`DocumentEditor.MovePage`) /
|
|
3749
|
+
* C# contracts.
|
|
3750
|
+
* @param {number} from_index
|
|
3751
|
+
* @param {number} to_index
|
|
3752
|
+
*/
|
|
3753
|
+
movePage(from_index, to_index) {
|
|
3754
|
+
try {
|
|
3755
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3756
|
+
wasm.wasmpdfdocument_movePage(retptr, this.__wbg_ptr, from_index, to_index);
|
|
3757
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3758
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3759
|
+
if (r1) {
|
|
3760
|
+
throw takeObject(r0);
|
|
3761
|
+
}
|
|
3762
|
+
} finally {
|
|
3763
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
1695
3766
|
/**
|
|
1696
3767
|
* Load a PDF document from raw bytes.
|
|
1697
3768
|
*
|
|
@@ -2082,6 +4153,37 @@ class WasmPdfDocument {
|
|
|
2082
4153
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2083
4154
|
}
|
|
2084
4155
|
}
|
|
4156
|
+
/**
|
|
4157
|
+
* Save with options (compress, garbage_collect, linearize) and return bytes.
|
|
4158
|
+
*
|
|
4159
|
+
* @param {Object} [options] - Optional save options.
|
|
4160
|
+
* @param {boolean} [options.compress=true] - Compress raw streams with FlateDecode.
|
|
4161
|
+
* @param {boolean} [options.garbageCollect=true] - Remove unreachable objects.
|
|
4162
|
+
* @param {boolean} [options.linearize=false] - Linearize (reserved, no-op).
|
|
4163
|
+
* @returns Uint8Array containing the modified PDF
|
|
4164
|
+
* @param {boolean | null} [compress]
|
|
4165
|
+
* @param {boolean | null} [garbage_collect]
|
|
4166
|
+
* @param {boolean | null} [linearize]
|
|
4167
|
+
* @returns {Uint8Array}
|
|
4168
|
+
*/
|
|
4169
|
+
saveWithOptions(compress, garbage_collect, linearize) {
|
|
4170
|
+
try {
|
|
4171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4172
|
+
wasm.wasmpdfdocument_saveWithOptions(retptr, this.__wbg_ptr, isLikeNone(compress) ? 0xFFFFFF : compress ? 1 : 0, isLikeNone(garbage_collect) ? 0xFFFFFF : garbage_collect ? 1 : 0, isLikeNone(linearize) ? 0xFFFFFF : linearize ? 1 : 0);
|
|
4173
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4174
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4175
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4176
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4177
|
+
if (r3) {
|
|
4178
|
+
throw takeObject(r2);
|
|
4179
|
+
}
|
|
4180
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
4181
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
4182
|
+
return v1;
|
|
4183
|
+
} finally {
|
|
4184
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
2085
4187
|
/**
|
|
2086
4188
|
* Search for text across all pages.
|
|
2087
4189
|
*
|
|
@@ -2295,33 +4397,77 @@ class WasmPdfDocument {
|
|
|
2295
4397
|
setSubject(subject) {
|
|
2296
4398
|
try {
|
|
2297
4399
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2298
|
-
const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2299
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2300
|
-
wasm.wasmpdfdocument_setSubject(retptr, this.__wbg_ptr, ptr0, len0);
|
|
4400
|
+
const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4402
|
+
wasm.wasmpdfdocument_setSubject(retptr, this.__wbg_ptr, ptr0, len0);
|
|
4403
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4404
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4405
|
+
if (r1) {
|
|
4406
|
+
throw takeObject(r0);
|
|
4407
|
+
}
|
|
4408
|
+
} finally {
|
|
4409
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
/**
|
|
4413
|
+
* Set the document title.
|
|
4414
|
+
* @param {string} title
|
|
4415
|
+
*/
|
|
4416
|
+
setTitle(title) {
|
|
4417
|
+
try {
|
|
4418
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4419
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4420
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4421
|
+
wasm.wasmpdfdocument_setTitle(retptr, this.__wbg_ptr, ptr0, len0);
|
|
4422
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4423
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4424
|
+
if (r1) {
|
|
4425
|
+
throw takeObject(r0);
|
|
4426
|
+
}
|
|
4427
|
+
} finally {
|
|
4428
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
/**
|
|
4432
|
+
* Count existing PDF signatures. Returns 0 when the document has
|
|
4433
|
+
* no AcroForm or no signed signature fields.
|
|
4434
|
+
* @returns {number}
|
|
4435
|
+
*/
|
|
4436
|
+
signatureCount() {
|
|
4437
|
+
try {
|
|
4438
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4439
|
+
wasm.wasmpdfdocument_signatureCount(retptr, this.__wbg_ptr);
|
|
2301
4440
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2302
4441
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2303
|
-
|
|
2304
|
-
|
|
4442
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4443
|
+
if (r2) {
|
|
4444
|
+
throw takeObject(r1);
|
|
2305
4445
|
}
|
|
4446
|
+
return r0 >>> 0;
|
|
2306
4447
|
} finally {
|
|
2307
4448
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2308
4449
|
}
|
|
2309
4450
|
}
|
|
2310
4451
|
/**
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
4452
|
+
* Enumerate existing PDF signatures. Each entry is a
|
|
4453
|
+
* `WasmSignature` (inspection-only) mirroring the C# and Python
|
|
4454
|
+
* Signature surfaces.
|
|
4455
|
+
* @returns {WasmSignature[]}
|
|
2313
4456
|
*/
|
|
2314
|
-
|
|
4457
|
+
signatures() {
|
|
2315
4458
|
try {
|
|
2316
4459
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2317
|
-
|
|
2318
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2319
|
-
wasm.wasmpdfdocument_setTitle(retptr, this.__wbg_ptr, ptr0, len0);
|
|
4460
|
+
wasm.wasmpdfdocument_signatures(retptr, this.__wbg_ptr);
|
|
2320
4461
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2321
4462
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2322
|
-
|
|
2323
|
-
|
|
4463
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4464
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4465
|
+
if (r3) {
|
|
4466
|
+
throw takeObject(r2);
|
|
2324
4467
|
}
|
|
4468
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
4469
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
4470
|
+
return v1;
|
|
2325
4471
|
} finally {
|
|
2326
4472
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2327
4473
|
}
|
|
@@ -2623,24 +4769,263 @@ class WasmPdfDocument {
|
|
|
2623
4769
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2624
4770
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2625
4771
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2626
|
-
if (r2) {
|
|
2627
|
-
throw takeObject(r1);
|
|
4772
|
+
if (r2) {
|
|
4773
|
+
throw takeObject(r1);
|
|
4774
|
+
}
|
|
4775
|
+
return WasmPdfPageRegion.__wrap(r0);
|
|
4776
|
+
} finally {
|
|
4777
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
/**
|
|
4781
|
+
* Get XMP metadata from the document.
|
|
4782
|
+
*
|
|
4783
|
+
* @returns Object with XMP fields (dc_title, dc_creator, etc.) or null if no XMP
|
|
4784
|
+
* @returns {any}
|
|
4785
|
+
*/
|
|
4786
|
+
xmpMetadata() {
|
|
4787
|
+
try {
|
|
4788
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4789
|
+
wasm.wasmpdfdocument_xmpMetadata(retptr, this.__wbg_ptr);
|
|
4790
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4791
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4792
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4793
|
+
if (r2) {
|
|
4794
|
+
throw takeObject(r1);
|
|
4795
|
+
}
|
|
4796
|
+
return takeObject(r0);
|
|
4797
|
+
} finally {
|
|
4798
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
if (Symbol.dispose) WasmPdfDocument.prototype[Symbol.dispose] = WasmPdfDocument.prototype.free;
|
|
4803
|
+
exports.WasmPdfDocument = WasmPdfDocument;
|
|
4804
|
+
|
|
4805
|
+
/**
|
|
4806
|
+
* A focused view of a PDF page region for scoped extraction (v0.3.14).
|
|
4807
|
+
*/
|
|
4808
|
+
class WasmPdfPageRegion {
|
|
4809
|
+
static __wrap(ptr) {
|
|
4810
|
+
ptr = ptr >>> 0;
|
|
4811
|
+
const obj = Object.create(WasmPdfPageRegion.prototype);
|
|
4812
|
+
obj.__wbg_ptr = ptr;
|
|
4813
|
+
WasmPdfPageRegionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4814
|
+
return obj;
|
|
4815
|
+
}
|
|
4816
|
+
__destroy_into_raw() {
|
|
4817
|
+
const ptr = this.__wbg_ptr;
|
|
4818
|
+
this.__wbg_ptr = 0;
|
|
4819
|
+
WasmPdfPageRegionFinalization.unregister(this);
|
|
4820
|
+
return ptr;
|
|
4821
|
+
}
|
|
4822
|
+
free() {
|
|
4823
|
+
const ptr = this.__destroy_into_raw();
|
|
4824
|
+
wasm.__wbg_wasmpdfpageregion_free(ptr, 0);
|
|
4825
|
+
}
|
|
4826
|
+
/**
|
|
4827
|
+
* Extract character-level data from this region.
|
|
4828
|
+
* @returns {any}
|
|
4829
|
+
*/
|
|
4830
|
+
extractChars() {
|
|
4831
|
+
try {
|
|
4832
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4833
|
+
wasm.wasmpdfpageregion_extractChars(retptr, this.__wbg_ptr);
|
|
4834
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4835
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4836
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4837
|
+
if (r2) {
|
|
4838
|
+
throw takeObject(r1);
|
|
4839
|
+
}
|
|
4840
|
+
return takeObject(r0);
|
|
4841
|
+
} finally {
|
|
4842
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4843
|
+
}
|
|
4844
|
+
}
|
|
4845
|
+
/**
|
|
4846
|
+
* Extract images from this region.
|
|
4847
|
+
* @returns {any}
|
|
4848
|
+
*/
|
|
4849
|
+
extractImages() {
|
|
4850
|
+
try {
|
|
4851
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4852
|
+
wasm.wasmpdfpageregion_extractImages(retptr, this.__wbg_ptr);
|
|
4853
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4854
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4855
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4856
|
+
if (r2) {
|
|
4857
|
+
throw takeObject(r1);
|
|
4858
|
+
}
|
|
4859
|
+
return takeObject(r0);
|
|
4860
|
+
} finally {
|
|
4861
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
/**
|
|
4865
|
+
* Extract straight lines from this region.
|
|
4866
|
+
* @returns {any}
|
|
4867
|
+
*/
|
|
4868
|
+
extractLines() {
|
|
4869
|
+
try {
|
|
4870
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4871
|
+
wasm.wasmpdfpageregion_extractLines(retptr, this.__wbg_ptr);
|
|
4872
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4873
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4874
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4875
|
+
if (r2) {
|
|
4876
|
+
throw takeObject(r1);
|
|
4877
|
+
}
|
|
4878
|
+
return takeObject(r0);
|
|
4879
|
+
} finally {
|
|
4880
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
/**
|
|
4884
|
+
* Extract vector paths from this region.
|
|
4885
|
+
* @returns {any}
|
|
4886
|
+
*/
|
|
4887
|
+
extractPaths() {
|
|
4888
|
+
try {
|
|
4889
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4890
|
+
wasm.wasmpdfpageregion_extractPaths(retptr, this.__wbg_ptr);
|
|
4891
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4892
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4893
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4894
|
+
if (r2) {
|
|
4895
|
+
throw takeObject(r1);
|
|
4896
|
+
}
|
|
4897
|
+
return takeObject(r0);
|
|
4898
|
+
} finally {
|
|
4899
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4900
|
+
}
|
|
4901
|
+
}
|
|
4902
|
+
/**
|
|
4903
|
+
* Extract rectangles from this region.
|
|
4904
|
+
* @returns {any}
|
|
4905
|
+
*/
|
|
4906
|
+
extractRects() {
|
|
4907
|
+
try {
|
|
4908
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4909
|
+
wasm.wasmpdfpageregion_extractRects(retptr, this.__wbg_ptr);
|
|
4910
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4911
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4912
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4913
|
+
if (r2) {
|
|
4914
|
+
throw takeObject(r1);
|
|
4915
|
+
}
|
|
4916
|
+
return takeObject(r0);
|
|
4917
|
+
} finally {
|
|
4918
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
/**
|
|
4922
|
+
* Extract tables from this region.
|
|
4923
|
+
* @returns {any}
|
|
4924
|
+
*/
|
|
4925
|
+
extractTables() {
|
|
4926
|
+
try {
|
|
4927
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4928
|
+
wasm.wasmpdfpageregion_extractTables(retptr, this.__wbg_ptr);
|
|
4929
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4930
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4931
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4932
|
+
if (r2) {
|
|
4933
|
+
throw takeObject(r1);
|
|
4934
|
+
}
|
|
4935
|
+
return takeObject(r0);
|
|
4936
|
+
} finally {
|
|
4937
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
/**
|
|
4941
|
+
* Extract text from this region.
|
|
4942
|
+
* @returns {string}
|
|
4943
|
+
*/
|
|
4944
|
+
extractText() {
|
|
4945
|
+
let deferred2_0;
|
|
4946
|
+
let deferred2_1;
|
|
4947
|
+
try {
|
|
4948
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4949
|
+
wasm.wasmpdfpageregion_extractText(retptr, this.__wbg_ptr);
|
|
4950
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4951
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4952
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4953
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4954
|
+
var ptr1 = r0;
|
|
4955
|
+
var len1 = r1;
|
|
4956
|
+
if (r3) {
|
|
4957
|
+
ptr1 = 0; len1 = 0;
|
|
4958
|
+
throw takeObject(r2);
|
|
4959
|
+
}
|
|
4960
|
+
deferred2_0 = ptr1;
|
|
4961
|
+
deferred2_1 = len1;
|
|
4962
|
+
return getStringFromWasm0(ptr1, len1);
|
|
4963
|
+
} finally {
|
|
4964
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4965
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
4966
|
+
}
|
|
4967
|
+
}
|
|
4968
|
+
/**
|
|
4969
|
+
* Extract text lines from this region.
|
|
4970
|
+
* @returns {any}
|
|
4971
|
+
*/
|
|
4972
|
+
extractTextLines() {
|
|
4973
|
+
try {
|
|
4974
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4975
|
+
wasm.wasmpdfpageregion_extractTextLines(retptr, this.__wbg_ptr);
|
|
4976
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4977
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4978
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4979
|
+
if (r2) {
|
|
4980
|
+
throw takeObject(r1);
|
|
4981
|
+
}
|
|
4982
|
+
return takeObject(r0);
|
|
4983
|
+
} finally {
|
|
4984
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
/**
|
|
4988
|
+
* Extract text using OCR from this region.
|
|
4989
|
+
* @param {WasmOcrEngine | null} [_engine]
|
|
4990
|
+
* @returns {string}
|
|
4991
|
+
*/
|
|
4992
|
+
extractTextOcr(_engine) {
|
|
4993
|
+
let deferred3_0;
|
|
4994
|
+
let deferred3_1;
|
|
4995
|
+
try {
|
|
4996
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4997
|
+
let ptr0 = 0;
|
|
4998
|
+
if (!isLikeNone(_engine)) {
|
|
4999
|
+
_assertClass(_engine, WasmOcrEngine);
|
|
5000
|
+
ptr0 = _engine.__destroy_into_raw();
|
|
5001
|
+
}
|
|
5002
|
+
wasm.wasmpdfpageregion_extractTextOcr(retptr, this.__wbg_ptr, ptr0);
|
|
5003
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5004
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5005
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
5006
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
5007
|
+
var ptr2 = r0;
|
|
5008
|
+
var len2 = r1;
|
|
5009
|
+
if (r3) {
|
|
5010
|
+
ptr2 = 0; len2 = 0;
|
|
5011
|
+
throw takeObject(r2);
|
|
2628
5012
|
}
|
|
2629
|
-
|
|
5013
|
+
deferred3_0 = ptr2;
|
|
5014
|
+
deferred3_1 = len2;
|
|
5015
|
+
return getStringFromWasm0(ptr2, len2);
|
|
2630
5016
|
} finally {
|
|
2631
5017
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5018
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
2632
5019
|
}
|
|
2633
5020
|
}
|
|
2634
5021
|
/**
|
|
2635
|
-
*
|
|
2636
|
-
*
|
|
2637
|
-
* @returns Object with XMP fields (dc_title, dc_creator, etc.) or null if no XMP
|
|
5022
|
+
* Extract words from this region.
|
|
2638
5023
|
* @returns {any}
|
|
2639
5024
|
*/
|
|
2640
|
-
|
|
5025
|
+
extractWords() {
|
|
2641
5026
|
try {
|
|
2642
5027
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2643
|
-
wasm.
|
|
5028
|
+
wasm.wasmpdfpageregion_extractWords(retptr, this.__wbg_ptr);
|
|
2644
5029
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2645
5030
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2646
5031
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2653,247 +5038,367 @@ class WasmPdfDocument {
|
|
|
2653
5038
|
}
|
|
2654
5039
|
}
|
|
2655
5040
|
}
|
|
2656
|
-
if (Symbol.dispose)
|
|
2657
|
-
exports.
|
|
5041
|
+
if (Symbol.dispose) WasmPdfPageRegion.prototype[Symbol.dispose] = WasmPdfPageRegion.prototype.free;
|
|
5042
|
+
exports.WasmPdfPageRegion = WasmPdfPageRegion;
|
|
2658
5043
|
|
|
2659
5044
|
/**
|
|
2660
|
-
* A
|
|
5045
|
+
* A single existing PDF signature surfaced by
|
|
5046
|
+
* `WasmPdfDocument.signatures()`. `verify()` runs the RSA-PKCS#1 v1.5
|
|
5047
|
+
* signer-attributes check; `verifyDetached()` adds the
|
|
5048
|
+
* `messageDigest` content-hash check. RSA-PSS / ECDSA signers still
|
|
5049
|
+
* throw an `UnsupportedFeature`-mapped JS error.
|
|
2661
5050
|
*/
|
|
2662
|
-
class
|
|
5051
|
+
class WasmSignature {
|
|
2663
5052
|
static __wrap(ptr) {
|
|
2664
5053
|
ptr = ptr >>> 0;
|
|
2665
|
-
const obj = Object.create(
|
|
5054
|
+
const obj = Object.create(WasmSignature.prototype);
|
|
2666
5055
|
obj.__wbg_ptr = ptr;
|
|
2667
|
-
|
|
5056
|
+
WasmSignatureFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2668
5057
|
return obj;
|
|
2669
5058
|
}
|
|
2670
5059
|
__destroy_into_raw() {
|
|
2671
5060
|
const ptr = this.__wbg_ptr;
|
|
2672
5061
|
this.__wbg_ptr = 0;
|
|
2673
|
-
|
|
5062
|
+
WasmSignatureFinalization.unregister(this);
|
|
2674
5063
|
return ptr;
|
|
2675
5064
|
}
|
|
2676
5065
|
free() {
|
|
2677
5066
|
const ptr = this.__destroy_into_raw();
|
|
2678
|
-
wasm.
|
|
5067
|
+
wasm.__wbg_wasmsignature_free(ptr, 0);
|
|
2679
5068
|
}
|
|
2680
5069
|
/**
|
|
2681
|
-
*
|
|
2682
|
-
* @returns {
|
|
5070
|
+
* `/ContactInfo` entry from the signature dictionary, if present.
|
|
5071
|
+
* @returns {string | undefined}
|
|
2683
5072
|
*/
|
|
2684
|
-
|
|
5073
|
+
get contactInfo() {
|
|
2685
5074
|
try {
|
|
2686
5075
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2687
|
-
wasm.
|
|
5076
|
+
wasm.wasmsignature_contactInfo(retptr, this.__wbg_ptr);
|
|
2688
5077
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2689
5078
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2690
|
-
|
|
2691
|
-
if (
|
|
2692
|
-
|
|
5079
|
+
let v1;
|
|
5080
|
+
if (r0 !== 0) {
|
|
5081
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
5082
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2693
5083
|
}
|
|
2694
|
-
return
|
|
5084
|
+
return v1;
|
|
2695
5085
|
} finally {
|
|
2696
5086
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2697
5087
|
}
|
|
2698
5088
|
}
|
|
2699
5089
|
/**
|
|
2700
|
-
*
|
|
2701
|
-
*
|
|
5090
|
+
* True iff `/ByteRange` is a 4-element array covering the whole
|
|
5091
|
+
* document (i.e. the signature protects every byte of the file).
|
|
5092
|
+
* @returns {boolean}
|
|
2702
5093
|
*/
|
|
2703
|
-
|
|
5094
|
+
get coversWholeDocument() {
|
|
5095
|
+
const ret = wasm.wasmsignature_coversWholeDocument(this.__wbg_ptr);
|
|
5096
|
+
return ret !== 0;
|
|
5097
|
+
}
|
|
5098
|
+
/**
|
|
5099
|
+
* `/Location` entry from the signature dictionary, if present.
|
|
5100
|
+
* @returns {string | undefined}
|
|
5101
|
+
*/
|
|
5102
|
+
get location() {
|
|
2704
5103
|
try {
|
|
2705
5104
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2706
|
-
wasm.
|
|
5105
|
+
wasm.wasmsignature_location(retptr, this.__wbg_ptr);
|
|
2707
5106
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2708
5107
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2709
|
-
|
|
2710
|
-
if (
|
|
2711
|
-
|
|
5108
|
+
let v1;
|
|
5109
|
+
if (r0 !== 0) {
|
|
5110
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
5111
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2712
5112
|
}
|
|
2713
|
-
return
|
|
5113
|
+
return v1;
|
|
2714
5114
|
} finally {
|
|
2715
5115
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2716
5116
|
}
|
|
2717
5117
|
}
|
|
2718
5118
|
/**
|
|
2719
|
-
*
|
|
2720
|
-
* @returns {
|
|
5119
|
+
* `/Reason` entry from the signature dictionary, if present.
|
|
5120
|
+
* @returns {string | undefined}
|
|
2721
5121
|
*/
|
|
2722
|
-
|
|
5122
|
+
get reason() {
|
|
2723
5123
|
try {
|
|
2724
5124
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2725
|
-
wasm.
|
|
5125
|
+
wasm.wasmsignature_reason(retptr, this.__wbg_ptr);
|
|
2726
5126
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2727
5127
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2728
|
-
|
|
2729
|
-
if (
|
|
2730
|
-
|
|
5128
|
+
let v1;
|
|
5129
|
+
if (r0 !== 0) {
|
|
5130
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
5131
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2731
5132
|
}
|
|
2732
|
-
return
|
|
5133
|
+
return v1;
|
|
2733
5134
|
} finally {
|
|
2734
5135
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2735
5136
|
}
|
|
2736
5137
|
}
|
|
2737
5138
|
/**
|
|
2738
|
-
*
|
|
2739
|
-
* @returns {
|
|
5139
|
+
* `/Name` entry from the signature dictionary, if present.
|
|
5140
|
+
* @returns {string | undefined}
|
|
2740
5141
|
*/
|
|
2741
|
-
|
|
5142
|
+
get signerName() {
|
|
2742
5143
|
try {
|
|
2743
5144
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2744
|
-
wasm.
|
|
5145
|
+
wasm.wasmsignature_signerName(retptr, this.__wbg_ptr);
|
|
2745
5146
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2746
5147
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2747
|
-
|
|
2748
|
-
if (
|
|
2749
|
-
|
|
5148
|
+
let v1;
|
|
5149
|
+
if (r0 !== 0) {
|
|
5150
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
5151
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2750
5152
|
}
|
|
2751
|
-
return
|
|
5153
|
+
return v1;
|
|
2752
5154
|
} finally {
|
|
2753
5155
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2754
5156
|
}
|
|
2755
5157
|
}
|
|
2756
5158
|
/**
|
|
2757
|
-
*
|
|
2758
|
-
*
|
|
5159
|
+
* Unix epoch (seconds). `None` if the `/M` entry is missing or
|
|
5160
|
+
* unparseable.
|
|
5161
|
+
* @returns {bigint | undefined}
|
|
2759
5162
|
*/
|
|
2760
|
-
|
|
5163
|
+
get signingTime() {
|
|
2761
5164
|
try {
|
|
2762
5165
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2763
|
-
wasm.
|
|
5166
|
+
wasm.wasmsignature_signingTime(retptr, this.__wbg_ptr);
|
|
5167
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5168
|
+
var r2 = getDataViewMemory0().getBigInt64(retptr + 8 * 1, true);
|
|
5169
|
+
return r0 === 0 ? undefined : r2;
|
|
5170
|
+
} finally {
|
|
5171
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
/**
|
|
5175
|
+
* Run the RFC 5652 §5.4 signer-attributes crypto check. Today
|
|
5176
|
+
* this covers RSA-PKCS#1 v1.5 over SHA-1/256/384/512 — the
|
|
5177
|
+
* padding used by essentially every PDF signature.
|
|
5178
|
+
*
|
|
5179
|
+
* A `true` return proves the signer held the private key matching
|
|
5180
|
+
* the embedded certificate and that the signed-attribute bundle
|
|
5181
|
+
* is authentic. It does **not** verify the `messageDigest`
|
|
5182
|
+
* attribute against the document's byte-range content hash —
|
|
5183
|
+
* call `verifyDetached()` for that end-to-end check.
|
|
5184
|
+
*
|
|
5185
|
+
* Throws for RSA-PSS, ECDSA, unknown digest OIDs, or signatures
|
|
5186
|
+
* without signed_attrs.
|
|
5187
|
+
* @returns {boolean}
|
|
5188
|
+
*/
|
|
5189
|
+
verify() {
|
|
5190
|
+
try {
|
|
5191
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5192
|
+
wasm.wasmsignature_verify(retptr, this.__wbg_ptr);
|
|
2764
5193
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2765
5194
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2766
5195
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2767
5196
|
if (r2) {
|
|
2768
5197
|
throw takeObject(r1);
|
|
2769
5198
|
}
|
|
2770
|
-
return
|
|
5199
|
+
return r0 !== 0;
|
|
2771
5200
|
} finally {
|
|
2772
5201
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2773
5202
|
}
|
|
2774
5203
|
}
|
|
2775
5204
|
/**
|
|
2776
|
-
*
|
|
2777
|
-
*
|
|
5205
|
+
* End-to-end detached-signature verification. Runs both the
|
|
5206
|
+
* signer-attributes RSA-PKCS#1 v1.5 crypto check AND the RFC 5652
|
|
5207
|
+
* §11.2 `messageDigest` check against the segment of `pdfData`
|
|
5208
|
+
* this signature covers (extracted via `/ByteRange`).
|
|
5209
|
+
*
|
|
5210
|
+
* `pdfData` must be the full PDF file. A `true` result proves
|
|
5211
|
+
* both the signer is authentic and that the document's byte-range
|
|
5212
|
+
* content has not been altered since signing. `false` means one
|
|
5213
|
+
* of the two checks failed (wrong key or tampered content).
|
|
5214
|
+
*
|
|
5215
|
+
* Throws for RSA-PSS, ECDSA, unknown digest OIDs, or CMS blobs
|
|
5216
|
+
* missing `signed_attrs` / `messageDigest`.
|
|
5217
|
+
* @param {Uint8Array} pdf_data
|
|
5218
|
+
* @returns {boolean}
|
|
2778
5219
|
*/
|
|
2779
|
-
|
|
5220
|
+
verifyDetached(pdf_data) {
|
|
2780
5221
|
try {
|
|
2781
5222
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2782
|
-
|
|
5223
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
5224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5225
|
+
wasm.wasmsignature_verifyDetached(retptr, this.__wbg_ptr, ptr0, len0);
|
|
2783
5226
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2784
5227
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2785
5228
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2786
5229
|
if (r2) {
|
|
2787
5230
|
throw takeObject(r1);
|
|
2788
5231
|
}
|
|
2789
|
-
return
|
|
5232
|
+
return r0 !== 0;
|
|
2790
5233
|
} finally {
|
|
2791
5234
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2792
5235
|
}
|
|
2793
5236
|
}
|
|
5237
|
+
}
|
|
5238
|
+
if (Symbol.dispose) WasmSignature.prototype[Symbol.dispose] = WasmSignature.prototype.free;
|
|
5239
|
+
exports.WasmSignature = WasmSignature;
|
|
5240
|
+
|
|
5241
|
+
/**
|
|
5242
|
+
* RFC 3161 timestamp parsed from a DER TimeStampToken or bare
|
|
5243
|
+
* TSTInfo. Mirrors the C#, Go, and Python `Timestamp` surfaces.
|
|
5244
|
+
*/
|
|
5245
|
+
class WasmTimestamp {
|
|
5246
|
+
static __wrap(ptr) {
|
|
5247
|
+
ptr = ptr >>> 0;
|
|
5248
|
+
const obj = Object.create(WasmTimestamp.prototype);
|
|
5249
|
+
obj.__wbg_ptr = ptr;
|
|
5250
|
+
WasmTimestampFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
5251
|
+
return obj;
|
|
5252
|
+
}
|
|
5253
|
+
__destroy_into_raw() {
|
|
5254
|
+
const ptr = this.__wbg_ptr;
|
|
5255
|
+
this.__wbg_ptr = 0;
|
|
5256
|
+
WasmTimestampFinalization.unregister(this);
|
|
5257
|
+
return ptr;
|
|
5258
|
+
}
|
|
5259
|
+
free() {
|
|
5260
|
+
const ptr = this.__destroy_into_raw();
|
|
5261
|
+
wasm.__wbg_wasmtimestamp_free(ptr, 0);
|
|
5262
|
+
}
|
|
2794
5263
|
/**
|
|
2795
|
-
*
|
|
2796
|
-
*
|
|
5264
|
+
* Hash algorithm enum value (1=SHA1, 2=SHA256, 3=SHA384,
|
|
5265
|
+
* 4=SHA512, 0=unknown).
|
|
5266
|
+
* @returns {number}
|
|
2797
5267
|
*/
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
5268
|
+
get hashAlgorithm() {
|
|
5269
|
+
const ret = wasm.wasmtimestamp_hashAlgorithm(this.__wbg_ptr);
|
|
5270
|
+
return ret;
|
|
5271
|
+
}
|
|
5272
|
+
/**
|
|
5273
|
+
* Raw message-imprint hash bytes.
|
|
5274
|
+
* @returns {Uint8Array}
|
|
5275
|
+
*/
|
|
5276
|
+
get messageImprint() {
|
|
2801
5277
|
try {
|
|
2802
5278
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2803
|
-
wasm.
|
|
5279
|
+
wasm.wasmtimestamp_messageImprint(retptr, this.__wbg_ptr);
|
|
2804
5280
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2805
5281
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2806
|
-
var
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
var len1 = r1;
|
|
2810
|
-
if (r3) {
|
|
2811
|
-
ptr1 = 0; len1 = 0;
|
|
2812
|
-
throw takeObject(r2);
|
|
2813
|
-
}
|
|
2814
|
-
deferred2_0 = ptr1;
|
|
2815
|
-
deferred2_1 = len1;
|
|
2816
|
-
return getStringFromWasm0(ptr1, len1);
|
|
5282
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
5283
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
5284
|
+
return v1;
|
|
2817
5285
|
} finally {
|
|
2818
5286
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2819
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
2820
5287
|
}
|
|
2821
5288
|
}
|
|
2822
5289
|
/**
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
5290
|
+
* Parse a DER blob that may be either a full TimeStampToken or
|
|
5291
|
+
* the bare TSTInfo SEQUENCE.
|
|
5292
|
+
* @param {Uint8Array} data
|
|
5293
|
+
* @returns {WasmTimestamp}
|
|
2825
5294
|
*/
|
|
2826
|
-
|
|
5295
|
+
static parse(data) {
|
|
2827
5296
|
try {
|
|
2828
5297
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2829
|
-
|
|
5298
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
5299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5300
|
+
wasm.wasmtimestamp_parse(retptr, ptr0, len0);
|
|
2830
5301
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2831
5302
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2832
5303
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2833
5304
|
if (r2) {
|
|
2834
5305
|
throw takeObject(r1);
|
|
2835
5306
|
}
|
|
2836
|
-
return
|
|
5307
|
+
return WasmTimestamp.__wrap(r0);
|
|
2837
5308
|
} finally {
|
|
2838
5309
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2839
5310
|
}
|
|
2840
5311
|
}
|
|
2841
5312
|
/**
|
|
2842
|
-
*
|
|
2843
|
-
* @param {WasmOcrEngine | null} [_engine]
|
|
5313
|
+
* TSA policy OID in dotted-decimal form.
|
|
2844
5314
|
* @returns {string}
|
|
2845
5315
|
*/
|
|
2846
|
-
|
|
2847
|
-
let
|
|
2848
|
-
let
|
|
5316
|
+
get policyOid() {
|
|
5317
|
+
let deferred1_0;
|
|
5318
|
+
let deferred1_1;
|
|
2849
5319
|
try {
|
|
2850
5320
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2851
|
-
|
|
2852
|
-
if (!isLikeNone(_engine)) {
|
|
2853
|
-
_assertClass(_engine, WasmOcrEngine);
|
|
2854
|
-
ptr0 = _engine.__destroy_into_raw();
|
|
2855
|
-
}
|
|
2856
|
-
wasm.wasmpdfpageregion_extractTextOcr(retptr, this.__wbg_ptr, ptr0);
|
|
5321
|
+
wasm.wasmtimestamp_policyOid(retptr, this.__wbg_ptr);
|
|
2857
5322
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2858
5323
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
var len2 = r1;
|
|
2863
|
-
if (r3) {
|
|
2864
|
-
ptr2 = 0; len2 = 0;
|
|
2865
|
-
throw takeObject(r2);
|
|
2866
|
-
}
|
|
2867
|
-
deferred3_0 = ptr2;
|
|
2868
|
-
deferred3_1 = len2;
|
|
2869
|
-
return getStringFromWasm0(ptr2, len2);
|
|
5324
|
+
deferred1_0 = r0;
|
|
5325
|
+
deferred1_1 = r1;
|
|
5326
|
+
return getStringFromWasm0(r0, r1);
|
|
2870
5327
|
} finally {
|
|
2871
5328
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2872
|
-
wasm.__wbindgen_export4(
|
|
5329
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2873
5330
|
}
|
|
2874
5331
|
}
|
|
2875
5332
|
/**
|
|
2876
|
-
*
|
|
2877
|
-
* @returns {
|
|
5333
|
+
* Serial number as a hex string (no `0x` prefix).
|
|
5334
|
+
* @returns {string}
|
|
2878
5335
|
*/
|
|
2879
|
-
|
|
5336
|
+
get serial() {
|
|
5337
|
+
let deferred1_0;
|
|
5338
|
+
let deferred1_1;
|
|
2880
5339
|
try {
|
|
2881
5340
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2882
|
-
wasm.
|
|
5341
|
+
wasm.wasmtimestamp_serial(retptr, this.__wbg_ptr);
|
|
5342
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5343
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5344
|
+
deferred1_0 = r0;
|
|
5345
|
+
deferred1_1 = r1;
|
|
5346
|
+
return getStringFromWasm0(r0, r1);
|
|
5347
|
+
} finally {
|
|
5348
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5349
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
/**
|
|
5353
|
+
* Generation time as Unix epoch seconds.
|
|
5354
|
+
* @returns {bigint}
|
|
5355
|
+
*/
|
|
5356
|
+
get time() {
|
|
5357
|
+
const ret = wasm.wasmtimestamp_time(this.__wbg_ptr);
|
|
5358
|
+
return ret;
|
|
5359
|
+
}
|
|
5360
|
+
/**
|
|
5361
|
+
* TSA name from the token (may be empty).
|
|
5362
|
+
* @returns {string}
|
|
5363
|
+
*/
|
|
5364
|
+
get tsaName() {
|
|
5365
|
+
let deferred1_0;
|
|
5366
|
+
let deferred1_1;
|
|
5367
|
+
try {
|
|
5368
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5369
|
+
wasm.wasmtimestamp_tsaName(retptr, this.__wbg_ptr);
|
|
5370
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5371
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5372
|
+
deferred1_0 = r0;
|
|
5373
|
+
deferred1_1 = r1;
|
|
5374
|
+
return getStringFromWasm0(r0, r1);
|
|
5375
|
+
} finally {
|
|
5376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5377
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
5378
|
+
}
|
|
5379
|
+
}
|
|
5380
|
+
/**
|
|
5381
|
+
* Cryptographic verify — not yet implemented.
|
|
5382
|
+
* @returns {boolean}
|
|
5383
|
+
*/
|
|
5384
|
+
verify() {
|
|
5385
|
+
try {
|
|
5386
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5387
|
+
wasm.wasmtimestamp_verify(retptr, this.__wbg_ptr);
|
|
2883
5388
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2884
5389
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2885
5390
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2886
5391
|
if (r2) {
|
|
2887
5392
|
throw takeObject(r1);
|
|
2888
5393
|
}
|
|
2889
|
-
return
|
|
5394
|
+
return r0 !== 0;
|
|
2890
5395
|
} finally {
|
|
2891
5396
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2892
5397
|
}
|
|
2893
5398
|
}
|
|
2894
5399
|
}
|
|
2895
|
-
if (Symbol.dispose)
|
|
2896
|
-
exports.
|
|
5400
|
+
if (Symbol.dispose) WasmTimestamp.prototype[Symbol.dispose] = WasmTimestamp.prototype.free;
|
|
5401
|
+
exports.WasmTimestamp = WasmTimestamp;
|
|
2897
5402
|
|
|
2898
5403
|
/**
|
|
2899
5404
|
* Disable all pdf_oxide log output — convenience wrapper for
|
|
@@ -2938,6 +5443,44 @@ function setLogLevel(level) {
|
|
|
2938
5443
|
}
|
|
2939
5444
|
}
|
|
2940
5445
|
exports.setLogLevel = setLogLevel;
|
|
5446
|
+
|
|
5447
|
+
/**
|
|
5448
|
+
* Sign raw PDF bytes and return the signed PDF as a `Uint8Array`.
|
|
5449
|
+
*
|
|
5450
|
+
* `cert` must carry a private key (loaded via `Certificate.loadPem` or
|
|
5451
|
+
* `Certificate.loadPkcs12`).
|
|
5452
|
+
* @param {Uint8Array} pdf_data
|
|
5453
|
+
* @param {WasmCertificate} cert
|
|
5454
|
+
* @param {string | null} [reason]
|
|
5455
|
+
* @param {string | null} [location]
|
|
5456
|
+
* @returns {Uint8Array}
|
|
5457
|
+
*/
|
|
5458
|
+
function signPdfBytes(pdf_data, cert, reason, location) {
|
|
5459
|
+
try {
|
|
5460
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5461
|
+
const ptr0 = passArray8ToWasm0(pdf_data, wasm.__wbindgen_export);
|
|
5462
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5463
|
+
_assertClass(cert, WasmCertificate);
|
|
5464
|
+
var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5465
|
+
var len1 = WASM_VECTOR_LEN;
|
|
5466
|
+
var ptr2 = isLikeNone(location) ? 0 : passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5467
|
+
var len2 = WASM_VECTOR_LEN;
|
|
5468
|
+
wasm.signPdfBytes(retptr, ptr0, len0, cert.__wbg_ptr, ptr1, len1, ptr2, len2);
|
|
5469
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5470
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5471
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
5472
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
5473
|
+
if (r3) {
|
|
5474
|
+
throw takeObject(r2);
|
|
5475
|
+
}
|
|
5476
|
+
var v4 = getArrayU8FromWasm0(r0, r1).slice();
|
|
5477
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
5478
|
+
return v4;
|
|
5479
|
+
} finally {
|
|
5480
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
exports.signPdfBytes = signPdfBytes;
|
|
2941
5484
|
function __wbg_get_imports() {
|
|
2942
5485
|
const import0 = {
|
|
2943
5486
|
__proto__: null,
|
|
@@ -2945,6 +5488,10 @@ function __wbg_get_imports() {
|
|
|
2945
5488
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
2946
5489
|
return addHeapObject(ret);
|
|
2947
5490
|
},
|
|
5491
|
+
__wbg_Number_32bf70a599af1d4b: function(arg0) {
|
|
5492
|
+
const ret = Number(getObject(arg0));
|
|
5493
|
+
return ret;
|
|
5494
|
+
},
|
|
2948
5495
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
2949
5496
|
const ret = String(getObject(arg1));
|
|
2950
5497
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -2952,6 +5499,12 @@ function __wbg_get_imports() {
|
|
|
2952
5499
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2953
5500
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2954
5501
|
},
|
|
5502
|
+
__wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
|
|
5503
|
+
const v = getObject(arg1);
|
|
5504
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
5505
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
5506
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
5507
|
+
},
|
|
2955
5508
|
__wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
|
|
2956
5509
|
const v = getObject(arg0);
|
|
2957
5510
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
@@ -2964,6 +5517,14 @@ function __wbg_get_imports() {
|
|
|
2964
5517
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2965
5518
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2966
5519
|
},
|
|
5520
|
+
__wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
|
|
5521
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
5522
|
+
return ret;
|
|
5523
|
+
},
|
|
5524
|
+
__wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
|
|
5525
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
5526
|
+
return ret;
|
|
5527
|
+
},
|
|
2967
5528
|
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
2968
5529
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
2969
5530
|
return ret;
|
|
@@ -2985,6 +5546,10 @@ function __wbg_get_imports() {
|
|
|
2985
5546
|
const ret = getObject(arg0) === undefined;
|
|
2986
5547
|
return ret;
|
|
2987
5548
|
},
|
|
5549
|
+
__wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
|
|
5550
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
5551
|
+
return ret;
|
|
5552
|
+
},
|
|
2988
5553
|
__wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
|
|
2989
5554
|
const ret = getObject(arg0) == getObject(arg1);
|
|
2990
5555
|
return ret;
|
|
@@ -3039,7 +5604,7 @@ function __wbg_get_imports() {
|
|
|
3039
5604
|
const ret = Array.from(getObject(arg0));
|
|
3040
5605
|
return addHeapObject(ret);
|
|
3041
5606
|
},
|
|
3042
|
-
|
|
5607
|
+
__wbg_getRandomValues_ef12552bf5acd2fe: function() { return handleError(function (arg0, arg1) {
|
|
3043
5608
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
3044
5609
|
}, arguments); },
|
|
3045
5610
|
__wbg_getTime_da7c55f52b71e8c6: function(arg0) {
|
|
@@ -3062,6 +5627,10 @@ function __wbg_get_imports() {
|
|
|
3062
5627
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
3063
5628
|
return addHeapObject(ret);
|
|
3064
5629
|
},
|
|
5630
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
5631
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
5632
|
+
return addHeapObject(ret);
|
|
5633
|
+
},
|
|
3065
5634
|
__wbg_info_e1c3400f7bf783dc: function(arg0, arg1, arg2, arg3) {
|
|
3066
5635
|
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
3067
5636
|
},
|
|
@@ -3089,6 +5658,10 @@ function __wbg_get_imports() {
|
|
|
3089
5658
|
const ret = Array.isArray(getObject(arg0));
|
|
3090
5659
|
return ret;
|
|
3091
5660
|
},
|
|
5661
|
+
__wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
|
|
5662
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
5663
|
+
return ret;
|
|
5664
|
+
},
|
|
3092
5665
|
__wbg_iterator_013bc09ec998c2a7: function() {
|
|
3093
5666
|
const ret = Symbol.iterator;
|
|
3094
5667
|
return addHeapObject(ret);
|
|
@@ -3179,6 +5752,10 @@ function __wbg_get_imports() {
|
|
|
3179
5752
|
__wbg_warn_ad997e36628bd23a: function(arg0, arg1, arg2, arg3) {
|
|
3180
5753
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
3181
5754
|
},
|
|
5755
|
+
__wbg_wasmsignature_new: function(arg0) {
|
|
5756
|
+
const ret = WasmSignature.__wrap(arg0);
|
|
5757
|
+
return addHeapObject(ret);
|
|
5758
|
+
},
|
|
3182
5759
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
3183
5760
|
// Cast intrinsic for `F64 -> Externref`.
|
|
3184
5761
|
const ret = arg0;
|
|
@@ -3219,6 +5796,18 @@ const WasmArtifactFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3219
5796
|
const ArtifactStyleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3220
5797
|
? { register: () => {}, unregister: () => {} }
|
|
3221
5798
|
: new FinalizationRegistry(ptr => wasm.__wbg_artifactstyle_free(ptr >>> 0, 1));
|
|
5799
|
+
const WasmCertificateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5800
|
+
? { register: () => {}, unregister: () => {} }
|
|
5801
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcertificate_free(ptr >>> 0, 1));
|
|
5802
|
+
const WasmDocumentBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5803
|
+
? { register: () => {}, unregister: () => {} }
|
|
5804
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdocumentbuilder_free(ptr >>> 0, 1));
|
|
5805
|
+
const WasmEmbeddedFontFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5806
|
+
? { register: () => {}, unregister: () => {} }
|
|
5807
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmembeddedfont_free(ptr >>> 0, 1));
|
|
5808
|
+
const WasmFluentPageBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5809
|
+
? { register: () => {}, unregister: () => {} }
|
|
5810
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmfluentpagebuilder_free(ptr >>> 0, 1));
|
|
3222
5811
|
const WasmFooterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3223
5812
|
? { register: () => {}, unregister: () => {} }
|
|
3224
5813
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmfooter_free(ptr >>> 0, 1));
|
|
@@ -3243,6 +5832,15 @@ const WasmPdfDocumentFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
3243
5832
|
const WasmPdfPageRegionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3244
5833
|
? { register: () => {}, unregister: () => {} }
|
|
3245
5834
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpdfpageregion_free(ptr >>> 0, 1));
|
|
5835
|
+
const WasmSignatureFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5836
|
+
? { register: () => {}, unregister: () => {} }
|
|
5837
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsignature_free(ptr >>> 0, 1));
|
|
5838
|
+
const StreamingTableFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5839
|
+
? { register: () => {}, unregister: () => {} }
|
|
5840
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamingtable_free(ptr >>> 0, 1));
|
|
5841
|
+
const WasmTimestampFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5842
|
+
? { register: () => {}, unregister: () => {} }
|
|
5843
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtimestamp_free(ptr >>> 0, 1));
|
|
3246
5844
|
|
|
3247
5845
|
function addHeapObject(obj) {
|
|
3248
5846
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
@@ -3335,11 +5933,34 @@ function getArrayF32FromWasm0(ptr, len) {
|
|
|
3335
5933
|
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
3336
5934
|
}
|
|
3337
5935
|
|
|
5936
|
+
function getArrayI64FromWasm0(ptr, len) {
|
|
5937
|
+
ptr = ptr >>> 0;
|
|
5938
|
+
return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
5939
|
+
}
|
|
5940
|
+
|
|
5941
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
5942
|
+
ptr = ptr >>> 0;
|
|
5943
|
+
const mem = getDataViewMemory0();
|
|
5944
|
+
const result = [];
|
|
5945
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
5946
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
5947
|
+
}
|
|
5948
|
+
return result;
|
|
5949
|
+
}
|
|
5950
|
+
|
|
3338
5951
|
function getArrayU8FromWasm0(ptr, len) {
|
|
3339
5952
|
ptr = ptr >>> 0;
|
|
3340
5953
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
3341
5954
|
}
|
|
3342
5955
|
|
|
5956
|
+
let cachedBigInt64ArrayMemory0 = null;
|
|
5957
|
+
function getBigInt64ArrayMemory0() {
|
|
5958
|
+
if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
|
|
5959
|
+
cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
|
|
5960
|
+
}
|
|
5961
|
+
return cachedBigInt64ArrayMemory0;
|
|
5962
|
+
}
|
|
5963
|
+
|
|
3343
5964
|
let cachedDataViewMemory0 = null;
|
|
3344
5965
|
function getDataViewMemory0() {
|
|
3345
5966
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|