@laminapdf/wasm 0.2.0-alpha.4 → 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.
@@ -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; `undefined` when there is nothing to redo.
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(): UndoOutcomeJs | undefined;
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 there is nothing to undo.
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(): UndoOutcomeJs | undefined;
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];
@@ -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; `undefined` when there is nothing to redo.
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 {UndoOutcomeJs | undefined}
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 there is nothing to undo.
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 {UndoOutcomeJs | undefined}
466
+ * @returns {RevertedJs | undefined}
456
467
  */
457
468
  undo() {
458
469
  let ret;
Binary file
@@ -32,11 +32,110 @@ export interface Diagnostic {
32
32
  }
33
33
 
34
34
 
35
+
36
+ /** One link on a page, in page space, and what following it does (by `kind`). */
37
+ export type PageLinkJs = {
38
+ /** Its rectangle: `[x0, y0, x1, y1]`, top-left and bottom-right. */
39
+ rect: [number, number, number, number];
40
+ /** The areas that follow it, eight numbers per area; absent when the rectangle is the area. */
41
+ quads?: number[];
42
+ /** Its description (`/Contents`, document text). */
43
+ contents?: string;
44
+ } & LinkToJs;
45
+
46
+
35
47
  /**
36
48
  * A conformance profile.
37
49
  */
38
50
  export type ProfileInit = "PDF/UA-1" | "PDF/A-2b" | "PDF/A-2u" | "PDF/A-3b";
39
51
 
52
+ /**
53
+ * A document's properties, for a properties view.
54
+ */
55
+ export interface PropertiesJs {
56
+ /**
57
+ * `/Title`.
58
+ */
59
+ title?: string;
60
+ /**
61
+ * `/Author`.
62
+ */
63
+ author?: string;
64
+ /**
65
+ * `/Subject`.
66
+ */
67
+ subject?: string;
68
+ /**
69
+ * `/Keywords`.
70
+ */
71
+ keywords?: string;
72
+ /**
73
+ * `/Creator`: the application the document was made with.
74
+ */
75
+ creator?: string;
76
+ /**
77
+ * `/Producer`: the application that wrote the PDF.
78
+ */
79
+ producer?: string;
80
+ /**
81
+ * `/CreationDate` as ISO 8601.
82
+ */
83
+ created?: string;
84
+ /**
85
+ * `/ModDate` as ISO 8601.
86
+ */
87
+ modified?: string;
88
+ /**
89
+ * The XMP packet as text.
90
+ */
91
+ xmp?: string;
92
+ /**
93
+ * The PDF version.
94
+ */
95
+ version?: string;
96
+ /**
97
+ * The number of pages.
98
+ */
99
+ pageCount: number;
100
+ /**
101
+ * The file's size in bytes.
102
+ */
103
+ fileSize: number;
104
+ /**
105
+ * The file is linearized ("fast web view").
106
+ */
107
+ linearized: boolean;
108
+ /**
109
+ * The catalog says the document is tagged.
110
+ */
111
+ tagged: boolean;
112
+ /**
113
+ * How the file is encrypted; absent when it isn't.
114
+ */
115
+ encryption?: EncryptionJs;
116
+ /**
117
+ * The fonts the pages use.
118
+ */
119
+ fonts: FontJs[];
120
+ /**
121
+ * The signatures present, not verified.
122
+ */
123
+ signatures: number;
124
+ /**
125
+ * The signature fields' full names.
126
+ */
127
+ signatureFields: string[];
128
+ /**
129
+ * What the document holds besides its pages.
130
+ */
131
+ contains: ContainsJs;
132
+ }
133
+
134
+ /**
135
+ * A font's encoding: a named one (`WinAnsiEncoding`, `Identity-H`), or the font's own.
136
+ */
137
+ export type EncodingJs = { kind: "named"; name: string } | { kind: "custom" };
138
+
40
139
  /**
41
140
  * A job's progress (`laminapdf::Step::Progress`).
42
141
  */
@@ -308,6 +407,32 @@ export interface SetInfo {
308
407
  */
309
408
  export type FitInit = { type: "page" } | { type: "width"; top?: number } | { type: "height"; left?: number } | { type: "xyz"; left?: number; top?: number; zoom?: number } | { type: "rect"; x: number; y: number; width: number; height: number } | { type: "bounds" };
310
409
 
410
+ /**
411
+ * How a file is encrypted, and what its author permits.
412
+ */
413
+ export interface EncryptionJs {
414
+ /**
415
+ * `/V`.
416
+ */
417
+ version: number;
418
+ /**
419
+ * `/R`.
420
+ */
421
+ revision: number;
422
+ /**
423
+ * The key length in bits.
424
+ */
425
+ keyBits: number;
426
+ /**
427
+ * The cipher streams use.
428
+ */
429
+ cipher: CipherJs;
430
+ /**
431
+ * What `/P` permits; absent when the handler gives no permissions.
432
+ */
433
+ permissions?: PermissionsJs;
434
+ }
435
+
311
436
  /**
312
437
  * How a target shows its page, in page space; an unset coordinate is left out.
313
438
  */
@@ -395,6 +520,32 @@ export interface StructureNodeJs {
395
520
  kids: StructureKidJs[];
396
521
  }
397
522
 
523
+ /**
524
+ * One font the document uses.
525
+ */
526
+ export interface FontJs {
527
+ /**
528
+ * Its name without a subset tag.
529
+ */
530
+ name?: string;
531
+ /**
532
+ * `Type0`, `Type1`, `MMType1`, `Type3` or `TrueType`.
533
+ */
534
+ kind?: string;
535
+ /**
536
+ * The file holds the font.
537
+ */
538
+ embedded: boolean;
539
+ /**
540
+ * The file holds only the glyphs used.
541
+ */
542
+ subset: boolean;
543
+ /**
544
+ * Its encoding; absent when the font gives none.
545
+ */
546
+ encoding?: EncodingJs;
547
+ }
548
+
398
549
  /**
399
550
  * One outline item and its children.
400
551
  */
@@ -742,6 +893,11 @@ export interface DocumentInfoJs {
742
893
  */
743
894
  export type PdfVersionInit = "1.4" | "1.5" | "1.6" | "1.7" | "2.0";
744
895
 
896
+ /**
897
+ * The cipher a file's streams use (ISO 32000-2 §7.6): the one list, which the `.d.ts` gets as a union.
898
+ */
899
+ export type CipherJs = "rc4" | "aes-128" | "aes-256" | "identity" | "other";
900
+
745
901
  /**
746
902
  * The cross-reference form.
747
903
  */
@@ -823,6 +979,11 @@ export interface EditedJs {
823
979
  * IDs of the pages whose content or attributes changed.
824
980
  */
825
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;
826
987
  }
827
988
 
828
989
  /**
@@ -845,6 +1006,62 @@ export type ExtractFormat = "markdown" | "json" | "text" | "chunks";
845
1006
  */
846
1007
  export type ModelResultInit = { kind: "layout"; regions: RegionInit[] } | { kind: "ocr"; words: WordInit[] };
847
1008
 
1009
+ /**
1010
+ * What a document holds besides its pages.
1011
+ */
1012
+ export interface ContainsJs {
1013
+ /**
1014
+ * Some action runs JavaScript.
1015
+ */
1016
+ javascript: boolean;
1017
+ /**
1018
+ * The number of embedded files.
1019
+ */
1020
+ attachments: number;
1021
+ /**
1022
+ * The document has a form with at least one field.
1023
+ */
1024
+ forms: boolean;
1025
+ }
1026
+
1027
+ /**
1028
+ * What a file's author permits: a request to readers, not a lock.
1029
+ */
1030
+ export interface PermissionsJs {
1031
+ /**
1032
+ * Printing.
1033
+ */
1034
+ print: boolean;
1035
+ /**
1036
+ * Printing at full quality.
1037
+ */
1038
+ printHighQuality: boolean;
1039
+ /**
1040
+ * Changing the contents.
1041
+ */
1042
+ modify: boolean;
1043
+ /**
1044
+ * Copying text and graphics.
1045
+ */
1046
+ copy: boolean;
1047
+ /**
1048
+ * Adding or changing annotations.
1049
+ */
1050
+ annotate: boolean;
1051
+ /**
1052
+ * Filling form fields.
1053
+ */
1054
+ fillForms: boolean;
1055
+ /**
1056
+ * Extracting text for accessibility.
1057
+ */
1058
+ accessibility: boolean;
1059
+ /**
1060
+ * Inserting, rotating or deleting pages.
1061
+ */
1062
+ assemble: boolean;
1063
+ }
1064
+
848
1065
  /**
849
1066
  * What a save wrote (`laminapdf::SaveReport`).
850
1067
  */
@@ -880,6 +1097,25 @@ export interface SaveReportJs {
880
1097
  */
881
1098
  export type OutputJs = "whole" | "appendedOnly";
882
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
+
1114
+ /**
1115
+ * What following a link does, by `kind`.
1116
+ */
1117
+ export type LinkToJs = { kind: "dest"; target?: TargetJs } | { kind: "named"; name: string; target?: TargetJs } | { kind: "uri"; uri: string } | { kind: "remote"; file?: string } | { kind: "named-action"; name: string } | { kind: "unsupported"; action: string };
1118
+
883
1119
  /**
884
1120
  * What happens to hidden text and page furniture.
885
1121
  */
@@ -1114,6 +1350,10 @@ export class WasmDocument {
1114
1350
  * Reading errors.
1115
1351
  */
1116
1352
  info(): DocumentInfoJs;
1353
+ /**
1354
+ * Whether the file is encrypted (it opened with its password, or the empty one).
1355
+ */
1356
+ isEncrypted(): boolean;
1117
1357
  /**
1118
1358
  * Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
1119
1359
  *
@@ -1182,6 +1422,13 @@ export class WasmDocument {
1182
1422
  * Reading errors.
1183
1423
  */
1184
1424
  pageInfos(): PageInfoJs[];
1425
+ /**
1426
+ * The visible links on page `index`, in annotation order (the extract and text modules).
1427
+ *
1428
+ * # Errors
1429
+ * `page-index-out-of-range`, `data-pending` and the reading errors.
1430
+ */
1431
+ pageLinks(index: number): PageLinkJs[];
1185
1432
  /**
1186
1433
  * A handle on page `index` that follows the page by its ID (F2).
1187
1434
  *
@@ -1189,6 +1436,13 @@ export class WasmDocument {
1189
1436
  * `page-index-out-of-range`; reading errors.
1190
1437
  */
1191
1438
  page(index: number): WasmPage;
1439
+ /**
1440
+ * The document's properties (the extract and text modules). Reads every object once.
1441
+ *
1442
+ * # Errors
1443
+ * `data-pending` and the reading errors.
1444
+ */
1445
+ properties(): PropertiesJs;
1192
1446
  /**
1193
1447
  * Rebases onto `bytes`, the output of a save whose rebase failed (`not-rebased`).
1194
1448
  *
@@ -1197,12 +1451,22 @@ export class WasmDocument {
1197
1451
  */
1198
1452
  rebase(bytes: Uint8Array): void;
1199
1453
  /**
1200
- * Redoes the newest undone transaction; `undefined` when there is nothing to redo.
1454
+ * Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
1455
+ * when there is nothing to redo.
1201
1456
  *
1202
1457
  * # Errors
1203
1458
  * As [`WasmDocument::undo`].
1204
1459
  */
1205
- redo(): UndoOutcomeJs | undefined;
1460
+ redo(): RevertedJs | undefined;
1461
+ /**
1462
+ * The document for reader mode, as JSON: whether it can be shown and why not, its
1463
+ * language, its blocks in the structure tree's order (figures, formulas and tables as crops
1464
+ * with their alternate text) and the checks' measures (the extract module only).
1465
+ *
1466
+ * # Errors
1467
+ * `data-pending` and the reading errors.
1468
+ */
1469
+ reflow(): string;
1206
1470
  /**
1207
1471
  * A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
1208
1472
  *
@@ -1226,12 +1490,13 @@ export class WasmDocument {
1226
1490
  */
1227
1491
  structureTree(): StructureNodeJs[] | undefined;
1228
1492
  /**
1229
- * Undoes the newest transaction; `undefined` when there is nothing to undo.
1493
+ * Undoes the newest transaction: how it went and the pages it touched; `undefined` when
1494
+ * there is nothing to undo.
1230
1495
  *
1231
1496
  * # Errors
1232
1497
  * `nested-transaction`, `saved-not-rebased`; reading errors.
1233
1498
  */
1234
- undo(): UndoOutcomeJs | undefined;
1499
+ undo(): RevertedJs | undefined;
1235
1500
  /**
1236
1501
  * A cursor over the warnings so far (build warnings first), each as the §1 object.
1237
1502
  */
@@ -1651,6 +1916,7 @@ export interface InitOutput {
1651
1916
  readonly wasmdocument_extractJob: (a: number, b: any) => [number, number, number];
1652
1917
  readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
1653
1918
  readonly wasmdocument_info: (a: number) => [number, number, number];
1919
+ readonly wasmdocument_isEncrypted: (a: number) => number;
1654
1920
  readonly wasmdocument_isTagged: (a: number) => [number, number, number];
1655
1921
  readonly wasmdocument_namedDestination: (a: number, b: number, c: number) => [number, number, number];
1656
1922
  readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
@@ -1661,8 +1927,11 @@ export interface InitOutput {
1661
1927
  readonly wasmdocument_pageCount: (a: number) => [number, number, number];
1662
1928
  readonly wasmdocument_pageInfo: (a: number, b: number) => [number, number, number];
1663
1929
  readonly wasmdocument_pageInfos: (a: number) => [number, number, number];
1930
+ readonly wasmdocument_pageLinks: (a: number, b: number) => [number, number, number];
1931
+ readonly wasmdocument_properties: (a: number) => [number, number, number];
1664
1932
  readonly wasmdocument_rebase: (a: number, b: number, c: number) => [number, number];
1665
1933
  readonly wasmdocument_redo: (a: number) => [number, number, number];
1934
+ readonly wasmdocument_reflow: (a: number) => [number, number, number, number];
1666
1935
  readonly wasmdocument_save: (a: number, b: any) => [number, number, number];
1667
1936
  readonly wasmdocument_saveJob: (a: number, b: any) => [number, number, number];
1668
1937
  readonly wasmdocument_structureTree: (a: number) => [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
  *
@@ -466,6 +475,22 @@ export class WasmDocument {
466
475
  }
467
476
  return takeFromExternrefTable0(ret[0]);
468
477
  }
478
+ /**
479
+ * The visible links on page `index`, in annotation order (the extract and text modules).
480
+ *
481
+ * # Errors
482
+ * `page-index-out-of-range`, `data-pending` and the reading errors.
483
+ * @param {number} index
484
+ * @returns {PageLinkJs[]}
485
+ */
486
+ pageLinks(index) {
487
+ let ret;
488
+ ret = wasm.wasmdocument_pageLinks(this.__wbg_ptr, index);
489
+ if (ret[2]) {
490
+ throw takeFromExternrefTable0(ret[1]);
491
+ }
492
+ return takeFromExternrefTable0(ret[0]);
493
+ }
469
494
  /**
470
495
  * A handle on page `index` that follows the page by its ID (F2).
471
496
  *
@@ -482,6 +507,21 @@ export class WasmDocument {
482
507
  }
483
508
  return WasmPage.__wrap(ret[0]);
484
509
  }
510
+ /**
511
+ * The document's properties (the extract and text modules). Reads every object once.
512
+ *
513
+ * # Errors
514
+ * `data-pending` and the reading errors.
515
+ * @returns {PropertiesJs}
516
+ */
517
+ properties() {
518
+ let ret;
519
+ ret = wasm.wasmdocument_properties(this.__wbg_ptr);
520
+ if (ret[2]) {
521
+ throw takeFromExternrefTable0(ret[1]);
522
+ }
523
+ return takeFromExternrefTable0(ret[0]);
524
+ }
485
525
  /**
486
526
  * Rebases onto `bytes`, the output of a save whose rebase failed (`not-rebased`).
487
527
  *
@@ -499,11 +539,12 @@ export class WasmDocument {
499
539
  }
500
540
  }
501
541
  /**
502
- * Redoes the newest undone transaction; `undefined` when there is nothing to redo.
542
+ * Redoes the newest undone transaction: how it went and the pages it touched; `undefined`
543
+ * when there is nothing to redo.
503
544
  *
504
545
  * # Errors
505
546
  * As [`WasmDocument::undo`].
506
- * @returns {UndoOutcomeJs | undefined}
547
+ * @returns {RevertedJs | undefined}
507
548
  */
508
549
  redo() {
509
550
  let ret;
@@ -513,6 +554,34 @@ export class WasmDocument {
513
554
  }
514
555
  return takeFromExternrefTable0(ret[0]);
515
556
  }
557
+ /**
558
+ * The document for reader mode, as JSON: whether it can be shown and why not, its
559
+ * language, its blocks in the structure tree's order (figures, formulas and tables as crops
560
+ * with their alternate text) and the checks' measures (the extract module only).
561
+ *
562
+ * # Errors
563
+ * `data-pending` and the reading errors.
564
+ * @returns {string}
565
+ */
566
+ reflow() {
567
+ let deferred2_0;
568
+ let deferred2_1;
569
+ try {
570
+ let ret;
571
+ ret = wasm.wasmdocument_reflow(this.__wbg_ptr);
572
+ var ptr1 = ret[0];
573
+ var len1 = ret[1];
574
+ if (ret[3]) {
575
+ ptr1 = 0; len1 = 0;
576
+ throw takeFromExternrefTable0(ret[2]);
577
+ }
578
+ deferred2_0 = ptr1;
579
+ deferred2_1 = len1;
580
+ return getStringFromWasm0(ptr1, len1);
581
+ } finally {
582
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
583
+ }
584
+ }
516
585
  /**
517
586
  * A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
518
587
  *
@@ -562,11 +631,12 @@ export class WasmDocument {
562
631
  return takeFromExternrefTable0(ret[0]);
563
632
  }
564
633
  /**
565
- * Undoes the newest transaction; `undefined` when there is nothing to undo.
634
+ * Undoes the newest transaction: how it went and the pages it touched; `undefined` when
635
+ * there is nothing to undo.
566
636
  *
567
637
  * # Errors
568
638
  * `nested-transaction`, `saved-not-rebased`; reading errors.
569
- * @returns {UndoOutcomeJs | undefined}
639
+ * @returns {RevertedJs | undefined}
570
640
  */
571
641
  undo() {
572
642
  let ret;
Binary file
@@ -35,12 +35,15 @@ export class HayroDocument {
35
35
  */
36
36
  plan(page: number, scale: number, x: number, y: number, width: number, height: number, rotation: number, flags: number, background?: number | null): Uint32Array;
37
37
  /**
38
- * Renders the request into `out` (exactly `width × height × 4` bytes, straight RGBA).
38
+ * Renders the request into `out` (exactly `width × height × 4` bytes, straight RGBA), in
39
+ * the page appearance `appearance` (0 original, 1 sepia, 2 dark, 3 high contrast with `ink`
40
+ * and `paper` as `0xRRGGBBAA`; the colours are ignored otherwise).
39
41
  *
40
42
  * # Errors
41
- * As [`HayroDocument::plan`], plus `render-failed` and `invalid-argument` for a wrong size.
43
+ * As [`HayroDocument::plan`], plus `render-failed`, and `invalid-argument` for a wrong size
44
+ * or an unknown appearance.
42
45
  */
43
- render(page: number, scale: number, x: number, y: number, width: number, height: number, rotation: number, flags: number, background: number | null | undefined, out: Uint8Array): void;
46
+ render(page: number, scale: number, x: number, y: number, width: number, height: number, rotation: number, flags: number, background: number | null | undefined, appearance: number, ink: number, paper: number, out: Uint8Array): void;
44
47
  }
45
48
 
46
49
  /**
@@ -78,7 +81,7 @@ export interface InitOutput {
78
81
  readonly hayrodocument_page: (a: number, b: number) => [number, number, number, number];
79
82
  readonly hayrodocument_pageCount: (a: number) => number;
80
83
  readonly hayrodocument_plan: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
81
- readonly hayrodocument_render: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: any) => [number, number];
84
+ readonly hayrodocument_render: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: any) => [number, number];
82
85
  readonly inputbuffer_new: (a: number) => [number, number, number];
83
86
  readonly inputbuffer_write: (a: number, b: number, c: number, d: number) => [number, number];
84
87
  readonly __wbindgen_exn_store: (a: number) => void;