@laminapdf/wasm 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lamina_pdf_base.d.ts +1178 -16
- package/dist/lamina_pdf_base.js +140 -0
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +1511 -34
- package/dist/lamina_pdf_extract.js +284 -0
- package/dist/lamina_pdf_extract.wasm +0 -0
- package/dist/lamina_pdf_render_hayro.wasm +0 -0
- package/dist/lamina_pdf_text.d.ts +1513 -36
- package/dist/lamina_pdf_text.js +284 -0
- package/dist/lamina_pdf_text.wasm +0 -0
- package/dist/lamina_pdf_tiff.d.ts +71 -0
- package/dist/lamina_pdf_tiff.js +259 -0
- package/dist/lamina_pdf_tiff.wasm +0 -0
- package/package.json +6 -1
package/dist/lamina_pdf_text.js
CHANGED
|
@@ -311,6 +311,29 @@ export class WasmDocument {
|
|
|
311
311
|
wasm.__wbg_wasmdocument_free(ptr, 0);
|
|
312
312
|
|
|
313
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Adds another PDF as a source document: `{ id, pages }`, its ID (64 hex digits, the
|
|
316
|
+
* SHA-256 of `bytes`) and its page IDs in order. An encrypted one opens with `password`,
|
|
317
|
+
* which no op ever holds.
|
|
318
|
+
*
|
|
319
|
+
* # Errors
|
|
320
|
+
* `wrong-password`, `password-required`, and the errors of a file that doesn't open.
|
|
321
|
+
* @param {Uint8Array} bytes
|
|
322
|
+
* @param {string | null} [password]
|
|
323
|
+
* @returns {{ id: string; pages: string[] }}
|
|
324
|
+
*/
|
|
325
|
+
addSource(bytes, password) {
|
|
326
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
327
|
+
const len0 = WASM_VECTOR_LEN;
|
|
328
|
+
var ptr1 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
329
|
+
var len1 = WASM_VECTOR_LEN;
|
|
330
|
+
let ret;
|
|
331
|
+
ret = wasm.wasmdocument_addSource(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
332
|
+
if (ret[2]) {
|
|
333
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
334
|
+
}
|
|
335
|
+
return takeFromExternrefTable0(ret[0]);
|
|
336
|
+
}
|
|
314
337
|
/**
|
|
315
338
|
* Makes `bytes`, the whole output of `saveCopy`, the document's saved file (it rebases onto
|
|
316
339
|
* them), once they are written where the document lives; `historyCleared` is the copy's
|
|
@@ -365,6 +388,24 @@ export class WasmDocument {
|
|
|
365
388
|
}
|
|
366
389
|
return takeFromExternrefTable0(ret[0]);
|
|
367
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* `view` (page space) on page `page` as the destination the outline and named-destination
|
|
393
|
+
* ops take, in the page's user space (the extract and text modules).
|
|
394
|
+
*
|
|
395
|
+
* # Errors
|
|
396
|
+
* `invalid-argument` for a view that isn't one; `page-index-out-of-range`; reading errors.
|
|
397
|
+
* @param {number} page
|
|
398
|
+
* @param {TargetViewJs} view
|
|
399
|
+
* @returns {ExplicitDestination}
|
|
400
|
+
*/
|
|
401
|
+
destinationAt(page, view) {
|
|
402
|
+
let ret;
|
|
403
|
+
ret = wasm.wasmdocument_destinationAt(this.__wbg_ptr, page, view);
|
|
404
|
+
if (ret[2]) {
|
|
405
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
406
|
+
}
|
|
407
|
+
return takeFromExternrefTable0(ret[0]);
|
|
408
|
+
}
|
|
368
409
|
/**
|
|
369
410
|
* An extraction stepped a page at a time, whose models the host runs: each step returns
|
|
370
411
|
* its progress, with the result it waits for under `request` (render that page at `dpi`,
|
|
@@ -384,6 +425,23 @@ export class WasmDocument {
|
|
|
384
425
|
}
|
|
385
426
|
return WasmExtractJob.__wrap(ret[0]);
|
|
386
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* A new document of `pages` of this one, in the order given.
|
|
430
|
+
*
|
|
431
|
+
* # Errors
|
|
432
|
+
* `invalid-argument` for a value that isn't a list of page IDs, `unknown-page`; reading
|
|
433
|
+
* errors.
|
|
434
|
+
* @param {string[]} pages
|
|
435
|
+
* @returns {WasmDocument}
|
|
436
|
+
*/
|
|
437
|
+
extractPages(pages) {
|
|
438
|
+
let ret;
|
|
439
|
+
ret = wasm.wasmdocument_extractPages(this.__wbg_ptr, pages);
|
|
440
|
+
if (ret[2]) {
|
|
441
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
442
|
+
}
|
|
443
|
+
return WasmDocument.__wrap(ret[0]);
|
|
444
|
+
}
|
|
387
445
|
/**
|
|
388
446
|
* The document's text for retrieval and LLMs, as one string: Markdown, plain text, the
|
|
389
447
|
* `laminapdf.extract/1` JSON, or the chunks as a JSON array (the extract and text modules).
|
|
@@ -437,6 +495,21 @@ export class WasmDocument {
|
|
|
437
495
|
}
|
|
438
496
|
return takeFromExternrefTable0(ret[0]);
|
|
439
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* How the document asks to be shown when it opens (the extract and text modules).
|
|
500
|
+
*
|
|
501
|
+
* # Errors
|
|
502
|
+
* `data-pending` and the reading errors.
|
|
503
|
+
* @returns {InitialViewJs}
|
|
504
|
+
*/
|
|
505
|
+
initialView() {
|
|
506
|
+
let ret;
|
|
507
|
+
ret = wasm.wasmdocument_initialView(this.__wbg_ptr);
|
|
508
|
+
if (ret[2]) {
|
|
509
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
510
|
+
}
|
|
511
|
+
return takeFromExternrefTable0(ret[0]);
|
|
512
|
+
}
|
|
440
513
|
/**
|
|
441
514
|
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
442
515
|
* @returns {boolean}
|
|
@@ -461,6 +534,26 @@ export class WasmDocument {
|
|
|
461
534
|
}
|
|
462
535
|
return ret[0] !== 0;
|
|
463
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* A new document of `inputs` (each `{ bytes, password?, title? }`) one after another,
|
|
539
|
+
* with their bookmarks, named destinations, form fields, layers and page labels; `options`
|
|
540
|
+
* as `mergeDocuments`' (`outline`, `fields`).
|
|
541
|
+
*
|
|
542
|
+
* # Errors
|
|
543
|
+
* `invalid-argument` / `unknown-option` for bad values, `wrong-password`,
|
|
544
|
+
* `password-required`, and the errors of a file that doesn't open.
|
|
545
|
+
* @param {{ bytes: Uint8Array; password?: string; title?: string }[]} inputs
|
|
546
|
+
* @param {MergeOptions | undefined} options
|
|
547
|
+
* @returns {WasmDocument}
|
|
548
|
+
*/
|
|
549
|
+
static merge(inputs, options) {
|
|
550
|
+
let ret;
|
|
551
|
+
ret = wasm.wasmdocument_merge(inputs, options);
|
|
552
|
+
if (ret[2]) {
|
|
553
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
554
|
+
}
|
|
555
|
+
return WasmDocument.__wrap(ret[0]);
|
|
556
|
+
}
|
|
464
557
|
/**
|
|
465
558
|
* The document's metadata, read from Info and XMP together, with the fields where they
|
|
466
559
|
* disagree.
|
|
@@ -496,6 +589,21 @@ export class WasmDocument {
|
|
|
496
589
|
}
|
|
497
590
|
return takeFromExternrefTable0(ret[0]);
|
|
498
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Every named destination, sorted by name (the extract and text modules).
|
|
594
|
+
*
|
|
595
|
+
* # Errors
|
|
596
|
+
* `data-pending` and the reading errors.
|
|
597
|
+
* @returns {NamedDestinationJs[]}
|
|
598
|
+
*/
|
|
599
|
+
namedDestinations() {
|
|
600
|
+
let ret;
|
|
601
|
+
ret = wasm.wasmdocument_namedDestinations(this.__wbg_ptr);
|
|
602
|
+
if (ret[2]) {
|
|
603
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
604
|
+
}
|
|
605
|
+
return takeFromExternrefTable0(ret[0]);
|
|
606
|
+
}
|
|
499
607
|
/**
|
|
500
608
|
* Opens a document from its bytes.
|
|
501
609
|
*
|
|
@@ -552,6 +660,23 @@ export class WasmDocument {
|
|
|
552
660
|
}
|
|
553
661
|
return takeFromExternrefTable0(ret[0]);
|
|
554
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* The annotations on page `index`, in the order of its `/Annots`, every subtype included
|
|
665
|
+
* (the extract and text modules).
|
|
666
|
+
*
|
|
667
|
+
* # Errors
|
|
668
|
+
* `page-index-out-of-range`, `data-pending` and the reading errors.
|
|
669
|
+
* @param {number} index
|
|
670
|
+
* @returns {PageAnnotationJs[]}
|
|
671
|
+
*/
|
|
672
|
+
pageAnnotations(index) {
|
|
673
|
+
let ret;
|
|
674
|
+
ret = wasm.wasmdocument_pageAnnotations(this.__wbg_ptr, index);
|
|
675
|
+
if (ret[2]) {
|
|
676
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
677
|
+
}
|
|
678
|
+
return takeFromExternrefTable0(ret[0]);
|
|
679
|
+
}
|
|
555
680
|
/**
|
|
556
681
|
* A handle on the page with `id` (`p12.0`).
|
|
557
682
|
*
|
|
@@ -760,6 +885,26 @@ export class WasmDocument {
|
|
|
760
885
|
}
|
|
761
886
|
return takeFromExternrefTable0(ret[0]);
|
|
762
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* This document cut into new ones: `{ count: n }` parts of `n` pages, `{ ranges: [[id, …],
|
|
890
|
+
* …] }` one part per list of page IDs, or `{ bookmarks: level }` a part from each bookmark
|
|
891
|
+
* at that depth (1: the top level). Each part carries what its pages reach and the
|
|
892
|
+
* bookmarks that go to them.
|
|
893
|
+
*
|
|
894
|
+
* # Errors
|
|
895
|
+
* `invalid-argument` / `unknown-option` for a value that isn't one of those, `unknown-page`,
|
|
896
|
+
* `no-pages-left` for an empty list; reading errors.
|
|
897
|
+
* @param {{ readonly count: number } | { readonly ranges: readonly (readonly string[])[] } | { readonly bookmarks: number }} by
|
|
898
|
+
* @returns {WasmDocument[]}
|
|
899
|
+
*/
|
|
900
|
+
split(by) {
|
|
901
|
+
let ret;
|
|
902
|
+
ret = wasm.wasmdocument_split(this.__wbg_ptr, by);
|
|
903
|
+
if (ret[2]) {
|
|
904
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
905
|
+
}
|
|
906
|
+
return takeFromExternrefTable0(ret[0]);
|
|
907
|
+
}
|
|
763
908
|
/**
|
|
764
909
|
* The structure tree's top-level elements in reading order, or `undefined` without one (the
|
|
765
910
|
* extract and text modules, beside `WasmPage.text`, whose runs it links by MCID).
|
|
@@ -776,6 +921,21 @@ export class WasmDocument {
|
|
|
776
921
|
}
|
|
777
922
|
return takeFromExternrefTable0(ret[0]);
|
|
778
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* The document's article threads; empty without any (the extract and text modules).
|
|
926
|
+
*
|
|
927
|
+
* # Errors
|
|
928
|
+
* `data-pending` and the reading errors.
|
|
929
|
+
* @returns {ThreadJs[]}
|
|
930
|
+
*/
|
|
931
|
+
threads() {
|
|
932
|
+
let ret;
|
|
933
|
+
ret = wasm.wasmdocument_threads(this.__wbg_ptr);
|
|
934
|
+
if (ret[2]) {
|
|
935
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
936
|
+
}
|
|
937
|
+
return takeFromExternrefTable0(ret[0]);
|
|
938
|
+
}
|
|
779
939
|
/**
|
|
780
940
|
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
781
941
|
* there is nothing to undo.
|
|
@@ -817,6 +977,21 @@ export class WasmDocument {
|
|
|
817
977
|
}
|
|
818
978
|
return takeFromExternrefTable0(ret[0]);
|
|
819
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* The document's XMP packet as text, with the edits made so far.
|
|
982
|
+
*
|
|
983
|
+
* # Errors
|
|
984
|
+
* Reading errors.
|
|
985
|
+
* @returns {XmpTextJs}
|
|
986
|
+
*/
|
|
987
|
+
xmpPacket() {
|
|
988
|
+
let ret;
|
|
989
|
+
ret = wasm.wasmdocument_xmpPacket(this.__wbg_ptr);
|
|
990
|
+
if (ret[2]) {
|
|
991
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
992
|
+
}
|
|
993
|
+
return takeFromExternrefTable0(ret[0]);
|
|
994
|
+
}
|
|
820
995
|
}
|
|
821
996
|
if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
|
|
822
997
|
|
|
@@ -1107,6 +1282,44 @@ export class WasmImage {
|
|
|
1107
1282
|
}
|
|
1108
1283
|
if (Symbol.dispose) WasmImage.prototype[Symbol.dispose] = WasmImage.prototype.free;
|
|
1109
1284
|
|
|
1285
|
+
/**
|
|
1286
|
+
* The images of [`images_to_pdf`], in page order. Images are JavaScript-owned objects, which a
|
|
1287
|
+
* record can't carry, so they are added one by one.
|
|
1288
|
+
*/
|
|
1289
|
+
export class WasmImageList {
|
|
1290
|
+
__destroy_into_raw() {
|
|
1291
|
+
const ptr = this.__wbg_ptr;
|
|
1292
|
+
this.__wbg_ptr = 0;
|
|
1293
|
+
WasmImageListFinalization.unregister(this);
|
|
1294
|
+
return ptr;
|
|
1295
|
+
}
|
|
1296
|
+
free() {
|
|
1297
|
+
const ptr = this.__destroy_into_raw();
|
|
1298
|
+
wasm.__wbg_wasmimagelist_free(ptr, 0);
|
|
1299
|
+
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* An empty list.
|
|
1303
|
+
*/
|
|
1304
|
+
constructor() {
|
|
1305
|
+
let ret;
|
|
1306
|
+
ret = wasm.wasmimagelist_new();
|
|
1307
|
+
this.__wbg_ptr = ret;
|
|
1308
|
+
Object.defineProperty(this, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
1309
|
+
WasmImageListFinalization.register(this, { ptr: ret, instance: __wbg_instance_id }, this);
|
|
1310
|
+
return this;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Adds `image` as the next page. The image stays usable: the list holds its own copy.
|
|
1314
|
+
* @param {WasmImage} image
|
|
1315
|
+
*/
|
|
1316
|
+
push(image) {
|
|
1317
|
+
_assertClass(image, WasmImage);
|
|
1318
|
+
wasm.wasmimagelist_push(this.__wbg_ptr, image.__wbg_ptr);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
if (Symbol.dispose) WasmImageList.prototype[Symbol.dispose] = WasmImageList.prototype.free;
|
|
1322
|
+
|
|
1110
1323
|
/**
|
|
1111
1324
|
* The fonts and images of a Markdown build, by role and by the target the Markdown names.
|
|
1112
1325
|
*/
|
|
@@ -1973,6 +2186,27 @@ export function hasText() {
|
|
|
1973
2186
|
return ret !== 0;
|
|
1974
2187
|
}
|
|
1975
2188
|
|
|
2189
|
+
/**
|
|
2190
|
+
* A new document with one page per image of `images`, in order: a JPEG embedded as it is, a PNG
|
|
2191
|
+
* with its transparency, each drawn the way up its EXIF orientation says.
|
|
2192
|
+
*
|
|
2193
|
+
* # Errors
|
|
2194
|
+
* `invalid-geometry` for no images, a negative margin or resolution, or a page too small for its
|
|
2195
|
+
* margins; `unknown-option`, `invalid-argument` for bad options.
|
|
2196
|
+
* @param {WasmImageList} images
|
|
2197
|
+
* @param {ImagesOptionsInit | undefined} options
|
|
2198
|
+
* @returns {WasmDocument}
|
|
2199
|
+
*/
|
|
2200
|
+
export function imagesToPdf(images, options) {
|
|
2201
|
+
_assertClass(images, WasmImageList);
|
|
2202
|
+
let ret;
|
|
2203
|
+
ret = wasm.imagesToPdf(images.__wbg_ptr, options);
|
|
2204
|
+
if (ret[2]) {
|
|
2205
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2206
|
+
}
|
|
2207
|
+
return WasmDocument.__wrap(ret[0]);
|
|
2208
|
+
}
|
|
2209
|
+
|
|
1976
2210
|
/**
|
|
1977
2211
|
* The crate version (`@laminapdf/wasm`'s).
|
|
1978
2212
|
* @returns {string}
|
|
@@ -2017,14 +2251,48 @@ function __wbg_get_imports() {
|
|
|
2017
2251
|
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
2018
2252
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2019
2253
|
},
|
|
2254
|
+
__wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
|
|
2255
|
+
const ret = Reflect.get(arg0, arg1);
|
|
2256
|
+
return ret;
|
|
2257
|
+
}, arguments); },
|
|
2258
|
+
__wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
|
|
2259
|
+
const ret = arg0[arg1 >>> 0];
|
|
2260
|
+
return ret;
|
|
2261
|
+
},
|
|
2262
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
2263
|
+
let result;
|
|
2264
|
+
try {
|
|
2265
|
+
result = arg0 instanceof Uint8Array;
|
|
2266
|
+
} catch (_) {
|
|
2267
|
+
result = false;
|
|
2268
|
+
}
|
|
2269
|
+
const ret = result;
|
|
2270
|
+
return ret;
|
|
2271
|
+
},
|
|
2272
|
+
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
2273
|
+
const ret = Array.isArray(arg0);
|
|
2274
|
+
return ret;
|
|
2275
|
+
},
|
|
2020
2276
|
__wbg_keys_440be172f17c0265: function(arg0) {
|
|
2021
2277
|
const ret = Object.keys(arg0);
|
|
2022
2278
|
return ret;
|
|
2023
2279
|
},
|
|
2280
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
2281
|
+
const ret = arg0.length;
|
|
2282
|
+
return ret;
|
|
2283
|
+
},
|
|
2284
|
+
__wbg_length_d4bdea10311bd9cf: function(arg0) {
|
|
2285
|
+
const ret = arg0.length;
|
|
2286
|
+
return ret;
|
|
2287
|
+
},
|
|
2024
2288
|
__wbg_new_617a8cdb8bb1130e: function() {
|
|
2025
2289
|
const ret = new Object();
|
|
2026
2290
|
return ret;
|
|
2027
2291
|
},
|
|
2292
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
2293
|
+
const ret = new Array();
|
|
2294
|
+
return ret;
|
|
2295
|
+
},
|
|
2028
2296
|
__wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
|
|
2029
2297
|
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
2030
2298
|
return ret;
|
|
@@ -2045,6 +2313,13 @@ function __wbg_get_imports() {
|
|
|
2045
2313
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
2046
2314
|
return ret;
|
|
2047
2315
|
}, arguments); },
|
|
2316
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
2317
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
2318
|
+
},
|
|
2319
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
2320
|
+
const ret = arg0.push(arg1);
|
|
2321
|
+
return ret;
|
|
2322
|
+
},
|
|
2048
2323
|
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2049
2324
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
2050
2325
|
return ret;
|
|
@@ -2060,6 +2335,10 @@ function __wbg_get_imports() {
|
|
|
2060
2335
|
const ret = JSON.stringify(arg0);
|
|
2061
2336
|
return ret;
|
|
2062
2337
|
}, arguments); },
|
|
2338
|
+
__wbg_wasmdocument_new: function(arg0) {
|
|
2339
|
+
const ret = WasmDocument.__wrap(arg0);
|
|
2340
|
+
return ret;
|
|
2341
|
+
},
|
|
2063
2342
|
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
2064
2343
|
// Cast intrinsic for `F64 -> Externref`.
|
|
2065
2344
|
const ret = arg0;
|
|
@@ -2125,6 +2404,11 @@ const WasmImageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2125
2404
|
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
2126
2405
|
if (instance === __wbg_instance_id) wasm.__wbg_wasmimage_free(ptr, 1);
|
|
2127
2406
|
});
|
|
2407
|
+
const WasmImageListFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2408
|
+
? { register: () => {}, unregister: () => {} }
|
|
2409
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
2410
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmimagelist_free(ptr, 1);
|
|
2411
|
+
});
|
|
2128
2412
|
const WasmMarkdownOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2129
2413
|
? { register: () => {}, unregister: () => {} }
|
|
2130
2414
|
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
Binary file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A TIFF file being written, one page per [`TiffFile::add_page`].
|
|
6
|
+
*/
|
|
7
|
+
export class TiffFile {
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Adds a page of `width` × `height` straight RGBA pixels, row by row, drawn at `dpi`.
|
|
12
|
+
*
|
|
13
|
+
* # Errors
|
|
14
|
+
* `invalid-argument` when `rgba` isn't `width × height × 4` bytes, `dpi` isn't
|
|
15
|
+
* positive, or the file is finished; `export-failed` if the encoder fails.
|
|
16
|
+
*/
|
|
17
|
+
addPage(width: number, height: number, rgba: Uint8Array, dpi: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* The file's bytes. The file is finished: it takes no more pages.
|
|
20
|
+
*
|
|
21
|
+
* # Errors
|
|
22
|
+
* `invalid-argument` when it was already finished.
|
|
23
|
+
*/
|
|
24
|
+
finish(): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* An empty file.
|
|
27
|
+
*
|
|
28
|
+
* # Errors
|
|
29
|
+
* `export-failed` if the encoder can't write the file's header.
|
|
30
|
+
*/
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
35
|
+
|
|
36
|
+
export interface InitOutput {
|
|
37
|
+
readonly memory: WebAssembly.Memory;
|
|
38
|
+
readonly __wbg_tifffile_free: (a: number, b: number) => void;
|
|
39
|
+
readonly tifffile_addPage: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
40
|
+
readonly tifffile_finish: (a: number) => [number, number, number, number];
|
|
41
|
+
readonly tifffile_new: () => [number, number, number];
|
|
42
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
43
|
+
readonly __externref_table_alloc: () => number;
|
|
44
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
45
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
46
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
47
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
48
|
+
readonly __wbindgen_start: () => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
55
|
+
* a precompiled `WebAssembly.Module`.
|
|
56
|
+
*
|
|
57
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
58
|
+
*
|
|
59
|
+
* @returns {InitOutput}
|
|
60
|
+
*/
|
|
61
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
65
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
66
|
+
*
|
|
67
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
68
|
+
*
|
|
69
|
+
* @returns {Promise<InitOutput>}
|
|
70
|
+
*/
|
|
71
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|