@laminapdf/wasm 0.2.0 → 0.3.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/dist/lamina_pdf_base.d.ts +1178 -16
- package/dist/lamina_pdf_base.js +140 -0
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +1511 -34
- package/dist/lamina_pdf_extract.js +284 -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 +1513 -36
- package/dist/lamina_pdf_text.js +284 -0
- package/dist/lamina_pdf_text.wasm +0 -0
- package/dist/lamina_pdf_tiff.d.ts +71 -0
- package/dist/lamina_pdf_tiff.js +259 -0
- package/dist/lamina_pdf_tiff.wasm +0 -0
- package/package.json +6 -1
|
@@ -44,6 +44,27 @@ export type PageLinkJs = {
|
|
|
44
44
|
} & LinkToJs;
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* A bookmark's look: its colour (`/C`; `None` is the viewer's default, black) and type style
|
|
49
|
+
* (`/F`: bit 1 italic, bit 2 bold).
|
|
50
|
+
*
|
|
51
|
+
* Added in 0.3.0.
|
|
52
|
+
*/
|
|
53
|
+
export interface OutlineStyle {
|
|
54
|
+
/**
|
|
55
|
+
* The colour.
|
|
56
|
+
*/
|
|
57
|
+
color?: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Bold.
|
|
60
|
+
*/
|
|
61
|
+
bold?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Italic.
|
|
64
|
+
*/
|
|
65
|
+
italic?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
/**
|
|
48
69
|
* A change a signature's restriction forbids.
|
|
49
70
|
*/
|
|
@@ -76,12 +97,20 @@ export interface ViolationJs {
|
|
|
76
97
|
*/
|
|
77
98
|
export type ColorInit = number[] | string;
|
|
78
99
|
|
|
100
|
+
/**
|
|
101
|
+
* A colour of 8 bits a channel, `"#rrggbb"` on the wire. A bookmark's `/C` (§12.3.3,
|
|
102
|
+
* Table 151) holds it as three numbers from 0 to 1.
|
|
103
|
+
*
|
|
104
|
+
* Added in 0.3.0.
|
|
105
|
+
*/
|
|
106
|
+
export type Rgb = string;
|
|
107
|
+
|
|
79
108
|
/**
|
|
80
109
|
* A conformance claim the document's metadata no longer meets.
|
|
81
110
|
*
|
|
82
111
|
* Added in 0.2.0.
|
|
83
112
|
*/
|
|
84
|
-
export type ConformanceWarning = { code: "pdfa-one-author"; authors: number } | { code: "pdfua-title-missing" } | { code: "pdfa-info-mismatch"; keys: MetadataKey[] };
|
|
113
|
+
export type ConformanceWarning = { code: "pdfa-one-author"; authors: number } | { code: "pdfua-title-missing" } | { code: "pdfa-info-mismatch"; keys: MetadataKey[] } | { code: "duplicate-tags-incomplete" } | { code: "imported-tags-dropped" } | { code: "imported-pdfa-unchecked" };
|
|
85
114
|
|
|
86
115
|
/**
|
|
87
116
|
* A conformance profile.
|
|
@@ -408,6 +437,32 @@ export interface ModelInfoInit {
|
|
|
408
437
|
licence: string;
|
|
409
438
|
}
|
|
410
439
|
|
|
440
|
+
/**
|
|
441
|
+
* A move in user space (ISO 32000-2 §8.3.2.3: y up), in user-space units. Both distances are
|
|
442
|
+
* finite: [`Offset::new`] and the wire form refuse anything else, so a move never writes a
|
|
443
|
+
* coordinate a PDF can't hold.
|
|
444
|
+
*
|
|
445
|
+
* Added in 0.3.0.
|
|
446
|
+
*/
|
|
447
|
+
export interface Offset {
|
|
448
|
+
dx: number;
|
|
449
|
+
dy: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* A named destination brought in under another name.
|
|
454
|
+
*/
|
|
455
|
+
export interface RenamedDestinationJs {
|
|
456
|
+
/**
|
|
457
|
+
* Its name in the source.
|
|
458
|
+
*/
|
|
459
|
+
from: string;
|
|
460
|
+
/**
|
|
461
|
+
* Its name in this document.
|
|
462
|
+
*/
|
|
463
|
+
to: string;
|
|
464
|
+
}
|
|
465
|
+
|
|
411
466
|
/**
|
|
412
467
|
* A page and how to show it.
|
|
413
468
|
*/
|
|
@@ -422,11 +477,60 @@ export interface TargetJs {
|
|
|
422
477
|
view: TargetViewJs;
|
|
423
478
|
}
|
|
424
479
|
|
|
480
|
+
/**
|
|
481
|
+
* A page of this document and how to show it: what `/Dest [page /XYZ …]` holds.
|
|
482
|
+
*
|
|
483
|
+
* Added in 0.3.0.
|
|
484
|
+
*/
|
|
485
|
+
export interface ExplicitDestination {
|
|
486
|
+
/**
|
|
487
|
+
* The page.
|
|
488
|
+
*/
|
|
489
|
+
page: string;
|
|
490
|
+
/**
|
|
491
|
+
* How to show it.
|
|
492
|
+
*/
|
|
493
|
+
view: DestinationView;
|
|
494
|
+
}
|
|
495
|
+
|
|
425
496
|
/**
|
|
426
497
|
* A page-label numbering style.
|
|
427
498
|
*/
|
|
428
499
|
export type LabelStyleInit = "decimal" | "upperRoman" | "lowerRoman" | "upperLetters" | "lowerLetters";
|
|
429
500
|
|
|
501
|
+
/**
|
|
502
|
+
* A patch of the window entries of `/ViewerPreferences` ([`WindowPreferences`]): each field
|
|
503
|
+
* left out keeps what the file has, `true` sets the entry, `false` removes it.
|
|
504
|
+
*
|
|
505
|
+
* Added in 0.3.0.
|
|
506
|
+
*/
|
|
507
|
+
export interface WindowPreferencesPatch {
|
|
508
|
+
/**
|
|
509
|
+
* `/HideToolbar`.
|
|
510
|
+
*/
|
|
511
|
+
hideToolbar?: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* `/HideMenubar`.
|
|
514
|
+
*/
|
|
515
|
+
hideMenubar?: boolean;
|
|
516
|
+
/**
|
|
517
|
+
* `/HideWindowUI`.
|
|
518
|
+
*/
|
|
519
|
+
hideWindowUi?: boolean;
|
|
520
|
+
/**
|
|
521
|
+
* `/FitWindow`.
|
|
522
|
+
*/
|
|
523
|
+
fitWindow?: boolean;
|
|
524
|
+
/**
|
|
525
|
+
* `/CenterWindow`.
|
|
526
|
+
*/
|
|
527
|
+
centerWindow?: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* `/DisplayDocTitle`.
|
|
530
|
+
*/
|
|
531
|
+
displayDocTitle?: boolean;
|
|
532
|
+
}
|
|
533
|
+
|
|
430
534
|
/**
|
|
431
535
|
* A rectangle as returned to JavaScript.
|
|
432
536
|
*/
|
|
@@ -494,6 +598,60 @@ export interface ExtractProgressJs {
|
|
|
494
598
|
request?: ModelRequestJs;
|
|
495
599
|
}
|
|
496
600
|
|
|
601
|
+
/**
|
|
602
|
+
* Adds a bookmark under `parent` (`null`: the top level) at `at`, with its title, target and
|
|
603
|
+
* style. It has no children, so it has no open state yet (`/Count`, §12.3.3): set it with
|
|
604
|
+
* [`UpdateOutlineItem::open`] once it has some. The new item's ID is in
|
|
605
|
+
* [`Applied::created_outline_items`](crate::Applied::created_outline_items).
|
|
606
|
+
*
|
|
607
|
+
* On the wire: `{ "op": "addOutlineItem", "args": { "parent": null, "at": "last", "title":
|
|
608
|
+
* "Chapter 1", "target": { "destination": { "page": "p3.0", "view": { "kind": "fit" } } } } }`.
|
|
609
|
+
*
|
|
610
|
+
* Added in 0.3.0.
|
|
611
|
+
*/
|
|
612
|
+
export interface AddOutlineItem {
|
|
613
|
+
/**
|
|
614
|
+
* The parent item; `None` for the top level.
|
|
615
|
+
*/
|
|
616
|
+
parent?: string | null;
|
|
617
|
+
/**
|
|
618
|
+
* Where among the parent's children.
|
|
619
|
+
*/
|
|
620
|
+
at: "first" | "last" | { before: string } | { after: string };
|
|
621
|
+
/**
|
|
622
|
+
* The title.
|
|
623
|
+
*/
|
|
624
|
+
title: string;
|
|
625
|
+
/**
|
|
626
|
+
* Where the bookmark goes.
|
|
627
|
+
*/
|
|
628
|
+
target: OutlineTarget;
|
|
629
|
+
/**
|
|
630
|
+
* Its colour and type style.
|
|
631
|
+
*/
|
|
632
|
+
style?: OutlineStyle;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Adds a named destination, or points an existing one at `destination`. A name the catalog's
|
|
637
|
+
* `/Dests` dictionary holds stays there; any other goes into the `/Names /Dests` tree.
|
|
638
|
+
*
|
|
639
|
+
* On the wire: `{ "op": "setNamedDestination", "args": { "name": "results", "destination": {
|
|
640
|
+
* "page": "p7.0", "view": { "kind": "fitH", "top": 700 } } } }`.
|
|
641
|
+
*
|
|
642
|
+
* Added in 0.3.0.
|
|
643
|
+
*/
|
|
644
|
+
export interface SetNamedDestination {
|
|
645
|
+
/**
|
|
646
|
+
* The name.
|
|
647
|
+
*/
|
|
648
|
+
name: string;
|
|
649
|
+
/**
|
|
650
|
+
* Where it points.
|
|
651
|
+
*/
|
|
652
|
+
destination: ExplicitDestination;
|
|
653
|
+
}
|
|
654
|
+
|
|
497
655
|
/**
|
|
498
656
|
* Alignment of a text box's lines.
|
|
499
657
|
*/
|
|
@@ -517,6 +675,47 @@ export interface WordInit {
|
|
|
517
675
|
confidence: number;
|
|
518
676
|
}
|
|
519
677
|
|
|
678
|
+
/**
|
|
679
|
+
* An XMP property declared in a PDF/A file's extension schemas.
|
|
680
|
+
*/
|
|
681
|
+
export interface ExtensionPropertyJs {
|
|
682
|
+
/**
|
|
683
|
+
* The schema's namespace URI.
|
|
684
|
+
*/
|
|
685
|
+
namespace: string;
|
|
686
|
+
/**
|
|
687
|
+
* The prefix the packet writes the namespace with.
|
|
688
|
+
*/
|
|
689
|
+
prefix: string;
|
|
690
|
+
/**
|
|
691
|
+
* The property's local name.
|
|
692
|
+
*/
|
|
693
|
+
name: string;
|
|
694
|
+
/**
|
|
695
|
+
* Its declared type, e.g. `Text` or `Seq Integer`.
|
|
696
|
+
*/
|
|
697
|
+
valueType: string;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* An annotation's own geometry, by `kind`; points are flat `[x, y, …]` lists in page space.
|
|
702
|
+
*/
|
|
703
|
+
export type GeometryJs = { kind: "none" } | { kind: "quads"; quads: number[] } | { kind: "ink"; strokes: number[][] } | { kind: "vertices"; points: number[] } | { kind: "line"; points: number[] } | { kind: "callout"; points: number[] };
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* An article thread: its title and its parts in reading order.
|
|
707
|
+
*/
|
|
708
|
+
export interface ThreadJs {
|
|
709
|
+
/**
|
|
710
|
+
* Its title (document text), when it has one.
|
|
711
|
+
*/
|
|
712
|
+
title?: string;
|
|
713
|
+
/**
|
|
714
|
+
* Its parts.
|
|
715
|
+
*/
|
|
716
|
+
parts: ThreadPartJs[];
|
|
717
|
+
}
|
|
718
|
+
|
|
520
719
|
/**
|
|
521
720
|
* An attached file's options.
|
|
522
721
|
*/
|
|
@@ -558,7 +757,146 @@ export interface AttachmentInit {
|
|
|
558
757
|
*
|
|
559
758
|
* Added in 0.2.0.
|
|
560
759
|
*/
|
|
561
|
-
export type Op = { op: "setInfo"; args: SetInfo } | { op: "rotatePage"; args: RotatePage } | { op: "setMetadata"; args: SetMetadata } | { op: "removeMetadata"; args: RemoveMetadata };
|
|
760
|
+
export type Op = { op: "setInfo"; args: SetInfo } | { op: "rotatePage"; args: RotatePage } | { op: "setMetadata"; args: SetMetadata } | { op: "removeMetadata"; args: RemoveMetadata } | { op: "setInitialView"; args: SetInitialView } | { op: "addOutlineItem"; args: AddOutlineItem } | { op: "updateOutlineItem"; args: UpdateOutlineItem } | { op: "moveOutlineItem"; args: MoveOutlineItem } | { op: "deleteOutlineItem"; args: DeleteOutlineItem } | { op: "setNamedDestination"; args: SetNamedDestination } | { op: "renameNamedDestination"; args: RenameNamedDestination } | { op: "deleteNamedDestination"; args: DeleteNamedDestination } | { op: "setXmpProperty"; args: SetXmpProperty } | { op: "removeXmpProperty"; args: RemoveXmpProperty } | { op: "replaceXmpPacket"; args: ReplaceXmpPacket } | { op: "insertBlankPages"; args: InsertBlankPages } | { op: "deletePages"; args: DeletePages } | { op: "movePages"; args: MovePages } | { op: "rotatePages"; args: RotatePages } | { op: "reversePages"; args: ReversePages } | { op: "duplicatePages"; args: DuplicatePages } | { op: "insertPagesFrom"; args: InsertPagesFrom } | { op: "replacePages"; args: ReplacePages } | { op: "mergeDocuments"; args: MergeDocuments } | { op: "updateAnnot"; args: UpdateAnnot } | { op: "deleteAnnot"; args: DeleteAnnot } | { op: "setPageLabels"; args: SetPageLabels };
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Changes a bookmark's title, target, style or open state. An absent field is left alone. A
|
|
764
|
+
* target held as another action (JavaScript, `Launch`, …) is replaced only when `target` is
|
|
765
|
+
* given; the item's other entries are kept.
|
|
766
|
+
*
|
|
767
|
+
* On the wire: `{ "op": "updateOutlineItem", "args": { "item": "o12.0", "title": "Results",
|
|
768
|
+
* "open": true } }`.
|
|
769
|
+
*
|
|
770
|
+
* Added in 0.3.0.
|
|
771
|
+
*/
|
|
772
|
+
export interface UpdateOutlineItem {
|
|
773
|
+
/**
|
|
774
|
+
* The item.
|
|
775
|
+
*/
|
|
776
|
+
item: string;
|
|
777
|
+
/**
|
|
778
|
+
* A new title.
|
|
779
|
+
*/
|
|
780
|
+
title?: string;
|
|
781
|
+
/**
|
|
782
|
+
* A new target.
|
|
783
|
+
*/
|
|
784
|
+
target?: OutlineTarget;
|
|
785
|
+
/**
|
|
786
|
+
* A new style (colour and type style together).
|
|
787
|
+
*/
|
|
788
|
+
style?: OutlineStyle;
|
|
789
|
+
/**
|
|
790
|
+
* Open (children shown) or closed; a bookmark without children has nowhere to keep it
|
|
791
|
+
* (`/Count`, §12.3.3), so it writes nothing there.
|
|
792
|
+
*/
|
|
793
|
+
open?: boolean;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Changes an annotation's common and markup entries and moves it.
|
|
798
|
+
*
|
|
799
|
+
* An absent field leaves the entry alone and `null` removes it. `translate` moves `/Rect` and
|
|
800
|
+
* the subtype's geometry (`/QuadPoints`, `/InkList`, `/Vertices`, `/L`, `/CL`) and the
|
|
801
|
+
* annotation's Popup with it, and keeps the appearance, which §12.5.5 maps onto the new
|
|
802
|
+
* `/Rect`. A `Locked` annotation refuses everything but a change of its flags and its
|
|
803
|
+
* contents; a `LockedContents` one refuses a change of its contents (`annotation-locked`).
|
|
804
|
+
* Widgets and annotations stored as direct dictionaries are refused (`annotation-not-editable`).
|
|
805
|
+
*
|
|
806
|
+
* On the wire: `{ "op": "updateAnnot", "args": { "id": "a12.0", "contents": "Checked",
|
|
807
|
+
* "translate": { "dx": 0, "dy": -10 } } }`.
|
|
808
|
+
*
|
|
809
|
+
* Added in 0.3.0.
|
|
810
|
+
*/
|
|
811
|
+
export interface UpdateAnnot {
|
|
812
|
+
/**
|
|
813
|
+
* The annotation.
|
|
814
|
+
*/
|
|
815
|
+
id: string;
|
|
816
|
+
/**
|
|
817
|
+
* `/Contents`: the comment, or the alternative description.
|
|
818
|
+
*/
|
|
819
|
+
contents?: string | null;
|
|
820
|
+
/**
|
|
821
|
+
* `/T`: the author.
|
|
822
|
+
*/
|
|
823
|
+
author?: string | null;
|
|
824
|
+
/**
|
|
825
|
+
* `/Subj`.
|
|
826
|
+
*/
|
|
827
|
+
subject?: string | null;
|
|
828
|
+
/**
|
|
829
|
+
* `/M`, the modification date the edit writes.
|
|
830
|
+
*/
|
|
831
|
+
modified?: string;
|
|
832
|
+
/**
|
|
833
|
+
* `/F`, all the flags at once (Table 167).
|
|
834
|
+
*/
|
|
835
|
+
flags?: number;
|
|
836
|
+
/**
|
|
837
|
+
* A move in user space.
|
|
838
|
+
*/
|
|
839
|
+
translate?: Offset;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Changes how the document asks to be shown when it opens. Each field is a patch: left out,
|
|
844
|
+
* it keeps what the file has; `null` removes the entry, so readers use their default; a value
|
|
845
|
+
* sets it.
|
|
846
|
+
*
|
|
847
|
+
* * `open`: the page and zoom to open at, written as an explicit destination in
|
|
848
|
+
* `/OpenAction` (§12.3.2.2). An `/OpenAction` that is an action other than `GoTo`
|
|
849
|
+
* (JavaScript, a named action, a link to another file) is never replaced or removed: the op
|
|
850
|
+
* fails with [`Error::OpenActionNotDestination`].
|
|
851
|
+
* * `page_mode`, `page_layout`: the panel to show and how to lay the pages out.
|
|
852
|
+
* * `preferences`: the window entries of `/ViewerPreferences` (§12.2, Table 147); `true` sets
|
|
853
|
+
* one, `false` removes it (its default), and other entries (`/Direction`, `/PrintScaling`, …)
|
|
854
|
+
* are kept.
|
|
855
|
+
*
|
|
856
|
+
* When a value needs a later PDF version than the file declares (`UseAttachments` 1.6,
|
|
857
|
+
* `UseOC` and the two-page layouts 1.5, `/DisplayDocTitle` 1.4), the catalog's `/Version` is
|
|
858
|
+
* raised to it. The op is class [`Document`](crate::ModificationClass::Document) and touches no
|
|
859
|
+
* page.
|
|
860
|
+
*
|
|
861
|
+
* On the wire:
|
|
862
|
+
* `{ "op": "setInitialView", "args": { "open": { "page": "p12.0", "zoom": "fitWidth" },
|
|
863
|
+
* "pageMode": "outlines", "pageLayout": null, "preferences": { "displayDocTitle": true } } }`.
|
|
864
|
+
*
|
|
865
|
+
* ```
|
|
866
|
+
* use laminapdf_ops::{OpenAt, OpenZoom, SetInitialView, WindowPreferencesPatch};
|
|
867
|
+
* use laminapdf_model::PageMode;
|
|
868
|
+
*
|
|
869
|
+
* let op = SetInitialView::default()
|
|
870
|
+
* .with_open(Some(OpenAt::new("p3.0".parse()?, OpenZoom::FitWidth)))
|
|
871
|
+
* .with_page_mode(Some(PageMode::Outlines))
|
|
872
|
+
* .with_preferences(WindowPreferencesPatch::default().with_display_doc_title(true));
|
|
873
|
+
* assert_eq!(
|
|
874
|
+
* serde_json::to_string(&op)?,
|
|
875
|
+
* r#"{"open":{"page":"p3.0","zoom":"fitWidth"},"pageMode":"outlines","preferences":{"displayDocTitle":true}}"#
|
|
876
|
+
* );
|
|
877
|
+
* # Ok::<(), Box<dyn std::error::Error>>(())
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
880
|
+
* Added in 0.3.0.
|
|
881
|
+
*/
|
|
882
|
+
export interface SetInitialView {
|
|
883
|
+
/**
|
|
884
|
+
* The page and zoom to open at.
|
|
885
|
+
*/
|
|
886
|
+
open?: OpenAt | null;
|
|
887
|
+
/**
|
|
888
|
+
* The panel to show (`/PageMode`).
|
|
889
|
+
*/
|
|
890
|
+
pageMode?: "none" | "outlines" | "thumbnails" | "fullScreen" | "optionalContent" | "attachments" | null;
|
|
891
|
+
/**
|
|
892
|
+
* How to lay the pages out (`/PageLayout`).
|
|
893
|
+
*/
|
|
894
|
+
pageLayout?: "singlePage" | "oneColumn" | "twoColumnLeft" | "twoColumnRight" | "twoPageLeft" | "twoPageRight" | null;
|
|
895
|
+
/**
|
|
896
|
+
* The window entries of `/ViewerPreferences`.
|
|
897
|
+
*/
|
|
898
|
+
preferences?: WindowPreferencesPatch;
|
|
899
|
+
}
|
|
562
900
|
|
|
563
901
|
/**
|
|
564
902
|
* Changes to the Info dictionary's text entries. For each field, `None` leaves the entry
|
|
@@ -651,6 +989,148 @@ export interface MetadataPatch {
|
|
|
651
989
|
modified?: string | null;
|
|
652
990
|
}
|
|
653
991
|
|
|
992
|
+
/**
|
|
993
|
+
* Copies `pages` (each once, in the order given) to `at`. A copy shares its source's content
|
|
994
|
+
* streams and resources and shows what it shows, inherited attributes included (ISO 32000-2
|
|
995
|
+
* §7.7.3.4). Its annotations are new objects with a new `/NM`; a form field's widget becomes
|
|
996
|
+
* a new field named `<partial>#<n>` with its own value, and a signature's widget is not copied
|
|
997
|
+
* (both in [`Applied::fields`](crate::Applied::fields)). In a tagged document the copy gets
|
|
998
|
+
* its own `/StructParents` key and clones of the elements whose content lies only on its
|
|
999
|
+
* source; content of elements that span pages is left untagged and the copy is listed in
|
|
1000
|
+
* [`Applied::tags_incomplete`](crate::Applied::tags_incomplete). Page labels continue the range
|
|
1001
|
+
* each copy lands in.
|
|
1002
|
+
*
|
|
1003
|
+
* On the wire: `{ "op": "duplicatePages", "args": { "pages": ["p7.0"], "at": { "after": "p7.0" } } }`.
|
|
1004
|
+
*
|
|
1005
|
+
* Added in 0.3.0.
|
|
1006
|
+
*/
|
|
1007
|
+
export interface DuplicatePages {
|
|
1008
|
+
/**
|
|
1009
|
+
* The pages to copy.
|
|
1010
|
+
*/
|
|
1011
|
+
pages: string[];
|
|
1012
|
+
/**
|
|
1013
|
+
* Where the copies go.
|
|
1014
|
+
*/
|
|
1015
|
+
at: "start" | "end" | { before: string } | { after: string };
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Copies pages of a source document into this one at `at`, in the order given (each once).
|
|
1020
|
+
* The copies are new objects with new IDs, sharing nothing with the source. Their
|
|
1021
|
+
* annotations point at them and get a new `/NM`; a link to a page that didn't come along is
|
|
1022
|
+
* removed ([`Applied::links_removed`](crate::Applied::links_removed)), and the named
|
|
1023
|
+
* destinations the others use come along, renamed `<name>#<n>` on a clash. Form fields join
|
|
1024
|
+
* the form under their own names, or per [`Carry::fields`] when the name is taken
|
|
1025
|
+
* ([`Applied::fields`](crate::Applied::fields)); signature fields are left off. The copies
|
|
1026
|
+
* lose their tags ([`Applied::tags_dropped`](crate::Applied::tags_dropped)), page labels
|
|
1027
|
+
* continue the range each copy lands in, and the document's version rises to the source's
|
|
1028
|
+
* when that is newer.
|
|
1029
|
+
*
|
|
1030
|
+
* On the wire: `{ "op": "insertPagesFrom", "args": { "source": "<64 hex digits>", "pages":
|
|
1031
|
+
* ["p3.0"], "at": "end" } }`, with `carry` optional.
|
|
1032
|
+
*
|
|
1033
|
+
* Added in 0.3.0.
|
|
1034
|
+
*/
|
|
1035
|
+
export interface InsertPagesFrom {
|
|
1036
|
+
/**
|
|
1037
|
+
* The source document.
|
|
1038
|
+
*/
|
|
1039
|
+
source: string;
|
|
1040
|
+
/**
|
|
1041
|
+
* The source's pages to copy, by their IDs in the source.
|
|
1042
|
+
*/
|
|
1043
|
+
pages: string[];
|
|
1044
|
+
/**
|
|
1045
|
+
* Where the copies go.
|
|
1046
|
+
*/
|
|
1047
|
+
at: "start" | "end" | { before: string } | { after: string };
|
|
1048
|
+
/**
|
|
1049
|
+
* What comes along with the pages.
|
|
1050
|
+
*/
|
|
1051
|
+
carry?: Carry;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Deletes `pages` (each once; unknown pages are an error). Outline items, links and `GoTo`
|
|
1056
|
+
* actions on surviving pages, named destinations and `/OpenAction` that named a deleted page
|
|
1057
|
+
* follow `references` ([`ReferencePolicy`]); structure elements whose content was all on
|
|
1058
|
+
* deleted pages are removed with their `/ParentTree` entries, and the widgets on deleted pages
|
|
1059
|
+
* leave the form (a field left with none leaves it too). The page objects stay in the file's
|
|
1060
|
+
* earlier revisions. Deleting every page is [`Error::NoPagesLeft`].
|
|
1061
|
+
*
|
|
1062
|
+
* On the wire: `{ "op": "deletePages", "args": { "pages": ["p7.0"], "references": "retarget" } }`.
|
|
1063
|
+
*
|
|
1064
|
+
* Added in 0.3.0.
|
|
1065
|
+
*/
|
|
1066
|
+
export interface DeletePages {
|
|
1067
|
+
/**
|
|
1068
|
+
* The pages.
|
|
1069
|
+
*/
|
|
1070
|
+
pages: string[];
|
|
1071
|
+
/**
|
|
1072
|
+
* What happens to destinations that name them; `retarget` when left out.
|
|
1073
|
+
*/
|
|
1074
|
+
references?: ReferencePolicy;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Deletes a bookmark, and its children with it or moved up into its place.
|
|
1079
|
+
*
|
|
1080
|
+
* On the wire: `{ "op": "deleteOutlineItem", "args": { "item": "o12.0", "children":
|
|
1081
|
+
* "promote" } }`.
|
|
1082
|
+
*
|
|
1083
|
+
* Added in 0.3.0.
|
|
1084
|
+
*/
|
|
1085
|
+
export interface DeleteOutlineItem {
|
|
1086
|
+
/**
|
|
1087
|
+
* The item.
|
|
1088
|
+
*/
|
|
1089
|
+
item: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* What happens to its children.
|
|
1092
|
+
*/
|
|
1093
|
+
children: ChildItems;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Deletes a named destination, from both stores when both hold it. Its uses in this file are left as they are and reported
|
|
1098
|
+
* ([`Applied::destination_uses`](crate::Applied::destination_uses)): a bookmark or link that
|
|
1099
|
+
* names it no longer goes anywhere.
|
|
1100
|
+
*
|
|
1101
|
+
* On the wire: `{ "op": "deleteNamedDestination", "args": { "name": "draft-notes" } }`.
|
|
1102
|
+
*
|
|
1103
|
+
* Added in 0.3.0.
|
|
1104
|
+
*/
|
|
1105
|
+
export interface DeleteNamedDestination {
|
|
1106
|
+
/**
|
|
1107
|
+
* The name.
|
|
1108
|
+
*/
|
|
1109
|
+
name: string;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Deletes an annotation with what belongs to it: its Popup, every reply whose `/IRT` chain
|
|
1114
|
+
* reaches it, and, for a member of a group (`/RT /Group`, §12.5.6.2), the whole group, which
|
|
1115
|
+
* is one unit. Chains are followed through cycles once. In a tagged document, the structure
|
|
1116
|
+
* element's object reference to each deleted annotation is removed, and so is an element left
|
|
1117
|
+
* with nothing in it. Each deleted object is freed.
|
|
1118
|
+
*
|
|
1119
|
+
* A `Locked` annotation is refused (`annotation-locked`), and so are widgets and direct
|
|
1120
|
+
* dictionaries (`annotation-not-editable`). Deleting a Popup alone removes the `/Popup` entry
|
|
1121
|
+
* that names it.
|
|
1122
|
+
*
|
|
1123
|
+
* On the wire: `{ "op": "deleteAnnot", "args": { "id": "a12.0" } }`.
|
|
1124
|
+
*
|
|
1125
|
+
* Added in 0.3.0.
|
|
1126
|
+
*/
|
|
1127
|
+
export interface DeleteAnnot {
|
|
1128
|
+
/**
|
|
1129
|
+
* The annotation.
|
|
1130
|
+
*/
|
|
1131
|
+
id: string;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
654
1134
|
/**
|
|
655
1135
|
* Edits the Info dictionary: applies `patch` and, when `at` is given, sets `/ModDate` to it.
|
|
656
1136
|
*
|
|
@@ -715,18 +1195,49 @@ export interface SetMetadata {
|
|
|
715
1195
|
}
|
|
716
1196
|
|
|
717
1197
|
/**
|
|
718
|
-
* How `
|
|
1198
|
+
* How [`RotatePages`] reads its angle.
|
|
1199
|
+
*
|
|
1200
|
+
* Added in 0.3.0.
|
|
719
1201
|
*/
|
|
720
|
-
export
|
|
721
|
-
/**
|
|
722
|
-
* The values a template's `$data`, `$each` and `$item` placeholders read; without it, the
|
|
723
|
-
* document is read as it is.
|
|
724
|
-
*/
|
|
725
|
-
data?: unknown;
|
|
726
|
-
}
|
|
1202
|
+
export type RotateMode = "set" | "turn";
|
|
727
1203
|
|
|
728
1204
|
/**
|
|
729
|
-
* How `
|
|
1205
|
+
* How [`images_to_pdf`] sizes its pages.
|
|
1206
|
+
*/
|
|
1207
|
+
export interface ImagesOptionsInit {
|
|
1208
|
+
/**
|
|
1209
|
+
* Each page this size, `[width, height]` in points, turned the image's way, the image fitted
|
|
1210
|
+
* inside the margins and centred. Without it, each page is its image's size at the image's
|
|
1211
|
+
* resolution.
|
|
1212
|
+
*/
|
|
1213
|
+
fit?: [number, number];
|
|
1214
|
+
/**
|
|
1215
|
+
* The space around each image, in points (0 by default).
|
|
1216
|
+
*/
|
|
1217
|
+
margin?: number;
|
|
1218
|
+
/**
|
|
1219
|
+
* The resolution of an image whose file gives none, in dots per inch (72 by default).
|
|
1220
|
+
*/
|
|
1221
|
+
defaultDpi?: number;
|
|
1222
|
+
/**
|
|
1223
|
+
* The new document's version, file ID, producer, creation date and compression.
|
|
1224
|
+
*/
|
|
1225
|
+
build?: BuildOptionsInit;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* How `flow` reads its document.
|
|
1230
|
+
*/
|
|
1231
|
+
export interface FlowOptionsInit {
|
|
1232
|
+
/**
|
|
1233
|
+
* The values a template's `$data`, `$each` and `$item` placeholders read; without it, the
|
|
1234
|
+
* document is read as it is.
|
|
1235
|
+
*/
|
|
1236
|
+
data?: unknown;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* How `markdown` lays a document out.
|
|
730
1241
|
*/
|
|
731
1242
|
export interface MarkdownOptionsInit {
|
|
732
1243
|
/**
|
|
@@ -748,6 +1259,38 @@ export interface MarkdownOptionsInit {
|
|
|
748
1259
|
*/
|
|
749
1260
|
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" };
|
|
750
1261
|
|
|
1262
|
+
/**
|
|
1263
|
+
* How a destination shows its page (§12.3.2.2, Table 149), in the page's user space. A `None`
|
|
1264
|
+
* coordinate keeps the viewer's current one (`null` in the file).
|
|
1265
|
+
*
|
|
1266
|
+
* Every number must be finite: the ops refuse any other with `view-not-finite`.
|
|
1267
|
+
*
|
|
1268
|
+
* Added in 0.3.0.
|
|
1269
|
+
*/
|
|
1270
|
+
export type DestinationView = { kind: "xyz"; left: number | undefined; top: number | undefined; zoom: number | undefined } | { kind: "fit" } | { kind: "fitH"; top: number | undefined } | { kind: "fitV"; left: number | undefined } | { kind: "fitR"; left: number; bottom: number; right: number; top: number } | { kind: "fitB" } | { kind: "fitBH"; top: number | undefined } | { kind: "fitBV"; left: number | undefined };
|
|
1271
|
+
|
|
1272
|
+
/**
|
|
1273
|
+
* How a document asks to be shown when it opens.
|
|
1274
|
+
*/
|
|
1275
|
+
export interface InitialViewJs {
|
|
1276
|
+
/**
|
|
1277
|
+
* Where it opens.
|
|
1278
|
+
*/
|
|
1279
|
+
open: OpenTargetJs;
|
|
1280
|
+
/**
|
|
1281
|
+
* The panel to show; left out when the file leaves it to the reader.
|
|
1282
|
+
*/
|
|
1283
|
+
pageMode?: "none" | "outlines" | "thumbnails" | "fullScreen" | "optionalContent" | "attachments";
|
|
1284
|
+
/**
|
|
1285
|
+
* How to lay the pages out; left out when the file leaves it to the reader.
|
|
1286
|
+
*/
|
|
1287
|
+
pageLayout?: "singlePage" | "oneColumn" | "twoColumnLeft" | "twoColumnRight" | "twoPageLeft" | "twoPageRight";
|
|
1288
|
+
/**
|
|
1289
|
+
* The window's viewer preferences.
|
|
1290
|
+
*/
|
|
1291
|
+
preferences: WindowPreferencesJs;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
751
1294
|
/**
|
|
752
1295
|
* How a file is encrypted, and what its author permits.
|
|
753
1296
|
*/
|
|
@@ -774,6 +1317,22 @@ export interface EncryptionJs {
|
|
|
774
1317
|
permissions?: PermissionsJs;
|
|
775
1318
|
}
|
|
776
1319
|
|
|
1320
|
+
/**
|
|
1321
|
+
* How a merge brings in what the sources hold besides their pages.
|
|
1322
|
+
*
|
|
1323
|
+
* Added in 0.3.0.
|
|
1324
|
+
*/
|
|
1325
|
+
export interface MergeOptions {
|
|
1326
|
+
/**
|
|
1327
|
+
* What becomes of the sources' bookmarks; `perFile` when left out.
|
|
1328
|
+
*/
|
|
1329
|
+
outline?: OutlineMerge;
|
|
1330
|
+
/**
|
|
1331
|
+
* What happens to a form field whose name is already used; `rename` when left out.
|
|
1332
|
+
*/
|
|
1333
|
+
fields?: FieldClash;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
777
1336
|
/**
|
|
778
1337
|
* How a run of text is drawn.
|
|
779
1338
|
*/
|
|
@@ -939,11 +1498,234 @@ export interface ViewerPreferencesInit {
|
|
|
939
1498
|
pageLayout?: PageLayoutInit;
|
|
940
1499
|
}
|
|
941
1500
|
|
|
1501
|
+
/**
|
|
1502
|
+
* Inserts `count` blank pages of `size` at `at`, each showing at `rotate`. Each new page
|
|
1503
|
+
* gets a new object and [`PageId`] (ADR 0005 §5), an empty `/Resources` and no content; in
|
|
1504
|
+
* a labelled document they continue the label range they land in. A count outside 1 to
|
|
1505
|
+
* 10,000, or a side that isn't above 0 and at most 14,400 points, is
|
|
1506
|
+
* [`Error::InvalidOp`](crate::Error::InvalidOp).
|
|
1507
|
+
*
|
|
1508
|
+
* On the wire: `{ "op": "insertBlankPages", "args": { "at": { "after": "p3.0" }, "count": 2,
|
|
1509
|
+
* "size": { "width": 612, "height": 792 }, "rotate": 0 } }`.
|
|
1510
|
+
*
|
|
1511
|
+
* Added in 0.3.0.
|
|
1512
|
+
*/
|
|
1513
|
+
export interface InsertBlankPages {
|
|
1514
|
+
/**
|
|
1515
|
+
* Where the pages go.
|
|
1516
|
+
*/
|
|
1517
|
+
at: "start" | "end" | { before: string } | { after: string };
|
|
1518
|
+
/**
|
|
1519
|
+
* How many pages, at least 1.
|
|
1520
|
+
*/
|
|
1521
|
+
count: number;
|
|
1522
|
+
/**
|
|
1523
|
+
* Their `/MediaBox` size, in points: `{ "width": 612, "height": 792 }`.
|
|
1524
|
+
*/
|
|
1525
|
+
size: { width: number; height: number };
|
|
1526
|
+
/**
|
|
1527
|
+
* Their rotation in degrees clockwise: 0, 90, 180 or 270.
|
|
1528
|
+
*/
|
|
1529
|
+
rotate: 0 | 90 | 180 | 270;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Merges source documents into this one at `at`, one after another, as one edit. Each
|
|
1534
|
+
* source's pages come in as [`InsertPagesFrom`](crate::InsertPagesFrom) brings them (their
|
|
1535
|
+
* annotations, links and the named destinations those use, form fields under the clash rule
|
|
1536
|
+
* of `options.fields`, signature fields left off, tags dropped), and with them what belongs to
|
|
1537
|
+
* the whole source:
|
|
1538
|
+
*
|
|
1539
|
+
* - its bookmarks, per `options.outline`, going to the copies of their pages; a bookmark whose
|
|
1540
|
+
* page didn't come along is left out unless one of its children came
|
|
1541
|
+
* ([`Applied::bookmarks_dropped`](crate::Applied::bookmarks_dropped));
|
|
1542
|
+
* - its layers (optional content groups the copied pages use), added to this document's list
|
|
1543
|
+
* in the source's order and visible or hidden as the source showed them;
|
|
1544
|
+
* - its page labels: each copy keeps the label it had in its source, and this document's
|
|
1545
|
+
* pages keep theirs (a document without labels numbers its pages from 1);
|
|
1546
|
+
* - its form's default appearance and `/NeedAppearances`, and its PDF version when newer.
|
|
1547
|
+
*
|
|
1548
|
+
* Named destinations that clash are renamed `<name>#<n>`
|
|
1549
|
+
* ([`Applied::renamed_destinations`](crate::Applied::renamed_destinations)).
|
|
1550
|
+
*
|
|
1551
|
+
* On the wire: `{ "op": "mergeDocuments", "args": { "sources": [{ "source": "<64 hex
|
|
1552
|
+
* digits>" }], "at": "end" } }`, with each source's `pages` and `title`, and `options`,
|
|
1553
|
+
* optional.
|
|
1554
|
+
*
|
|
1555
|
+
* Added in 0.3.0.
|
|
1556
|
+
*/
|
|
1557
|
+
export interface MergeDocuments {
|
|
1558
|
+
/**
|
|
1559
|
+
* The documents to bring in, in order.
|
|
1560
|
+
*/
|
|
1561
|
+
sources: MergeSource[];
|
|
1562
|
+
/**
|
|
1563
|
+
* Where their pages go.
|
|
1564
|
+
*/
|
|
1565
|
+
at: "start" | "end" | { before: string } | { after: string };
|
|
1566
|
+
/**
|
|
1567
|
+
* What comes along besides the pages.
|
|
1568
|
+
*/
|
|
1569
|
+
options?: MergeOptions;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Moves `pages` to `to`. They keep their order among themselves (the order given, each page
|
|
1574
|
+
* once) and their IDs; an anchor that is itself moved is replaced by the nearest page that
|
|
1575
|
+
* stays.
|
|
1576
|
+
*
|
|
1577
|
+
* On the wire: `{ "op": "movePages", "args": { "pages": ["p7.0", "p8.0"], "to": "start" } }`.
|
|
1578
|
+
*
|
|
1579
|
+
* Added in 0.3.0.
|
|
1580
|
+
*/
|
|
1581
|
+
export interface MovePages {
|
|
1582
|
+
/**
|
|
1583
|
+
* The pages, in the order they take at `to`.
|
|
1584
|
+
*/
|
|
1585
|
+
pages: string[];
|
|
1586
|
+
/**
|
|
1587
|
+
* Where they go.
|
|
1588
|
+
*/
|
|
1589
|
+
to: "start" | "end" | { before: string } | { after: string };
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Moves a bookmark, with its children, under `parent` (`null`: the top level) at `at`. The
|
|
1594
|
+
* item keeps its ID.
|
|
1595
|
+
*
|
|
1596
|
+
* On the wire: `{ "op": "moveOutlineItem", "args": { "item": "o12.0", "parent": "o9.0", "at":
|
|
1597
|
+
* { "after": "o10.0" } } }`.
|
|
1598
|
+
*
|
|
1599
|
+
* Added in 0.3.0.
|
|
1600
|
+
*/
|
|
1601
|
+
export interface MoveOutlineItem {
|
|
1602
|
+
/**
|
|
1603
|
+
* The item.
|
|
1604
|
+
*/
|
|
1605
|
+
item: string;
|
|
1606
|
+
/**
|
|
1607
|
+
* The new parent; `None` for the top level.
|
|
1608
|
+
*/
|
|
1609
|
+
parent?: string | null;
|
|
1610
|
+
/**
|
|
1611
|
+
* Where among the new parent's children.
|
|
1612
|
+
*/
|
|
1613
|
+
at: "first" | "last" | { before: string } | { after: string };
|
|
1614
|
+
}
|
|
1615
|
+
|
|
942
1616
|
/**
|
|
943
1617
|
* Object numbering in a full rewrite.
|
|
944
1618
|
*/
|
|
945
1619
|
export type RenumberJs = "keep" | "compact";
|
|
946
1620
|
|
|
1621
|
+
/**
|
|
1622
|
+
* One annotation on a page, in page space.
|
|
1623
|
+
*/
|
|
1624
|
+
export interface PageAnnotationJs {
|
|
1625
|
+
/**
|
|
1626
|
+
* Its ID (`a12.0`), as `updateAnnot` and `deleteAnnot` take it.
|
|
1627
|
+
*/
|
|
1628
|
+
id: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Its position in the page's `/Annots`.
|
|
1631
|
+
*/
|
|
1632
|
+
index: number;
|
|
1633
|
+
/**
|
|
1634
|
+
* Its subtype as written (`Highlight`, `Text`, …).
|
|
1635
|
+
*/
|
|
1636
|
+
subtype: string;
|
|
1637
|
+
/**
|
|
1638
|
+
* Its rectangle: `[x0, y0, x1, y1]`, top-left and bottom-right; left out when it has none.
|
|
1639
|
+
*/
|
|
1640
|
+
rect?: [number, number, number, number];
|
|
1641
|
+
/**
|
|
1642
|
+
* `/Contents` (document text).
|
|
1643
|
+
*/
|
|
1644
|
+
contents?: string;
|
|
1645
|
+
/**
|
|
1646
|
+
* `/NM` (document text), only a hint.
|
|
1647
|
+
*/
|
|
1648
|
+
name?: string;
|
|
1649
|
+
/**
|
|
1650
|
+
* `/T`, the author.
|
|
1651
|
+
*/
|
|
1652
|
+
author?: string;
|
|
1653
|
+
/**
|
|
1654
|
+
* `/Subj`.
|
|
1655
|
+
*/
|
|
1656
|
+
subject?: string;
|
|
1657
|
+
/**
|
|
1658
|
+
* `/CreationDate` as stored.
|
|
1659
|
+
*/
|
|
1660
|
+
created?: string;
|
|
1661
|
+
/**
|
|
1662
|
+
* `/M` as stored.
|
|
1663
|
+
*/
|
|
1664
|
+
modified?: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* `/F`, the flags.
|
|
1667
|
+
*/
|
|
1668
|
+
flags: number;
|
|
1669
|
+
/**
|
|
1670
|
+
* `/C`: no components (transparent), one (gray), three (RGB) or four (CMYK).
|
|
1671
|
+
*/
|
|
1672
|
+
color: number[];
|
|
1673
|
+
/**
|
|
1674
|
+
* `/CA`, the opacity.
|
|
1675
|
+
*/
|
|
1676
|
+
opacity?: number;
|
|
1677
|
+
/**
|
|
1678
|
+
* The ID of the annotation this one replies to or is grouped with.
|
|
1679
|
+
*/
|
|
1680
|
+
inReplyTo?: string;
|
|
1681
|
+
/**
|
|
1682
|
+
* Whether `inReplyTo` is a group rather than a reply.
|
|
1683
|
+
*/
|
|
1684
|
+
grouped: boolean;
|
|
1685
|
+
/**
|
|
1686
|
+
* The ID of its Popup.
|
|
1687
|
+
*/
|
|
1688
|
+
popup?: string;
|
|
1689
|
+
/**
|
|
1690
|
+
* For a Popup, the ID of the annotation it belongs to.
|
|
1691
|
+
*/
|
|
1692
|
+
parent?: string;
|
|
1693
|
+
/**
|
|
1694
|
+
* Whether it has a normal appearance stream.
|
|
1695
|
+
*/
|
|
1696
|
+
hasAppearance: boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* Whether it has rich-text contents.
|
|
1699
|
+
*/
|
|
1700
|
+
hasRichText: boolean;
|
|
1701
|
+
/**
|
|
1702
|
+
* The subtype's own geometry, as flat `[x, y, …]` lists in page space.
|
|
1703
|
+
*/
|
|
1704
|
+
geometry: GeometryJs;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* One document a merge brings in.
|
|
1709
|
+
*
|
|
1710
|
+
* Added in 0.3.0.
|
|
1711
|
+
*/
|
|
1712
|
+
export interface MergeSource {
|
|
1713
|
+
/**
|
|
1714
|
+
* The source document, added with [`Document::add_source`](crate::Document::add_source).
|
|
1715
|
+
*/
|
|
1716
|
+
source: string;
|
|
1717
|
+
/**
|
|
1718
|
+
* The source's pages to bring in, by their IDs in the source, in order; all of them when
|
|
1719
|
+
* left out.
|
|
1720
|
+
*/
|
|
1721
|
+
pages?: string[];
|
|
1722
|
+
/**
|
|
1723
|
+
* The name of the bookmark [`OutlineMerge::PerFile`] gives the source's bookmarks (a file
|
|
1724
|
+
* name, say); the source's own title when left out.
|
|
1725
|
+
*/
|
|
1726
|
+
title?: string;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
947
1729
|
/**
|
|
948
1730
|
* One drawn line of a text box. Offsets are UTF-16 code units into the text (JS
|
|
949
1731
|
* string indices).
|
|
@@ -997,6 +1779,14 @@ export interface StructureNodeJs {
|
|
|
997
1779
|
kids: StructureKidJs[];
|
|
998
1780
|
}
|
|
999
1781
|
|
|
1782
|
+
/**
|
|
1783
|
+
* One entry of a language alternative, under the name TypeScript gives it.
|
|
1784
|
+
*/
|
|
1785
|
+
export interface XmpLangText {
|
|
1786
|
+
lang: string;
|
|
1787
|
+
text: string;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1000
1790
|
/**
|
|
1001
1791
|
* One font the document uses.
|
|
1002
1792
|
*/
|
|
@@ -1023,6 +1813,20 @@ export interface FontJs {
|
|
|
1023
1813
|
encoding?: EncodingJs;
|
|
1024
1814
|
}
|
|
1025
1815
|
|
|
1816
|
+
/**
|
|
1817
|
+
* One named destination and where it goes.
|
|
1818
|
+
*/
|
|
1819
|
+
export interface NamedDestinationJs {
|
|
1820
|
+
/**
|
|
1821
|
+
* The name.
|
|
1822
|
+
*/
|
|
1823
|
+
name: string;
|
|
1824
|
+
/**
|
|
1825
|
+
* Where it goes, when it names a page of this document.
|
|
1826
|
+
*/
|
|
1827
|
+
target?: TargetJs;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1026
1830
|
/**
|
|
1027
1831
|
* One outline item and its children.
|
|
1028
1832
|
*/
|
|
@@ -1061,6 +1865,10 @@ export interface OutlineEntryInit {
|
|
|
1061
1865
|
* One outline item.
|
|
1062
1866
|
*/
|
|
1063
1867
|
export interface OutlineNodeJs {
|
|
1868
|
+
/**
|
|
1869
|
+
* Its ID (`o12.0`), which the outline ops take.
|
|
1870
|
+
*/
|
|
1871
|
+
id: string;
|
|
1064
1872
|
/**
|
|
1065
1873
|
* Its title (document text).
|
|
1066
1874
|
*/
|
|
@@ -1073,6 +1881,30 @@ export interface OutlineNodeJs {
|
|
|
1073
1881
|
* Where it goes, when its destination names a page of this document.
|
|
1074
1882
|
*/
|
|
1075
1883
|
target?: TargetJs;
|
|
1884
|
+
/**
|
|
1885
|
+
* The named destination it goes to, when it names one.
|
|
1886
|
+
*/
|
|
1887
|
+
destinationName?: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* The web address it opens, when it has one.
|
|
1890
|
+
*/
|
|
1891
|
+
uri?: string;
|
|
1892
|
+
/**
|
|
1893
|
+
* Its action's type when that is neither `GoTo` nor `URI` (`JavaScript`, `Launch`, …).
|
|
1894
|
+
*/
|
|
1895
|
+
otherAction?: string;
|
|
1896
|
+
/**
|
|
1897
|
+
* Its colour as `"#rrggbb"`, when it isn't the default black.
|
|
1898
|
+
*/
|
|
1899
|
+
color?: string;
|
|
1900
|
+
/**
|
|
1901
|
+
* Shown in bold.
|
|
1902
|
+
*/
|
|
1903
|
+
bold: boolean;
|
|
1904
|
+
/**
|
|
1905
|
+
* Shown in italic.
|
|
1906
|
+
*/
|
|
1907
|
+
italic: boolean;
|
|
1076
1908
|
/**
|
|
1077
1909
|
* Its children, in order.
|
|
1078
1910
|
*/
|
|
@@ -1131,6 +1963,73 @@ export interface PageLabelInit {
|
|
|
1131
1963
|
first?: number;
|
|
1132
1964
|
}
|
|
1133
1965
|
|
|
1966
|
+
/**
|
|
1967
|
+
* One part of an article thread.
|
|
1968
|
+
*/
|
|
1969
|
+
export interface ThreadPartJs {
|
|
1970
|
+
/**
|
|
1971
|
+
* The page's 0-based index; left out when the part names a page the document lacks.
|
|
1972
|
+
*/
|
|
1973
|
+
page?: number;
|
|
1974
|
+
/**
|
|
1975
|
+
* Its rectangle, `[x0, y0, x1, y1]` in page space; left out when unreadable.
|
|
1976
|
+
*/
|
|
1977
|
+
rect?: [number, number, number, number];
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* One range of [`SetPageLabels`]: the labels from `page` up to the next range's page.
|
|
1982
|
+
*
|
|
1983
|
+
* Added in 0.3.0.
|
|
1984
|
+
*/
|
|
1985
|
+
export interface PageLabelRange {
|
|
1986
|
+
/**
|
|
1987
|
+
* The range's first page.
|
|
1988
|
+
*/
|
|
1989
|
+
page: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* The numbering style; without one, each label is the prefix alone. On the wire:
|
|
1992
|
+
* `decimal`, `upperRoman`, `lowerRoman`, `upperLetters` or `lowerLetters`.
|
|
1993
|
+
*/
|
|
1994
|
+
style?: "decimal" | "upperRoman" | "lowerRoman" | "upperLetters" | "lowerLetters";
|
|
1995
|
+
/**
|
|
1996
|
+
* Text before each number (`A-` in `A-1`).
|
|
1997
|
+
*/
|
|
1998
|
+
prefix?: string;
|
|
1999
|
+
/**
|
|
2000
|
+
* The number of the range's first page, 1 or more (a `u32`, as the builder's page labels
|
|
2001
|
+
* take).
|
|
2002
|
+
*/
|
|
2003
|
+
first?: number;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
/**
|
|
2007
|
+
* One reference to a deleted page and what the deletion did to it.
|
|
2008
|
+
*/
|
|
2009
|
+
export interface ReferenceEditJs {
|
|
2010
|
+
/**
|
|
2011
|
+
* The deleted page it named.
|
|
2012
|
+
*/
|
|
2013
|
+
page: string;
|
|
2014
|
+
/**
|
|
2015
|
+
* `outlineItem`, `link`, `namedDestination`, `openAction`, `structureElement`,
|
|
2016
|
+
* `structureKid` or `widget`.
|
|
2017
|
+
*/
|
|
2018
|
+
kind: "outlineItem" | "link" | "namedDestination" | "openAction" | "structureElement" | "structureKid" | "widget";
|
|
2019
|
+
/**
|
|
2020
|
+
* The named destination's name, for a `namedDestination`.
|
|
2021
|
+
*/
|
|
2022
|
+
name?: string;
|
|
2023
|
+
/**
|
|
2024
|
+
* `retargeted` or `removed`.
|
|
2025
|
+
*/
|
|
2026
|
+
outcome: "retargeted" | "removed";
|
|
2027
|
+
/**
|
|
2028
|
+
* The surviving page it now names, when retargeted.
|
|
2029
|
+
*/
|
|
2030
|
+
to?: string;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
1134
2033
|
/**
|
|
1135
2034
|
* One text run (`laminapdf::extract::PageTextRun`): glyphs of one font, size, direction and marked
|
|
1136
2035
|
* content on one baseline, in logical order.
|
|
@@ -1346,46 +2245,224 @@ export interface SaveOptionsInit {
|
|
|
1346
2245
|
*/
|
|
1347
2246
|
metadataDate?: string;
|
|
1348
2247
|
/**
|
|
1349
|
-
* The XMP instance ID the save writes, a UUID (`uuid:` optional); without it, one is
|
|
1350
|
-
* derived from the content.
|
|
2248
|
+
* The XMP instance ID the save writes, a UUID (`uuid:` optional); without it, one is
|
|
2249
|
+
* derived from the content.
|
|
2250
|
+
*/
|
|
2251
|
+
instanceId?: string;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Paragraph direction.
|
|
2256
|
+
*/
|
|
2257
|
+
export type DirectionInit = "ltr" | "rtl";
|
|
2258
|
+
|
|
2259
|
+
/**
|
|
2260
|
+
* Removes an XMP property, every copy of it in the packet; a property the Info dictionary
|
|
2261
|
+
* mirrors is removed from both. The value stays in the file's earlier revisions until a full
|
|
2262
|
+
* rewrite ([`Applied::still_in_earlier_revisions`](crate::Applied::still_in_earlier_revisions)).
|
|
2263
|
+
*
|
|
2264
|
+
* ```
|
|
2265
|
+
* use laminapdf_ops::{Op, RemoveXmpProperty};
|
|
2266
|
+
*
|
|
2267
|
+
* let op = Op::from(RemoveXmpProperty::new("http://example.com/ns/", "batch"));
|
|
2268
|
+
* assert_eq!(
|
|
2269
|
+
* serde_json::to_string(&op)?,
|
|
2270
|
+
* r#"{"op":"removeXmpProperty","args":{"namespace":"http://example.com/ns/","name":"batch"}}"#
|
|
2271
|
+
* );
|
|
2272
|
+
* # Ok::<(), serde_json::Error>(())
|
|
2273
|
+
* ```
|
|
2274
|
+
*
|
|
2275
|
+
* Added in 0.3.0.
|
|
2276
|
+
*/
|
|
2277
|
+
export interface RemoveXmpProperty {
|
|
2278
|
+
/**
|
|
2279
|
+
* The property's namespace URI.
|
|
2280
|
+
*/
|
|
2281
|
+
namespace: string;
|
|
2282
|
+
/**
|
|
2283
|
+
* The property's local name.
|
|
2284
|
+
*/
|
|
2285
|
+
name: string;
|
|
2286
|
+
/**
|
|
2287
|
+
* As [`SetMetadata::replace_malformed`](crate::SetMetadata::replace_malformed).
|
|
2288
|
+
*/
|
|
2289
|
+
replaceMalformed?: boolean;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Removes metadata fields from the Info dictionary and the XMP packet; the packet's other
|
|
2294
|
+
* properties stay (J.10).
|
|
2295
|
+
*
|
|
2296
|
+
* The values stay in the file's earlier revisions until a full rewrite: an incremental save
|
|
2297
|
+
* appends the change and keeps the original bytes. When it removed anything, the op's result
|
|
2298
|
+
* says so ([`Applied::still_in_earlier_revisions`](crate::Applied::still_in_earlier_revisions)),
|
|
2299
|
+
* so the caller can offer a full rewrite (on a signed file, the override that removes the
|
|
2300
|
+
* signatures).
|
|
2301
|
+
*
|
|
2302
|
+
* ```
|
|
2303
|
+
* use laminapdf_ops::{MetadataKey, Op, RemoveMetadata};
|
|
2304
|
+
*
|
|
2305
|
+
* let op = Op::from(RemoveMetadata::new(vec![MetadataKey::Authors, MetadataKey::Creator]));
|
|
2306
|
+
* assert_eq!(serde_json::to_string(&op)?, r#"{"op":"removeMetadata","args":{"keys":["authors","creator"]}}"#);
|
|
2307
|
+
* # Ok::<(), serde_json::Error>(())
|
|
2308
|
+
* ```
|
|
2309
|
+
*
|
|
2310
|
+
* Added in 0.2.0.
|
|
2311
|
+
*/
|
|
2312
|
+
export interface RemoveMetadata {
|
|
2313
|
+
/**
|
|
2314
|
+
* The fields to remove.
|
|
2315
|
+
*/
|
|
2316
|
+
keys: MetadataKey[];
|
|
2317
|
+
/**
|
|
2318
|
+
* As [`SetMetadata::replace_malformed`].
|
|
2319
|
+
*/
|
|
2320
|
+
replaceMalformed?: boolean;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
/**
|
|
2324
|
+
* Renames a named destination, keeping it where it is. With `links: follow` (the default) the
|
|
2325
|
+
* bookmarks, links and `GoTo` actions of this file that name it are renamed too, in the form
|
|
2326
|
+
* they named it in.
|
|
2327
|
+
*
|
|
2328
|
+
* On the wire: `{ "op": "renameNamedDestination", "args": { "from": "sec2", "to": "methods" } }`.
|
|
2329
|
+
*
|
|
2330
|
+
* Added in 0.3.0.
|
|
2331
|
+
*/
|
|
2332
|
+
export interface RenameNamedDestination {
|
|
2333
|
+
/**
|
|
2334
|
+
* The current name.
|
|
2335
|
+
*/
|
|
2336
|
+
from: string;
|
|
2337
|
+
/**
|
|
2338
|
+
* The new name; no destination may have it yet.
|
|
2339
|
+
*/
|
|
2340
|
+
to: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Whether the uses follow.
|
|
2343
|
+
*/
|
|
2344
|
+
links?: RenameLinks;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* Replaces pages of this document with pages of a source document, pair by pair: the first
|
|
2349
|
+
* source page takes the first target's place, and so on. What pointed at a replaced page
|
|
2350
|
+
* (outline items, links, named destinations, `GoTo` actions, `/OpenAction`) now points at
|
|
2351
|
+
* the page that took its place, with the view `/Fit`, since coordinates on the old page mean
|
|
2352
|
+
* nothing on the new one. Targets left over are deleted (their references retargeted to the
|
|
2353
|
+
* nearest surviving page); source pages left over go after the last copy. The copies come
|
|
2354
|
+
* in as with [`InsertPagesFrom`]; the replaced pages are deleted as with
|
|
2355
|
+
* [`DeletePages`](crate::DeletePages), structure, widgets and earlier revisions included.
|
|
2356
|
+
*
|
|
2357
|
+
* On the wire: `{ "op": "replacePages", "args": { "targets": ["p7.0"], "source": "<64 hex
|
|
2358
|
+
* digits>", "pages": ["p3.0"] } }`, with `carry` optional.
|
|
2359
|
+
*
|
|
2360
|
+
* Added in 0.3.0.
|
|
2361
|
+
*/
|
|
2362
|
+
export interface ReplacePages {
|
|
2363
|
+
/**
|
|
2364
|
+
* The pages to replace, in order.
|
|
2365
|
+
*/
|
|
2366
|
+
targets: string[];
|
|
2367
|
+
/**
|
|
2368
|
+
* The source document.
|
|
2369
|
+
*/
|
|
2370
|
+
source: string;
|
|
2371
|
+
/**
|
|
2372
|
+
* The source's pages that take their places, by their IDs in the source.
|
|
2373
|
+
*/
|
|
2374
|
+
pages: string[];
|
|
2375
|
+
/**
|
|
2376
|
+
* What comes along with the pages.
|
|
2377
|
+
*/
|
|
2378
|
+
carry?: Carry;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* Replaces the document's page labels with `ranges`; an empty list removes them, so viewers
|
|
2383
|
+
* show page numbers again.
|
|
2384
|
+
*
|
|
2385
|
+
* Each range starts at a page, named by its ID, and labels that page and the ones after it up
|
|
2386
|
+
* to the next range. The ranges must be in page order, two never on one page, the first on
|
|
2387
|
+
* the document's first page (the number tree must have an entry for page 0, §12.4.2), and
|
|
2388
|
+
* each numbered from 1 or more; otherwise the op fails with `invalid-label-ranges`. Nothing
|
|
2389
|
+
* is written when the catalog already holds exactly these labels
|
|
2390
|
+
* ([`PageLabels::is_written`]); any other tree, a damaged one included, is replaced.
|
|
2391
|
+
*
|
|
2392
|
+
* On the wire:
|
|
2393
|
+
* `{ "op": "setPageLabels", "args": { "ranges": [{ "page": "p3.0", "style": "lowerRoman" }] } }`.
|
|
2394
|
+
*
|
|
2395
|
+
* Added in 0.3.0.
|
|
2396
|
+
*/
|
|
2397
|
+
export interface SetPageLabels {
|
|
2398
|
+
/**
|
|
2399
|
+
* The ranges, in page order.
|
|
1351
2400
|
*/
|
|
1352
|
-
|
|
2401
|
+
ranges: PageLabelRange[];
|
|
1353
2402
|
}
|
|
1354
2403
|
|
|
1355
2404
|
/**
|
|
1356
|
-
*
|
|
2405
|
+
* Replaces the whole XMP packet with `xml`, for what the property ops can't write
|
|
2406
|
+
* (structures, qualifiers, comments). The packet is parsed before it applies and refused if it
|
|
2407
|
+
* doesn't parse (`invalid-xmp-packet`) or changes the PDF/A or PDF/UA identification
|
|
2408
|
+
* (`xmp-claim-read-only`). Info's mirrored entries follow the new packet; in a file that
|
|
2409
|
+
* claims PDF/A, the extension schema entries its properties lack are added and reported
|
|
2410
|
+
* ([`Applied::declared`](crate::Applied::declared)). The old packet stays in the file's
|
|
2411
|
+
* earlier revisions until a full rewrite.
|
|
2412
|
+
*
|
|
2413
|
+
* ```
|
|
2414
|
+
* use laminapdf_ops::{Op, ReplaceXmpPacket};
|
|
2415
|
+
*
|
|
2416
|
+
* let op = Op::from(ReplaceXmpPacket::new("<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">…</x:xmpmeta>"));
|
|
2417
|
+
* assert!(serde_json::to_string(&op)?.starts_with(r#"{"op":"replaceXmpPacket","args":{"xml":"<x:xmpmeta"#));
|
|
2418
|
+
* # Ok::<(), serde_json::Error>(())
|
|
2419
|
+
* ```
|
|
2420
|
+
*
|
|
2421
|
+
* Added in 0.3.0.
|
|
1357
2422
|
*/
|
|
1358
|
-
export
|
|
2423
|
+
export interface ReplaceXmpPacket {
|
|
2424
|
+
/**
|
|
2425
|
+
* The new packet's XML, with or without its `<?xpacket … ?>` wrapper.
|
|
2426
|
+
*/
|
|
2427
|
+
xml: string;
|
|
2428
|
+
}
|
|
1359
2429
|
|
|
1360
2430
|
/**
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
2431
|
+
* Reverses the order of `pages` within the places they hold: the first of them (in page
|
|
2432
|
+
* order) takes the last one's place, and so on; the other pages don't move.
|
|
1363
2433
|
*
|
|
1364
|
-
*
|
|
1365
|
-
* appends the change and keeps the original bytes. When it removed anything, the op's result
|
|
1366
|
-
* says so ([`Applied::still_in_earlier_revisions`](crate::Applied::still_in_earlier_revisions)),
|
|
1367
|
-
* so the caller can offer a full rewrite (on a signed file, the override that removes the
|
|
1368
|
-
* signatures).
|
|
2434
|
+
* On the wire: `{ "op": "reversePages", "args": { "pages": ["p3.0", "p4.0", "p5.0"] } }`.
|
|
1369
2435
|
*
|
|
1370
|
-
*
|
|
1371
|
-
|
|
2436
|
+
* Added in 0.3.0.
|
|
2437
|
+
*/
|
|
2438
|
+
export interface ReversePages {
|
|
2439
|
+
/**
|
|
2440
|
+
* The pages; their order here doesn't matter.
|
|
2441
|
+
*/
|
|
2442
|
+
pages: string[];
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Rotates `pages` by `angle`, set or turned ([`RotateMode`]); each page as
|
|
2447
|
+
* [`RotatePage`] does, keeping its object and [`PageId`].
|
|
1372
2448
|
*
|
|
1373
|
-
*
|
|
1374
|
-
* assert_eq!(serde_json::to_string(&op)?, r#"{"op":"removeMetadata","args":{"keys":["authors","creator"]}}"#);
|
|
1375
|
-
* # Ok::<(), serde_json::Error>(())
|
|
1376
|
-
* ```
|
|
2449
|
+
* On the wire: `{ "op": "rotatePages", "args": { "pages": ["p3.0"], "angle": 90, "mode": "turn" } }`.
|
|
1377
2450
|
*
|
|
1378
|
-
* Added in 0.
|
|
2451
|
+
* Added in 0.3.0.
|
|
1379
2452
|
*/
|
|
1380
|
-
export interface
|
|
2453
|
+
export interface RotatePages {
|
|
1381
2454
|
/**
|
|
1382
|
-
* The
|
|
2455
|
+
* The pages.
|
|
1383
2456
|
*/
|
|
1384
|
-
|
|
2457
|
+
pages: string[];
|
|
1385
2458
|
/**
|
|
1386
|
-
*
|
|
2459
|
+
* The angle in degrees clockwise: 0, 90, 180 or 270.
|
|
1387
2460
|
*/
|
|
1388
|
-
|
|
2461
|
+
angle: 0 | 90 | 180 | 270;
|
|
2462
|
+
/**
|
|
2463
|
+
* Whether the angle is set or added; `set` when left out.
|
|
2464
|
+
*/
|
|
2465
|
+
mode?: RotateMode;
|
|
1389
2466
|
}
|
|
1390
2467
|
|
|
1391
2468
|
/**
|
|
@@ -1414,6 +2491,60 @@ export interface RotatePage {
|
|
|
1414
2491
|
rotate: 0 | 90 | 180 | 270;
|
|
1415
2492
|
}
|
|
1416
2493
|
|
|
2494
|
+
/**
|
|
2495
|
+
* Sets any XMP property: text, a URI, a number, a boolean, a date, a language alternative,
|
|
2496
|
+
* or an ordered or unordered array of simple values. A file without a packet gets one.
|
|
2497
|
+
*
|
|
2498
|
+
* `prefix` names the namespace when the packet binds no prefix to it. A property the Info
|
|
2499
|
+
* dictionary mirrors (`dc:title`, `pdf:Producer`, …) is set in both, as
|
|
2500
|
+
* [`SetMetadata`](crate::SetMetadata) sets it, and must have its shape: text, or a language
|
|
2501
|
+
* alternative of the `x-default` entry alone, for `dc:title` and `dc:description`; an array of
|
|
2502
|
+
* text for `dc:creator`; a date for the dates.
|
|
2503
|
+
*
|
|
2504
|
+
* ```
|
|
2505
|
+
* use laminapdf_ops::{Op, SetXmpProperty};
|
|
2506
|
+
* use laminapdf_model::xmp::XmpValue;
|
|
2507
|
+
*
|
|
2508
|
+
* let op = Op::from(SetXmpProperty::new("http://example.com/ns/", "acme", "batch", XmpValue::Integer(42)));
|
|
2509
|
+
* assert_eq!(
|
|
2510
|
+
* serde_json::to_string(&op)?,
|
|
2511
|
+
* r#"{"op":"setXmpProperty","args":{"namespace":"http://example.com/ns/","prefix":"acme","name":"batch","value":{"type":"integer","value":42}}}"#
|
|
2512
|
+
* );
|
|
2513
|
+
* # Ok::<(), serde_json::Error>(())
|
|
2514
|
+
* ```
|
|
2515
|
+
*
|
|
2516
|
+
* Added in 0.3.0.
|
|
2517
|
+
*/
|
|
2518
|
+
export interface SetXmpProperty {
|
|
2519
|
+
/**
|
|
2520
|
+
* The property's namespace URI.
|
|
2521
|
+
*/
|
|
2522
|
+
namespace: string;
|
|
2523
|
+
/**
|
|
2524
|
+
* The prefix to write the namespace with when the packet binds none.
|
|
2525
|
+
*/
|
|
2526
|
+
prefix: string;
|
|
2527
|
+
/**
|
|
2528
|
+
* The property's local name.
|
|
2529
|
+
*/
|
|
2530
|
+
name: string;
|
|
2531
|
+
/**
|
|
2532
|
+
* The new value.
|
|
2533
|
+
*/
|
|
2534
|
+
value: XmpValue;
|
|
2535
|
+
/**
|
|
2536
|
+
* As [`SetMetadata::replace_malformed`](crate::SetMetadata::replace_malformed).
|
|
2537
|
+
*/
|
|
2538
|
+
replaceMalformed?: boolean;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
/**
|
|
2542
|
+
* Something in the file that names a destination.
|
|
2543
|
+
*
|
|
2544
|
+
* Added in 0.3.0.
|
|
2545
|
+
*/
|
|
2546
|
+
export type DestinationUse = { kind: "outlineItem"; item: string } | { kind: "annotation"; page: string; annot: string } | { kind: "catalog" };
|
|
2547
|
+
|
|
1417
2548
|
/**
|
|
1418
2549
|
* Text rendering (`Tr`).
|
|
1419
2550
|
*/
|
|
@@ -1502,6 +2633,24 @@ export interface MetadataInit {
|
|
|
1502
2633
|
modDate?: string;
|
|
1503
2634
|
}
|
|
1504
2635
|
|
|
2636
|
+
/**
|
|
2637
|
+
* The document's XMP packet as text (`laminapdf::XmpText`).
|
|
2638
|
+
*/
|
|
2639
|
+
export interface XmpTextJs {
|
|
2640
|
+
/**
|
|
2641
|
+
* Whether there is a packet, and whether it was read.
|
|
2642
|
+
*/
|
|
2643
|
+
status: PacketStatus;
|
|
2644
|
+
/**
|
|
2645
|
+
* The packet's XML, with the edits made so far.
|
|
2646
|
+
*/
|
|
2647
|
+
xml?: string;
|
|
2648
|
+
/**
|
|
2649
|
+
* The PDF/A part and conformance the packet claims, e.g. `"2B"`.
|
|
2650
|
+
*/
|
|
2651
|
+
pdfa?: string;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
1505
2654
|
/**
|
|
1506
2655
|
* The kind of change an op makes. The save planner checks it against `DocMDP` / `FieldMDP`
|
|
1507
2656
|
* permissions and the document's `SaveConstraint` ([ADR 0007]).
|
|
@@ -1534,6 +2683,22 @@ export interface ModelsInit {
|
|
|
1534
2683
|
langs?: string[];
|
|
1535
2684
|
}
|
|
1536
2685
|
|
|
2686
|
+
/**
|
|
2687
|
+
* The page and zoom a document opens at.
|
|
2688
|
+
*
|
|
2689
|
+
* Added in 0.3.0.
|
|
2690
|
+
*/
|
|
2691
|
+
export interface OpenAt {
|
|
2692
|
+
/**
|
|
2693
|
+
* The page.
|
|
2694
|
+
*/
|
|
2695
|
+
page: string;
|
|
2696
|
+
/**
|
|
2697
|
+
* The zoom.
|
|
2698
|
+
*/
|
|
2699
|
+
zoom?: "default" | "fitPage" | "fitWidth" | number;
|
|
2700
|
+
}
|
|
2701
|
+
|
|
1537
2702
|
/**
|
|
1538
2703
|
* The pages a Markdown document flows through.
|
|
1539
2704
|
*/
|
|
@@ -1577,11 +2742,71 @@ export interface EditedJs {
|
|
|
1577
2742
|
* full rewrite drops.
|
|
1578
2743
|
*/
|
|
1579
2744
|
stillInEarlierRevisions: boolean;
|
|
2745
|
+
/**
|
|
2746
|
+
* IDs of annotations an annotation op deleted besides the one it names (Popups, replies,
|
|
2747
|
+
* the rest of a group); left out when there are none.
|
|
2748
|
+
*/
|
|
2749
|
+
alsoDeleted?: string[];
|
|
1580
2750
|
/**
|
|
1581
2751
|
* Whether the edit changed the document: one that only set values they already had leaves
|
|
1582
2752
|
* no step to undo.
|
|
1583
2753
|
*/
|
|
1584
2754
|
changed: boolean;
|
|
2755
|
+
/**
|
|
2756
|
+
* The IDs of the bookmarks the edit added, in order.
|
|
2757
|
+
*/
|
|
2758
|
+
createdOutlineItems: string[];
|
|
2759
|
+
/**
|
|
2760
|
+
* An outline edit found the outline's links broken and rewrote them whole; bookmarks
|
|
2761
|
+
* stored inside others have new IDs.
|
|
2762
|
+
*/
|
|
2763
|
+
outlineRepaired: boolean;
|
|
2764
|
+
/**
|
|
2765
|
+
* What still names a named destination the edit deleted.
|
|
2766
|
+
*/
|
|
2767
|
+
destinationUses: DestinationUse[];
|
|
2768
|
+
/**
|
|
2769
|
+
* The XMP properties the edit declared in a PDF/A file's extension schemas.
|
|
2770
|
+
*/
|
|
2771
|
+
declared: ExtensionPropertyJs[];
|
|
2772
|
+
/**
|
|
2773
|
+
* The page IDs in order after the edit, when it changed the page list.
|
|
2774
|
+
*/
|
|
2775
|
+
pageOrder?: string[];
|
|
2776
|
+
/**
|
|
2777
|
+
* What a page deletion did to the references to the deleted pages.
|
|
2778
|
+
*/
|
|
2779
|
+
references: ReferenceEditJs[];
|
|
2780
|
+
/**
|
|
2781
|
+
* What a page duplication did to the form fields whose widgets the copied pages show;
|
|
2782
|
+
* left out when there are none.
|
|
2783
|
+
*/
|
|
2784
|
+
fields?: FieldEditJs[];
|
|
2785
|
+
/**
|
|
2786
|
+
* The copies a page duplication made whose tags couldn't all be cloned; left out when
|
|
2787
|
+
* there are none.
|
|
2788
|
+
*/
|
|
2789
|
+
tagsIncomplete?: string[];
|
|
2790
|
+
/**
|
|
2791
|
+
* The page holding each link a page copied in from another document lost, one entry per
|
|
2792
|
+
* link; left out when there are none.
|
|
2793
|
+
*/
|
|
2794
|
+
linksRemoved?: string[];
|
|
2795
|
+
/**
|
|
2796
|
+
* The pages copied in from another document without the tags their source gave them; left
|
|
2797
|
+
* out when there are none.
|
|
2798
|
+
*/
|
|
2799
|
+
tagsDropped?: string[];
|
|
2800
|
+
/**
|
|
2801
|
+
* The named destinations a merge or a page import brought in under another name, because
|
|
2802
|
+
* the document already used theirs; left out when there are none.
|
|
2803
|
+
*/
|
|
2804
|
+
renamedDestinations?: RenamedDestinationJs[];
|
|
2805
|
+
/**
|
|
2806
|
+
* The bookmarks a merge left out because the pages they went to didn't come along; left
|
|
2807
|
+
* out when there are none.
|
|
2808
|
+
*/
|
|
2809
|
+
bookmarksDropped?: number;
|
|
1585
2810
|
}
|
|
1586
2811
|
|
|
1587
2812
|
/**
|
|
@@ -1594,6 +2819,55 @@ export type PageModeInit = "none" | "outlines" | "thumbnails" | "fullScreen" | "
|
|
|
1594
2819
|
*/
|
|
1595
2820
|
export type SaveModeJs = "auto" | "incremental" | "fullRewrite";
|
|
1596
2821
|
|
|
2822
|
+
/**
|
|
2823
|
+
* The wire form, under the name TypeScript gives it.
|
|
2824
|
+
*/
|
|
2825
|
+
export type XmpValue = { type: "text"; value: string } | { type: "uri"; value: string } | { type: "integer"; value: number } | { type: "real"; value: number } | { type: "boolean"; value: boolean } | { type: "date"; value: string } | { type: "langAlt"; value: XmpLangText[] } | { type: "seq"; value: XmpValue[] } | { type: "bag"; value: XmpValue[] };
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* The yes-or-no window entries of the viewer preferences.
|
|
2829
|
+
*/
|
|
2830
|
+
export interface WindowPreferencesJs {
|
|
2831
|
+
/**
|
|
2832
|
+
* Hide the reader's toolbars.
|
|
2833
|
+
*/
|
|
2834
|
+
hideToolbar: boolean;
|
|
2835
|
+
/**
|
|
2836
|
+
* Hide the reader's menu bar.
|
|
2837
|
+
*/
|
|
2838
|
+
hideMenubar: boolean;
|
|
2839
|
+
/**
|
|
2840
|
+
* Hide the scroll bars and navigation controls.
|
|
2841
|
+
*/
|
|
2842
|
+
hideWindowUi: boolean;
|
|
2843
|
+
/**
|
|
2844
|
+
* Resize the window to fit the first page.
|
|
2845
|
+
*/
|
|
2846
|
+
fitWindow: boolean;
|
|
2847
|
+
/**
|
|
2848
|
+
* Put the window in the middle of the screen.
|
|
2849
|
+
*/
|
|
2850
|
+
centerWindow: boolean;
|
|
2851
|
+
/**
|
|
2852
|
+
* Show the document's title in the title bar.
|
|
2853
|
+
*/
|
|
2854
|
+
displayDocTitle: boolean;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
/**
|
|
2858
|
+
* What [`DeleteOutlineItem`](super::DeleteOutlineItem) does with the item's children.
|
|
2859
|
+
*
|
|
2860
|
+
* Added in 0.3.0.
|
|
2861
|
+
*/
|
|
2862
|
+
export type ChildItems = "delete" | "promote";
|
|
2863
|
+
|
|
2864
|
+
/**
|
|
2865
|
+
* What [`DeletePages`] does with a destination that names a deleted page.
|
|
2866
|
+
*
|
|
2867
|
+
* Added in 0.3.0.
|
|
2868
|
+
*/
|
|
2869
|
+
export type ReferencePolicy = "retarget" | "remove";
|
|
2870
|
+
|
|
1597
2871
|
/**
|
|
1598
2872
|
* What `WasmDocument.extract` returns.
|
|
1599
2873
|
*/
|
|
@@ -1680,6 +2954,33 @@ export interface PermissionsJs {
|
|
|
1680
2954
|
assemble: boolean;
|
|
1681
2955
|
}
|
|
1682
2956
|
|
|
2957
|
+
/**
|
|
2958
|
+
* What a page duplication or a page copied in did to one form field.
|
|
2959
|
+
*/
|
|
2960
|
+
export interface FieldEditJs {
|
|
2961
|
+
/**
|
|
2962
|
+
* The field on the source page (in the source document, for a page copied in).
|
|
2963
|
+
*/
|
|
2964
|
+
field: string;
|
|
2965
|
+
/**
|
|
2966
|
+
* The copy whose widget it concerns.
|
|
2967
|
+
*/
|
|
2968
|
+
page: string;
|
|
2969
|
+
/**
|
|
2970
|
+
* `renamed` (the copy's widget belongs to a new field), `linked` (it joined the field of
|
|
2971
|
+
* the same name) or `notCopied` (a signature's widget).
|
|
2972
|
+
*/
|
|
2973
|
+
outcome: "renamed" | "linked" | "notCopied";
|
|
2974
|
+
/**
|
|
2975
|
+
* The new field's ID, when renamed; the field it joined, when linked.
|
|
2976
|
+
*/
|
|
2977
|
+
to?: string;
|
|
2978
|
+
/**
|
|
2979
|
+
* The new field's fully qualified name, when renamed.
|
|
2980
|
+
*/
|
|
2981
|
+
name?: string;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
1683
2984
|
/**
|
|
1684
2985
|
* What a run measures.
|
|
1685
2986
|
*/
|
|
@@ -1771,11 +3072,44 @@ export interface RevertedJs {
|
|
|
1771
3072
|
touchedPages: string[];
|
|
1772
3073
|
}
|
|
1773
3074
|
|
|
3075
|
+
/**
|
|
3076
|
+
* What becomes of the sources' outlines (bookmarks) in a merge.
|
|
3077
|
+
*
|
|
3078
|
+
* Added in 0.3.0.
|
|
3079
|
+
*/
|
|
3080
|
+
export type OutlineMerge = "perFile" | "keep" | "none";
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* What comes along with pages copied from another document.
|
|
3084
|
+
*
|
|
3085
|
+
* Added in 0.3.0.
|
|
3086
|
+
*/
|
|
3087
|
+
export interface Carry {
|
|
3088
|
+
/**
|
|
3089
|
+
* Whether the pages' annotations other than form fields come along (links, comments,
|
|
3090
|
+
* markup); `true` when left out.
|
|
3091
|
+
*/
|
|
3092
|
+
annotations?: boolean;
|
|
3093
|
+
/**
|
|
3094
|
+
* What happens to a form field whose name the target already uses; `rename` when left
|
|
3095
|
+
* out.
|
|
3096
|
+
*/
|
|
3097
|
+
fields?: FieldClash;
|
|
3098
|
+
}
|
|
3099
|
+
|
|
1774
3100
|
/**
|
|
1775
3101
|
* What following a link does, by `kind`.
|
|
1776
3102
|
*/
|
|
1777
3103
|
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 };
|
|
1778
3104
|
|
|
3105
|
+
/**
|
|
3106
|
+
* What happens to a copied form field whose fully qualified name the target already uses
|
|
3107
|
+
* (E2 plan §11).
|
|
3108
|
+
*
|
|
3109
|
+
* Added in 0.3.0.
|
|
3110
|
+
*/
|
|
3111
|
+
export type FieldClash = "rename" | "link";
|
|
3112
|
+
|
|
1779
3113
|
/**
|
|
1780
3114
|
* What happens to hidden text and page furniture.
|
|
1781
3115
|
*/
|
|
@@ -1803,6 +3137,18 @@ export type OverflowInit = "clip" | "error";
|
|
|
1803
3137
|
*/
|
|
1804
3138
|
export type PacketStatus = "absent" | "parsed" | "malformed";
|
|
1805
3139
|
|
|
3140
|
+
/**
|
|
3141
|
+
* Where a bookmark goes.
|
|
3142
|
+
*
|
|
3143
|
+
* Added in 0.3.0.
|
|
3144
|
+
*/
|
|
3145
|
+
export type OutlineTarget = { destination: ExplicitDestination } | { named: string } | { uri: string };
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* Where a document opens, by `kind`.
|
|
3149
|
+
*/
|
|
3150
|
+
export type OpenTargetJs = { kind: "default" } | { kind: "page"; target: TargetJs } | { kind: "action"; action: string };
|
|
3151
|
+
|
|
1806
3152
|
/**
|
|
1807
3153
|
* Where a link or outline item goes.
|
|
1808
3154
|
*/
|
|
@@ -1818,6 +3164,14 @@ export type SplitOnName = "headings" | "blocks" | "pages";
|
|
|
1818
3164
|
*/
|
|
1819
3165
|
export type ReadingOrderName = "auto" | "tagged" | "layout" | "content-stream";
|
|
1820
3166
|
|
|
3167
|
+
/**
|
|
3168
|
+
* Whether [`RenameNamedDestination`](super::RenameNamedDestination) renames the uses of the
|
|
3169
|
+
* name in this file too.
|
|
3170
|
+
*
|
|
3171
|
+
* Added in 0.3.0.
|
|
3172
|
+
*/
|
|
3173
|
+
export type RenameLinks = "keep" | "follow";
|
|
3174
|
+
|
|
1821
3175
|
/**
|
|
1822
3176
|
* Which side [`DocumentMetadata`]'s values come from.
|
|
1823
3177
|
*
|
|
@@ -2030,6 +3384,15 @@ export class WasmDocument {
|
|
|
2030
3384
|
private constructor();
|
|
2031
3385
|
free(): void;
|
|
2032
3386
|
[Symbol.dispose](): void;
|
|
3387
|
+
/**
|
|
3388
|
+
* Adds another PDF as a source document: `{ id, pages }`, its ID (64 hex digits, the
|
|
3389
|
+
* SHA-256 of `bytes`) and its page IDs in order. An encrypted one opens with `password`,
|
|
3390
|
+
* which no op ever holds.
|
|
3391
|
+
*
|
|
3392
|
+
* # Errors
|
|
3393
|
+
* `wrong-password`, `password-required`, and the errors of a file that doesn't open.
|
|
3394
|
+
*/
|
|
3395
|
+
addSource(bytes: Uint8Array, password?: string | null): { id: string; pages: string[] };
|
|
2033
3396
|
/**
|
|
2034
3397
|
* Makes `bytes`, the whole output of `saveCopy`, the document's saved file (it rebases onto
|
|
2035
3398
|
* them), once they are written where the document lives; `historyCleared` is the copy's
|
|
@@ -2054,6 +3417,14 @@ export class WasmDocument {
|
|
|
2054
3417
|
* error (nothing is applied).
|
|
2055
3418
|
*/
|
|
2056
3419
|
apply(ops: Op[]): EditedJs;
|
|
3420
|
+
/**
|
|
3421
|
+
* `view` (page space) on page `page` as the destination the outline and named-destination
|
|
3422
|
+
* ops take, in the page's user space (the extract and text modules).
|
|
3423
|
+
*
|
|
3424
|
+
* # Errors
|
|
3425
|
+
* `invalid-argument` for a view that isn't one; `page-index-out-of-range`; reading errors.
|
|
3426
|
+
*/
|
|
3427
|
+
destinationAt(page: number, view: TargetViewJs): ExplicitDestination;
|
|
2057
3428
|
/**
|
|
2058
3429
|
* An extraction stepped a page at a time, whose models the host runs: each step returns
|
|
2059
3430
|
* its progress, with the result it waits for under `request` (render that page at `dpi`,
|
|
@@ -2064,6 +3435,14 @@ export class WasmDocument {
|
|
|
2064
3435
|
* As `extract`, for the options and the pages asked for.
|
|
2065
3436
|
*/
|
|
2066
3437
|
extractJob(options: ExtractInit): WasmExtractJob;
|
|
3438
|
+
/**
|
|
3439
|
+
* A new document of `pages` of this one, in the order given.
|
|
3440
|
+
*
|
|
3441
|
+
* # Errors
|
|
3442
|
+
* `invalid-argument` for a value that isn't a list of page IDs, `unknown-page`; reading
|
|
3443
|
+
* errors.
|
|
3444
|
+
*/
|
|
3445
|
+
extractPages(pages: string[]): WasmDocument;
|
|
2067
3446
|
/**
|
|
2068
3447
|
* The document's text for retrieval and LLMs, as one string: Markdown, plain text, the
|
|
2069
3448
|
* `laminapdf.extract/1` JSON, or the chunks as a JSON array (the extract and text modules).
|
|
@@ -2084,6 +3463,13 @@ export class WasmDocument {
|
|
|
2084
3463
|
* Reading errors.
|
|
2085
3464
|
*/
|
|
2086
3465
|
info(): DocumentInfoJs;
|
|
3466
|
+
/**
|
|
3467
|
+
* How the document asks to be shown when it opens (the extract and text modules).
|
|
3468
|
+
*
|
|
3469
|
+
* # Errors
|
|
3470
|
+
* `data-pending` and the reading errors.
|
|
3471
|
+
*/
|
|
3472
|
+
initialView(): InitialViewJs;
|
|
2087
3473
|
/**
|
|
2088
3474
|
* Whether the file is encrypted (it opened with its password, or the empty one).
|
|
2089
3475
|
*/
|
|
@@ -2095,6 +3481,16 @@ export class WasmDocument {
|
|
|
2095
3481
|
* Reading errors.
|
|
2096
3482
|
*/
|
|
2097
3483
|
isTagged(): boolean;
|
|
3484
|
+
/**
|
|
3485
|
+
* A new document of `inputs` (each `{ bytes, password?, title? }`) one after another,
|
|
3486
|
+
* with their bookmarks, named destinations, form fields, layers and page labels; `options`
|
|
3487
|
+
* as `mergeDocuments`' (`outline`, `fields`).
|
|
3488
|
+
*
|
|
3489
|
+
* # Errors
|
|
3490
|
+
* `invalid-argument` / `unknown-option` for bad values, `wrong-password`,
|
|
3491
|
+
* `password-required`, and the errors of a file that doesn't open.
|
|
3492
|
+
*/
|
|
3493
|
+
static merge(inputs: { bytes: Uint8Array; password?: string; title?: string }[], options: MergeOptions | undefined): WasmDocument;
|
|
2098
3494
|
/**
|
|
2099
3495
|
* The document's metadata, read from Info and XMP together, with the fields where they
|
|
2100
3496
|
* disagree.
|
|
@@ -2111,6 +3507,13 @@ export class WasmDocument {
|
|
|
2111
3507
|
* `data-pending` and the reading errors.
|
|
2112
3508
|
*/
|
|
2113
3509
|
namedDestination(name: string): TargetJs | undefined;
|
|
3510
|
+
/**
|
|
3511
|
+
* Every named destination, sorted by name (the extract and text modules).
|
|
3512
|
+
*
|
|
3513
|
+
* # Errors
|
|
3514
|
+
* `data-pending` and the reading errors.
|
|
3515
|
+
*/
|
|
3516
|
+
namedDestinations(): NamedDestinationJs[];
|
|
2114
3517
|
/**
|
|
2115
3518
|
* Opens a document from its bytes.
|
|
2116
3519
|
*
|
|
@@ -2136,6 +3539,14 @@ export class WasmDocument {
|
|
|
2136
3539
|
* `data-pending` and the reading errors.
|
|
2137
3540
|
*/
|
|
2138
3541
|
outline(): OutlineNodeJs[];
|
|
3542
|
+
/**
|
|
3543
|
+
* The annotations on page `index`, in the order of its `/Annots`, every subtype included
|
|
3544
|
+
* (the extract and text modules).
|
|
3545
|
+
*
|
|
3546
|
+
* # Errors
|
|
3547
|
+
* `page-index-out-of-range`, `data-pending` and the reading errors.
|
|
3548
|
+
*/
|
|
3549
|
+
pageAnnotations(index: number): PageAnnotationJs[];
|
|
2139
3550
|
/**
|
|
2140
3551
|
* A handle on the page with `id` (`p12.0`).
|
|
2141
3552
|
*
|
|
@@ -2229,6 +3640,17 @@ export class WasmDocument {
|
|
|
2229
3640
|
* The save's errors (`would-invalidate-signatures`, `requires-rewrite`, …).
|
|
2230
3641
|
*/
|
|
2231
3642
|
save(options: SaveOptionsInit | undefined): { bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
|
|
3643
|
+
/**
|
|
3644
|
+
* This document cut into new ones: `{ count: n }` parts of `n` pages, `{ ranges: [[id, …],
|
|
3645
|
+
* …] }` one part per list of page IDs, or `{ bookmarks: level }` a part from each bookmark
|
|
3646
|
+
* at that depth (1: the top level). Each part carries what its pages reach and the
|
|
3647
|
+
* bookmarks that go to them.
|
|
3648
|
+
*
|
|
3649
|
+
* # Errors
|
|
3650
|
+
* `invalid-argument` / `unknown-option` for a value that isn't one of those, `unknown-page`,
|
|
3651
|
+
* `no-pages-left` for an empty list; reading errors.
|
|
3652
|
+
*/
|
|
3653
|
+
split(by: { readonly count: number } | { readonly ranges: readonly (readonly string[])[] } | { readonly bookmarks: number }): WasmDocument[];
|
|
2232
3654
|
/**
|
|
2233
3655
|
* The structure tree's top-level elements in reading order, or `undefined` without one (the
|
|
2234
3656
|
* extract and text modules, beside `WasmPage.text`, whose runs it links by MCID).
|
|
@@ -2237,6 +3659,13 @@ export class WasmDocument {
|
|
|
2237
3659
|
* Reading errors.
|
|
2238
3660
|
*/
|
|
2239
3661
|
structureTree(): StructureNodeJs[] | undefined;
|
|
3662
|
+
/**
|
|
3663
|
+
* The document's article threads; empty without any (the extract and text modules).
|
|
3664
|
+
*
|
|
3665
|
+
* # Errors
|
|
3666
|
+
* `data-pending` and the reading errors.
|
|
3667
|
+
*/
|
|
3668
|
+
threads(): ThreadJs[];
|
|
2240
3669
|
/**
|
|
2241
3670
|
* Undoes the newest transaction: how it went and the pages it touched; `undefined` when
|
|
2242
3671
|
* there is nothing to undo.
|
|
@@ -2256,6 +3685,13 @@ export class WasmDocument {
|
|
|
2256
3685
|
* `invalid-argument` for a value that isn't an op; reading errors.
|
|
2257
3686
|
*/
|
|
2258
3687
|
wouldViolate(op: Op): ViolationJs[];
|
|
3688
|
+
/**
|
|
3689
|
+
* The document's XMP packet as text, with the edits made so far.
|
|
3690
|
+
*
|
|
3691
|
+
* # Errors
|
|
3692
|
+
* Reading errors.
|
|
3693
|
+
*/
|
|
3694
|
+
xmpPacket(): XmpTextJs;
|
|
2259
3695
|
}
|
|
2260
3696
|
|
|
2261
3697
|
/**
|
|
@@ -2369,6 +3805,23 @@ export class WasmImage {
|
|
|
2369
3805
|
readonly width: number;
|
|
2370
3806
|
}
|
|
2371
3807
|
|
|
3808
|
+
/**
|
|
3809
|
+
* The images of [`images_to_pdf`], in page order. Images are JavaScript-owned objects, which a
|
|
3810
|
+
* record can't carry, so they are added one by one.
|
|
3811
|
+
*/
|
|
3812
|
+
export class WasmImageList {
|
|
3813
|
+
free(): void;
|
|
3814
|
+
[Symbol.dispose](): void;
|
|
3815
|
+
/**
|
|
3816
|
+
* An empty list.
|
|
3817
|
+
*/
|
|
3818
|
+
constructor();
|
|
3819
|
+
/**
|
|
3820
|
+
* Adds `image` as the next page. The image stays usable: the list holds its own copy.
|
|
3821
|
+
*/
|
|
3822
|
+
push(image: WasmImage): void;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
2372
3825
|
/**
|
|
2373
3826
|
* The fonts and images of a Markdown build, by role and by the target the Markdown names.
|
|
2374
3827
|
*/
|
|
@@ -2716,6 +4169,16 @@ export function allocationFailed(): boolean;
|
|
|
2716
4169
|
*/
|
|
2717
4170
|
export function hasText(): boolean;
|
|
2718
4171
|
|
|
4172
|
+
/**
|
|
4173
|
+
* A new document with one page per image of `images`, in order: a JPEG embedded as it is, a PNG
|
|
4174
|
+
* with its transparency, each drawn the way up its EXIF orientation says.
|
|
4175
|
+
*
|
|
4176
|
+
* # Errors
|
|
4177
|
+
* `invalid-geometry` for no images, a negative margin or resolution, or a page too small for its
|
|
4178
|
+
* margins; `unknown-option`, `invalid-argument` for bad options.
|
|
4179
|
+
*/
|
|
4180
|
+
export function imagesToPdf(images: WasmImageList, options: ImagesOptionsInit | undefined): WasmDocument;
|
|
4181
|
+
|
|
2719
4182
|
/**
|
|
2720
4183
|
* The crate version (`@laminapdf/wasm`'s).
|
|
2721
4184
|
*/
|
|
@@ -2731,6 +4194,7 @@ export interface InitOutput {
|
|
|
2731
4194
|
readonly __wbg_wasmflowresources_free: (a: number, b: number) => void;
|
|
2732
4195
|
readonly __wbg_wasmfont_free: (a: number, b: number) => void;
|
|
2733
4196
|
readonly __wbg_wasmimage_free: (a: number, b: number) => void;
|
|
4197
|
+
readonly __wbg_wasmimagelist_free: (a: number, b: number) => void;
|
|
2734
4198
|
readonly __wbg_wasmmarkdownoptions_free: (a: number, b: number) => void;
|
|
2735
4199
|
readonly __wbg_wasmpage_free: (a: number, b: number) => void;
|
|
2736
4200
|
readonly __wbg_wasmpagebuilder_free: (a: number, b: number) => void;
|
|
@@ -2739,6 +4203,7 @@ export interface InitOutput {
|
|
|
2739
4203
|
readonly __wbg_wasmwarningcursor_free: (a: number, b: number) => void;
|
|
2740
4204
|
readonly allocationFailed: () => number;
|
|
2741
4205
|
readonly hasText: () => number;
|
|
4206
|
+
readonly imagesToPdf: (a: number, b: any) => [number, number, number];
|
|
2742
4207
|
readonly version: () => [number, number];
|
|
2743
4208
|
readonly wasmbuilder_attach: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number];
|
|
2744
4209
|
readonly wasmbuilder_destination: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
@@ -2755,21 +4220,28 @@ export interface InitOutput {
|
|
|
2755
4220
|
readonly wasmbuilder_pageLabels: (a: number, b: any) => [number, number];
|
|
2756
4221
|
readonly wasmbuilder_standardFont: (a: number, b: number, c: number) => [number, number, number];
|
|
2757
4222
|
readonly wasmbuilder_viewerPreferences: (a: number, b: any) => [number, number];
|
|
4223
|
+
readonly wasmdocument_addSource: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
2758
4224
|
readonly wasmdocument_adoptCopy: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2759
4225
|
readonly wasmdocument_apply: (a: number, b: any) => [number, number, number];
|
|
2760
4226
|
readonly wasmdocument_applyLog: (a: number, b: number, c: number) => [number, number, number];
|
|
4227
|
+
readonly wasmdocument_destinationAt: (a: number, b: number, c: any) => [number, number, number];
|
|
2761
4228
|
readonly wasmdocument_extract: (a: number, b: any) => [number, number, number, number];
|
|
2762
4229
|
readonly wasmdocument_extractJob: (a: number, b: any) => [number, number, number];
|
|
4230
|
+
readonly wasmdocument_extractPages: (a: number, b: any) => [number, number, number];
|
|
2763
4231
|
readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
|
|
2764
4232
|
readonly wasmdocument_info: (a: number) => [number, number, number];
|
|
4233
|
+
readonly wasmdocument_initialView: (a: number) => [number, number, number];
|
|
2765
4234
|
readonly wasmdocument_isEncrypted: (a: number) => number;
|
|
2766
4235
|
readonly wasmdocument_isTagged: (a: number) => [number, number, number];
|
|
4236
|
+
readonly wasmdocument_merge: (a: any, b: any) => [number, number, number];
|
|
2767
4237
|
readonly wasmdocument_metadata: (a: number) => [number, number, number];
|
|
2768
4238
|
readonly wasmdocument_namedDestination: (a: number, b: number, c: number) => [number, number, number];
|
|
4239
|
+
readonly wasmdocument_namedDestinations: (a: number) => [number, number, number];
|
|
2769
4240
|
readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
|
|
2770
4241
|
readonly wasmdocument_openSource: (a: number, b: any) => [number, number, number];
|
|
2771
4242
|
readonly wasmdocument_outline: (a: number) => [number, number, number];
|
|
2772
4243
|
readonly wasmdocument_page: (a: number, b: number) => [number, number, number];
|
|
4244
|
+
readonly wasmdocument_pageAnnotations: (a: number, b: number) => [number, number, number];
|
|
2773
4245
|
readonly wasmdocument_pageById: (a: number, b: number, c: number) => [number, number, number];
|
|
2774
4246
|
readonly wasmdocument_pageCount: (a: number) => [number, number, number];
|
|
2775
4247
|
readonly wasmdocument_pageInfo: (a: number, b: number) => [number, number, number];
|
|
@@ -2782,10 +4254,13 @@ export interface InitOutput {
|
|
|
2782
4254
|
readonly wasmdocument_save: (a: number, b: any) => [number, number, number];
|
|
2783
4255
|
readonly wasmdocument_saveCopy: (a: number, b: any) => [number, number, number];
|
|
2784
4256
|
readonly wasmdocument_saveJob: (a: number, b: any) => [number, number, number];
|
|
4257
|
+
readonly wasmdocument_split: (a: number, b: any) => [number, number, number];
|
|
2785
4258
|
readonly wasmdocument_structureTree: (a: number) => [number, number, number];
|
|
4259
|
+
readonly wasmdocument_threads: (a: number) => [number, number, number];
|
|
2786
4260
|
readonly wasmdocument_undo: (a: number) => [number, number, number];
|
|
2787
4261
|
readonly wasmdocument_warnings: (a: number) => number;
|
|
2788
4262
|
readonly wasmdocument_wouldViolate: (a: number, b: any) => [number, number, number];
|
|
4263
|
+
readonly wasmdocument_xmpPacket: (a: number) => [number, number, number];
|
|
2789
4264
|
readonly wasmextractjob_cancel: (a: number) => void;
|
|
2790
4265
|
readonly wasmextractjob_provide: (a: number, b: any) => [number, number];
|
|
2791
4266
|
readonly wasmextractjob_step: (a: number, b: number) => [number, number, number];
|
|
@@ -2800,6 +4275,8 @@ export interface InitOutput {
|
|
|
2800
4275
|
readonly wasmimage_png: (a: number, b: number) => [number, number, number];
|
|
2801
4276
|
readonly wasmimage_rgba: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2802
4277
|
readonly wasmimage_width: (a: number) => number;
|
|
4278
|
+
readonly wasmimagelist_new: () => number;
|
|
4279
|
+
readonly wasmimagelist_push: (a: number, b: number) => void;
|
|
2803
4280
|
readonly wasmmarkdownoptions_font: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2804
4281
|
readonly wasmmarkdownoptions_image: (a: number, b: number, c: number, d: number) => void;
|
|
2805
4282
|
readonly wasmmarkdownoptions_new: () => number;
|
|
@@ -2845,8 +4322,8 @@ export interface InitOutput {
|
|
|
2845
4322
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
2846
4323
|
readonly __externref_table_alloc: () => number;
|
|
2847
4324
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
2848
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
2849
4325
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
4326
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
2850
4327
|
readonly __wbindgen_start: () => void;
|
|
2851
4328
|
}
|
|
2852
4329
|
|