@2018kguo/recto 0.1.0 → 0.5.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.
Files changed (44) hide show
  1. package/dist/assets.d.ts +11 -6
  2. package/dist/assets.js +123 -42
  3. package/dist/document.d.ts +144 -2
  4. package/dist/document.js +163 -14
  5. package/dist/engine.d.ts +24 -9
  6. package/dist/engine.js +236 -49
  7. package/dist/errors.d.ts +4 -2
  8. package/dist/errors.js +4 -1
  9. package/dist/index.d.ts +12 -1
  10. package/dist/index.js +13 -0
  11. package/dist/pool-worker.d.ts +15 -0
  12. package/dist/pool-worker.js +65 -0
  13. package/dist/pool.d.ts +42 -0
  14. package/dist/pool.js +295 -0
  15. package/dist/ranged.d.ts +44 -9
  16. package/dist/ranged.js +571 -86
  17. package/package.json +2 -1
  18. package/wasm/FoxitDingbats.pfb +0 -0
  19. package/wasm/FoxitFixed.pfb +0 -0
  20. package/wasm/FoxitFixedBold.pfb +0 -0
  21. package/wasm/FoxitFixedBoldItalic.pfb +0 -0
  22. package/wasm/FoxitFixedItalic.pfb +0 -0
  23. package/wasm/FoxitSans.pfb +0 -0
  24. package/wasm/FoxitSansBold.pfb +0 -0
  25. package/wasm/FoxitSansBoldItalic.pfb +0 -0
  26. package/wasm/FoxitSansItalic.pfb +0 -0
  27. package/wasm/FoxitSerif.pfb +0 -0
  28. package/wasm/FoxitSerifBold.pfb +0 -0
  29. package/wasm/FoxitSerifBoldItalic.pfb +0 -0
  30. package/wasm/FoxitSerifItalic.pfb +0 -0
  31. package/wasm/FoxitSymbol.pfb +0 -0
  32. package/wasm/THIRD_PARTY_NOTICES +2 -158
  33. package/wasm/cmaps.deflate +0 -0
  34. package/wasm/pins.d.mts +1 -1
  35. package/wasm/pins.mjs +19 -3
  36. package/wasm/recto-more.wasm +0 -0
  37. package/wasm/recto-rare.wasm +0 -0
  38. package/wasm/recto-render.wasm +0 -0
  39. package/wasm/recto.gen.d.mts +2 -1
  40. package/wasm/recto.gen.mjs +213 -19
  41. package/wasm/recto.types.d.mts +83 -4
  42. package/wasm/recto.wasm +0 -0
  43. package/wasm/cmaps.brotli +0 -0
  44. package/wasm/fonts.bin +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2018kguo/recto",
3
- "version": "0.1.0",
3
+ "version": "0.5.0",
4
4
  "description": "A PDF engine for JavaScript: text with boxes, page objects, annotations and rendering, in Rust compiled to WebAssembly.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,6 +26,7 @@
26
26
  "types": "./dist/index.d.ts",
27
27
  "default": "./dist/index.js"
28
28
  },
29
+ "./wasm/*": "./wasm/*",
29
30
  "./package.json": "./package.json"
30
31
  },
31
32
  "files": [
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -198,7 +198,7 @@ Copyright (c) 2005-2008, The Android Open Source Project
198
198
  END OF TERMS AND CONDITIONS
199
199
 
200
200
  ==============================================================================
201
- Foxit fonts (fonts.bin)
201
+ Foxit fonts (Foxit*.pfb)
202
202
  ==============================================================================
203
203
 
204
204
  // Copyright 2014 PDFium Authors. All rights reserved.
@@ -230,7 +230,7 @@ Foxit fonts (fonts.bin)
230
230
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
231
231
 
232
232
  ==============================================================================
233
- Adobe CMap resources (cmaps.brotli)
233
+ Adobe CMap resources (cmaps.deflate)
234
234
  ==============================================================================
235
235
 
236
236
  Copyright 1990-2023 Adobe. All rights reserved.
@@ -862,34 +862,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
862
862
  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
863
863
  DEALINGS IN THE SOFTWARE.
864
864
 
865
- ==============================================================================
866
- fastrand 2.5.0 (compiled into recto.wasm; Apache-2.0 OR MIT)
867
- ==============================================================================
868
-
869
- Permission is hereby granted, free of charge, to any
870
- person obtaining a copy of this software and associated
871
- documentation files (the "Software"), to deal in the
872
- Software without restriction, including without
873
- limitation the rights to use, copy, modify, merge,
874
- publish, distribute, sublicense, and/or sell copies of
875
- the Software, and to permit persons to whom the Software
876
- is furnished to do so, subject to the following
877
- conditions:
878
-
879
- The above copyright notice and this permission notice
880
- shall be included in all copies or substantial portions
881
- of the Software.
882
-
883
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
884
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
885
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
886
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
887
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
888
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
889
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
890
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
891
- DEALINGS IN THE SOFTWARE.
892
-
893
865
  ==============================================================================
894
866
  fdeflate 0.3.7 (compiled into recto.wasm; MIT OR Apache-2.0)
895
867
  ==============================================================================
@@ -1544,106 +1516,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
1544
1516
  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1545
1517
  DEALINGS IN THE SOFTWARE.
1546
1518
 
1547
- ==============================================================================
1548
- phf 0.13.1 (compiled into recto.wasm; MIT)
1549
- ==============================================================================
1550
-
1551
- The MIT License (MIT)
1552
-
1553
- Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi
1554
-
1555
- Permission is hereby granted, free of charge, to any person obtaining a copy of
1556
- this software and associated documentation files (the "Software"), to deal in
1557
- the Software without restriction, including without limitation the rights to
1558
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1559
- the Software, and to permit persons to whom the Software is furnished to do so,
1560
- subject to the following conditions:
1561
-
1562
- The above copyright notice and this permission notice shall be included in all
1563
- copies or substantial portions of the Software.
1564
-
1565
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1566
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1567
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1568
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1569
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1570
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1571
-
1572
- ==============================================================================
1573
- phf_generator 0.13.1 (compiled into recto.wasm; MIT)
1574
- ==============================================================================
1575
-
1576
- The MIT License (MIT)
1577
-
1578
- Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi
1579
-
1580
- Permission is hereby granted, free of charge, to any person obtaining a copy of
1581
- this software and associated documentation files (the "Software"), to deal in
1582
- the Software without restriction, including without limitation the rights to
1583
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1584
- the Software, and to permit persons to whom the Software is furnished to do so,
1585
- subject to the following conditions:
1586
-
1587
- The above copyright notice and this permission notice shall be included in all
1588
- copies or substantial portions of the Software.
1589
-
1590
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1591
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1592
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1593
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1594
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1595
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1596
-
1597
- ==============================================================================
1598
- phf_macros 0.13.1 (compiled into recto.wasm; MIT)
1599
- ==============================================================================
1600
-
1601
- The MIT License (MIT)
1602
-
1603
- Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi
1604
-
1605
- Permission is hereby granted, free of charge, to any person obtaining a copy of
1606
- this software and associated documentation files (the "Software"), to deal in
1607
- the Software without restriction, including without limitation the rights to
1608
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1609
- the Software, and to permit persons to whom the Software is furnished to do so,
1610
- subject to the following conditions:
1611
-
1612
- The above copyright notice and this permission notice shall be included in all
1613
- copies or substantial portions of the Software.
1614
-
1615
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1617
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1618
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1619
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1620
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1621
-
1622
- ==============================================================================
1623
- phf_shared 0.13.1 (compiled into recto.wasm; MIT)
1624
- ==============================================================================
1625
-
1626
- The MIT License (MIT)
1627
-
1628
- Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi
1629
-
1630
- Permission is hereby granted, free of charge, to any person obtaining a copy of
1631
- this software and associated documentation files (the "Software"), to deal in
1632
- the Software without restriction, including without limitation the rights to
1633
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1634
- the Software, and to permit persons to whom the Software is furnished to do so,
1635
- subject to the following conditions:
1636
-
1637
- The above copyright notice and this permission notice shall be included in all
1638
- copies or substantial portions of the Software.
1639
-
1640
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1641
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1642
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1643
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1644
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1645
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1646
-
1647
1519
  ==============================================================================
1648
1520
  pic-scale 0.7.12 (compiled into recto.wasm; BSD-3-Clause OR Apache-2.0)
1649
1521
  ==============================================================================
@@ -2024,34 +1896,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
2024
1896
  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2025
1897
  DEALINGS IN THE SOFTWARE.
2026
1898
 
2027
- ==============================================================================
2028
- syn 2.0.119 (compiled into recto.wasm; MIT OR Apache-2.0)
2029
- ==============================================================================
2030
-
2031
- Permission is hereby granted, free of charge, to any
2032
- person obtaining a copy of this software and associated
2033
- documentation files (the "Software"), to deal in the
2034
- Software without restriction, including without
2035
- limitation the rights to use, copy, modify, merge,
2036
- publish, distribute, sublicense, and/or sell copies of
2037
- the Software, and to permit persons to whom the Software
2038
- is furnished to do so, subject to the following
2039
- conditions:
2040
-
2041
- The above copyright notice and this permission notice
2042
- shall be included in all copies or substantial portions
2043
- of the Software.
2044
-
2045
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
2046
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
2047
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
2048
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
2049
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
2050
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2051
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
2052
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2053
- DEALINGS IN THE SOFTWARE.
2054
-
2055
1899
  ==============================================================================
2056
1900
  syn 3.0.9 (compiled into recto.wasm; MIT OR Apache-2.0)
2057
1901
  ==============================================================================
Binary file
package/wasm/pins.d.mts CHANGED
@@ -1 +1 @@
1
- export declare const PINS: Record<"recto.wasm" | "fonts.bin" | "cjk-fallback.ttf" | "cmaps.brotli", string>;
1
+ export declare const PINS: Record<"recto.wasm" | "recto-render.wasm" | "recto-more.wasm" | "recto-rare.wasm" | "FoxitFixed.pfb" | "FoxitFixedBold.pfb" | "FoxitFixedBoldItalic.pfb" | "FoxitFixedItalic.pfb" | "FoxitSans.pfb" | "FoxitSansBold.pfb" | "FoxitSansBoldItalic.pfb" | "FoxitSansItalic.pfb" | "FoxitSerif.pfb" | "FoxitSerifBold.pfb" | "FoxitSerifBoldItalic.pfb" | "FoxitSerifItalic.pfb" | "FoxitSymbol.pfb" | "FoxitDingbats.pfb" | "cjk-fallback.ttf" | "cmaps.deflate", string>;
package/wasm/pins.mjs CHANGED
@@ -1,7 +1,23 @@
1
1
  // Generated by scripts/package-wasm.mjs.
2
2
  export const PINS = {
3
- "recto.wasm": "3d377c0a72a0f4d529cbae0b5d2b99fee7362485259a8f193fb99eff9c7277e4",
4
- "fonts.bin": "98b2cdac11db0a4b8b3fa8c308f0ca8dcd5a79a88a3e43ba1ba280149c0ae797",
3
+ "recto.wasm": "6ea5dcbefb46130b65af4e3e8abd4c36204ecff4beaa089960c5d24e58dd6345",
4
+ "recto-render.wasm": "903b95817bb9c23769db27cedf3a29a7b5d3dcff0c65fbe28c0d0191943d59b7",
5
+ "recto-more.wasm": "e612392af0129e4e2f9083605f56c1e39b6eca0e2c5fef6ee39b72849b384f9b",
6
+ "recto-rare.wasm": "da54f130b42290ff9ef8c0ba45a0f9f49545f038f3bcfa19c5ec75ac2e9f4e6e",
7
+ "FoxitFixed.pfb": "b6c8fe53f134b8b6d4578cd2d544df4cee9624c4efa8d51a560fb40ea296101b",
8
+ "FoxitFixedBold.pfb": "f1b7159702973f54fc86254ea38bcf3712b2a736eb3a0995751e9f4bb45ad603",
9
+ "FoxitFixedBoldItalic.pfb": "8a000945843bd31add06aee63bf9fd41b7578b4f3242a4b7cd46349ad9d24d4d",
10
+ "FoxitFixedItalic.pfb": "5007faf8320fa1fcc08b8894b356ad976f60b992ba29ee5272578bbdebaf3876",
11
+ "FoxitSans.pfb": "a02339e95d20db14cbdfc1c6baf359cd36a091d5434925c3a4040f60e1a1af9e",
12
+ "FoxitSansBold.pfb": "7bdfa36de1d5757dcfaf8b8a4be95c6e41c40fa70dbed9d78bf979a7b9959054",
13
+ "FoxitSansBoldItalic.pfb": "555ce45924338e2e4b32821910221ce85da691fd59a9723c4c971a7c5627fc8b",
14
+ "FoxitSansItalic.pfb": "7751cbefeda351708dae8c4a88db043411bc39ab2ae2097685da845d4d16f307",
15
+ "FoxitSerif.pfb": "4f57d2b9d884af8f907bf22df6019b52d86cbf6214fdbd02b1ae05472a543f35",
16
+ "FoxitSerifBold.pfb": "0bdf4b04e964139818d51eda03d566ba999fc3ba2421b1c6c51f9dc969022e80",
17
+ "FoxitSerifBoldItalic.pfb": "a406cac82583bf98175cb62c87ed5e95c45fbb34eece63a10b0a13e793cb2e10",
18
+ "FoxitSerifItalic.pfb": "610ae0687198045c4db5d1a6650fd5e92536631706382eb8b72e38df578d0ae9",
19
+ "FoxitSymbol.pfb": "47967d055530e7357088a08403115425643ec2cdfd6201ba8af0fbd7116c1539",
20
+ "FoxitDingbats.pfb": "845c752392b6c914fb989c75a08b7792b88f542d2499042ef2889f8c814a16ed",
5
21
  "cjk-fallback.ttf": "8a4dea0899424438af25a6f1f6eb61e5d111d85367eece0a5d30170861ae6b2e",
6
- "cmaps.brotli": "ddf37af521d904d5646c2fc37b2b7e912dc1b56f0d210190b61f598154758e46"
22
+ "cmaps.deflate": "4664ac3a868d2e255c961ed4d8be4b236d61f47ee0ce3d285355ab4af245d7df"
7
23
  };
Binary file
Binary file
Binary file
@@ -1,2 +1,3 @@
1
1
  import type * as Glue from "./recto.types.mjs";
2
- export declare function createGlue(): Pick<typeof Glue, "Annotations" | "Document" | "PageObjects" | "PageScan" | "PageText" | "RenderedPage" | "setAssetLoader" | "initSync">;
2
+ export declare function createGlue(placeholders: Record<string, object>, finalizing: (free: () => void) => void): Pick<typeof Glue, "Annotations" | "Document" | "PageObjects" | "PageScan" | "PageText" | "RenderTask" | "RenderedPage" | "setAssetLoader" | "setMaxDecodedBytes" | "sha256" | "initSync">;
3
+ export declare const PART_TABLE: string;
@@ -1,5 +1,5 @@
1
1
  // Generated by scripts/package-wasm.mjs from wasm-bindgen's glue.
2
- export function createGlue() {
2
+ export function createGlue(placeholders, finalizing) {
3
3
  /* @ts-self-types="./recto.d.ts" */
4
4
 
5
5
  /**
@@ -142,6 +142,36 @@ class Document {
142
142
  }
143
143
  return Annotations.__wrap(ret[0]);
144
144
  }
145
+ /**
146
+ * @returns {number}
147
+ */
148
+ fileLength() {
149
+ const ret = wasm.document_fileLength(this.__wbg_ptr);
150
+ return ret >>> 0;
151
+ }
152
+ /**
153
+ * Where the file is in this instance's memory, to reopen it on the full engine without a copy.
154
+ * @returns {number}
155
+ */
156
+ filePointer() {
157
+ const ret = wasm.document_filePointer(this.__wbg_ptr);
158
+ return ret >>> 0;
159
+ }
160
+ /**
161
+ * Flat, per link: `[annotation, x, y, width, height, kind, text, page, view, destX, destY,
162
+ * zoom, rectX, rectY, rectWidth, rectHeight, name]`, NaN for a number that isn't there.
163
+ * `kind` is "none", "uri", "page", "remote", "launch" or "action"; `text` is the URI, the
164
+ * file, or the action's `/S`; `name` a remote destination's name or a `Named` action's `/N`.
165
+ * @param {number} index
166
+ * @returns {Array<any>}
167
+ */
168
+ links(index) {
169
+ const ret = wasm.document_links(this.__wbg_ptr, index);
170
+ if (ret[2]) {
171
+ throw takeFromExternrefTable0(ret[1]);
172
+ }
173
+ return takeFromExternrefTable0(ret[0]);
174
+ }
145
175
  /**
146
176
  * @param {number} index
147
177
  * @returns {PageObjects}
@@ -159,7 +189,7 @@ class Document {
159
189
  * read them; it is called synchronously, chunk-aligned, at most 1 MiB.
160
190
  * @param {number} length
161
191
  * @param {number} chunk
162
- * @param {(offset: number, length: number) => Uint8Array | undefined} read
192
+ * @param {(offset: number, length: number, ahead: number) => Uint8Array | undefined} read
163
193
  * @param {string | null} [password]
164
194
  * @returns {Document}
165
195
  */
@@ -218,6 +248,14 @@ class Document {
218
248
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
219
249
  return v1;
220
250
  }
251
+ /**
252
+ * One string per page, or null if the file gives no labels.
253
+ * @returns {any}
254
+ */
255
+ pageLabels() {
256
+ const ret = wasm.document_pageLabels(this.__wbg_ptr);
257
+ return ret;
258
+ }
221
259
  /**
222
260
  * `PdfPageText` columns.
223
261
  * @param {number} index
@@ -231,13 +269,37 @@ class Document {
231
269
  return PageText.__wrap(ret[0]);
232
270
  }
233
271
  /**
272
+ * A render that returns to its caller between slices, for as long as it's asked to run.
273
+ * The region is x, y, width, height in the viewer frame, or NaNs for the whole page.
274
+ * @param {number} index
275
+ * @param {number} width
276
+ * @param {number} max_height
277
+ * @param {number} x
278
+ * @param {number} y
279
+ * @param {number} region_width
280
+ * @param {number} region_height
281
+ * @returns {RenderTask}
282
+ */
283
+ renderTask(index, width, max_height, x, y, region_width, region_height) {
284
+ const ret = wasm.document_renderTask(this.__wbg_ptr, index, width, max_height, x, y, region_width, region_height);
285
+ if (ret[2]) {
286
+ throw takeFromExternrefTable0(ret[1]);
287
+ }
288
+ return RenderTask.__wrap(ret[0]);
289
+ }
290
+ /**
291
+ * The region as `renderTask`'s.
234
292
  * @param {number} index
235
293
  * @param {number} width
236
294
  * @param {number} max_height
295
+ * @param {number} x
296
+ * @param {number} y
297
+ * @param {number} region_width
298
+ * @param {number} region_height
237
299
  * @returns {RenderedPage}
238
300
  */
239
- render(index, width, max_height) {
240
- const ret = wasm.document_render(this.__wbg_ptr, index, width, max_height);
301
+ render(index, width, max_height, x, y, region_width, region_height) {
302
+ const ret = wasm.document_render(this.__wbg_ptr, index, width, max_height, x, y, region_width, region_height);
241
303
  if (ret[2]) {
242
304
  throw takeFromExternrefTable0(ret[1]);
243
305
  }
@@ -255,6 +317,16 @@ class Document {
255
317
  }
256
318
  return PageScan.__wrap(ret[0]);
257
319
  }
320
+ /**
321
+ * `[pages, pageLabels, outline]`: whether a limit cut each short.
322
+ * @returns {Uint8Array}
323
+ */
324
+ structureTruncated() {
325
+ const ret = wasm.document_structureTruncated(this.__wbg_ptr);
326
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
327
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
328
+ return v1;
329
+ }
258
330
  /**
259
331
  * Text and annotations (no objects).
260
332
  * @param {number} index
@@ -648,6 +720,43 @@ class PageText {
648
720
  }
649
721
  if (Symbol.dispose) PageText.prototype[Symbol.dispose] = PageText.prototype.free;
650
722
 
723
+ class RenderTask {
724
+ static __wrap(ptr) {
725
+ const obj = Object.create(RenderTask.prototype);
726
+ obj.__wbg_ptr = ptr;
727
+ RenderTaskFinalization.register(obj, obj.__wbg_ptr, obj);
728
+ return obj;
729
+ }
730
+ __destroy_into_raw() {
731
+ const ptr = this.__wbg_ptr;
732
+ this.__wbg_ptr = 0;
733
+ RenderTaskFinalization.unregister(this);
734
+ return ptr;
735
+ }
736
+ free() {
737
+ const ptr = this.__destroy_into_raw();
738
+ wasm.__wbg_rendertask_free(ptr, 0);
739
+ }
740
+ /**
741
+ * Rasterizes what `step` drew: the rest of the page, in one call.
742
+ * @returns {RenderedPage}
743
+ */
744
+ finish() {
745
+ const ret = wasm.rendertask_finish(this.__wbg_ptr);
746
+ return RenderedPage.__wrap(ret);
747
+ }
748
+ /**
749
+ * Runs for about `budget_ms`; true once the page's content is done.
750
+ * @param {number} budget_ms
751
+ * @returns {boolean}
752
+ */
753
+ step(budget_ms) {
754
+ const ret = wasm.rendertask_step(this.__wbg_ptr, budget_ms);
755
+ return ret !== 0;
756
+ }
757
+ }
758
+ if (Symbol.dispose) RenderTask.prototype[Symbol.dispose] = RenderTask.prototype.free;
759
+
651
760
  class RenderedPage {
652
761
  static __wrap(ptr) {
653
762
  const obj = Object.create(RenderedPage.prototype);
@@ -672,6 +781,20 @@ class RenderedPage {
672
781
  const ret = wasm.__wbg_get_renderedpage_height(this.__wbg_ptr);
673
782
  return ret >>> 0;
674
783
  }
784
+ /**
785
+ * @returns {number}
786
+ */
787
+ get pageHeight() {
788
+ const ret = wasm.__wbg_get_renderedpage_pageHeight(this.__wbg_ptr);
789
+ return ret >>> 0;
790
+ }
791
+ /**
792
+ * @returns {number}
793
+ */
794
+ get pageWidth() {
795
+ const ret = wasm.__wbg_get_renderedpage_pageWidth(this.__wbg_ptr);
796
+ return ret >>> 0;
797
+ }
675
798
  /**
676
799
  * @returns {boolean}
677
800
  */
@@ -686,6 +809,21 @@ class RenderedPage {
686
809
  const ret = wasm.__wbg_get_renderedpage_width(this.__wbg_ptr);
687
810
  return ret >>> 0;
688
811
  }
812
+ /**
813
+ * Where it is in the page's bitmap, and that bitmap's size: see `Bitmap`.
814
+ * @returns {number}
815
+ */
816
+ get x() {
817
+ const ret = wasm.__wbg_get_renderedpage_x(this.__wbg_ptr);
818
+ return ret >>> 0;
819
+ }
820
+ /**
821
+ * @returns {number}
822
+ */
823
+ get y() {
824
+ const ret = wasm.__wbg_get_renderedpage_y(this.__wbg_ptr);
825
+ return ret >>> 0;
826
+ }
689
827
  /**
690
828
  * Moves the pixels out; call once.
691
829
  * @returns {Uint8Array}
@@ -702,6 +840,18 @@ class RenderedPage {
702
840
  set height(arg0) {
703
841
  wasm.__wbg_set_renderedpage_height(this.__wbg_ptr, arg0);
704
842
  }
843
+ /**
844
+ * @param {number} arg0
845
+ */
846
+ set pageHeight(arg0) {
847
+ wasm.__wbg_set_renderedpage_pageHeight(this.__wbg_ptr, arg0);
848
+ }
849
+ /**
850
+ * @param {number} arg0
851
+ */
852
+ set pageWidth(arg0) {
853
+ wasm.__wbg_set_renderedpage_pageWidth(this.__wbg_ptr, arg0);
854
+ }
705
855
  /**
706
856
  * @param {boolean} arg0
707
857
  */
@@ -714,23 +864,59 @@ class RenderedPage {
714
864
  set width(arg0) {
715
865
  wasm.__wbg_set_renderedpage_width(this.__wbg_ptr, arg0);
716
866
  }
867
+ /**
868
+ * Where it is in the page's bitmap, and that bitmap's size: see `Bitmap`.
869
+ * @param {number} arg0
870
+ */
871
+ set x(arg0) {
872
+ wasm.__wbg_set_renderedpage_x(this.__wbg_ptr, arg0);
873
+ }
874
+ /**
875
+ * @param {number} arg0
876
+ */
877
+ set y(arg0) {
878
+ wasm.__wbg_set_renderedpage_y(this.__wbg_ptr, arg0);
879
+ }
717
880
  }
718
881
  if (Symbol.dispose) RenderedPage.prototype[Symbol.dispose] = RenderedPage.prototype.free;
719
882
 
720
883
  /**
721
884
  * The host's asset loader: `(index) => Uint8Array | undefined`, called
722
885
  * synchronously the first time a document needs a built-in font (0..13,
723
- * `fonts.bin` order), the CJK fallback (14) or the predefined CMaps (15).
886
+ * `STANDARD_FONTS` order), the CJK fallback (14) or the predefined CMaps (15).
724
887
  * Fonts are kept per instance; the CMaps are decompressed once and kept.
725
888
  * @param {Function} loader
726
889
  */
727
890
  function setAssetLoader(loader) {
728
891
  wasm.setAssetLoader(loader);
729
892
  }
893
+
894
+ /**
895
+ * The most bytes one stream may decode to and one image hold, for this instance: past it, it's left
896
+ * out and the page's results say `truncated`.
897
+ * @param {number} bytes
898
+ */
899
+ function setMaxDecodedBytes(bytes) {
900
+ wasm.setMaxDecodedBytes(bytes);
901
+ }
902
+
903
+ /**
904
+ * SHA-256, for the JavaScript side's checks on large assets it read synchronously.
905
+ * @param {Uint8Array} bytes
906
+ * @returns {Uint8Array}
907
+ */
908
+ function sha256(bytes) {
909
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
910
+ const len0 = WASM_VECTOR_LEN;
911
+ const ret = wasm.sha256(ptr0, len0);
912
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
913
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
914
+ return v2;
915
+ }
730
916
  function __wbg_get_imports() {
731
917
  const import0 = {
732
918
  __proto__: null,
733
- __wbg_Error_c1f57494f0e0f78b: function(arg0, arg1) {
919
+ __wbg_Error_ac777cef8e847b72: function(arg0, arg1) {
734
920
  const ret = Error(getStringFromWasm0(arg0, arg1));
735
921
  return ret;
736
922
  },
@@ -745,14 +931,14 @@ function __wbg_get_imports() {
745
931
  __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
746
932
  throw new Error(getStringFromWasm0(arg0, arg1));
747
933
  },
748
- __wbg_call_1875a20c43a36133: function() { return handleError(function (arg0, arg1, arg2, arg3) {
749
- const ret = arg0.call(arg1, arg2, arg3);
750
- return ret;
751
- }, arguments); },
752
934
  __wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
753
935
  const ret = arg0.call(arg1, arg2);
754
936
  return ret;
755
937
  }, arguments); },
938
+ __wbg_call_939a2607c4484b0b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
939
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
940
+ return ret;
941
+ }, arguments); },
756
942
  __wbg_length_7f3c00c40364105e: function(arg0) {
757
943
  const ret = arg0.length;
758
944
  return ret;
@@ -765,6 +951,10 @@ function __wbg_get_imports() {
765
951
  const ret = new Array();
766
952
  return ret;
767
953
  },
954
+ __wbg_now_aa4ccb83129e9e55: function() {
955
+ const ret = Date.now();
956
+ return ret;
957
+ },
768
958
  __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
769
959
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
770
960
  },
@@ -772,7 +962,7 @@ function __wbg_get_imports() {
772
962
  const ret = arg0.push(arg1);
773
963
  return ret;
774
964
  },
775
- __wbg_set_e4e464ef2e7b25d9: function() { return handleError(function (arg0, arg1, arg2) {
965
+ __wbg_set_0fd79ff56b8778a4: function() { return handleError(function (arg0, arg1, arg2) {
776
966
  const ret = Reflect.set(arg0, arg1, arg2);
777
967
  return ret;
778
968
  }, arguments); },
@@ -798,28 +988,31 @@ function __wbg_get_imports() {
798
988
  };
799
989
  return {
800
990
  __proto__: null,
801
- "./recto_bg.js": import0,
991
+ "./recto_bg.js": import0, ...placeholders,
802
992
  };
803
993
  }
804
994
 
805
995
  const AnnotationsFinalization = (typeof FinalizationRegistry === 'undefined')
806
996
  ? { register: () => {}, unregister: () => {} }
807
- : new FinalizationRegistry(ptr => wasm.__wbg_annotations_free(ptr, 1));
997
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_annotations_free(ptr, 1)));
808
998
  const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
809
999
  ? { register: () => {}, unregister: () => {} }
810
- : new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr, 1));
1000
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_document_free(ptr, 1)));
811
1001
  const PageObjectsFinalization = (typeof FinalizationRegistry === 'undefined')
812
1002
  ? { register: () => {}, unregister: () => {} }
813
- : new FinalizationRegistry(ptr => wasm.__wbg_pageobjects_free(ptr, 1));
1003
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_pageobjects_free(ptr, 1)));
814
1004
  const PageScanFinalization = (typeof FinalizationRegistry === 'undefined')
815
1005
  ? { register: () => {}, unregister: () => {} }
816
- : new FinalizationRegistry(ptr => wasm.__wbg_pagescan_free(ptr, 1));
1006
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_pagescan_free(ptr, 1)));
817
1007
  const PageTextFinalization = (typeof FinalizationRegistry === 'undefined')
818
1008
  ? { register: () => {}, unregister: () => {} }
819
- : new FinalizationRegistry(ptr => wasm.__wbg_pagetext_free(ptr, 1));
1009
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_pagetext_free(ptr, 1)));
1010
+ const RenderTaskFinalization = (typeof FinalizationRegistry === 'undefined')
1011
+ ? { register: () => {}, unregister: () => {} }
1012
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_rendertask_free(ptr, 1)));
820
1013
  const RenderedPageFinalization = (typeof FinalizationRegistry === 'undefined')
821
1014
  ? { register: () => {}, unregister: () => {} }
822
- : new FinalizationRegistry(ptr => wasm.__wbg_renderedpage_free(ptr, 1));
1015
+ : new FinalizationRegistry(ptr => finalizing(() => wasm.__wbg_renderedpage_free(ptr, 1)));
823
1016
 
824
1017
  function addToExternrefTable0(obj) {
825
1018
  const idx = wasm.__externref_table_alloc();
@@ -1093,5 +1286,6 @@ async function __wbg_init(module_or_path) {
1093
1286
 
1094
1287
 
1095
1288
 
1096
- return { Annotations, Document, PageObjects, PageScan, PageText, RenderedPage, setAssetLoader, initSync };
1289
+ return { Annotations, Document, PageObjects, PageScan, PageText, RenderTask, RenderedPage, setAssetLoader, setMaxDecodedBytes, sha256, initSync };
1097
1290
  }
1291
+ export const PART_TABLE = "%c";