unpdf 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/pdfjs.mjs +107 -1
- package/dist/types/src/display/annotation_layer.d.ts +14 -11
- package/dist/types/src/display/annotation_storage.d.ts +8 -8
- package/dist/types/src/display/api.d.ts +81 -57
- package/dist/types/src/display/api_utils.d.ts +1 -1
- package/dist/types/src/display/binary_data_factory.d.ts +26 -0
- package/dist/types/src/display/canvas.d.ts +19 -16
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +66 -10
- package/dist/types/src/display/canvas_factory.d.ts +3 -1
- package/dist/types/src/display/display_utils.d.ts +4 -3
- package/dist/types/src/display/draw_layer.d.ts +2 -6
- package/dist/types/src/display/editor/alt_text.d.ts +1 -1
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +7 -12
- package/dist/types/src/display/editor/color_picker.d.ts +2 -2
- package/dist/types/src/display/editor/comment.d.ts +12 -0
- package/dist/types/src/display/editor/draw.d.ts +3 -7
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/types/src/display/editor/editor.d.ts +16 -13
- package/dist/types/src/display/editor/freetext.d.ts +2 -2
- package/dist/types/src/display/editor/highlight.d.ts +3 -3
- package/dist/types/src/display/editor/toolbar.d.ts +2 -2
- package/dist/types/src/display/editor/tools.d.ts +37 -1
- package/dist/types/src/display/fetch_stream.d.ts +3 -56
- package/dist/types/src/display/font_loader.d.ts +2 -1
- package/dist/types/src/display/network.d.ts +14 -80
- package/dist/types/src/display/network_stream.d.ts +2 -0
- package/dist/types/src/display/network_utils.d.ts +3 -3
- package/dist/types/src/display/node_stream.d.ts +2 -52
- package/dist/types/src/display/node_utils.d.ts +5 -19
- package/dist/types/src/{shared/obj-bin-transform.d.ts → display/obj_bin_transform_display.d.ts} +21 -18
- package/dist/types/src/display/pages_mapper.d.ts +72 -0
- package/dist/types/src/display/pattern_helper.d.ts +7 -2
- package/dist/types/src/display/text_layer.d.ts +16 -10
- package/dist/types/src/display/text_layer_images.d.ts +10 -0
- package/dist/types/src/display/transport_stream.d.ts +8 -64
- package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/display/xfa_layer.d.ts +3 -3
- package/dist/types/src/pdf.d.ts +5 -1
- package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
- package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
- package/dist/types/src/shared/util.d.ts +14 -5
- package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
- package/dist/types/web/annotation_layer_builder.d.ts +9 -9
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/autolinker.d.ts +3 -2
- package/dist/types/web/base_download_manager.d.ts +24 -0
- package/dist/types/web/base_pdf_page_view.d.ts +5 -5
- package/dist/types/web/comment_manager.d.ts +2 -2
- package/dist/types/web/download_manager.d.ts +3 -12
- package/dist/types/web/draw_layer_builder.d.ts +0 -12
- package/dist/types/web/genericl10n.d.ts +6 -10
- package/dist/types/web/l10n.d.ts +3 -6
- package/dist/types/web/menu.d.ts +11 -0
- package/dist/types/web/pdf_find_controller.d.ts +9 -11
- package/dist/types/web/pdf_history.d.ts +3 -3
- package/dist/types/web/pdf_link_service.d.ts +2 -7
- package/dist/types/web/pdf_page_detail_view.d.ts +1 -7
- package/dist/types/web/pdf_page_view.d.ts +17 -11
- package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
- package/dist/types/web/pdf_thumbnail_view.d.ts +18 -42
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
- package/dist/types/web/pdf_viewer.component.d.ts +1 -1
- package/dist/types/web/pdf_viewer.d.ts +30 -27
- package/dist/types/web/renderable_view.d.ts +33 -0
- package/dist/types/web/sidebar.d.ts +65 -0
- package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +11 -6
- package/dist/types/web/ui_utils.d.ts +3 -11
- package/dist/types/web/xfa_layer_builder.d.ts +4 -4
- package/package.json +22 -17
- package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
- package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
- package/dist/types/src/display/wasm_factory.d.ts +0 -20
- package/dist/types/web/interfaces.d.ts +0 -174
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
|
2
2
|
export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
|
|
3
3
|
export type EventBus = import("./event_utils").EventBus;
|
|
4
|
-
export type IL10n = import("./interfaces").IL10n;
|
|
5
|
-
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
6
4
|
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
7
5
|
export type CommentManager = import("./comment_manager.js").CommentManager;
|
|
6
|
+
export type L10n = import("./l10n.js").L10n;
|
|
8
7
|
export type PDFPageViewOptions = {
|
|
9
8
|
/**
|
|
10
9
|
* - The viewer element.
|
|
@@ -81,6 +80,12 @@ export type PDFPageViewOptions = {
|
|
|
81
80
|
* The default value is `true`.
|
|
82
81
|
*/
|
|
83
82
|
enableDetailCanvas?: boolean | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* - All images whose width and
|
|
85
|
+
* height are at least this value (in pixels) will be lazily inserted in the
|
|
86
|
+
* dom to allow right-clicking and saving them. Use `-1` to disable this.
|
|
87
|
+
*/
|
|
88
|
+
imagesRightClickMinSize?: number | undefined;
|
|
84
89
|
/**
|
|
85
90
|
* - When enabled, PDF
|
|
86
91
|
* rendering will keep track of which areas of the page each PDF operation
|
|
@@ -98,7 +103,7 @@ export type PDFPageViewOptions = {
|
|
|
98
103
|
/**
|
|
99
104
|
* - Localization service.
|
|
100
105
|
*/
|
|
101
|
-
l10n?: import("./
|
|
106
|
+
l10n?: import("./l10n.js").L10n | undefined;
|
|
102
107
|
/**
|
|
103
108
|
* - The object that is used to lookup
|
|
104
109
|
* the necessary layer-properties.
|
|
@@ -111,18 +116,16 @@ export type PDFPageViewOptions = {
|
|
|
111
116
|
enableAutoLinking?: boolean | undefined;
|
|
112
117
|
/**
|
|
113
118
|
* - The comment manager instance.
|
|
119
|
+
* to.
|
|
114
120
|
*/
|
|
115
121
|
commentManager?: import("./comment_manager.js").CommentManager | undefined;
|
|
122
|
+
abortSignal?: AbortSignal | undefined;
|
|
116
123
|
};
|
|
117
|
-
|
|
118
|
-
* @implements {IRenderableView}
|
|
119
|
-
*/
|
|
120
|
-
export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
124
|
+
export class PDFPageView extends BasePDFPageView {
|
|
121
125
|
/**
|
|
122
126
|
* @param {PDFPageViewOptions} options
|
|
123
127
|
*/
|
|
124
128
|
constructor(options: PDFPageViewOptions);
|
|
125
|
-
renderingId: string;
|
|
126
129
|
pdfPage: any;
|
|
127
130
|
pageLabel: string | null;
|
|
128
131
|
rotation: number;
|
|
@@ -135,7 +138,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
135
138
|
maxCanvasPixels: any;
|
|
136
139
|
maxCanvasDim: any;
|
|
137
140
|
capCanvasAreaFactor: any;
|
|
138
|
-
l10n: import("./
|
|
141
|
+
l10n: import("./l10n.js").L10n | undefined;
|
|
139
142
|
_isStandalone: boolean | undefined;
|
|
140
143
|
_container: HTMLDivElement | undefined;
|
|
141
144
|
_annotationCanvasMap: any;
|
|
@@ -147,8 +150,11 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
147
150
|
drawLayer: any;
|
|
148
151
|
detailView: any;
|
|
149
152
|
div: HTMLDivElement;
|
|
153
|
+
clone(id: any): PDFPageView;
|
|
154
|
+
updatePageNumber(newPageNumber: any): void;
|
|
150
155
|
setPdfPage(pdfPage: any): void;
|
|
151
156
|
destroy(): void;
|
|
157
|
+
deleteMe(isCut: any): void;
|
|
152
158
|
hasEditableAnnotations(): boolean;
|
|
153
159
|
get _textHighlighter(): any;
|
|
154
160
|
reset({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, keepCanvasWrapper, preserveDetailViewState, }?: {
|
|
@@ -212,7 +218,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
212
218
|
get height(): number;
|
|
213
219
|
getPagePoint(x: any, y: any): any[];
|
|
214
220
|
_ensureCanvasWrapper(): null;
|
|
215
|
-
_getRenderingContext(canvas: any, transform: any, recordOperations: any): {
|
|
221
|
+
_getRenderingContext(canvas: any, transform: any, recordOperations: any, recordImages: any): {
|
|
216
222
|
canvas: any;
|
|
217
223
|
transform: any;
|
|
218
224
|
viewport: import("../src/display/display_utils").PageViewport;
|
|
@@ -222,6 +228,7 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
222
228
|
pageColors: null;
|
|
223
229
|
isEditing: boolean;
|
|
224
230
|
recordOperations: any;
|
|
231
|
+
recordImages: any;
|
|
225
232
|
};
|
|
226
233
|
draw(): Promise<void>;
|
|
227
234
|
/**
|
|
@@ -236,7 +243,6 @@ export class PDFPageView extends BasePDFPageView implements IRenderableView {
|
|
|
236
243
|
#private;
|
|
237
244
|
}
|
|
238
245
|
import { BasePDFPageView } from "./base_pdf_page_view.js";
|
|
239
|
-
import { GenericL10n } from "./genericl10n";
|
|
240
246
|
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
|
|
241
247
|
import { TextLayerBuilder } from "./text_layer_builder.js";
|
|
242
248
|
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
2
1
|
export type PDFViewer = import("./pdf_viewer").PDFViewer;
|
|
3
2
|
export type PDFThumbnailViewer = import("./pdf_thumbnail_viewer").PDFThumbnailViewer;
|
|
3
|
+
export type RenderableView = import("./renderable_view").RenderableView;
|
|
4
4
|
/**
|
|
5
5
|
* Controls rendering of the views for pages and thumbnails.
|
|
6
6
|
*/
|
|
7
7
|
export class PDFRenderingQueue {
|
|
8
|
-
pdfViewer: import("./pdf_viewer").PDFViewer | null;
|
|
9
|
-
pdfThumbnailViewer: import("./pdf_thumbnail_viewer").PDFThumbnailViewer | null;
|
|
10
|
-
onIdle: any;
|
|
11
|
-
highestPriorityPage: string | null;
|
|
12
|
-
/** @type {number} */
|
|
13
|
-
idleTimeout: number;
|
|
14
|
-
printing: boolean;
|
|
15
8
|
isThumbnailViewEnabled: boolean;
|
|
9
|
+
onIdle: null;
|
|
10
|
+
printing: boolean;
|
|
16
11
|
/**
|
|
17
12
|
* @param {PDFViewer} pdfViewer
|
|
18
13
|
*/
|
|
@@ -22,10 +17,10 @@ export class PDFRenderingQueue {
|
|
|
22
17
|
*/
|
|
23
18
|
setThumbnailViewer(pdfThumbnailViewer: PDFThumbnailViewer): void;
|
|
24
19
|
/**
|
|
25
|
-
* @param {
|
|
20
|
+
* @param {RenderableView} view
|
|
26
21
|
* @returns {boolean}
|
|
27
22
|
*/
|
|
28
|
-
isHighestPriority(view:
|
|
23
|
+
isHighestPriority(view: RenderableView): boolean;
|
|
29
24
|
/**
|
|
30
25
|
* @param {Object} currentlyVisiblePages
|
|
31
26
|
*/
|
|
@@ -39,16 +34,17 @@ export class PDFRenderingQueue {
|
|
|
39
34
|
*/
|
|
40
35
|
getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): any;
|
|
41
36
|
/**
|
|
42
|
-
* @param {
|
|
37
|
+
* @param {RenderableView} view
|
|
43
38
|
* @returns {boolean}
|
|
44
39
|
*/
|
|
45
|
-
isViewFinished(view:
|
|
40
|
+
isViewFinished(view: RenderableView): boolean;
|
|
46
41
|
/**
|
|
47
42
|
* Render a page or thumbnail view. This calls the appropriate function
|
|
48
43
|
* based on the views state. If the view is already rendered it will return
|
|
49
44
|
* `false`.
|
|
50
45
|
*
|
|
51
|
-
* @param {
|
|
46
|
+
* @param {RenderableView} view
|
|
52
47
|
*/
|
|
53
|
-
renderView(view:
|
|
48
|
+
renderView(view: RenderableView): boolean;
|
|
49
|
+
#private;
|
|
54
50
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
|
|
2
2
|
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
|
3
3
|
export type EventBus = import("./event_utils").EventBus;
|
|
4
|
-
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
5
|
-
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
6
4
|
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
7
5
|
export type PDFThumbnailViewOptions = {
|
|
8
6
|
/**
|
|
@@ -30,7 +28,7 @@ export type PDFThumbnailViewOptions = {
|
|
|
30
28
|
/**
|
|
31
29
|
* - The navigation/linking service.
|
|
32
30
|
*/
|
|
33
|
-
linkService:
|
|
31
|
+
linkService: PDFLinkService;
|
|
34
32
|
/**
|
|
35
33
|
* - The rendering queue object.
|
|
36
34
|
*/
|
|
@@ -54,16 +52,12 @@ export type PDFThumbnailViewOptions = {
|
|
|
54
52
|
*/
|
|
55
53
|
pageColors?: Object | undefined;
|
|
56
54
|
};
|
|
57
|
-
|
|
58
|
-
* @implements {IRenderableView}
|
|
59
|
-
*/
|
|
60
|
-
export class PDFThumbnailView implements IRenderableView {
|
|
55
|
+
export class PDFThumbnailView extends RenderableView {
|
|
61
56
|
/**
|
|
62
57
|
* @param {PDFThumbnailViewOptions} options
|
|
63
58
|
*/
|
|
64
|
-
constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, }: PDFThumbnailViewOptions);
|
|
59
|
+
constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, enableSplitMerge, }: PDFThumbnailViewOptions);
|
|
65
60
|
id: number;
|
|
66
|
-
renderingId: string;
|
|
67
61
|
pageLabel: string | null;
|
|
68
62
|
pdfPage: any;
|
|
69
63
|
rotation: number;
|
|
@@ -74,28 +68,35 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
74
68
|
maxCanvasDim: any;
|
|
75
69
|
pageColors: Object | null;
|
|
76
70
|
eventBus: import("./event_utils").EventBus;
|
|
77
|
-
linkService:
|
|
71
|
+
linkService: PDFLinkService;
|
|
78
72
|
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
79
|
-
|
|
80
|
-
renderingState: number;
|
|
81
|
-
resume: (() => void) | null;
|
|
82
|
-
anchor: HTMLAnchorElement;
|
|
73
|
+
placeholder: any;
|
|
83
74
|
div: HTMLDivElement;
|
|
84
|
-
|
|
75
|
+
imageContainer: HTMLDivElement;
|
|
76
|
+
image: HTMLImageElement;
|
|
77
|
+
checkbox: HTMLInputElement | undefined;
|
|
78
|
+
pasteButton: HTMLButtonElement | null;
|
|
79
|
+
clone(container: any, id: any): PDFThumbnailView;
|
|
80
|
+
addPasteButton(pasteCallback: any): void;
|
|
81
|
+
prevPasteButton: Node | null | undefined;
|
|
82
|
+
removePasteButton(): void;
|
|
83
|
+
toggleSelected(isSelected: any): void;
|
|
84
|
+
updateId(newId: any): void;
|
|
85
85
|
canvasWidth: number | undefined;
|
|
86
86
|
canvasHeight: number | undefined;
|
|
87
87
|
scale: number | undefined;
|
|
88
88
|
setPdfPage(pdfPage: any): void;
|
|
89
89
|
reset(): void;
|
|
90
|
+
destroy(): void;
|
|
90
91
|
update({ rotation }: {
|
|
91
92
|
rotation?: null | undefined;
|
|
92
93
|
}): void;
|
|
94
|
+
toggleCurrent(isCurrent: any): void;
|
|
93
95
|
/**
|
|
94
96
|
* PLEASE NOTE: Most likely you want to use the `this.reset()` method,
|
|
95
97
|
* rather than calling this one directly.
|
|
96
98
|
*/
|
|
97
99
|
cancelRendering(): void;
|
|
98
|
-
image: HTMLImageElement | undefined;
|
|
99
100
|
draw(): Promise<void>;
|
|
100
101
|
setImage(pageView: any): void;
|
|
101
102
|
/**
|
|
@@ -104,29 +105,4 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
104
105
|
setPageLabel(label: string | null): void;
|
|
105
106
|
#private;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
* @typedef {Object} PDFThumbnailViewOptions
|
|
109
|
-
* @property {HTMLDivElement} container - The viewer element.
|
|
110
|
-
* @property {EventBus} eventBus - The application event bus.
|
|
111
|
-
* @property {number} id - The thumbnail's unique ID (normally its number).
|
|
112
|
-
* @property {PageViewport} defaultViewport - The page viewport.
|
|
113
|
-
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
|
|
114
|
-
* A promise that is resolved with an {@link OptionalContentConfig} instance.
|
|
115
|
-
* The default value is `null`.
|
|
116
|
-
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
|
117
|
-
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
|
118
|
-
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
|
|
119
|
-
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
120
|
-
* CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
|
|
121
|
-
* @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
|
|
122
|
-
* in either width or height. Use `-1` for no limit.
|
|
123
|
-
* The default value is 32767.
|
|
124
|
-
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
125
|
-
* with user defined ones in order to improve readability in high contrast
|
|
126
|
-
* mode.
|
|
127
|
-
*/
|
|
128
|
-
export class TempImageFactory {
|
|
129
|
-
static #tempCanvas: null;
|
|
130
|
-
static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
|
|
131
|
-
static destroyCanvas(): void;
|
|
132
|
-
}
|
|
108
|
+
import { RenderableView } from "./renderable_view.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
|
|
2
2
|
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
3
3
|
export type EventBus = import("./event_utils").EventBus;
|
|
4
|
-
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
5
4
|
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
5
|
+
export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
|
|
6
6
|
export type PDFThumbnailViewerOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* - The container for the thumbnail
|
|
@@ -16,7 +16,7 @@ export type PDFThumbnailViewerOptions = {
|
|
|
16
16
|
/**
|
|
17
17
|
* - The navigation/linking service.
|
|
18
18
|
*/
|
|
19
|
-
linkService:
|
|
19
|
+
linkService: PDFLinkService;
|
|
20
20
|
/**
|
|
21
21
|
* - The rendering queue object.
|
|
22
22
|
*/
|
|
@@ -45,17 +45,45 @@ export type PDFThumbnailViewerOptions = {
|
|
|
45
45
|
*/
|
|
46
46
|
abortSignal?: AbortSignal | undefined;
|
|
47
47
|
/**
|
|
48
|
-
* - Enables
|
|
49
|
-
*
|
|
48
|
+
* - Enables the "new" badge for the split
|
|
49
|
+
* and merge features.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
enableNewBadge?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* - Enables split and merge features.
|
|
54
|
+
* The default value is `false`.
|
|
55
|
+
*/
|
|
56
|
+
enableSplitMerge?: boolean | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* - The status bar elements to manage the status
|
|
59
|
+
* label and action when editing pages.
|
|
60
|
+
*/
|
|
61
|
+
statusBar?: Object | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* - The undo bar elements to manage the undo
|
|
64
|
+
* action.
|
|
65
|
+
*/
|
|
66
|
+
undoBar?: Object | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* - The menu elements to manage saving edited
|
|
69
|
+
* PDF.
|
|
70
|
+
*/
|
|
71
|
+
manageMenu?: Object | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* - The button that opens a dialog
|
|
74
|
+
* to add a PDF file to merge with the current one.
|
|
75
|
+
*
|
|
76
|
+
* /**
|
|
77
|
+
* Viewer control to display thumbnails for pages in a PDF document.
|
|
78
|
+
*/
|
|
79
|
+
addFileButton: HTMLButtonElement;
|
|
52
80
|
};
|
|
53
81
|
/**
|
|
54
82
|
* @typedef {Object} PDFThumbnailViewerOptions
|
|
55
83
|
* @property {HTMLDivElement} container - The container for the thumbnail
|
|
56
84
|
* elements.
|
|
57
85
|
* @property {EventBus} eventBus - The application event bus.
|
|
58
|
-
* @property {
|
|
86
|
+
* @property {PDFLinkService} linkService - The navigation/linking service.
|
|
59
87
|
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
|
60
88
|
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
|
|
61
89
|
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
@@ -68,25 +96,38 @@ export type PDFThumbnailViewerOptions = {
|
|
|
68
96
|
* mode.
|
|
69
97
|
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
|
|
70
98
|
* events.
|
|
71
|
-
* @property {boolean} [
|
|
72
|
-
*
|
|
73
|
-
|
|
99
|
+
* @property {boolean} [enableNewBadge] - Enables the "new" badge for the split
|
|
100
|
+
* and merge features.
|
|
101
|
+
* @property {boolean} [enableSplitMerge] - Enables split and merge features.
|
|
102
|
+
* The default value is `false`.
|
|
103
|
+
* @property {Object} [statusBar] - The status bar elements to manage the status
|
|
104
|
+
* label and action when editing pages.
|
|
105
|
+
* @property {Object} [undoBar] - The undo bar elements to manage the undo
|
|
106
|
+
* action.
|
|
107
|
+
* @property {Object} [manageMenu] - The menu elements to manage saving edited
|
|
108
|
+
* PDF.
|
|
109
|
+
* @property {HTMLButtonElement} addFileButton - The button that opens a dialog
|
|
110
|
+
* to add a PDF file to merge with the current one.
|
|
111
|
+
|
|
74
112
|
/**
|
|
75
113
|
* Viewer control to display thumbnails for pages in a PDF document.
|
|
76
114
|
*/
|
|
77
115
|
export class PDFThumbnailViewer {
|
|
116
|
+
static "__#private@#draggingScaleFactor": number;
|
|
117
|
+
static "__#private@#getScaleFactor"(image: any): number;
|
|
78
118
|
/**
|
|
79
119
|
* @param {PDFThumbnailViewerOptions} options
|
|
80
120
|
*/
|
|
81
|
-
constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal,
|
|
121
|
+
constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableSplitMerge, enableNewBadge, statusBar, undoBar, manageMenu, addFileButton, }: PDFThumbnailViewerOptions);
|
|
122
|
+
scrollableContainer: HTMLElement | null;
|
|
82
123
|
container: HTMLDivElement;
|
|
83
124
|
eventBus: import("./event_utils").EventBus;
|
|
84
|
-
linkService: import("./
|
|
125
|
+
linkService: import("./pdf_link_service.js").PDFLinkService;
|
|
85
126
|
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
86
127
|
maxCanvasPixels: number | undefined;
|
|
87
128
|
maxCanvasDim: number | undefined;
|
|
88
129
|
pageColors: Object | null;
|
|
89
|
-
|
|
130
|
+
_manageMenu: Menu | undefined;
|
|
90
131
|
scroll: {
|
|
91
132
|
right: boolean;
|
|
92
133
|
down: boolean;
|
|
@@ -95,8 +136,8 @@ export class PDFThumbnailViewer {
|
|
|
95
136
|
_eventHandler: (evt: any) => void;
|
|
96
137
|
};
|
|
97
138
|
getThumbnail(index: any): any;
|
|
98
|
-
scrollThumbnailIntoView(pageNumber: any): void;
|
|
99
139
|
_currentPageNumber: any;
|
|
140
|
+
scrollThumbnailIntoView(pageNumber: any): void;
|
|
100
141
|
set pagesRotation(rotation: any);
|
|
101
142
|
get pagesRotation(): any;
|
|
102
143
|
_pagesRotation: any;
|
|
@@ -113,5 +154,8 @@ export class PDFThumbnailViewer {
|
|
|
113
154
|
*/
|
|
114
155
|
setPageLabels(labels: any[] | null): void;
|
|
115
156
|
forceRendering(): boolean;
|
|
157
|
+
hasStructuralChanges(): any;
|
|
158
|
+
getStructuralChanges(): any;
|
|
116
159
|
#private;
|
|
117
160
|
}
|
|
161
|
+
import { Menu } from "./menu.js";
|
|
@@ -13,7 +13,7 @@ import { PDFScriptingManager } from "./pdf_scripting_manager.component.js";
|
|
|
13
13
|
import { PDFSinglePageViewer } from "./pdf_single_page_viewer.js";
|
|
14
14
|
import { PDFViewer } from "./pdf_viewer.js";
|
|
15
15
|
import { ProgressBar } from "./ui_utils.js";
|
|
16
|
-
import { RenderingStates } from "./
|
|
16
|
+
import { RenderingStates } from "./renderable_view.js";
|
|
17
17
|
import { ScrollMode } from "./ui_utils.js";
|
|
18
18
|
import { SimpleLinkService } from "./pdf_link_service.js";
|
|
19
19
|
import { SpreadMode } from "./ui_utils.js";
|
|
@@ -3,11 +3,11 @@ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
|
3
3
|
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
|
4
4
|
export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
|
|
5
5
|
export type EventBus = import("./event_utils").EventBus;
|
|
6
|
-
export type IDownloadManager = import("./interfaces").IDownloadManager;
|
|
7
|
-
export type IL10n = import("./interfaces").IL10n;
|
|
8
|
-
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
9
6
|
export type PDFFindController = import("./pdf_find_controller").PDFFindController;
|
|
10
7
|
export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager;
|
|
8
|
+
export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
|
|
9
|
+
export type BaseDownloadManager = import("./base_download_manager.js").BaseDownloadManager;
|
|
10
|
+
export type L10n = import("./l10n.js").L10n;
|
|
11
11
|
export type PDFViewerOptions = {
|
|
12
12
|
/**
|
|
13
13
|
* - The container for the viewer element.
|
|
@@ -24,12 +24,12 @@ export type PDFViewerOptions = {
|
|
|
24
24
|
/**
|
|
25
25
|
* - The navigation/linking service.
|
|
26
26
|
*/
|
|
27
|
-
linkService?: import("./
|
|
27
|
+
linkService?: import("./pdf_link_service.js").PDFLinkService | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* - The download manager
|
|
30
30
|
* component.
|
|
31
31
|
*/
|
|
32
|
-
downloadManager?: import("./
|
|
32
|
+
downloadManager?: import("./base_download_manager.js").BaseDownloadManager | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* - The find controller
|
|
35
35
|
* component.
|
|
@@ -110,6 +110,12 @@ export type PDFViewerOptions = {
|
|
|
110
110
|
* The default value is `true`.
|
|
111
111
|
*/
|
|
112
112
|
enableDetailCanvas?: boolean | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* - All images whose width and
|
|
115
|
+
* height are at least this value (in pixels) will be lazily inserted in the
|
|
116
|
+
* dom to allow right-clicking and saving them. Use `-1` to disable this.
|
|
117
|
+
*/
|
|
118
|
+
imagesRightClickMinSize?: number | undefined;
|
|
113
119
|
/**
|
|
114
120
|
* - When enabled, PDF
|
|
115
121
|
* rendering will keep track of which areas of the page each PDF operation
|
|
@@ -120,7 +126,7 @@ export type PDFViewerOptions = {
|
|
|
120
126
|
/**
|
|
121
127
|
* - Localization service.
|
|
122
128
|
*/
|
|
123
|
-
l10n?: import("./
|
|
129
|
+
l10n?: import("./l10n.js").L10n | undefined;
|
|
124
130
|
/**
|
|
125
131
|
* - Enables PDF document permissions,
|
|
126
132
|
* when they exist. The default value is `false`.
|
|
@@ -132,11 +138,6 @@ export type PDFViewerOptions = {
|
|
|
132
138
|
* mode.
|
|
133
139
|
*/
|
|
134
140
|
pageColors?: Object | undefined;
|
|
135
|
-
/**
|
|
136
|
-
* - Enables hardware acceleration for
|
|
137
|
-
* rendering. The default value is `false`.
|
|
138
|
-
*/
|
|
139
|
-
enableHWA?: boolean | undefined;
|
|
140
141
|
/**
|
|
141
142
|
* - Enable zooming on pinch gesture.
|
|
142
143
|
* The default value is `true`.
|
|
@@ -163,8 +164,8 @@ export namespace PagesCountLimit {
|
|
|
163
164
|
* @property {HTMLDivElement} container - The container for the viewer element.
|
|
164
165
|
* @property {HTMLDivElement} [viewer] - The viewer element.
|
|
165
166
|
* @property {EventBus} eventBus - The application event bus.
|
|
166
|
-
* @property {
|
|
167
|
-
* @property {
|
|
167
|
+
* @property {PDFLinkService} [linkService] - The navigation/linking service.
|
|
168
|
+
* @property {BaseDownloadManager} [downloadManager] - The download manager
|
|
168
169
|
* component.
|
|
169
170
|
* @property {PDFFindController} [findController] - The find controller
|
|
170
171
|
* component.
|
|
@@ -204,18 +205,19 @@ export namespace PagesCountLimit {
|
|
|
204
205
|
* `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
|
|
205
206
|
* that only renders the part of the page that is close to the viewport.
|
|
206
207
|
* The default value is `true`.
|
|
208
|
+
* @property {number} [imagesRightClickMinSize] - All images whose width and
|
|
209
|
+
* height are at least this value (in pixels) will be lazily inserted in the
|
|
210
|
+
* dom to allow right-clicking and saving them. Use `-1` to disable this.
|
|
207
211
|
* @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF
|
|
208
212
|
* rendering will keep track of which areas of the page each PDF operation
|
|
209
213
|
* affects. Then, when rendering a partial page (if `enableDetailCanvas` is
|
|
210
214
|
* enabled), it will only run through the operations that affect that portion.
|
|
211
|
-
* @property {
|
|
215
|
+
* @property {L10n} [l10n] - Localization service.
|
|
212
216
|
* @property {boolean} [enablePermissions] - Enables PDF document permissions,
|
|
213
217
|
* when they exist. The default value is `false`.
|
|
214
218
|
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
215
219
|
* with user defined ones in order to improve readability in high contrast
|
|
216
220
|
* mode.
|
|
217
|
-
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
218
|
-
* rendering. The default value is `false`.
|
|
219
221
|
* @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
|
|
220
222
|
* The default value is `true`.
|
|
221
223
|
* @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
|
|
@@ -249,8 +251,8 @@ export class PDFViewer {
|
|
|
249
251
|
container: HTMLDivElement;
|
|
250
252
|
viewer: Element | null;
|
|
251
253
|
eventBus: import("./event_utils").EventBus;
|
|
252
|
-
linkService: import("./
|
|
253
|
-
downloadManager: import("./
|
|
254
|
+
linkService: import("./pdf_link_service.js").PDFLinkService;
|
|
255
|
+
downloadManager: import("./base_download_manager.js").BaseDownloadManager | null;
|
|
254
256
|
findController: import("./pdf_find_controller").PDFFindController | null;
|
|
255
257
|
_scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null;
|
|
256
258
|
imageResourcesPath: string;
|
|
@@ -261,7 +263,8 @@ export class PDFViewer {
|
|
|
261
263
|
capCanvasAreaFactor: number | undefined;
|
|
262
264
|
enableDetailCanvas: boolean;
|
|
263
265
|
enableOptimizedPartialRendering: boolean;
|
|
264
|
-
|
|
266
|
+
imagesRightClickMinSize: number;
|
|
267
|
+
l10n: import("./l10n.js").L10n | undefined;
|
|
265
268
|
pageColors: Object | null;
|
|
266
269
|
defaultRenderingQueue: boolean;
|
|
267
270
|
renderingQueue: PDFRenderingQueue | undefined;
|
|
@@ -341,7 +344,7 @@ export class PDFViewer {
|
|
|
341
344
|
get onePageRendered(): any;
|
|
342
345
|
get pagesPromise(): any;
|
|
343
346
|
get _layerProperties(): any;
|
|
344
|
-
getAllText(): Promise<string | null>;
|
|
347
|
+
getAllText(interruptSignal?: null): Promise<string | null>;
|
|
345
348
|
/**
|
|
346
349
|
* @param {PDFDocumentProxy} pdfDocument
|
|
347
350
|
*/
|
|
@@ -349,13 +352,19 @@ export class PDFViewer {
|
|
|
349
352
|
pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
|
|
350
353
|
_scrollMode: any;
|
|
351
354
|
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null | undefined;
|
|
355
|
+
onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }: {
|
|
356
|
+
pagesMapper: any;
|
|
357
|
+
type: any;
|
|
358
|
+
hasBeenCut: any;
|
|
359
|
+
pageNumbers: any;
|
|
360
|
+
}): void;
|
|
361
|
+
_pages: any[] | undefined;
|
|
352
362
|
/**
|
|
353
363
|
* @param {Array|null} labels
|
|
354
364
|
*/
|
|
355
365
|
setPageLabels(labels: any[] | null): void;
|
|
356
366
|
_pageLabels: any[] | null | undefined;
|
|
357
367
|
_resetView(): void;
|
|
358
|
-
_pages: any[] | undefined;
|
|
359
368
|
_currentScale: any;
|
|
360
369
|
_currentScaleValue: any;
|
|
361
370
|
_location: {
|
|
@@ -479,10 +488,6 @@ export class PDFViewer {
|
|
|
479
488
|
*/
|
|
480
489
|
get spreadMode(): number;
|
|
481
490
|
_updateSpreadMode(pageNumber?: null): void;
|
|
482
|
-
/**
|
|
483
|
-
* @private
|
|
484
|
-
*/
|
|
485
|
-
private _getPageAdvance;
|
|
486
491
|
/**
|
|
487
492
|
* Go to the next page, taking scroll/spread-modes into account.
|
|
488
493
|
* @returns {boolean} Whether navigation occurred.
|
|
@@ -612,5 +617,3 @@ export class PDFViewer {
|
|
|
612
617
|
#private;
|
|
613
618
|
}
|
|
614
619
|
import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
|
|
615
|
-
import { SimpleLinkService } from "./pdf_link_service.js";
|
|
616
|
-
import { GenericL10n } from "./genericl10n";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class RenderableView {
|
|
2
|
+
/**
|
|
3
|
+
* Unique ID for rendering queue.
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
renderingId: string;
|
|
7
|
+
/**
|
|
8
|
+
* @type {import("../src/display/api").RenderTask | null}
|
|
9
|
+
*/
|
|
10
|
+
renderTask: import("../src/display/api").RenderTask | null;
|
|
11
|
+
/**
|
|
12
|
+
* @type {function | null}
|
|
13
|
+
*/
|
|
14
|
+
resume: Function | null;
|
|
15
|
+
/**
|
|
16
|
+
* @param {number} state
|
|
17
|
+
*/
|
|
18
|
+
set renderingState(state: number);
|
|
19
|
+
/**
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
get renderingState(): number;
|
|
23
|
+
/**
|
|
24
|
+
* @returns {Promise} Resolved on draw completion.
|
|
25
|
+
*/
|
|
26
|
+
draw(): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
export namespace RenderingStates {
|
|
29
|
+
let INITIAL: number;
|
|
30
|
+
let RUNNING: number;
|
|
31
|
+
let PAUSED: number;
|
|
32
|
+
let FINISHED: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer control to display a sidebar with resizer functionality.
|
|
3
|
+
*/
|
|
4
|
+
export class Sidebar {
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} SidebarElements
|
|
7
|
+
* @property {HTMLElement} sidebar - The sidebar element.
|
|
8
|
+
* @property {HTMLElement} resizer - The sidebar resizer element.
|
|
9
|
+
* @property {HTMLElement} toggleButton - The button used to toggle the
|
|
10
|
+
* sidebar.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Create a sidebar with resizer functionality.
|
|
14
|
+
* @param {SidebarElements} sidebarElements
|
|
15
|
+
* @param {boolean} ltr
|
|
16
|
+
* @param {boolean} isResizerOnTheLeft
|
|
17
|
+
*/
|
|
18
|
+
constructor({ sidebar, resizer, toggleButton }: {
|
|
19
|
+
/**
|
|
20
|
+
* - The sidebar element.
|
|
21
|
+
*/
|
|
22
|
+
sidebar: HTMLElement;
|
|
23
|
+
/**
|
|
24
|
+
* - The sidebar resizer element.
|
|
25
|
+
*/
|
|
26
|
+
resizer: HTMLElement;
|
|
27
|
+
/**
|
|
28
|
+
* - The button used to toggle the
|
|
29
|
+
* sidebar.
|
|
30
|
+
*/
|
|
31
|
+
toggleButton: HTMLElement;
|
|
32
|
+
}, ltr: boolean, isResizerOnTheLeft: boolean, globalAbortSignal: any);
|
|
33
|
+
_sidebar: HTMLElement;
|
|
34
|
+
_isOpen: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Set the width of the sidebar in pixels.
|
|
37
|
+
* @param {number} newWidth
|
|
38
|
+
*/
|
|
39
|
+
set width(newWidth: number);
|
|
40
|
+
/**
|
|
41
|
+
* Get the current width of the sidebar in pixels.
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
get width(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Callback to be executed when the user starts resizing the sidebar.
|
|
47
|
+
*/
|
|
48
|
+
onStartResizing(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Callback to be executed when the user stops resizing the sidebar.
|
|
51
|
+
*/
|
|
52
|
+
onStopResizing(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Callback to be executed when the sidebar is being resized.
|
|
55
|
+
* @param {number} newWidth - The new width of the sidebar in pixels.
|
|
56
|
+
*/
|
|
57
|
+
onResizing(_newWidth: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Toggle the sidebar's visibility.
|
|
60
|
+
* @param {boolean} [visibility] - The visibility state to set.
|
|
61
|
+
*/
|
|
62
|
+
toggle(visibility?: boolean): void;
|
|
63
|
+
destroy(): void;
|
|
64
|
+
#private;
|
|
65
|
+
}
|