@laminapdf/wasm 0.2.0-alpha.5 → 0.2.0-alpha.6
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 +30 -4
- package/dist/lamina_pdf_base.js +15 -4
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +30 -4
- package/dist/lamina_pdf_extract.js +15 -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 +151 -4
- package/dist/lamina_pdf_text.js +123 -4
- package/dist/lamina_pdf_text.wasm +0 -0
- package/package.json +3 -3
|
@@ -490,6 +490,11 @@ export interface EditedJs {
|
|
|
490
490
|
* IDs of the pages whose content or attributes changed.
|
|
491
491
|
*/
|
|
492
492
|
touchedPages: string[];
|
|
493
|
+
/**
|
|
494
|
+
* Whether the edit changed the document: one that only set values they already had leaves
|
|
495
|
+
* no step to undo.
|
|
496
|
+
*/
|
|
497
|
+
changed: boolean;
|
|
493
498
|
}
|
|
494
499
|
|
|
495
500
|
/**
|
|
@@ -537,6 +542,20 @@ export interface SaveReportJs {
|
|
|
537
542
|
*/
|
|
538
543
|
export type OutputJs = "whole" | "appendedOnly";
|
|
539
544
|
|
|
545
|
+
/**
|
|
546
|
+
* What an undo or redo did (`laminapdf::Reverted`).
|
|
547
|
+
*/
|
|
548
|
+
export interface RevertedJs {
|
|
549
|
+
/**
|
|
550
|
+
* How it went.
|
|
551
|
+
*/
|
|
552
|
+
outcome: UndoOutcomeJs;
|
|
553
|
+
/**
|
|
554
|
+
* IDs of the pages the undone or redone transaction touched: draw these again.
|
|
555
|
+
*/
|
|
556
|
+
touchedPages: string[];
|
|
557
|
+
}
|
|
558
|
+
|
|
540
559
|
/**
|
|
541
560
|
* Where a link or outline item goes.
|
|
542
561
|
*/
|
|
@@ -722,6 +741,10 @@ export class WasmDocument {
|
|
|
722
741
|
* Reading errors.
|
|
723
742
|
*/
|
|
724
743
|
info(): DocumentInfoJs;
|
|
744
|
+
/**
|
|
745
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
746
|
+
*/
|
|
747
|
+
isEncrypted(): boolean;
|
|
725
748
|
/**
|
|
726
749
|
* Opens a document from its bytes.
|
|
727
750
|
*
|
|
@@ -782,12 +805,13 @@ export class WasmDocument {
|
|
|
782
805
|
*/
|
|
783
806
|
rebase(bytes: Uint8Array): void;
|
|
784
807
|
/**
|
|
785
|
-
* Redoes the newest undone transaction
|
|
808
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
809
|
+
* when there is nothing to redo.
|
|
786
810
|
*
|
|
787
811
|
* # Errors
|
|
788
812
|
* As [`WasmDocument::undo`].
|
|
789
813
|
*/
|
|
790
|
-
redo():
|
|
814
|
+
redo(): RevertedJs | undefined;
|
|
791
815
|
/**
|
|
792
816
|
* A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
|
|
793
817
|
*
|
|
@@ -803,12 +827,13 @@ export class WasmDocument {
|
|
|
803
827
|
*/
|
|
804
828
|
save(options: SaveOptionsInit | undefined): { bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
|
|
805
829
|
/**
|
|
806
|
-
* Undoes the newest transaction; `undefined` when
|
|
830
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
831
|
+
* there is nothing to undo.
|
|
807
832
|
*
|
|
808
833
|
* # Errors
|
|
809
834
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
810
835
|
*/
|
|
811
|
-
undo():
|
|
836
|
+
undo(): RevertedJs | undefined;
|
|
812
837
|
/**
|
|
813
838
|
* A cursor over the warnings so far (build warnings first), each as the §1 object.
|
|
814
839
|
*/
|
|
@@ -1184,6 +1209,7 @@ export interface InitOutput {
|
|
|
1184
1209
|
readonly wasmdocument_applyLog: (a: number, b: number, c: number) => [number, number, number];
|
|
1185
1210
|
readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
|
|
1186
1211
|
readonly wasmdocument_info: (a: number) => [number, number, number];
|
|
1212
|
+
readonly wasmdocument_isEncrypted: (a: number) => number;
|
|
1187
1213
|
readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
|
|
1188
1214
|
readonly wasmdocument_openSource: (a: number, b: any) => [number, number, number];
|
|
1189
1215
|
readonly wasmdocument_page: (a: number, b: number) => [number, number, number];
|
package/dist/lamina_pdf_base.js
CHANGED
|
@@ -264,6 +264,15 @@ export class WasmDocument {
|
|
|
264
264
|
}
|
|
265
265
|
return takeFromExternrefTable0(ret[0]);
|
|
266
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
269
|
+
* @returns {boolean}
|
|
270
|
+
*/
|
|
271
|
+
isEncrypted() {
|
|
272
|
+
let ret;
|
|
273
|
+
ret = wasm.wasmdocument_isEncrypted(this.__wbg_ptr);
|
|
274
|
+
return ret !== 0;
|
|
275
|
+
}
|
|
267
276
|
/**
|
|
268
277
|
* Opens a document from its bytes.
|
|
269
278
|
*
|
|
@@ -401,11 +410,12 @@ export class WasmDocument {
|
|
|
401
410
|
}
|
|
402
411
|
}
|
|
403
412
|
/**
|
|
404
|
-
* Redoes the newest undone transaction
|
|
413
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
414
|
+
* when there is nothing to redo.
|
|
405
415
|
*
|
|
406
416
|
* # Errors
|
|
407
417
|
* As [`WasmDocument::undo`].
|
|
408
|
-
* @returns {
|
|
418
|
+
* @returns {RevertedJs | undefined}
|
|
409
419
|
*/
|
|
410
420
|
redo() {
|
|
411
421
|
let ret;
|
|
@@ -448,11 +458,12 @@ export class WasmDocument {
|
|
|
448
458
|
return takeFromExternrefTable0(ret[0]);
|
|
449
459
|
}
|
|
450
460
|
/**
|
|
451
|
-
* Undoes the newest transaction; `undefined` when
|
|
461
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
462
|
+
* there is nothing to undo.
|
|
452
463
|
*
|
|
453
464
|
* # Errors
|
|
454
465
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
455
|
-
* @returns {
|
|
466
|
+
* @returns {RevertedJs | undefined}
|
|
456
467
|
*/
|
|
457
468
|
undo() {
|
|
458
469
|
let ret;
|
|
Binary file
|
|
@@ -979,6 +979,11 @@ export interface EditedJs {
|
|
|
979
979
|
* IDs of the pages whose content or attributes changed.
|
|
980
980
|
*/
|
|
981
981
|
touchedPages: string[];
|
|
982
|
+
/**
|
|
983
|
+
* Whether the edit changed the document: one that only set values they already had leaves
|
|
984
|
+
* no step to undo.
|
|
985
|
+
*/
|
|
986
|
+
changed: boolean;
|
|
982
987
|
}
|
|
983
988
|
|
|
984
989
|
/**
|
|
@@ -1092,6 +1097,20 @@ export interface SaveReportJs {
|
|
|
1092
1097
|
*/
|
|
1093
1098
|
export type OutputJs = "whole" | "appendedOnly";
|
|
1094
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* What an undo or redo did (`laminapdf::Reverted`).
|
|
1102
|
+
*/
|
|
1103
|
+
export interface RevertedJs {
|
|
1104
|
+
/**
|
|
1105
|
+
* How it went.
|
|
1106
|
+
*/
|
|
1107
|
+
outcome: UndoOutcomeJs;
|
|
1108
|
+
/**
|
|
1109
|
+
* IDs of the pages the undone or redone transaction touched: draw these again.
|
|
1110
|
+
*/
|
|
1111
|
+
touchedPages: string[];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1095
1114
|
/**
|
|
1096
1115
|
* What following a link does, by `kind`.
|
|
1097
1116
|
*/
|
|
@@ -1331,6 +1350,10 @@ export class WasmDocument {
|
|
|
1331
1350
|
* Reading errors.
|
|
1332
1351
|
*/
|
|
1333
1352
|
info(): DocumentInfoJs;
|
|
1353
|
+
/**
|
|
1354
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
1355
|
+
*/
|
|
1356
|
+
isEncrypted(): boolean;
|
|
1334
1357
|
/**
|
|
1335
1358
|
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
1336
1359
|
*
|
|
@@ -1428,12 +1451,13 @@ export class WasmDocument {
|
|
|
1428
1451
|
*/
|
|
1429
1452
|
rebase(bytes: Uint8Array): void;
|
|
1430
1453
|
/**
|
|
1431
|
-
* Redoes the newest undone transaction
|
|
1454
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
1455
|
+
* when there is nothing to redo.
|
|
1432
1456
|
*
|
|
1433
1457
|
* # Errors
|
|
1434
1458
|
* As [`WasmDocument::undo`].
|
|
1435
1459
|
*/
|
|
1436
|
-
redo():
|
|
1460
|
+
redo(): RevertedJs | undefined;
|
|
1437
1461
|
/**
|
|
1438
1462
|
* The document for reader mode, as JSON: whether it can be shown and why not, its
|
|
1439
1463
|
* language, its blocks in the structure tree's order (figures, formulas and tables as crops
|
|
@@ -1466,12 +1490,13 @@ export class WasmDocument {
|
|
|
1466
1490
|
*/
|
|
1467
1491
|
structureTree(): StructureNodeJs[] | undefined;
|
|
1468
1492
|
/**
|
|
1469
|
-
* Undoes the newest transaction; `undefined` when
|
|
1493
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
1494
|
+
* there is nothing to undo.
|
|
1470
1495
|
*
|
|
1471
1496
|
* # Errors
|
|
1472
1497
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
1473
1498
|
*/
|
|
1474
|
-
undo():
|
|
1499
|
+
undo(): RevertedJs | undefined;
|
|
1475
1500
|
/**
|
|
1476
1501
|
* A cursor over the warnings so far (build warnings first), each as the §1 object.
|
|
1477
1502
|
*/
|
|
@@ -1891,6 +1916,7 @@ export interface InitOutput {
|
|
|
1891
1916
|
readonly wasmdocument_extractJob: (a: number, b: any) => [number, number, number];
|
|
1892
1917
|
readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
|
|
1893
1918
|
readonly wasmdocument_info: (a: number) => [number, number, number];
|
|
1919
|
+
readonly wasmdocument_isEncrypted: (a: number) => number;
|
|
1894
1920
|
readonly wasmdocument_isTagged: (a: number) => [number, number, number];
|
|
1895
1921
|
readonly wasmdocument_namedDestination: (a: number, b: number, c: number) => [number, number, number];
|
|
1896
1922
|
readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
|
|
@@ -312,6 +312,15 @@ export class WasmDocument {
|
|
|
312
312
|
}
|
|
313
313
|
return takeFromExternrefTable0(ret[0]);
|
|
314
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
317
|
+
* @returns {boolean}
|
|
318
|
+
*/
|
|
319
|
+
isEncrypted() {
|
|
320
|
+
let ret;
|
|
321
|
+
ret = wasm.wasmdocument_isEncrypted(this.__wbg_ptr);
|
|
322
|
+
return ret !== 0;
|
|
323
|
+
}
|
|
315
324
|
/**
|
|
316
325
|
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
317
326
|
*
|
|
@@ -530,11 +539,12 @@ export class WasmDocument {
|
|
|
530
539
|
}
|
|
531
540
|
}
|
|
532
541
|
/**
|
|
533
|
-
* Redoes the newest undone transaction
|
|
542
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
543
|
+
* when there is nothing to redo.
|
|
534
544
|
*
|
|
535
545
|
* # Errors
|
|
536
546
|
* As [`WasmDocument::undo`].
|
|
537
|
-
* @returns {
|
|
547
|
+
* @returns {RevertedJs | undefined}
|
|
538
548
|
*/
|
|
539
549
|
redo() {
|
|
540
550
|
let ret;
|
|
@@ -621,11 +631,12 @@ export class WasmDocument {
|
|
|
621
631
|
return takeFromExternrefTable0(ret[0]);
|
|
622
632
|
}
|
|
623
633
|
/**
|
|
624
|
-
* Undoes the newest transaction; `undefined` when
|
|
634
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
635
|
+
* there is nothing to undo.
|
|
625
636
|
*
|
|
626
637
|
* # Errors
|
|
627
638
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
628
|
-
* @returns {
|
|
639
|
+
* @returns {RevertedJs | undefined}
|
|
629
640
|
*/
|
|
630
641
|
undo() {
|
|
631
642
|
let ret;
|
|
Binary file
|
|
Binary file
|
|
@@ -141,6 +141,25 @@ export interface PropertiesJs {
|
|
|
141
141
|
*/
|
|
142
142
|
export type EncodingJs = { kind: "named"; name: string } | { kind: "custom" };
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* A header or footer: text at the start, centre and end, with `{page}`, `{pages}`, `{section}`
|
|
146
|
+
* and `{title}` filled in.
|
|
147
|
+
*/
|
|
148
|
+
export interface PageRegionInit {
|
|
149
|
+
/**
|
|
150
|
+
* At the start of the line.
|
|
151
|
+
*/
|
|
152
|
+
start?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Centred.
|
|
155
|
+
*/
|
|
156
|
+
center?: string;
|
|
157
|
+
/**
|
|
158
|
+
* At the end of the line.
|
|
159
|
+
*/
|
|
160
|
+
end?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
144
163
|
/**
|
|
145
164
|
* A job's progress (`laminapdf::Step::Progress`).
|
|
146
165
|
*/
|
|
@@ -448,6 +467,24 @@ export interface SetInfo {
|
|
|
448
467
|
at?: string;
|
|
449
468
|
}
|
|
450
469
|
|
|
470
|
+
/**
|
|
471
|
+
* How `markdown` lays a document out.
|
|
472
|
+
*/
|
|
473
|
+
export interface MarkdownOptionsInit {
|
|
474
|
+
/**
|
|
475
|
+
* The body text's size in points (10.5 by default); headings scale from it.
|
|
476
|
+
*/
|
|
477
|
+
size?: number;
|
|
478
|
+
/**
|
|
479
|
+
* A contents page listing headings of levels 1 to `contents`, at the start.
|
|
480
|
+
*/
|
|
481
|
+
contents?: number;
|
|
482
|
+
/**
|
|
483
|
+
* The pages (by default A4, 56-point margins, "Page {page} of {pages}" in the footer).
|
|
484
|
+
*/
|
|
485
|
+
page?: PageTemplateInit;
|
|
486
|
+
}
|
|
487
|
+
|
|
451
488
|
/**
|
|
452
489
|
* How a destination shows its page (§12.3.2.2).
|
|
453
490
|
*/
|
|
@@ -1134,6 +1171,32 @@ export interface ModelsInit {
|
|
|
1134
1171
|
langs?: string[];
|
|
1135
1172
|
}
|
|
1136
1173
|
|
|
1174
|
+
/**
|
|
1175
|
+
* The pages a Markdown document flows through.
|
|
1176
|
+
*/
|
|
1177
|
+
export interface PageTemplateInit {
|
|
1178
|
+
/**
|
|
1179
|
+
* The page's width and height in points.
|
|
1180
|
+
*/
|
|
1181
|
+
size: [number, number];
|
|
1182
|
+
/**
|
|
1183
|
+
* Top, right, bottom and left margins in points (72 each by default).
|
|
1184
|
+
*/
|
|
1185
|
+
margins?: [number, number, number, number];
|
|
1186
|
+
/**
|
|
1187
|
+
* The header.
|
|
1188
|
+
*/
|
|
1189
|
+
header?: PageRegionInit;
|
|
1190
|
+
/**
|
|
1191
|
+
* The footer.
|
|
1192
|
+
*/
|
|
1193
|
+
footer?: PageRegionInit;
|
|
1194
|
+
/**
|
|
1195
|
+
* The size of the header and footer text, in the regular font (8 points by default).
|
|
1196
|
+
*/
|
|
1197
|
+
furnitureSize?: number;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1137
1200
|
/**
|
|
1138
1201
|
* The pages an edit touched.
|
|
1139
1202
|
*/
|
|
@@ -1142,6 +1205,11 @@ export interface EditedJs {
|
|
|
1142
1205
|
* IDs of the pages whose content or attributes changed.
|
|
1143
1206
|
*/
|
|
1144
1207
|
touchedPages: string[];
|
|
1208
|
+
/**
|
|
1209
|
+
* Whether the edit changed the document: one that only set values they already had leaves
|
|
1210
|
+
* no step to undo.
|
|
1211
|
+
*/
|
|
1212
|
+
changed: boolean;
|
|
1145
1213
|
}
|
|
1146
1214
|
|
|
1147
1215
|
/**
|
|
@@ -1159,6 +1227,16 @@ export type SaveModeJs = "auto" | "incremental" | "fullRewrite";
|
|
|
1159
1227
|
*/
|
|
1160
1228
|
export type ExtractFormat = "markdown" | "json" | "text" | "chunks";
|
|
1161
1229
|
|
|
1230
|
+
/**
|
|
1231
|
+
* What `markdown` added.
|
|
1232
|
+
*/
|
|
1233
|
+
export interface MarkdownReportJs {
|
|
1234
|
+
/**
|
|
1235
|
+
* The pages it added, in order, by ID.
|
|
1236
|
+
*/
|
|
1237
|
+
pages: string[];
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1162
1240
|
/**
|
|
1163
1241
|
* What `provide` takes.
|
|
1164
1242
|
*/
|
|
@@ -1279,6 +1357,20 @@ export interface SaveReportJs {
|
|
|
1279
1357
|
*/
|
|
1280
1358
|
export type OutputJs = "whole" | "appendedOnly";
|
|
1281
1359
|
|
|
1360
|
+
/**
|
|
1361
|
+
* What an undo or redo did (`laminapdf::Reverted`).
|
|
1362
|
+
*/
|
|
1363
|
+
export interface RevertedJs {
|
|
1364
|
+
/**
|
|
1365
|
+
* How it went.
|
|
1366
|
+
*/
|
|
1367
|
+
outcome: UndoOutcomeJs;
|
|
1368
|
+
/**
|
|
1369
|
+
* IDs of the pages the undone or redone transaction touched: draw these again.
|
|
1370
|
+
*/
|
|
1371
|
+
touchedPages: string[];
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1282
1374
|
/**
|
|
1283
1375
|
* What following a link does, by `kind`.
|
|
1284
1376
|
*/
|
|
@@ -1430,6 +1522,13 @@ export class WasmBuilder {
|
|
|
1430
1522
|
* `builder-finished`; `invalid-font`, `font-not-embeddable`.
|
|
1431
1523
|
*/
|
|
1432
1524
|
fontBytes(bytes: Uint8Array): WasmFont;
|
|
1525
|
+
/**
|
|
1526
|
+
* Loads face `index` (from 0) of a font collection (`.ttc`, `.otc`) and registers it.
|
|
1527
|
+
*
|
|
1528
|
+
* # Errors
|
|
1529
|
+
* `builder-finished`; `invalid-font`, `collection-index` (no such face), `font-not-embeddable`.
|
|
1530
|
+
*/
|
|
1531
|
+
fontCollection(bytes: Uint8Array, index: number): WasmFont;
|
|
1433
1532
|
/**
|
|
1434
1533
|
* The natural language (`/Lang`), a BCP 47 tag.
|
|
1435
1534
|
*
|
|
@@ -1437,6 +1536,17 @@ export class WasmBuilder {
|
|
|
1437
1536
|
* `builder-finished`.
|
|
1438
1537
|
*/
|
|
1439
1538
|
lang(lang: string): void;
|
|
1539
|
+
/**
|
|
1540
|
+
* Lays `markdown` out as tagged pages that flow, after any pages already added; its front
|
|
1541
|
+
* matter's title, language, author and subject become the document's. Its warnings
|
|
1542
|
+
* (`markdown-html-ignored`, `markdown-image-missing`, the flow's) are the finished
|
|
1543
|
+
* document's.
|
|
1544
|
+
*
|
|
1545
|
+
* # Errors
|
|
1546
|
+
* `builder-finished`; `unknown-option`, `invalid-argument`; `missing-glyph`,
|
|
1547
|
+
* `flow-content-too-large`; `unknown-font` at `finish` for a font another builder registered.
|
|
1548
|
+
*/
|
|
1549
|
+
markdown(markdown: string, resources: WasmMarkdownOptions, options: MarkdownOptionsInit | undefined): MarkdownReportJs;
|
|
1440
1550
|
/**
|
|
1441
1551
|
* The metadata, written as the Info dictionary and an XMP packet.
|
|
1442
1552
|
*
|
|
@@ -1539,6 +1649,10 @@ export class WasmDocument {
|
|
|
1539
1649
|
* Reading errors.
|
|
1540
1650
|
*/
|
|
1541
1651
|
info(): DocumentInfoJs;
|
|
1652
|
+
/**
|
|
1653
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
1654
|
+
*/
|
|
1655
|
+
isEncrypted(): boolean;
|
|
1542
1656
|
/**
|
|
1543
1657
|
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
1544
1658
|
*
|
|
@@ -1636,12 +1750,13 @@ export class WasmDocument {
|
|
|
1636
1750
|
*/
|
|
1637
1751
|
rebase(bytes: Uint8Array): void;
|
|
1638
1752
|
/**
|
|
1639
|
-
* Redoes the newest undone transaction
|
|
1753
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
1754
|
+
* when there is nothing to redo.
|
|
1640
1755
|
*
|
|
1641
1756
|
* # Errors
|
|
1642
1757
|
* As [`WasmDocument::undo`].
|
|
1643
1758
|
*/
|
|
1644
|
-
redo():
|
|
1759
|
+
redo(): RevertedJs | undefined;
|
|
1645
1760
|
/**
|
|
1646
1761
|
* A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
|
|
1647
1762
|
*
|
|
@@ -1665,12 +1780,13 @@ export class WasmDocument {
|
|
|
1665
1780
|
*/
|
|
1666
1781
|
structureTree(): StructureNodeJs[] | undefined;
|
|
1667
1782
|
/**
|
|
1668
|
-
* Undoes the newest transaction; `undefined` when
|
|
1783
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
1784
|
+
* there is nothing to undo.
|
|
1669
1785
|
*
|
|
1670
1786
|
* # Errors
|
|
1671
1787
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
1672
1788
|
*/
|
|
1673
|
-
undo():
|
|
1789
|
+
undo(): RevertedJs | undefined;
|
|
1674
1790
|
/**
|
|
1675
1791
|
* A cursor over the warnings so far (build warnings first), each as the §1 object.
|
|
1676
1792
|
*/
|
|
@@ -1768,6 +1884,30 @@ export class WasmImage {
|
|
|
1768
1884
|
readonly width: number;
|
|
1769
1885
|
}
|
|
1770
1886
|
|
|
1887
|
+
/**
|
|
1888
|
+
* The fonts and images of a Markdown build, by role and by the target the Markdown names.
|
|
1889
|
+
*/
|
|
1890
|
+
export class WasmMarkdownOptions {
|
|
1891
|
+
free(): void;
|
|
1892
|
+
[Symbol.dispose](): void;
|
|
1893
|
+
/**
|
|
1894
|
+
* `font` for `role`: `regular`, `bold` (headings too), `italic`, `boldItalic`, `mono`, or
|
|
1895
|
+
* `fallback` (each call adds one) for characters the others lack.
|
|
1896
|
+
*
|
|
1897
|
+
* # Errors
|
|
1898
|
+
* `invalid-argument` for another role.
|
|
1899
|
+
*/
|
|
1900
|
+
font(role: string, font: WasmFont): void;
|
|
1901
|
+
/**
|
|
1902
|
+
* `image` for the images whose target is `target`, as the Markdown writes it.
|
|
1903
|
+
*/
|
|
1904
|
+
image(target: string, image: WasmImage): void;
|
|
1905
|
+
/**
|
|
1906
|
+
* No fonts (the standard 14 Helvetica family and Courier) and no images.
|
|
1907
|
+
*/
|
|
1908
|
+
constructor();
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1771
1911
|
/**
|
|
1772
1912
|
* A page of a [`WasmDocument`], held by its ID (F2): moving pages doesn't retarget it.
|
|
1773
1913
|
*/
|
|
@@ -2105,6 +2245,7 @@ export interface InitOutput {
|
|
|
2105
2245
|
readonly __wbg_wasmextractjob_free: (a: number, b: number) => void;
|
|
2106
2246
|
readonly __wbg_wasmfont_free: (a: number, b: number) => void;
|
|
2107
2247
|
readonly __wbg_wasmimage_free: (a: number, b: number) => void;
|
|
2248
|
+
readonly __wbg_wasmmarkdownoptions_free: (a: number, b: number) => void;
|
|
2108
2249
|
readonly __wbg_wasmpage_free: (a: number, b: number) => void;
|
|
2109
2250
|
readonly __wbg_wasmpagebuilder_free: (a: number, b: number) => void;
|
|
2110
2251
|
readonly __wbg_wasmsavejob_free: (a: number, b: number) => void;
|
|
@@ -2117,7 +2258,9 @@ export interface InitOutput {
|
|
|
2117
2258
|
readonly wasmbuilder_destination: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
2118
2259
|
readonly wasmbuilder_finish: (a: number) => [number, number, number];
|
|
2119
2260
|
readonly wasmbuilder_fontBytes: (a: number, b: number, c: number) => [number, number, number];
|
|
2261
|
+
readonly wasmbuilder_fontCollection: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2120
2262
|
readonly wasmbuilder_lang: (a: number, b: number, c: number) => [number, number];
|
|
2263
|
+
readonly wasmbuilder_markdown: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
2121
2264
|
readonly wasmbuilder_metadata: (a: number, b: any) => [number, number];
|
|
2122
2265
|
readonly wasmbuilder_new: (a: any) => [number, number, number];
|
|
2123
2266
|
readonly wasmbuilder_outline: (a: number, b: any) => [number, number, number];
|
|
@@ -2131,6 +2274,7 @@ export interface InitOutput {
|
|
|
2131
2274
|
readonly wasmdocument_extractJob: (a: number, b: any) => [number, number, number];
|
|
2132
2275
|
readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
|
|
2133
2276
|
readonly wasmdocument_info: (a: number) => [number, number, number];
|
|
2277
|
+
readonly wasmdocument_isEncrypted: (a: number) => number;
|
|
2134
2278
|
readonly wasmdocument_isTagged: (a: number) => [number, number, number];
|
|
2135
2279
|
readonly wasmdocument_namedDestination: (a: number, b: number, c: number) => [number, number, number];
|
|
2136
2280
|
readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
|
|
@@ -2161,6 +2305,9 @@ export interface InitOutput {
|
|
|
2161
2305
|
readonly wasmimage_png: (a: number, b: number) => [number, number, number];
|
|
2162
2306
|
readonly wasmimage_rgba: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2163
2307
|
readonly wasmimage_width: (a: number) => number;
|
|
2308
|
+
readonly wasmmarkdownoptions_font: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2309
|
+
readonly wasmmarkdownoptions_image: (a: number, b: number, c: number, d: number) => void;
|
|
2310
|
+
readonly wasmmarkdownoptions_new: () => number;
|
|
2164
2311
|
readonly wasmpage_id: (a: number) => [number, number];
|
|
2165
2312
|
readonly wasmpage_index: (a: number) => [number, number, number];
|
|
2166
2313
|
readonly wasmpage_info: (a: number) => [number, number, number];
|
package/dist/lamina_pdf_text.js
CHANGED
|
@@ -94,6 +94,25 @@ export class WasmBuilder {
|
|
|
94
94
|
}
|
|
95
95
|
return WasmFont.__wrap(ret[0]);
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Loads face `index` (from 0) of a font collection (`.ttc`, `.otc`) and registers it.
|
|
99
|
+
*
|
|
100
|
+
* # Errors
|
|
101
|
+
* `builder-finished`; `invalid-font`, `collection-index` (no such face), `font-not-embeddable`.
|
|
102
|
+
* @param {Uint8Array} bytes
|
|
103
|
+
* @param {number} index
|
|
104
|
+
* @returns {WasmFont}
|
|
105
|
+
*/
|
|
106
|
+
fontCollection(bytes, index) {
|
|
107
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
108
|
+
const len0 = WASM_VECTOR_LEN;
|
|
109
|
+
let ret;
|
|
110
|
+
ret = wasm.wasmbuilder_fontCollection(this.__wbg_ptr, ptr0, len0, index);
|
|
111
|
+
if (ret[2]) {
|
|
112
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
113
|
+
}
|
|
114
|
+
return WasmFont.__wrap(ret[0]);
|
|
115
|
+
}
|
|
97
116
|
/**
|
|
98
117
|
* The natural language (`/Lang`), a BCP 47 tag.
|
|
99
118
|
*
|
|
@@ -110,6 +129,31 @@ export class WasmBuilder {
|
|
|
110
129
|
throw takeFromExternrefTable0(ret[0]);
|
|
111
130
|
}
|
|
112
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Lays `markdown` out as tagged pages that flow, after any pages already added; its front
|
|
134
|
+
* matter's title, language, author and subject become the document's. Its warnings
|
|
135
|
+
* (`markdown-html-ignored`, `markdown-image-missing`, the flow's) are the finished
|
|
136
|
+
* document's.
|
|
137
|
+
*
|
|
138
|
+
* # Errors
|
|
139
|
+
* `builder-finished`; `unknown-option`, `invalid-argument`; `missing-glyph`,
|
|
140
|
+
* `flow-content-too-large`; `unknown-font` at `finish` for a font another builder registered.
|
|
141
|
+
* @param {string} markdown
|
|
142
|
+
* @param {WasmMarkdownOptions} resources
|
|
143
|
+
* @param {MarkdownOptionsInit | undefined} options
|
|
144
|
+
* @returns {MarkdownReportJs}
|
|
145
|
+
*/
|
|
146
|
+
markdown(markdown, resources, options) {
|
|
147
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
148
|
+
const len0 = WASM_VECTOR_LEN;
|
|
149
|
+
_assertClass(resources, WasmMarkdownOptions);
|
|
150
|
+
let ret;
|
|
151
|
+
ret = wasm.wasmbuilder_markdown(this.__wbg_ptr, ptr0, len0, resources.__wbg_ptr, options);
|
|
152
|
+
if (ret[2]) {
|
|
153
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
154
|
+
}
|
|
155
|
+
return takeFromExternrefTable0(ret[0]);
|
|
156
|
+
}
|
|
113
157
|
/**
|
|
114
158
|
* The metadata, written as the Info dictionary and an XMP packet.
|
|
115
159
|
*
|
|
@@ -350,6 +394,15 @@ export class WasmDocument {
|
|
|
350
394
|
}
|
|
351
395
|
return takeFromExternrefTable0(ret[0]);
|
|
352
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
399
|
+
* @returns {boolean}
|
|
400
|
+
*/
|
|
401
|
+
isEncrypted() {
|
|
402
|
+
let ret;
|
|
403
|
+
ret = wasm.wasmdocument_isEncrypted(this.__wbg_ptr);
|
|
404
|
+
return ret !== 0;
|
|
405
|
+
}
|
|
353
406
|
/**
|
|
354
407
|
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
355
408
|
*
|
|
@@ -568,11 +621,12 @@ export class WasmDocument {
|
|
|
568
621
|
}
|
|
569
622
|
}
|
|
570
623
|
/**
|
|
571
|
-
* Redoes the newest undone transaction
|
|
624
|
+
* Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
|
|
625
|
+
* when there is nothing to redo.
|
|
572
626
|
*
|
|
573
627
|
* # Errors
|
|
574
628
|
* As [`WasmDocument::undo`].
|
|
575
|
-
* @returns {
|
|
629
|
+
* @returns {RevertedJs | undefined}
|
|
576
630
|
*/
|
|
577
631
|
redo() {
|
|
578
632
|
let ret;
|
|
@@ -631,11 +685,12 @@ export class WasmDocument {
|
|
|
631
685
|
return takeFromExternrefTable0(ret[0]);
|
|
632
686
|
}
|
|
633
687
|
/**
|
|
634
|
-
* Undoes the newest transaction; `undefined` when
|
|
688
|
+
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
689
|
+
* there is nothing to undo.
|
|
635
690
|
*
|
|
636
691
|
* # Errors
|
|
637
692
|
* `nested-transaction`, `saved-not-rebased`; reading errors.
|
|
638
|
-
* @returns {
|
|
693
|
+
* @returns {RevertedJs | undefined}
|
|
639
694
|
*/
|
|
640
695
|
undo() {
|
|
641
696
|
let ret;
|
|
@@ -893,6 +948,65 @@ export class WasmImage {
|
|
|
893
948
|
}
|
|
894
949
|
if (Symbol.dispose) WasmImage.prototype[Symbol.dispose] = WasmImage.prototype.free;
|
|
895
950
|
|
|
951
|
+
/**
|
|
952
|
+
* The fonts and images of a Markdown build, by role and by the target the Markdown names.
|
|
953
|
+
*/
|
|
954
|
+
export class WasmMarkdownOptions {
|
|
955
|
+
__destroy_into_raw() {
|
|
956
|
+
const ptr = this.__wbg_ptr;
|
|
957
|
+
this.__wbg_ptr = 0;
|
|
958
|
+
WasmMarkdownOptionsFinalization.unregister(this);
|
|
959
|
+
return ptr;
|
|
960
|
+
}
|
|
961
|
+
free() {
|
|
962
|
+
const ptr = this.__destroy_into_raw();
|
|
963
|
+
wasm.__wbg_wasmmarkdownoptions_free(ptr, 0);
|
|
964
|
+
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* `font` for `role`: `regular`, `bold` (headings too), `italic`, `boldItalic`, `mono`, or
|
|
968
|
+
* `fallback` (each call adds one) for characters the others lack.
|
|
969
|
+
*
|
|
970
|
+
* # Errors
|
|
971
|
+
* `invalid-argument` for another role.
|
|
972
|
+
* @param {string} role
|
|
973
|
+
* @param {WasmFont} font
|
|
974
|
+
*/
|
|
975
|
+
font(role, font) {
|
|
976
|
+
const ptr0 = passStringToWasm0(role, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
977
|
+
const len0 = WASM_VECTOR_LEN;
|
|
978
|
+
_assertClass(font, WasmFont);
|
|
979
|
+
let ret;
|
|
980
|
+
ret = wasm.wasmmarkdownoptions_font(this.__wbg_ptr, ptr0, len0, font.__wbg_ptr);
|
|
981
|
+
if (ret[1]) {
|
|
982
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* `image` for the images whose target is `target`, as the Markdown writes it.
|
|
987
|
+
* @param {string} target
|
|
988
|
+
* @param {WasmImage} image
|
|
989
|
+
*/
|
|
990
|
+
image(target, image) {
|
|
991
|
+
const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
992
|
+
const len0 = WASM_VECTOR_LEN;
|
|
993
|
+
_assertClass(image, WasmImage);
|
|
994
|
+
wasm.wasmmarkdownoptions_image(this.__wbg_ptr, ptr0, len0, image.__wbg_ptr);
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* No fonts (the standard 14 Helvetica family and Courier) and no images.
|
|
998
|
+
*/
|
|
999
|
+
constructor() {
|
|
1000
|
+
let ret;
|
|
1001
|
+
ret = wasm.wasmmarkdownoptions_new();
|
|
1002
|
+
this.__wbg_ptr = ret;
|
|
1003
|
+
Object.defineProperty(this, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
1004
|
+
WasmMarkdownOptionsFinalization.register(this, { ptr: ret, instance: __wbg_instance_id }, this);
|
|
1005
|
+
return this;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
if (Symbol.dispose) WasmMarkdownOptions.prototype[Symbol.dispose] = WasmMarkdownOptions.prototype.free;
|
|
1009
|
+
|
|
896
1010
|
/**
|
|
897
1011
|
* A page of a [`WasmDocument`], held by its ID (F2): moving pages doesn't retarget it.
|
|
898
1012
|
*/
|
|
@@ -1847,6 +1961,11 @@ const WasmImageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1847
1961
|
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1848
1962
|
if (instance === __wbg_instance_id) wasm.__wbg_wasmimage_free(ptr, 1);
|
|
1849
1963
|
});
|
|
1964
|
+
const WasmMarkdownOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1965
|
+
? { register: () => {}, unregister: () => {} }
|
|
1966
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1967
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmmarkdownoptions_free(ptr, 1);
|
|
1968
|
+
});
|
|
1850
1969
|
const WasmPageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1851
1970
|
? { register: () => {}, unregister: () => {} }
|
|
1852
1971
|
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laminapdf/wasm",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.6",
|
|
4
4
|
"description": "Lamina PDF's WebAssembly modules and their wasm-bindgen glue: lamina_pdf_base (open, read, edit, save, vector and image pages), lamina_pdf_text (all of base plus fonts and text) and lamina_pdf_extract (all of base plus text extraction); and lamina_pdf_render_hayro, laminapdf-render's hayro adapter, which @laminapdf/render-hayro wraps. Generated into dist/ by `cargo xtask wasm`; @laminapdf/sdk is the API to use.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"homepage": "https://laminapdf.com",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "26.6.
|
|
49
|
+
"@types/node": "26.6.6",
|
|
50
50
|
"ajv": "8.20.0",
|
|
51
51
|
"esbuild": "0.28.2",
|
|
52
52
|
"typescript": "7.0.2",
|
|
53
|
-
"vitest": "5.0
|
|
53
|
+
"vitest": "5.1.0",
|
|
54
54
|
"@laminapdf/test-utils": "0.0.0"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|