@laminapdf/wasm 0.2.0-alpha.6 → 0.2.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/README.md +1 -1
- package/dist/lamina_pdf_base.d.ts +438 -1
- package/dist/lamina_pdf_base.js +84 -0
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +438 -1
- package/dist/lamina_pdf_extract.js +84 -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 +496 -1
- package/dist/lamina_pdf_text.js +164 -0
- package/dist/lamina_pdf_text.wasm +0 -0
- package/package.json +9 -3
|
@@ -205,6 +205,25 @@ export class WasmDocument {
|
|
|
205
205
|
wasm.__wbg_wasmdocument_free(ptr, 0);
|
|
206
206
|
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Makes `bytes`, the whole output of `saveCopy`, the document's saved file (it rebases onto
|
|
210
|
+
* them), once they are written where the document lives; `historyCleared` is the copy's
|
|
211
|
+
* report's.
|
|
212
|
+
*
|
|
213
|
+
* # Errors
|
|
214
|
+
* `nested-transaction`, `saved-not-rebased`; `not-rebased` when `bytes` can't be read.
|
|
215
|
+
* @param {Uint8Array} bytes
|
|
216
|
+
* @param {boolean} historyCleared
|
|
217
|
+
*/
|
|
218
|
+
adoptCopy(bytes, historyCleared) {
|
|
219
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
220
|
+
const len0 = WASM_VECTOR_LEN;
|
|
221
|
+
let ret;
|
|
222
|
+
ret = wasm.wasmdocument_adoptCopy(this.__wbg_ptr, ptr0, len0, historyCleared);
|
|
223
|
+
if (ret[1]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
208
227
|
/**
|
|
209
228
|
* Applies an op log (`{ "v": 1, "ops": [ … ] }`) as one transaction.
|
|
210
229
|
*
|
|
@@ -336,6 +355,22 @@ export class WasmDocument {
|
|
|
336
355
|
}
|
|
337
356
|
return ret[0] !== 0;
|
|
338
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* The document's metadata, read from Info and XMP together, with the fields where they
|
|
360
|
+
* disagree.
|
|
361
|
+
*
|
|
362
|
+
* # Errors
|
|
363
|
+
* Reading errors.
|
|
364
|
+
* @returns {DocumentMetadata}
|
|
365
|
+
*/
|
|
366
|
+
metadata() {
|
|
367
|
+
let ret;
|
|
368
|
+
ret = wasm.wasmdocument_metadata(this.__wbg_ptr);
|
|
369
|
+
if (ret[2]) {
|
|
370
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
371
|
+
}
|
|
372
|
+
return takeFromExternrefTable0(ret[0]);
|
|
373
|
+
}
|
|
339
374
|
/**
|
|
340
375
|
* The named destination `name`, or `undefined` when the document has none by that name or
|
|
341
376
|
* it names no page here (the extract and text modules).
|
|
@@ -507,6 +542,22 @@ export class WasmDocument {
|
|
|
507
542
|
}
|
|
508
543
|
return WasmPage.__wrap(ret[0]);
|
|
509
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* How a save with `options` would go, without saving.
|
|
547
|
+
*
|
|
548
|
+
* # Errors
|
|
549
|
+
* `invalid-argument` / `unknown-option` for bad options; reading errors.
|
|
550
|
+
* @param {SaveOptionsInit | undefined} options
|
|
551
|
+
* @returns {PlannedSaveJs}
|
|
552
|
+
*/
|
|
553
|
+
plan(options) {
|
|
554
|
+
let ret;
|
|
555
|
+
ret = wasm.wasmdocument_plan(this.__wbg_ptr, options);
|
|
556
|
+
if (ret[2]) {
|
|
557
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
558
|
+
}
|
|
559
|
+
return takeFromExternrefTable0(ret[0]);
|
|
560
|
+
}
|
|
510
561
|
/**
|
|
511
562
|
* The document's properties (the extract and text modules). Reads every object once.
|
|
512
563
|
*
|
|
@@ -582,6 +633,23 @@ export class WasmDocument {
|
|
|
582
633
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
583
634
|
}
|
|
584
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* Writes what `save` would and leaves the document as it was: not rebased, its changes
|
|
638
|
+
* still unsaved, the save-time stamp in the copy only (Save a copy).
|
|
639
|
+
*
|
|
640
|
+
* # Errors
|
|
641
|
+
* As `save`; the document is unchanged either way.
|
|
642
|
+
* @param {SaveOptionsInit | undefined} options
|
|
643
|
+
* @returns {{ bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs }}
|
|
644
|
+
*/
|
|
645
|
+
saveCopy(options) {
|
|
646
|
+
let ret;
|
|
647
|
+
ret = wasm.wasmdocument_saveCopy(this.__wbg_ptr, options);
|
|
648
|
+
if (ret[2]) {
|
|
649
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
650
|
+
}
|
|
651
|
+
return takeFromExternrefTable0(ret[0]);
|
|
652
|
+
}
|
|
585
653
|
/**
|
|
586
654
|
* A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
|
|
587
655
|
*
|
|
@@ -655,6 +723,22 @@ export class WasmDocument {
|
|
|
655
723
|
ret = wasm.wasmdocument_warnings(this.__wbg_ptr);
|
|
656
724
|
return WasmWarningCursor.__wrap(ret);
|
|
657
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* The signature restrictions `op` would break if it were applied and saved.
|
|
728
|
+
*
|
|
729
|
+
* # Errors
|
|
730
|
+
* `invalid-argument` for a value that isn't an op; reading errors.
|
|
731
|
+
* @param {Op} op
|
|
732
|
+
* @returns {ViolationJs[]}
|
|
733
|
+
*/
|
|
734
|
+
wouldViolate(op) {
|
|
735
|
+
let ret;
|
|
736
|
+
ret = wasm.wasmdocument_wouldViolate(this.__wbg_ptr, op);
|
|
737
|
+
if (ret[2]) {
|
|
738
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
739
|
+
}
|
|
740
|
+
return takeFromExternrefTable0(ret[0]);
|
|
741
|
+
}
|
|
658
742
|
}
|
|
659
743
|
if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
|
|
660
744
|
|
|
Binary file
|
|
Binary file
|