@embedpdf/core 3.0.0-next.15 → 3.0.0-next.16

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.
@@ -1,4 +1,4 @@
1
- import { Annotation, ChangeOp, ChangeResult, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DocCapability, DocumentEvent, DocumentEvent as DocumentEvent$1, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentMetadata, Engine as Engine$1, EngineFactory, EngineRenderPolicy, EventOrigin, FormFieldDTO, Identity as Identity$1, MetadataPatch, MetadataUpdateResult, OpenInput, OpenOptions, PageDeleteResult, PageDestination, PageInsertBlankSpec, PageInsertResult, PageLayout as PageLayout$1, PageObjectNumber, PagePosition, PageRef, PageReorderResult, PageRotateResult, PdfDestination, PdfRotation, PdfSaveMode, PdfSize, WidgetAnnotation } from "@embedpdf/engine-core/runtime";
1
+ import { Annotation, Attachment, ChangeOp, ChangeResult, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DocCapability, DocumentEvent, DocumentEvent as DocumentEvent$1, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentMetadata, Engine as Engine$1, EngineFactory, EngineRenderPolicy, EventOrigin, FormFieldDTO, Identity as Identity$1, MetadataPatch, MetadataUpdateResult, OpenInput, OpenOptions, OutlineItem, PageDeleteResult, PageDestination, PageInsertBlankSpec, PageInsertResult, PageLayout as PageLayout$1, PageObjectNumber, PagePosition, PageRef, PageReorderResult, PageRotateResult, PdfDestination, PdfRotation, PdfSaveMode, PdfSize, PrintDpi, WidgetAnnotation } from "@embedpdf/engine-core/runtime";
2
2
  //#region src/lanes.d.ts
3
3
  /** One execution inside a `latest` lane. */
4
4
  /** `details` of the `operation-cancelled` error a superseded or cancelled run rejects with. */
@@ -136,6 +136,16 @@ type PredictedOp = ChangeOp | {
136
136
  readonly widget: WidgetAnnotation;
137
137
  /** Its field as the restore leaves it, with the widget back; `null` when it had none. */
138
138
  readonly field: FormFieldDTO | null;
139
+ } | {
140
+ readonly type: 'outline.restore';
141
+ /** The items as they were: the item first, then the items under it, depth first. */
142
+ readonly items: readonly OutlineItem[];
143
+ /** The item's place among its parent's children. */
144
+ readonly index: number;
145
+ } | {
146
+ readonly type: 'attachments.restore';
147
+ /** The embedded file as it was, under the key it had. */
148
+ readonly attachment: Attachment;
139
149
  };
140
150
  /** One user action, as a plugin stages it. */
141
151
  type StagedChange = {
@@ -848,6 +858,14 @@ interface PluginContext<S = unknown, T extends object = NoSettings> {
848
858
  * others. Document-scoped plugins only; unregistered when the instance closes.
849
859
  */
850
860
  aroundDownload(wrap: (read: () => Promise<Uint8Array>) => Promise<Uint8Array>): void;
861
+ /**
862
+ * Run something of the document's own around every print of it (`documents.print()`, a
863
+ * prepared print's `print()`): `wrap` gets the print and resolves when it did, doing what
864
+ * comes before and after it. The actions plugin runs the document's print actions this way.
865
+ * The first registered wraps the others. Document-scoped plugins only; unregistered when the
866
+ * instance closes.
867
+ */
868
+ aroundPrint(wrap: (print: () => Promise<void>) => Promise<void>): void;
851
869
  /** Acquire a resource whose disposal the instance owns; a late arrival after close is disposed, not returned. */
852
870
  acquire<R>(get: (lifetime: AbortSignal) => Promise<R>, dispose: (resource: R) => void | Promise<void>): Promise<R>;
853
871
  /**
@@ -1004,6 +1022,111 @@ interface DownloadOptions extends OperationOptions {
1004
1022
  */
1005
1023
  readonly mode?: PdfSaveMode;
1006
1024
  }
1025
+ /**
1026
+ * How a print comes out.
1027
+ *
1028
+ * - `'pdf'`: the printer prints a copy of the pages as they print (`pages.extract()` with
1029
+ * `flatten: { usage: 'print' }`): sharp text and lines. It takes `doc.print.high`, a right to
1030
+ * keep the copy (`doc.download` or `doc.download.flattened`: every print dialog can save it as
1031
+ * a file), and a printer that prints a PDF (`HostPrinter.stagePdf`).
1032
+ * - `'images'` otherwise: pictures of the pages, drawn by the print rules, at 150 DPI with
1033
+ * `doc.print` or 300 DPI with `doc.print.high` (Acrobat's low and high resolution printing).
1034
+ */
1035
+ type PrintQuality = {
1036
+ readonly kind: 'pdf';
1037
+ } | {
1038
+ readonly kind: 'images';
1039
+ readonly dpi: PrintDpi;
1040
+ };
1041
+ /** How far preparing a print got. */
1042
+ interface PrintProgress {
1043
+ /** Pages that are ready: one at a time as pictures, all at once as a PDF. */
1044
+ readonly pagesRendered: number;
1045
+ /** Pages the print has. */
1046
+ readonly pageCount: number;
1047
+ }
1048
+ interface PrintOptions extends OperationOptions {
1049
+ /** The pages to print, in this order. Default: every page. */
1050
+ readonly pages?: readonly PageRef[];
1051
+ /**
1052
+ * Print the annotations that print. Default: when the user may read them. Form fields print
1053
+ * when the user may read the form, whatever this says.
1054
+ */
1055
+ readonly includeAnnotations?: boolean;
1056
+ /** Called each time pages are ready, and once before the first. */
1057
+ readonly onProgress?: (progress: PrintProgress) => void;
1058
+ }
1059
+ /**
1060
+ * A print got ready by `documents.preparePrint()`. Everything slow already happened, so
1061
+ * `print()` opens the print dialog at once.
1062
+ */
1063
+ interface PreparedPrint {
1064
+ readonly quality: PrintQuality;
1065
+ /** How many pages it prints. */
1066
+ readonly pageCount: number;
1067
+ /**
1068
+ * Whether `print()` must run inside the user's tap or click: the printer's `needsTap`. Safari
1069
+ * doesn't print what waited for its pages (iOS refuses the dialog, the Mac prints blank pages),
1070
+ * so a dialog that prepared on a tap asks for another once the print is ready. When `false`,
1071
+ * print as soon as it is ready.
1072
+ */
1073
+ readonly needsTap: boolean;
1074
+ /**
1075
+ * Open the print dialog. The document's own print actions run around it, when the actions
1076
+ * plugin is installed; when they, or anyone, change the document after it was prepared, it is
1077
+ * prepared again first. Resolves when the printer has the job. When the printer refuses a
1078
+ * PDF, the same pages print as pictures. Rejects `invalid-input` once disposed,
1079
+ * `operation-cancelled` when `signal` fires before the dialog opens.
1080
+ */
1081
+ print(options?: OperationOptions): Promise<void>;
1082
+ /** Free what preparing took. Closing the document does too. */
1083
+ dispose(): void;
1084
+ }
1085
+ /** One printed sheet: a picture of a page, and the page's size on paper. */
1086
+ interface PrintSheet {
1087
+ /** A PNG of the page, drawn by the print rules. */
1088
+ readonly image: Blob;
1089
+ /** The page's width in points (1/72 inch), as it prints. */
1090
+ readonly widthPt: number;
1091
+ /** The page's height in points. */
1092
+ readonly heightPt: number;
1093
+ }
1094
+ /** What a printer got ready: `print()` opens the print dialog with it. */
1095
+ interface StagedPrint {
1096
+ /** Open the print dialog. Resolves once the printer has the job. */
1097
+ print(): Promise<void>;
1098
+ /** Free what staging took. */
1099
+ dispose(): void;
1100
+ }
1101
+ /**
1102
+ * Where prints go: the host's print dialog. A browser passes `browserPrinter()` from
1103
+ * `@embedpdf/web`; an app with its own print path (a desktop shell, a native app) passes its
1104
+ * own.
1105
+ */
1106
+ interface HostPrinter {
1107
+ /**
1108
+ * `true` when this printer prints only while the user's tap or click is being handled (Safari),
1109
+ * so a print that waited for its pages needs another tap. Default `false`.
1110
+ */
1111
+ readonly needsTap?: boolean;
1112
+ /**
1113
+ * Get the sheets ready to print, so `print()` on what it returns opens the dialog at once.
1114
+ * `name` names the print job. Rejects when `signal` fires.
1115
+ */
1116
+ stage(sheets: readonly PrintSheet[], options: {
1117
+ readonly name: string;
1118
+ readonly signal?: AbortSignal;
1119
+ }): Promise<StagedPrint>;
1120
+ /**
1121
+ * Present when this printer prints a PDF file on this device: a browser whose own PDF viewer
1122
+ * prints it, a desktop shell, a native print API. Gets `pdf`, a copy of the pages as they
1123
+ * print, ready as `stage()` gets sheets ready. A printer without it prints pictures.
1124
+ */
1125
+ stagePdf?(pdf: Uint8Array, options: {
1126
+ readonly name: string;
1127
+ readonly signal?: AbortSignal;
1128
+ }): Promise<StagedPrint>;
1129
+ }
1007
1130
  /**
1008
1131
  * One boot document for `documents.openAll()` — the shared shape every
1009
1132
  * framework adapter's `initialDocuments` input uses (adapters re-export it,
@@ -1127,7 +1250,26 @@ interface DocumentsCapability {
1127
1250
  downloadLayer(id?: string, options?: OperationOptions): Promise<Uint8Array>;
1128
1251
  /** Whether the document (the one in scope without an id) may be downloaded: `doc.download`. */
1129
1252
  canDownload(id?: string): boolean;
1130
- /** Whether the document (the one in scope without an id) may be printed: `doc.print`. */
1253
+ /**
1254
+ * Get a print of the document ready (the one in scope without an id): wait for changes still
1255
+ * on their way, make the pages as they print (a PDF copy or pictures, as `getPrintQuality()`
1256
+ * says), and hand them to the host's printer. `onProgress` follows the pages. Rejects
1257
+ * `permission-denied` without `doc.print`, `unsupported` when the host gave no printer,
1258
+ * `not-found` for a page the document doesn't have, `invalid-input` for an empty `pages` or a
1259
+ * page named twice, `not-ready` with no open document, `operation-cancelled` when `signal`
1260
+ * fires.
1261
+ */
1262
+ preparePrint(id?: string, options?: PrintOptions): Promise<PreparedPrint>;
1263
+ /**
1264
+ * Prepare a print and print it: `preparePrint()`, then its `print()`. The document's own
1265
+ * print actions run around the dialog when the actions plugin is installed. Rejects as
1266
+ * `preparePrint()` does. A printer that `needsTap` may refuse the dialog once preparing took a
1267
+ * while: there, prepare first and print from a tap.
1268
+ */
1269
+ print(id?: string, options?: PrintOptions): Promise<void>;
1270
+ /** How a print of the document comes out for this user, or null when they can't print it. */
1271
+ getPrintQuality(id?: string): PrintQuality | null;
1272
+ /** Whether the document (the one in scope without an id) may be printed: `doc.print`, and the host gave a printer. */
1131
1273
  canPrint(id?: string): boolean;
1132
1274
  /**
1133
1275
  * The document's pages, in order (the one in scope without an id). The same array until a
@@ -1158,5 +1300,5 @@ interface DocumentsCapability {
1158
1300
  /** Built-in token for the document registry capability (provided by the kernel). */
1159
1301
  declare const DocumentsToken: CapabilityToken<DocumentsCapability>;
1160
1302
  //#endregion
1161
- export { PdfSaveMode as $, isPluginError as $t, Identity$1 as A, MirrorReload as At, OperationOptions as B, ChangeQueue as Bt, DocumentsToken as C, SerialQueue as Ct, EventOrigin as D, PageMirrorSpec as Dt, EngineFactory as E, PageMirrorChange as Et, OpenDocumentOptions as F, Cancel as Ft, PageInsertResult as G, SettledChange as Gt, PageDestination as H, HoldOptions as Ht, OpenDocumentResult as I, HostClock as It, PagePosition as J, EventHookSource as Jt, PageLayout$1 as K, StagedChange as Kt, OpenInput as L, PluginClock as Lt, LockedDocumentInfo as M, reload as Mt, MetadataPatch as N, SliceChange as Nt, FailedDocumentInfo as O, Mirror as Ot, MetadataUpdateResult as P, SliceLease as Pt, PdfRotation as Q, PluginErrorInfo as Qt, OpenOptions as R, timerClock as Rt, DocumentsCapability as S, mergeSettings as St, Engine$1 as T, PageMirror as Tt, PageInfo as U, PendingChange as Ut, PageDeleteResult as V, HeldChange as Vt, PageInsertBlankSpec as W, PredictedOp as Wt, PageRotateResult as X, PluginError as Xt, PageReorderResult as Y, createEventHook as Yt, PdfDestination as Z, PluginErrorCode as Zt, DocumentOpenFailedEvent as _, Settings as _t, CustomMetadata as a, createLatestLane as an, PluginScope as at, DocumentStatus as b, SettingsDeclaration as bt, DocCapability as c, ResourceStatus as ct, DocumentEvent$1 as d, Subscribable as dt, toPluginError as en, PdfSize as et, DocumentHandle$1 as f, UnlockOptions as ft, DocumentMetadata as g, NoSettings as gt, DocumentMeta as h, DeepPartial as ht, CoreState as i, LatestRun as in, PluginDef as it, InitialDocument as j, MirrorSpec as jt, GlobalState as k, MirrorChange as kt, DocumentActiveChangedEvent as l, StateCell as lt, DocumentLockedEvent as m, UrlSource as mt, BatchResult as n, LatestCancellation as nn, Permission as nt, CustomMetadataPatch as o, PromiseMemberOf as ot, DocumentInfo as p, Unsubscribe as pt, PageObjectNumber as q, EventHook as qt, CapabilityToken as r, LatestLane as rn, PluginContext as rt, CustomMetadataUpdateResult as s, PromiseMembers as st, AnyPlugin as t, toPluginErrorInfo as tn, PendingMeta as tt, DocumentClosedEvent as u, StateChange as ut, DocumentOpenedEvent as v, SettingsApi as vt, DownloadOptions as w, createSerialQueue as wt, DocumentUnsavedChangesChangedEvent as x, SettingsOf as xt, DocumentPagesChangedEvent as y, SettingsChangedEvent as yt, OpenSource as z, ChangeLabel as zt };
1162
- //# sourceMappingURL=types-t-DaU8VK.d.ts.map
1303
+ export { PdfRotation as $, StagedChange as $t, HostPrinter as A, SerialQueue as At, OpenSource as B, SliceChange as Bt, DocumentsToken as C, NoSettings as Ct, EventOrigin as D, SettingsDeclaration as Dt, EngineFactory as E, SettingsChangedEvent as Et, MetadataUpdateResult as F, Mirror as Ft, PageInsertBlankSpec as G, timerClock as Gt, PageDeleteResult as H, Cancel as Ht, OpenDocumentOptions as I, MirrorChange as It, PageObjectNumber as J, HeldChange as Jt, PageInsertResult as K, ChangeLabel as Kt, OpenDocumentResult as L, MirrorReload as Lt, InitialDocument as M, PageMirror as Mt, LockedDocumentInfo as N, PageMirrorChange as Nt, FailedDocumentInfo as O, SettingsOf as Ot, MetadataPatch as P, PageMirrorSpec as Pt, PdfDestination as Q, SettledChange as Qt, OpenInput as R, MirrorSpec as Rt, DocumentsCapability as S, DeepPartial as St, Engine$1 as T, SettingsApi as Tt, PageDestination as U, HostClock as Ut, OperationOptions as V, SliceLease as Vt, PageInfo as W, PluginClock as Wt, PageReorderResult as X, PendingChange as Xt, PagePosition as Y, HoldOptions as Yt, PageRotateResult as Z, PredictedOp as Zt, DocumentOpenFailedEvent as _, StateChange as _t, CustomMetadata as a, PluginErrorInfo as an, PluginDef as at, DocumentStatus as b, Unsubscribe as bt, DocCapability as c, toPluginErrorInfo as cn, PrintOptions as ct, DocumentEvent$1 as d, LatestRun as dn, PrintSheet as dt, EventHook as en, PdfSaveMode as et, DocumentHandle$1 as f, createLatestLane as fn, PromiseMemberOf as ft, DocumentMetadata as g, StateCell as gt, DocumentMeta as h, StagedPrint as ht, CoreState as i, PluginErrorCode as in, PluginContext as it, Identity$1 as j, createSerialQueue as jt, GlobalState as k, mergeSettings as kt, DocumentActiveChangedEvent as l, LatestCancellation as ln, PrintProgress as lt, DocumentLockedEvent as m, ResourceStatus as mt, BatchResult as n, createEventHook as nn, PendingMeta as nt, CustomMetadataPatch as o, isPluginError as on, PluginScope as ot, DocumentInfo as p, PromiseMembers as pt, PageLayout$1 as q, ChangeQueue as qt, CapabilityToken as r, PluginError as rn, Permission as rt, CustomMetadataUpdateResult as s, toPluginError as sn, PreparedPrint as st, AnyPlugin as t, EventHookSource as tn, PdfSize as tt, DocumentClosedEvent as u, LatestLane as un, PrintQuality as ut, DocumentOpenedEvent as v, Subscribable as vt, DownloadOptions as w, Settings as wt, DocumentUnsavedChangesChangedEvent as x, UrlSource as xt, DocumentPagesChangedEvent as y, UnlockOptions as yt, OpenOptions as z, reload as zt };
1304
+ //# sourceMappingURL=types-CfnZ7go6.d.cts.map
@@ -1,4 +1,4 @@
1
- import { Annotation, ChangeOp, ChangeResult, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DocCapability, DocumentEvent, DocumentEvent as DocumentEvent$1, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentMetadata, Engine as Engine$1, EngineFactory, EngineRenderPolicy, EventOrigin, FormFieldDTO, Identity as Identity$1, MetadataPatch, MetadataUpdateResult, OpenInput, OpenOptions, PageDeleteResult, PageDestination, PageInsertBlankSpec, PageInsertResult, PageLayout as PageLayout$1, PageObjectNumber, PagePosition, PageRef, PageReorderResult, PageRotateResult, PdfDestination, PdfRotation, PdfSaveMode, PdfSize, WidgetAnnotation } from "@embedpdf/engine-core/runtime";
1
+ import { Annotation, Attachment, ChangeOp, ChangeResult, CustomMetadata, CustomMetadataPatch, CustomMetadataUpdateResult, DocCapability, DocumentEvent, DocumentEvent as DocumentEvent$1, DocumentHandle, DocumentHandle as DocumentHandle$1, DocumentMetadata, Engine as Engine$1, EngineFactory, EngineRenderPolicy, EventOrigin, FormFieldDTO, Identity as Identity$1, MetadataPatch, MetadataUpdateResult, OpenInput, OpenOptions, OutlineItem, PageDeleteResult, PageDestination, PageInsertBlankSpec, PageInsertResult, PageLayout as PageLayout$1, PageObjectNumber, PagePosition, PageRef, PageReorderResult, PageRotateResult, PdfDestination, PdfRotation, PdfSaveMode, PdfSize, PrintDpi, WidgetAnnotation } from "@embedpdf/engine-core/runtime";
2
2
  //#region src/lanes.d.ts
3
3
  /** One execution inside a `latest` lane. */
4
4
  /** `details` of the `operation-cancelled` error a superseded or cancelled run rejects with. */
@@ -136,6 +136,16 @@ type PredictedOp = ChangeOp | {
136
136
  readonly widget: WidgetAnnotation;
137
137
  /** Its field as the restore leaves it, with the widget back; `null` when it had none. */
138
138
  readonly field: FormFieldDTO | null;
139
+ } | {
140
+ readonly type: 'outline.restore';
141
+ /** The items as they were: the item first, then the items under it, depth first. */
142
+ readonly items: readonly OutlineItem[];
143
+ /** The item's place among its parent's children. */
144
+ readonly index: number;
145
+ } | {
146
+ readonly type: 'attachments.restore';
147
+ /** The embedded file as it was, under the key it had. */
148
+ readonly attachment: Attachment;
139
149
  };
140
150
  /** One user action, as a plugin stages it. */
141
151
  type StagedChange = {
@@ -848,6 +858,14 @@ interface PluginContext<S = unknown, T extends object = NoSettings> {
848
858
  * others. Document-scoped plugins only; unregistered when the instance closes.
849
859
  */
850
860
  aroundDownload(wrap: (read: () => Promise<Uint8Array>) => Promise<Uint8Array>): void;
861
+ /**
862
+ * Run something of the document's own around every print of it (`documents.print()`, a
863
+ * prepared print's `print()`): `wrap` gets the print and resolves when it did, doing what
864
+ * comes before and after it. The actions plugin runs the document's print actions this way.
865
+ * The first registered wraps the others. Document-scoped plugins only; unregistered when the
866
+ * instance closes.
867
+ */
868
+ aroundPrint(wrap: (print: () => Promise<void>) => Promise<void>): void;
851
869
  /** Acquire a resource whose disposal the instance owns; a late arrival after close is disposed, not returned. */
852
870
  acquire<R>(get: (lifetime: AbortSignal) => Promise<R>, dispose: (resource: R) => void | Promise<void>): Promise<R>;
853
871
  /**
@@ -1004,6 +1022,111 @@ interface DownloadOptions extends OperationOptions {
1004
1022
  */
1005
1023
  readonly mode?: PdfSaveMode;
1006
1024
  }
1025
+ /**
1026
+ * How a print comes out.
1027
+ *
1028
+ * - `'pdf'`: the printer prints a copy of the pages as they print (`pages.extract()` with
1029
+ * `flatten: { usage: 'print' }`): sharp text and lines. It takes `doc.print.high`, a right to
1030
+ * keep the copy (`doc.download` or `doc.download.flattened`: every print dialog can save it as
1031
+ * a file), and a printer that prints a PDF (`HostPrinter.stagePdf`).
1032
+ * - `'images'` otherwise: pictures of the pages, drawn by the print rules, at 150 DPI with
1033
+ * `doc.print` or 300 DPI with `doc.print.high` (Acrobat's low and high resolution printing).
1034
+ */
1035
+ type PrintQuality = {
1036
+ readonly kind: 'pdf';
1037
+ } | {
1038
+ readonly kind: 'images';
1039
+ readonly dpi: PrintDpi;
1040
+ };
1041
+ /** How far preparing a print got. */
1042
+ interface PrintProgress {
1043
+ /** Pages that are ready: one at a time as pictures, all at once as a PDF. */
1044
+ readonly pagesRendered: number;
1045
+ /** Pages the print has. */
1046
+ readonly pageCount: number;
1047
+ }
1048
+ interface PrintOptions extends OperationOptions {
1049
+ /** The pages to print, in this order. Default: every page. */
1050
+ readonly pages?: readonly PageRef[];
1051
+ /**
1052
+ * Print the annotations that print. Default: when the user may read them. Form fields print
1053
+ * when the user may read the form, whatever this says.
1054
+ */
1055
+ readonly includeAnnotations?: boolean;
1056
+ /** Called each time pages are ready, and once before the first. */
1057
+ readonly onProgress?: (progress: PrintProgress) => void;
1058
+ }
1059
+ /**
1060
+ * A print got ready by `documents.preparePrint()`. Everything slow already happened, so
1061
+ * `print()` opens the print dialog at once.
1062
+ */
1063
+ interface PreparedPrint {
1064
+ readonly quality: PrintQuality;
1065
+ /** How many pages it prints. */
1066
+ readonly pageCount: number;
1067
+ /**
1068
+ * Whether `print()` must run inside the user's tap or click: the printer's `needsTap`. Safari
1069
+ * doesn't print what waited for its pages (iOS refuses the dialog, the Mac prints blank pages),
1070
+ * so a dialog that prepared on a tap asks for another once the print is ready. When `false`,
1071
+ * print as soon as it is ready.
1072
+ */
1073
+ readonly needsTap: boolean;
1074
+ /**
1075
+ * Open the print dialog. The document's own print actions run around it, when the actions
1076
+ * plugin is installed; when they, or anyone, change the document after it was prepared, it is
1077
+ * prepared again first. Resolves when the printer has the job. When the printer refuses a
1078
+ * PDF, the same pages print as pictures. Rejects `invalid-input` once disposed,
1079
+ * `operation-cancelled` when `signal` fires before the dialog opens.
1080
+ */
1081
+ print(options?: OperationOptions): Promise<void>;
1082
+ /** Free what preparing took. Closing the document does too. */
1083
+ dispose(): void;
1084
+ }
1085
+ /** One printed sheet: a picture of a page, and the page's size on paper. */
1086
+ interface PrintSheet {
1087
+ /** A PNG of the page, drawn by the print rules. */
1088
+ readonly image: Blob;
1089
+ /** The page's width in points (1/72 inch), as it prints. */
1090
+ readonly widthPt: number;
1091
+ /** The page's height in points. */
1092
+ readonly heightPt: number;
1093
+ }
1094
+ /** What a printer got ready: `print()` opens the print dialog with it. */
1095
+ interface StagedPrint {
1096
+ /** Open the print dialog. Resolves once the printer has the job. */
1097
+ print(): Promise<void>;
1098
+ /** Free what staging took. */
1099
+ dispose(): void;
1100
+ }
1101
+ /**
1102
+ * Where prints go: the host's print dialog. A browser passes `browserPrinter()` from
1103
+ * `@embedpdf/web`; an app with its own print path (a desktop shell, a native app) passes its
1104
+ * own.
1105
+ */
1106
+ interface HostPrinter {
1107
+ /**
1108
+ * `true` when this printer prints only while the user's tap or click is being handled (Safari),
1109
+ * so a print that waited for its pages needs another tap. Default `false`.
1110
+ */
1111
+ readonly needsTap?: boolean;
1112
+ /**
1113
+ * Get the sheets ready to print, so `print()` on what it returns opens the dialog at once.
1114
+ * `name` names the print job. Rejects when `signal` fires.
1115
+ */
1116
+ stage(sheets: readonly PrintSheet[], options: {
1117
+ readonly name: string;
1118
+ readonly signal?: AbortSignal;
1119
+ }): Promise<StagedPrint>;
1120
+ /**
1121
+ * Present when this printer prints a PDF file on this device: a browser whose own PDF viewer
1122
+ * prints it, a desktop shell, a native print API. Gets `pdf`, a copy of the pages as they
1123
+ * print, ready as `stage()` gets sheets ready. A printer without it prints pictures.
1124
+ */
1125
+ stagePdf?(pdf: Uint8Array, options: {
1126
+ readonly name: string;
1127
+ readonly signal?: AbortSignal;
1128
+ }): Promise<StagedPrint>;
1129
+ }
1007
1130
  /**
1008
1131
  * One boot document for `documents.openAll()` — the shared shape every
1009
1132
  * framework adapter's `initialDocuments` input uses (adapters re-export it,
@@ -1127,7 +1250,26 @@ interface DocumentsCapability {
1127
1250
  downloadLayer(id?: string, options?: OperationOptions): Promise<Uint8Array>;
1128
1251
  /** Whether the document (the one in scope without an id) may be downloaded: `doc.download`. */
1129
1252
  canDownload(id?: string): boolean;
1130
- /** Whether the document (the one in scope without an id) may be printed: `doc.print`. */
1253
+ /**
1254
+ * Get a print of the document ready (the one in scope without an id): wait for changes still
1255
+ * on their way, make the pages as they print (a PDF copy or pictures, as `getPrintQuality()`
1256
+ * says), and hand them to the host's printer. `onProgress` follows the pages. Rejects
1257
+ * `permission-denied` without `doc.print`, `unsupported` when the host gave no printer,
1258
+ * `not-found` for a page the document doesn't have, `invalid-input` for an empty `pages` or a
1259
+ * page named twice, `not-ready` with no open document, `operation-cancelled` when `signal`
1260
+ * fires.
1261
+ */
1262
+ preparePrint(id?: string, options?: PrintOptions): Promise<PreparedPrint>;
1263
+ /**
1264
+ * Prepare a print and print it: `preparePrint()`, then its `print()`. The document's own
1265
+ * print actions run around the dialog when the actions plugin is installed. Rejects as
1266
+ * `preparePrint()` does. A printer that `needsTap` may refuse the dialog once preparing took a
1267
+ * while: there, prepare first and print from a tap.
1268
+ */
1269
+ print(id?: string, options?: PrintOptions): Promise<void>;
1270
+ /** How a print of the document comes out for this user, or null when they can't print it. */
1271
+ getPrintQuality(id?: string): PrintQuality | null;
1272
+ /** Whether the document (the one in scope without an id) may be printed: `doc.print`, and the host gave a printer. */
1131
1273
  canPrint(id?: string): boolean;
1132
1274
  /**
1133
1275
  * The document's pages, in order (the one in scope without an id). The same array until a
@@ -1158,5 +1300,5 @@ interface DocumentsCapability {
1158
1300
  /** Built-in token for the document registry capability (provided by the kernel). */
1159
1301
  declare const DocumentsToken: CapabilityToken<DocumentsCapability>;
1160
1302
  //#endregion
1161
- export { PdfSaveMode as $, isPluginError as $t, Identity$1 as A, MirrorReload as At, OperationOptions as B, ChangeQueue as Bt, DocumentsToken as C, SerialQueue as Ct, EventOrigin as D, PageMirrorSpec as Dt, EngineFactory as E, PageMirrorChange as Et, OpenDocumentOptions as F, Cancel as Ft, PageInsertResult as G, SettledChange as Gt, PageDestination as H, HoldOptions as Ht, OpenDocumentResult as I, HostClock as It, PagePosition as J, EventHookSource as Jt, PageLayout$1 as K, StagedChange as Kt, OpenInput as L, PluginClock as Lt, LockedDocumentInfo as M, reload as Mt, MetadataPatch as N, SliceChange as Nt, FailedDocumentInfo as O, Mirror as Ot, MetadataUpdateResult as P, SliceLease as Pt, PdfRotation as Q, PluginErrorInfo as Qt, OpenOptions as R, timerClock as Rt, DocumentsCapability as S, mergeSettings as St, Engine$1 as T, PageMirror as Tt, PageInfo as U, PendingChange as Ut, PageDeleteResult as V, HeldChange as Vt, PageInsertBlankSpec as W, PredictedOp as Wt, PageRotateResult as X, PluginError as Xt, PageReorderResult as Y, createEventHook as Yt, PdfDestination as Z, PluginErrorCode as Zt, DocumentOpenFailedEvent as _, Settings as _t, CustomMetadata as a, createLatestLane as an, PluginScope as at, DocumentStatus as b, SettingsDeclaration as bt, DocCapability as c, ResourceStatus as ct, DocumentEvent$1 as d, Subscribable as dt, toPluginError as en, PdfSize as et, DocumentHandle$1 as f, UnlockOptions as ft, DocumentMetadata as g, NoSettings as gt, DocumentMeta as h, DeepPartial as ht, CoreState as i, LatestRun as in, PluginDef as it, InitialDocument as j, MirrorSpec as jt, GlobalState as k, MirrorChange as kt, DocumentActiveChangedEvent as l, StateCell as lt, DocumentLockedEvent as m, UrlSource as mt, BatchResult as n, LatestCancellation as nn, Permission as nt, CustomMetadataPatch as o, PromiseMemberOf as ot, DocumentInfo as p, Unsubscribe as pt, PageObjectNumber as q, EventHook as qt, CapabilityToken as r, LatestLane as rn, PluginContext as rt, CustomMetadataUpdateResult as s, PromiseMembers as st, AnyPlugin as t, toPluginErrorInfo as tn, PendingMeta as tt, DocumentClosedEvent as u, StateChange as ut, DocumentOpenedEvent as v, SettingsApi as vt, DownloadOptions as w, createSerialQueue as wt, DocumentUnsavedChangesChangedEvent as x, SettingsOf as xt, DocumentPagesChangedEvent as y, SettingsChangedEvent as yt, OpenSource as z, ChangeLabel as zt };
1162
- //# sourceMappingURL=types-t-DaU8VK.d.cts.map
1303
+ export { PdfRotation as $, StagedChange as $t, HostPrinter as A, SerialQueue as At, OpenSource as B, SliceChange as Bt, DocumentsToken as C, NoSettings as Ct, EventOrigin as D, SettingsDeclaration as Dt, EngineFactory as E, SettingsChangedEvent as Et, MetadataUpdateResult as F, Mirror as Ft, PageInsertBlankSpec as G, timerClock as Gt, PageDeleteResult as H, Cancel as Ht, OpenDocumentOptions as I, MirrorChange as It, PageObjectNumber as J, HeldChange as Jt, PageInsertResult as K, ChangeLabel as Kt, OpenDocumentResult as L, MirrorReload as Lt, InitialDocument as M, PageMirror as Mt, LockedDocumentInfo as N, PageMirrorChange as Nt, FailedDocumentInfo as O, SettingsOf as Ot, MetadataPatch as P, PageMirrorSpec as Pt, PdfDestination as Q, SettledChange as Qt, OpenInput as R, MirrorSpec as Rt, DocumentsCapability as S, DeepPartial as St, Engine$1 as T, SettingsApi as Tt, PageDestination as U, HostClock as Ut, OperationOptions as V, SliceLease as Vt, PageInfo as W, PluginClock as Wt, PageReorderResult as X, PendingChange as Xt, PagePosition as Y, HoldOptions as Yt, PageRotateResult as Z, PredictedOp as Zt, DocumentOpenFailedEvent as _, StateChange as _t, CustomMetadata as a, PluginErrorInfo as an, PluginDef as at, DocumentStatus as b, Unsubscribe as bt, DocCapability as c, toPluginErrorInfo as cn, PrintOptions as ct, DocumentEvent$1 as d, LatestRun as dn, PrintSheet as dt, EventHook as en, PdfSaveMode as et, DocumentHandle$1 as f, createLatestLane as fn, PromiseMemberOf as ft, DocumentMetadata as g, StateCell as gt, DocumentMeta as h, StagedPrint as ht, CoreState as i, PluginErrorCode as in, PluginContext as it, Identity$1 as j, createSerialQueue as jt, GlobalState as k, mergeSettings as kt, DocumentActiveChangedEvent as l, LatestCancellation as ln, PrintProgress as lt, DocumentLockedEvent as m, ResourceStatus as mt, BatchResult as n, createEventHook as nn, PendingMeta as nt, CustomMetadataPatch as o, isPluginError as on, PluginScope as ot, DocumentInfo as p, PromiseMembers as pt, PageLayout$1 as q, ChangeQueue as qt, CapabilityToken as r, PluginError as rn, Permission as rt, CustomMetadataUpdateResult as s, toPluginError as sn, PreparedPrint as st, AnyPlugin as t, EventHookSource as tn, PdfSize as tt, DocumentClosedEvent as u, LatestLane as un, PrintQuality as ut, DocumentOpenedEvent as v, Subscribable as vt, DownloadOptions as w, Settings as wt, DocumentUnsavedChangesChangedEvent as x, UrlSource as xt, DocumentPagesChangedEvent as y, UnlockOptions as yt, OpenOptions as z, reload as zt };
1304
+ //# sourceMappingURL=types-CfnZ7go6.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/core",
3
- "version": "3.0.0-next.15",
3
+ "version": "3.0.0-next.16",
4
4
  "private": false,
5
5
  "description": "Pure, framework-free runtime for the EmbedPDF v3 viewer: store, typed capabilities, and plugin lifecycle. DOM-free and serializable.",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@embedpdf/engine-core": "3.0.0-next.15"
25
+ "@embedpdf/engine-core": "3.0.0-next.16"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^5.0.0",