@laminapdf/wasm 0.2.0-alpha.5 → 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 +468 -5
- package/dist/lamina_pdf_base.js +99 -4
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +468 -5
- package/dist/lamina_pdf_extract.js +99 -4
- package/dist/lamina_pdf_extract.wasm +0 -0
- package/dist/lamina_pdf_render_hayro.wasm +0 -0
- package/dist/lamina_pdf_text.d.ts +647 -5
- package/dist/lamina_pdf_text.js +287 -4
- package/dist/lamina_pdf_text.wasm +0 -0
- package/package.json +11 -5
|
@@ -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
|
*
|
|
@@ -312,6 +331,15 @@ export class WasmDocument {
|
|
|
312
331
|
}
|
|
313
332
|
return takeFromExternrefTable0(ret[0]);
|
|
314
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
336
|
+
* @returns {boolean}
|
|
337
|
+
*/
|
|
338
|
+
isEncrypted() {
|
|
339
|
+
let ret;
|
|
340
|
+
ret = wasm.wasmdocument_isEncrypted(this.__wbg_ptr);
|
|
341
|
+
return ret !== 0;
|
|
342
|
+
}
|
|
315
343
|
/**
|
|
316
344
|
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
317
345
|
*
|
|
@@ -327,6 +355,22 @@ export class WasmDocument {
|
|
|
327
355
|
}
|
|
328
356
|
return ret[0] !== 0;
|
|
329
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
|
+
}
|
|
330
374
|
/**
|
|
331
375
|
* The named destination `name`, or `undefined` when the document has none by that name or
|
|
332
376
|
* it names no page here (the extract and text modules).
|
|
@@ -498,6 +542,22 @@ export class WasmDocument {
|
|
|
498
542
|
}
|
|
499
543
|
return WasmPage.__wrap(ret[0]);
|
|
500
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
|
+
}
|
|
501
561
|
/**
|
|
502
562
|
* The document's properties (the extract and text modules). Reads every object once.
|
|
503
563
|
*
|
|
@@ -530,11 +590,12 @@ export class WasmDocument {
|
|
|
530
590
|
}
|
|
531
591
|
}
|
|
532
592
|
/**
|
|
533
|
-
* Redoes the newest undone transaction
|
|
593
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
594
|
+
* when there is nothing to redo.
|
|
534
595
|
*
|
|
535
596
|
* # Errors
|
|
536
597
|
* As [`WasmDocument::undo`].
|
|
537
|
-
* @returns {
|
|
598
|
+
* @returns {RevertedJs | undefined}
|
|
538
599
|
*/
|
|
539
600
|
redo() {
|
|
540
601
|
let ret;
|
|
@@ -572,6 +633,23 @@ export class WasmDocument {
|
|
|
572
633
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
573
634
|
}
|
|
574
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
|
+
}
|
|
575
653
|
/**
|
|
576
654
|
* A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
|
|
577
655
|
*
|
|
@@ -621,11 +699,12 @@ export class WasmDocument {
|
|
|
621
699
|
return takeFromExternrefTable0(ret[0]);
|
|
622
700
|
}
|
|
623
701
|
/**
|
|
624
|
-
* Undoes the newest transaction; `undefined` when
|
|
702
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
703
|
+
* there is nothing to undo.
|
|
625
704
|
*
|
|
626
705
|
* # Errors
|
|
627
706
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
628
|
-
* @returns {
|
|
707
|
+
* @returns {RevertedJs | undefined}
|
|
629
708
|
*/
|
|
630
709
|
undo() {
|
|
631
710
|
let ret;
|
|
@@ -644,6 +723,22 @@ export class WasmDocument {
|
|
|
644
723
|
ret = wasm.wasmdocument_warnings(this.__wbg_ptr);
|
|
645
724
|
return WasmWarningCursor.__wrap(ret);
|
|
646
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
|
+
}
|
|
647
742
|
}
|
|
648
743
|
if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
|
|
649
744
|
|
|
Binary file
|
|
Binary file
|