unpdf 0.10.1 → 0.12.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 +12 -8
- package/dist/index.cjs +15 -15
- package/dist/index.d.cts +32 -13
- package/dist/index.d.mts +32 -13
- package/dist/index.d.ts +32 -13
- package/dist/index.mjs +15 -15
- package/dist/pdfjs.d.mts +1 -0
- package/dist/pdfjs.d.ts +1 -0
- package/dist/pdfjs.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +12 -5
- package/dist/types/src/display/annotation_storage.d.ts +10 -0
- package/dist/types/src/display/api.d.ts +95 -45
- package/dist/types/src/display/base_factory.d.ts +7 -1
- package/dist/types/src/display/canvas.d.ts +4 -0
- package/dist/types/src/display/display_utils.d.ts +6 -4
- package/dist/types/src/display/draw_layer.d.ts +12 -14
- package/dist/types/src/display/editor/alt_text.d.ts +33 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +26 -2
- package/dist/types/src/display/editor/color_picker.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +85 -16
- package/dist/types/src/display/editor/freetext.d.ts +6 -1
- package/dist/types/src/display/editor/highlight.d.ts +88 -0
- package/dist/types/src/display/editor/ink.d.ts +5 -4
- package/dist/types/src/display/editor/outliner.d.ts +53 -9
- package/dist/types/src/display/editor/stamp.d.ts +22 -1
- package/dist/types/src/display/editor/toolbar.d.ts +10 -1
- package/dist/types/src/display/editor/tools.d.ts +56 -6
- package/dist/types/src/display/fetch_stream.d.ts +3 -4
- package/dist/types/src/display/font_loader.d.ts +1 -5
- package/dist/types/src/display/network.d.ts +2 -3
- package/dist/types/src/display/node_stream.d.ts +5 -6
- package/dist/types/src/display/node_utils.d.ts +6 -5
- package/dist/types/src/display/optional_content_config.d.ts +6 -1
- package/dist/types/src/display/text_layer.d.ts +37 -106
- package/dist/types/src/display/transport_stream.d.ts +3 -7
- package/dist/types/src/display/worker_options.d.ts +20 -22
- package/dist/types/src/pdf.d.ts +3 -6
- package/dist/types/src/shared/util.d.ts +24 -22
- package/dist/types/web/annotation_editor_layer_builder.d.ts +10 -13
- package/dist/types/web/annotation_layer_builder.d.ts +8 -4
- package/dist/types/web/app_options.d.ts +5 -4
- package/dist/types/web/download_manager.d.ts +1 -2
- package/dist/types/web/draw_layer_builder.d.ts +23 -0
- package/dist/types/web/event_utils.d.ts +8 -6
- package/dist/types/web/genericl10n.d.ts +5 -3
- package/dist/types/web/interfaces.d.ts +10 -14
- package/dist/types/web/l10n.d.ts +7 -2
- package/dist/types/web/pdf_find_controller.d.ts +25 -2
- package/dist/types/web/pdf_history.d.ts +1 -53
- package/dist/types/web/pdf_link_service.d.ts +4 -107
- package/dist/types/web/pdf_page_view.d.ts +16 -21
- package/dist/types/web/pdf_scripting_manager.d.ts +6 -10
- package/dist/types/web/pdf_thumbnail_view.d.ts +11 -15
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -17
- package/dist/types/web/pdf_viewer.component.d.ts +1 -2
- package/dist/types/web/pdf_viewer.d.ts +67 -35
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_highlighter.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +17 -29
- package/dist/types/web/ui_utils.d.ts +7 -2
- package/package.json +24 -23
- package/dist/types/web/l10n_utils.d.ts +0 -9
|
@@ -27,7 +27,7 @@ export type PDFPageViewOptions = {
|
|
|
27
27
|
defaultViewport: PageViewport;
|
|
28
28
|
/**
|
|
29
29
|
* -
|
|
30
|
-
* A promise that is resolved with an {@link OptionalContentConfig
|
|
30
|
+
* A promise that is resolved with an {@link OptionalContentConfig} instance.
|
|
31
31
|
* The default value is `null`.
|
|
32
32
|
*/
|
|
33
33
|
optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
|
|
@@ -44,8 +44,8 @@ export type PDFPageViewOptions = {
|
|
|
44
44
|
/**
|
|
45
45
|
* - Controls if the annotation layer is
|
|
46
46
|
* created, and if interactive form elements or `AnnotationStorage`-data are
|
|
47
|
-
* being rendered. The constants from {@link AnnotationMode
|
|
48
|
-
* see also {@link RenderParameters
|
|
47
|
+
* being rendered. The constants from {@link AnnotationMode} should be used;
|
|
48
|
+
* see also {@link RenderParameters} and {@link GetOperatorListParameters}.
|
|
49
49
|
* The default value is `AnnotationMode.ENABLE_FORMS`.
|
|
50
50
|
*/
|
|
51
51
|
annotationMode?: number | undefined;
|
|
@@ -54,15 +54,10 @@ export type PDFPageViewOptions = {
|
|
|
54
54
|
* for annotation icons. Include trailing slash.
|
|
55
55
|
*/
|
|
56
56
|
imageResourcesPath?: string | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* - Allows to use an
|
|
59
|
-
* OffscreenCanvas if needed.
|
|
60
|
-
*/
|
|
61
|
-
isOffscreenCanvasSupported?: boolean | undefined;
|
|
62
57
|
/**
|
|
63
58
|
* - The maximum supported canvas size in
|
|
64
59
|
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
65
|
-
* CSS-only zooming. The default value is 4096 *
|
|
60
|
+
* CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
|
|
66
61
|
*/
|
|
67
62
|
maxCanvasPixels?: number | undefined;
|
|
68
63
|
/**
|
|
@@ -80,6 +75,11 @@ export type PDFPageViewOptions = {
|
|
|
80
75
|
* the necessary layer-properties.
|
|
81
76
|
*/
|
|
82
77
|
layerProperties?: Object | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* - Enables hardware acceleration for
|
|
80
|
+
* rendering. The default value is `false`.
|
|
81
|
+
*/
|
|
82
|
+
enableHWA?: boolean | undefined;
|
|
83
83
|
};
|
|
84
84
|
/**
|
|
85
85
|
* @implements {IRenderableView}
|
|
@@ -99,35 +99,29 @@ export class PDFPageView implements IRenderableView {
|
|
|
99
99
|
pdfPageRotate: number;
|
|
100
100
|
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
|
|
101
101
|
imageResourcesPath: string;
|
|
102
|
-
isOffscreenCanvasSupported: boolean;
|
|
103
102
|
maxCanvasPixels: any;
|
|
104
103
|
pageColors: Object | null;
|
|
105
104
|
eventBus: import("./event_utils").EventBus;
|
|
106
105
|
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
|
|
107
|
-
l10n:
|
|
108
|
-
getLanguage(): any;
|
|
109
|
-
getDirection(): any;
|
|
110
|
-
get(ids: any, args: null | undefined, fallback: any): Promise<any>;
|
|
111
|
-
translate(element: any): Promise<any>;
|
|
112
|
-
pause(): any;
|
|
113
|
-
resume(): any;
|
|
114
|
-
};
|
|
106
|
+
l10n: import("./interfaces").IL10n | GenericL10n | undefined;
|
|
115
107
|
renderTask: any;
|
|
116
108
|
resume: (() => void) | null;
|
|
117
109
|
_isStandalone: boolean | undefined;
|
|
118
110
|
_container: HTMLDivElement | undefined;
|
|
119
111
|
_annotationCanvasMap: any;
|
|
120
112
|
annotationLayer: AnnotationLayerBuilder | null;
|
|
121
|
-
annotationEditorLayer:
|
|
113
|
+
annotationEditorLayer: any;
|
|
122
114
|
textLayer: TextLayerBuilder | null;
|
|
123
115
|
zoomLayer: ParentNode | null;
|
|
124
116
|
xfaLayer: XfaLayerBuilder | null;
|
|
125
117
|
structTreeLayer: any;
|
|
118
|
+
drawLayer: any;
|
|
126
119
|
div: HTMLDivElement;
|
|
127
120
|
set renderingState(state: number);
|
|
128
121
|
get renderingState(): number;
|
|
129
122
|
setPdfPage(pdfPage: any): void;
|
|
130
123
|
destroy(): void;
|
|
124
|
+
hasEditableAnnotations(): boolean;
|
|
131
125
|
get _textHighlighter(): any;
|
|
132
126
|
/**
|
|
133
127
|
* @private
|
|
@@ -140,6 +134,7 @@ export class PDFPageView implements IRenderableView {
|
|
|
140
134
|
keepXfaLayer?: boolean | undefined;
|
|
141
135
|
keepTextLayer?: boolean | undefined;
|
|
142
136
|
}): void;
|
|
137
|
+
toggleEditingMode(isEditing: any): void;
|
|
143
138
|
/**
|
|
144
139
|
* @typedef {Object} PDFPageViewUpdateParameters
|
|
145
140
|
* @property {number} [scale] The new scale, if specified.
|
|
@@ -163,7 +158,7 @@ export class PDFPageView implements IRenderableView {
|
|
|
163
158
|
*/
|
|
164
159
|
rotation?: number | undefined;
|
|
165
160
|
/**
|
|
166
|
-
* A promise that is resolved with an {@link OptionalContentConfig
|
|
161
|
+
* A promise that is resolved with an {@link OptionalContentConfig}instance. The default value is `null`.
|
|
167
162
|
*/
|
|
168
163
|
optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
|
|
169
164
|
drawingDelay?: number | undefined;
|
|
@@ -204,8 +199,8 @@ export class PDFPageView implements IRenderableView {
|
|
|
204
199
|
get thumbnailCanvas(): HTMLCanvasElement | null | undefined;
|
|
205
200
|
#private;
|
|
206
201
|
}
|
|
202
|
+
import { GenericL10n } from "./genericl10n";
|
|
207
203
|
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
|
|
208
|
-
import { AnnotationEditorLayerBuilder } from "./annotation_editor_layer_builder.js";
|
|
209
204
|
import { TextLayerBuilder } from "./text_layer_builder.js";
|
|
210
205
|
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
|
|
211
206
|
import { OutputScale } from "./ui_utils.js";
|
|
@@ -5,10 +5,10 @@ export type PDFScriptingManagerOptions = {
|
|
|
5
5
|
*/
|
|
6
6
|
eventBus: EventBus;
|
|
7
7
|
/**
|
|
8
|
-
* - The path and filename of the
|
|
9
|
-
* bundle.
|
|
8
|
+
* - The path and filename of the
|
|
9
|
+
* scripting bundle.
|
|
10
10
|
*/
|
|
11
|
-
sandboxBundleSrc
|
|
11
|
+
sandboxBundleSrc?: string | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* - The factory that is used when
|
|
14
14
|
* initializing scripting; must contain a `createScripting` method.
|
|
@@ -24,8 +24,8 @@ export type PDFScriptingManagerOptions = {
|
|
|
24
24
|
/**
|
|
25
25
|
* @typedef {Object} PDFScriptingManagerOptions
|
|
26
26
|
* @property {EventBus} eventBus - The application event bus.
|
|
27
|
-
* @property {string} sandboxBundleSrc - The path and filename of the
|
|
28
|
-
* bundle.
|
|
27
|
+
* @property {string} [sandboxBundleSrc] - The path and filename of the
|
|
28
|
+
* scripting bundle.
|
|
29
29
|
* @property {Object} [externalServices] - The factory that is used when
|
|
30
30
|
* initializing scripting; must contain a `createScripting` method.
|
|
31
31
|
* PLEASE NOTE: Primarily intended for the default viewer use-case.
|
|
@@ -36,7 +36,7 @@ export class PDFScriptingManager {
|
|
|
36
36
|
/**
|
|
37
37
|
* @param {PDFScriptingManagerOptions} options
|
|
38
38
|
*/
|
|
39
|
-
constructor({ eventBus,
|
|
39
|
+
constructor({ eventBus, externalServices, docProperties }: PDFScriptingManagerOptions);
|
|
40
40
|
setViewer(pdfViewer: any): void;
|
|
41
41
|
setDocument(pdfDocument: any): Promise<void>;
|
|
42
42
|
dispatchWillSave(): Promise<any>;
|
|
@@ -45,10 +45,6 @@ export class PDFScriptingManager {
|
|
|
45
45
|
dispatchDidPrint(): Promise<any>;
|
|
46
46
|
get destroyPromise(): any;
|
|
47
47
|
get ready(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
private get _internalEvents();
|
|
52
48
|
/**
|
|
53
49
|
* @private
|
|
54
50
|
*/
|
|
@@ -23,7 +23,7 @@ export type PDFThumbnailViewOptions = {
|
|
|
23
23
|
defaultViewport: PageViewport;
|
|
24
24
|
/**
|
|
25
25
|
* -
|
|
26
|
-
* A promise that is resolved with an {@link OptionalContentConfig
|
|
26
|
+
* A promise that is resolved with an {@link OptionalContentConfig} instance.
|
|
27
27
|
* The default value is `null`.
|
|
28
28
|
*/
|
|
29
29
|
optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
|
|
@@ -41,6 +41,11 @@ export type PDFThumbnailViewOptions = {
|
|
|
41
41
|
* mode.
|
|
42
42
|
*/
|
|
43
43
|
pageColors?: Object | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* - Enables hardware acceleration for
|
|
46
|
+
* rendering. The default value is `false`.
|
|
47
|
+
*/
|
|
48
|
+
enableHWA?: boolean | undefined;
|
|
44
49
|
};
|
|
45
50
|
/**
|
|
46
51
|
* @implements {IRenderableView}
|
|
@@ -49,7 +54,7 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
49
54
|
/**
|
|
50
55
|
* @param {PDFThumbnailViewOptions} options
|
|
51
56
|
*/
|
|
52
|
-
constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, }: PDFThumbnailViewOptions);
|
|
57
|
+
constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, enableHWA, }: PDFThumbnailViewOptions);
|
|
53
58
|
id: number;
|
|
54
59
|
renderingId: string;
|
|
55
60
|
pageLabel: string | null;
|
|
@@ -59,6 +64,7 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
59
64
|
pdfPageRotate: number;
|
|
60
65
|
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
|
|
61
66
|
pageColors: Object | null;
|
|
67
|
+
enableHWA: boolean;
|
|
62
68
|
eventBus: import("./event_utils").EventBus;
|
|
63
69
|
linkService: import("./interfaces").IPDFLinkService;
|
|
64
70
|
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
@@ -81,21 +87,9 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
81
87
|
* rather than calling this one directly.
|
|
82
88
|
*/
|
|
83
89
|
cancelRendering(): void;
|
|
84
|
-
/**
|
|
85
|
-
* @private
|
|
86
|
-
*/
|
|
87
|
-
private _getPageDrawContext;
|
|
88
|
-
/**
|
|
89
|
-
* @private
|
|
90
|
-
*/
|
|
91
|
-
private _convertCanvasToImage;
|
|
92
90
|
image: HTMLImageElement | undefined;
|
|
93
91
|
draw(): Promise<any>;
|
|
94
92
|
setImage(pageView: any): void;
|
|
95
|
-
/**
|
|
96
|
-
* @private
|
|
97
|
-
*/
|
|
98
|
-
private _reduceImage;
|
|
99
93
|
/**
|
|
100
94
|
* @param {string|null} label
|
|
101
95
|
*/
|
|
@@ -116,9 +110,11 @@ export class PDFThumbnailView implements IRenderableView {
|
|
|
116
110
|
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
117
111
|
* with user defined ones in order to improve readability in high contrast
|
|
118
112
|
* mode.
|
|
113
|
+
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
114
|
+
* rendering. The default value is `false`.
|
|
119
115
|
*/
|
|
120
116
|
export class TempImageFactory {
|
|
121
|
-
static "__#
|
|
117
|
+
static "__#72@#tempCanvas": null;
|
|
122
118
|
static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
|
|
123
119
|
static destroyCanvas(): void;
|
|
124
120
|
}
|
|
@@ -27,6 +27,16 @@ export type PDFThumbnailViewerOptions = {
|
|
|
27
27
|
* mode.
|
|
28
28
|
*/
|
|
29
29
|
pageColors?: Object | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* - The AbortSignal for the window
|
|
32
|
+
* events.
|
|
33
|
+
*/
|
|
34
|
+
abortSignal?: AbortSignal | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* - Enables hardware acceleration for
|
|
37
|
+
* rendering. The default value is `false`.
|
|
38
|
+
*/
|
|
39
|
+
enableHWA?: boolean | undefined;
|
|
30
40
|
};
|
|
31
41
|
/**
|
|
32
42
|
* @typedef {Object} PDFThumbnailViewerOptions
|
|
@@ -38,6 +48,10 @@ export type PDFThumbnailViewerOptions = {
|
|
|
38
48
|
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
39
49
|
* with user defined ones in order to improve readability in high contrast
|
|
40
50
|
* mode.
|
|
51
|
+
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
|
|
52
|
+
* events.
|
|
53
|
+
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
54
|
+
* rendering. The default value is `false`.
|
|
41
55
|
*/
|
|
42
56
|
/**
|
|
43
57
|
* Viewer control to display thumbnails for pages in a PDF document.
|
|
@@ -46,12 +60,13 @@ export class PDFThumbnailViewer {
|
|
|
46
60
|
/**
|
|
47
61
|
* @param {PDFThumbnailViewerOptions} options
|
|
48
62
|
*/
|
|
49
|
-
constructor({ container, eventBus, linkService, renderingQueue, pageColors, }: PDFThumbnailViewerOptions);
|
|
63
|
+
constructor({ container, eventBus, linkService, renderingQueue, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions);
|
|
50
64
|
container: HTMLDivElement;
|
|
51
65
|
eventBus: import("./event_utils").EventBus;
|
|
52
66
|
linkService: import("./interfaces").IPDFLinkService;
|
|
53
67
|
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
54
68
|
pageColors: Object | null;
|
|
69
|
+
enableHWA: boolean;
|
|
55
70
|
scroll: {
|
|
56
71
|
right: boolean;
|
|
57
72
|
down: boolean;
|
|
@@ -59,25 +74,13 @@ export class PDFThumbnailViewer {
|
|
|
59
74
|
lastY: any;
|
|
60
75
|
_eventHandler: (evt: any) => void;
|
|
61
76
|
};
|
|
62
|
-
/**
|
|
63
|
-
* @private
|
|
64
|
-
*/
|
|
65
|
-
private _scrollUpdated;
|
|
66
77
|
getThumbnail(index: any): any;
|
|
67
|
-
/**
|
|
68
|
-
* @private
|
|
69
|
-
*/
|
|
70
|
-
private _getVisibleThumbs;
|
|
71
78
|
scrollThumbnailIntoView(pageNumber: any): void;
|
|
72
79
|
_currentPageNumber: any;
|
|
73
80
|
set pagesRotation(rotation: any);
|
|
74
81
|
get pagesRotation(): any;
|
|
75
82
|
_pagesRotation: any;
|
|
76
83
|
cleanup(): void;
|
|
77
|
-
/**
|
|
78
|
-
* @private
|
|
79
|
-
*/
|
|
80
|
-
private _resetView;
|
|
81
84
|
_thumbnails: any[] | undefined;
|
|
82
85
|
_pageLabels: any[] | null | undefined;
|
|
83
86
|
/**
|
|
@@ -85,10 +88,6 @@ export class PDFThumbnailViewer {
|
|
|
85
88
|
*/
|
|
86
89
|
setDocument(pdfDocument: PDFDocumentProxy): void;
|
|
87
90
|
pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* @private
|
|
90
|
-
*/
|
|
91
|
-
private _cancelRendering;
|
|
92
91
|
/**
|
|
93
92
|
* @param {Array|null} labels
|
|
94
93
|
*/
|
|
@@ -4,7 +4,6 @@ import { EventBus } from "./event_utils.js";
|
|
|
4
4
|
import { FindState } from "./pdf_find_controller.js";
|
|
5
5
|
import { GenericL10n } from "./genericl10n.js";
|
|
6
6
|
import { LinkTarget } from "./pdf_link_service.js";
|
|
7
|
-
import { NullL10n } from "./l10n_utils.js";
|
|
8
7
|
import { parseQueryString } from "./ui_utils.js";
|
|
9
8
|
import { PDFFindController } from "./pdf_find_controller.js";
|
|
10
9
|
import { PDFHistory } from "./pdf_history.js";
|
|
@@ -21,4 +20,4 @@ import { SpreadMode } from "./ui_utils.js";
|
|
|
21
20
|
import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js";
|
|
22
21
|
import { TextLayerBuilder } from "./text_layer_builder.js";
|
|
23
22
|
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
|
|
24
|
-
export { AnnotationLayerBuilder, DownloadManager, EventBus, FindState, GenericL10n, LinkTarget,
|
|
23
|
+
export { AnnotationLayerBuilder, DownloadManager, EventBus, FindState, GenericL10n, LinkTarget, parseQueryString, PDFFindController, PDFHistory, PDFLinkService, PDFPageView, PDFScriptingManager, PDFSinglePageViewer, PDFViewer, ProgressBar, RenderingStates, ScrollMode, SimpleLinkService, SpreadMode, StructTreeLayerBuilder, TextLayerBuilder, XfaLayerBuilder };
|
|
@@ -58,17 +58,22 @@ export type PDFViewerOptions = {
|
|
|
58
58
|
/**
|
|
59
59
|
* - Controls if the annotation layer is
|
|
60
60
|
* created, and if interactive form elements or `AnnotationStorage`-data are
|
|
61
|
-
* being rendered. The constants from {@link AnnotationMode
|
|
62
|
-
* see also {@link RenderParameters
|
|
61
|
+
* being rendered. The constants from {@link AnnotationMode} should be used;
|
|
62
|
+
* see also {@link RenderParameters} and {@link GetOperatorListParameters}.
|
|
63
63
|
* The default value is `AnnotationMode.ENABLE_FORMS`.
|
|
64
64
|
*/
|
|
65
65
|
annotationMode?: number | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* - Enables the creation and editing
|
|
68
|
-
* of new Annotations. The constants from {@link AnnotationEditorType
|
|
68
|
+
* of new Annotations. The constants from {@link AnnotationEditorType} should
|
|
69
69
|
* be used. The default value is `AnnotationEditorType.NONE`.
|
|
70
70
|
*/
|
|
71
71
|
annotationEditorMode?: number | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* - A comma separated list
|
|
74
|
+
* of colors to propose to highlight some text in the pdf.
|
|
75
|
+
*/
|
|
76
|
+
annotationEditorHighlightColors?: string | undefined;
|
|
72
77
|
/**
|
|
73
78
|
* - Path for image resources, mainly
|
|
74
79
|
* mainly for annotation icons. Include trailing slash.
|
|
@@ -79,15 +84,10 @@ export type PDFViewerOptions = {
|
|
|
79
84
|
* landscape pages upon printing. The default is `false`.
|
|
80
85
|
*/
|
|
81
86
|
enablePrintAutoRotate?: boolean | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* - Allows to use an
|
|
84
|
-
* OffscreenCanvas if needed.
|
|
85
|
-
*/
|
|
86
|
-
isOffscreenCanvasSupported?: boolean | undefined;
|
|
87
87
|
/**
|
|
88
88
|
* - The maximum supported canvas size in
|
|
89
89
|
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
90
|
-
* CSS-only zooming. The default value is 4096 *
|
|
90
|
+
* CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
|
|
91
91
|
*/
|
|
92
92
|
maxCanvasPixels?: number | undefined;
|
|
93
93
|
/**
|
|
@@ -105,6 +105,11 @@ export type PDFViewerOptions = {
|
|
|
105
105
|
* mode.
|
|
106
106
|
*/
|
|
107
107
|
pageColors?: Object | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* - Enables hardware acceleration for
|
|
110
|
+
* rendering. The default value is `false`.
|
|
111
|
+
*/
|
|
112
|
+
enableHWA?: boolean | undefined;
|
|
108
113
|
};
|
|
109
114
|
export namespace PagesCountLimit {
|
|
110
115
|
let FORCE_SCROLL_MODE_PAGE: number;
|
|
@@ -137,21 +142,23 @@ export namespace PagesCountLimit {
|
|
|
137
142
|
* @property {number} [annotationEditorMode] - Enables the creation and editing
|
|
138
143
|
* of new Annotations. The constants from {@link AnnotationEditorType} should
|
|
139
144
|
* be used. The default value is `AnnotationEditorType.NONE`.
|
|
145
|
+
* @property {string} [annotationEditorHighlightColors] - A comma separated list
|
|
146
|
+
* of colors to propose to highlight some text in the pdf.
|
|
140
147
|
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
|
141
148
|
* mainly for annotation icons. Include trailing slash.
|
|
142
149
|
* @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of
|
|
143
150
|
* landscape pages upon printing. The default is `false`.
|
|
144
|
-
* @property {boolean} [isOffscreenCanvasSupported] - Allows to use an
|
|
145
|
-
* OffscreenCanvas if needed.
|
|
146
151
|
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
|
|
147
152
|
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
148
|
-
* CSS-only zooming. The default value is 4096 *
|
|
153
|
+
* CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
|
|
149
154
|
* @property {IL10n} [l10n] - Localization service.
|
|
150
155
|
* @property {boolean} [enablePermissions] - Enables PDF document permissions,
|
|
151
156
|
* when they exist. The default value is `false`.
|
|
152
157
|
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
153
158
|
* with user defined ones in order to improve readability in high contrast
|
|
154
159
|
* mode.
|
|
160
|
+
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
161
|
+
* rendering. The default value is `false`.
|
|
155
162
|
*/
|
|
156
163
|
export class PDFPageViewBuffer {
|
|
157
164
|
constructor(size: any);
|
|
@@ -186,16 +193,8 @@ export class PDFViewer {
|
|
|
186
193
|
imageResourcesPath: string;
|
|
187
194
|
enablePrintAutoRotate: boolean;
|
|
188
195
|
removePageBorders: boolean | undefined;
|
|
189
|
-
isOffscreenCanvasSupported: boolean;
|
|
190
196
|
maxCanvasPixels: number | undefined;
|
|
191
|
-
l10n:
|
|
192
|
-
getLanguage(): any;
|
|
193
|
-
getDirection(): any;
|
|
194
|
-
get(ids: any, args: null | undefined, fallback: any): Promise<any>;
|
|
195
|
-
translate(element: any): Promise<any>;
|
|
196
|
-
pause(): any;
|
|
197
|
-
resume(): any;
|
|
198
|
-
};
|
|
197
|
+
l10n: import("./interfaces").IL10n | GenericL10n | undefined;
|
|
199
198
|
pageColors: Object | null;
|
|
200
199
|
defaultRenderingQueue: boolean;
|
|
201
200
|
renderingQueue: PDFRenderingQueue | undefined;
|
|
@@ -207,8 +206,6 @@ export class PDFViewer {
|
|
|
207
206
|
_eventHandler: (evt: any) => void;
|
|
208
207
|
};
|
|
209
208
|
presentationModeState: number;
|
|
210
|
-
_onBeforeDraw: ((evt: any) => void) | null;
|
|
211
|
-
_onAfterDraw: any;
|
|
212
209
|
get pagesCount(): number;
|
|
213
210
|
getPageView(index: any): any;
|
|
214
211
|
getCachedPageViews(): Set<any>;
|
|
@@ -241,7 +238,7 @@ export class PDFViewer {
|
|
|
241
238
|
/**
|
|
242
239
|
* @param {string} val - The page label.
|
|
243
240
|
*/
|
|
244
|
-
set currentPageLabel(val: string
|
|
241
|
+
set currentPageLabel(val: string);
|
|
245
242
|
/**
|
|
246
243
|
* @type {string|null} Returns the current page label, or `null` if no page
|
|
247
244
|
* labels exist.
|
|
@@ -272,9 +269,9 @@ export class PDFViewer {
|
|
|
272
269
|
*/
|
|
273
270
|
get pagesRotation(): number;
|
|
274
271
|
_pagesRotation: any;
|
|
275
|
-
get firstPagePromise():
|
|
276
|
-
get onePageRendered():
|
|
277
|
-
get pagesPromise():
|
|
272
|
+
get firstPagePromise(): any;
|
|
273
|
+
get onePageRendered(): any;
|
|
274
|
+
get pagesPromise(): any;
|
|
278
275
|
get _layerProperties(): any;
|
|
279
276
|
getAllText(): Promise<string | null>;
|
|
280
277
|
/**
|
|
@@ -301,9 +298,9 @@ export class PDFViewer {
|
|
|
301
298
|
rotation: any;
|
|
302
299
|
pdfOpenParams: string;
|
|
303
300
|
} | null | undefined;
|
|
304
|
-
_firstPageCapability:
|
|
305
|
-
_onePageRenderedCapability:
|
|
306
|
-
_pagesCapability:
|
|
301
|
+
_firstPageCapability: any;
|
|
302
|
+
_onePageRenderedCapability: any;
|
|
303
|
+
_pagesCapability: any;
|
|
307
304
|
_previousScrollMode: any;
|
|
308
305
|
_spreadMode: any;
|
|
309
306
|
_scrollUpdate(): void;
|
|
@@ -378,7 +375,7 @@ export class PDFViewer {
|
|
|
378
375
|
* @param {Promise<OptionalContentConfig>} promise - A promise that is
|
|
379
376
|
* resolved with an {@link OptionalContentConfig} instance.
|
|
380
377
|
*/
|
|
381
|
-
set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig
|
|
378
|
+
set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig>);
|
|
382
379
|
/**
|
|
383
380
|
* @type {Promise<OptionalContentConfig | null>}
|
|
384
381
|
*/
|
|
@@ -424,24 +421,50 @@ export class PDFViewer {
|
|
|
424
421
|
* @property {number} [drawingDelay]
|
|
425
422
|
* @property {number} [scaleFactor]
|
|
426
423
|
* @property {number} [steps]
|
|
424
|
+
* @property {Array} [origin] x and y coordinates of the scale
|
|
425
|
+
* transformation origin.
|
|
427
426
|
*/
|
|
427
|
+
/**
|
|
428
|
+
* Changes the current zoom level by the specified amount.
|
|
429
|
+
* @param {ChangeScaleOptions} [options]
|
|
430
|
+
*/
|
|
431
|
+
updateScale({ drawingDelay, scaleFactor, steps, origin }?: {
|
|
432
|
+
drawingDelay?: number | undefined;
|
|
433
|
+
scaleFactor?: number | undefined;
|
|
434
|
+
steps?: number | undefined;
|
|
435
|
+
/**
|
|
436
|
+
* x and y coordinates of the scale
|
|
437
|
+
* transformation origin.
|
|
438
|
+
*/
|
|
439
|
+
origin?: any[] | undefined;
|
|
440
|
+
} | undefined): void;
|
|
428
441
|
/**
|
|
429
442
|
* Increase the current zoom level one, or more, times.
|
|
430
443
|
* @param {ChangeScaleOptions} [options]
|
|
431
444
|
*/
|
|
432
|
-
increaseScale(
|
|
445
|
+
increaseScale(options?: {
|
|
433
446
|
drawingDelay?: number | undefined;
|
|
434
447
|
scaleFactor?: number | undefined;
|
|
435
448
|
steps?: number | undefined;
|
|
449
|
+
/**
|
|
450
|
+
* x and y coordinates of the scale
|
|
451
|
+
* transformation origin.
|
|
452
|
+
*/
|
|
453
|
+
origin?: any[] | undefined;
|
|
436
454
|
} | undefined): void;
|
|
437
455
|
/**
|
|
438
456
|
* Decrease the current zoom level one, or more, times.
|
|
439
457
|
* @param {ChangeScaleOptions} [options]
|
|
440
458
|
*/
|
|
441
|
-
decreaseScale(
|
|
459
|
+
decreaseScale(options?: {
|
|
442
460
|
drawingDelay?: number | undefined;
|
|
443
461
|
scaleFactor?: number | undefined;
|
|
444
462
|
steps?: number | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* x and y coordinates of the scale
|
|
465
|
+
* transformation origin.
|
|
466
|
+
*/
|
|
467
|
+
origin?: any[] | undefined;
|
|
445
468
|
} | undefined): void;
|
|
446
469
|
get containerTopLeft(): number[];
|
|
447
470
|
/**
|
|
@@ -470,24 +493,33 @@ export class PDFViewer {
|
|
|
470
493
|
isFromKeyboard?: boolean | undefined;
|
|
471
494
|
});
|
|
472
495
|
get annotationEditorMode(): {
|
|
496
|
+
/**
|
|
497
|
+
* - The editor mode (none, FreeText, ink, ...).
|
|
498
|
+
*/
|
|
473
499
|
/**
|
|
474
500
|
* - The editor mode (none, FreeText, ink, ...).
|
|
475
501
|
*/
|
|
476
502
|
mode: number;
|
|
503
|
+
/**
|
|
504
|
+
* - ID of the existing annotation to edit.
|
|
505
|
+
*/
|
|
477
506
|
/**
|
|
478
507
|
* - ID of the existing annotation to edit.
|
|
479
508
|
*/
|
|
480
509
|
editId?: string | null | undefined;
|
|
510
|
+
/**
|
|
511
|
+
* - True if the mode change is due to a
|
|
512
|
+
* keyboard action.
|
|
513
|
+
*/
|
|
481
514
|
/**
|
|
482
515
|
* - True if the mode change is due to a
|
|
483
516
|
* keyboard action.
|
|
484
517
|
*/
|
|
485
518
|
isFromKeyboard?: boolean | undefined;
|
|
486
519
|
};
|
|
487
|
-
set annotationEditorParams({ type, value }: any);
|
|
488
520
|
refresh(noUpdate?: boolean, updateArgs?: any): void;
|
|
489
521
|
#private;
|
|
490
522
|
}
|
|
491
523
|
import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
|
|
492
524
|
import { SimpleLinkService } from "./pdf_link_service.js";
|
|
493
|
-
import {
|
|
525
|
+
import { GenericL10n } from "./genericl10n";
|
|
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
|
|
|
14
14
|
* @param {HTMLElement} e2
|
|
15
15
|
* @returns {number}
|
|
16
16
|
*/
|
|
17
|
-
static "__#
|
|
17
|
+
static "__#7@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
|
|
18
18
|
setTextMapping(textDivs: any): void;
|
|
19
19
|
/**
|
|
20
20
|
* Function called when the text layer has finished rendering.
|
|
@@ -32,7 +32,6 @@ export class TextHighlighter {
|
|
|
32
32
|
matches: any[];
|
|
33
33
|
eventBus: import("./event_utils").EventBus;
|
|
34
34
|
pageIdx: number;
|
|
35
|
-
_onUpdateTextLayerMatches: ((evt: any) => void) | null;
|
|
36
35
|
textDivs: Node[] | null;
|
|
37
36
|
textContentItemsStr: string[] | null;
|
|
38
37
|
enabled: boolean;
|
|
@@ -60,4 +59,5 @@ export class TextHighlighter {
|
|
|
60
59
|
}[];
|
|
61
60
|
_renderMatches(matches: any): void;
|
|
62
61
|
_updateMatches(reset?: boolean): void;
|
|
62
|
+
#private;
|
|
63
63
|
}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
+
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
|
1
2
|
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
|
2
|
-
export type TextContent = import("../src/display/api").TextContent;
|
|
3
3
|
export type TextHighlighter = import("./text_highlighter").TextHighlighter;
|
|
4
4
|
export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
|
|
5
5
|
export type TextLayerBuilderOptions = {
|
|
6
|
+
pdfPage: PDFPageProxy;
|
|
6
7
|
/**
|
|
7
8
|
* - Optional object that will handle
|
|
8
9
|
* highlighting text from the find controller.
|
|
9
10
|
*/
|
|
10
|
-
highlighter
|
|
11
|
+
highlighter?: import("./text_highlighter").TextHighlighter | undefined;
|
|
11
12
|
accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
|
12
|
-
|
|
13
|
-
* - Allows to use an
|
|
14
|
-
* OffscreenCanvas if needed.
|
|
15
|
-
*/
|
|
16
|
-
isOffscreenCanvasSupported?: boolean | undefined;
|
|
13
|
+
onAppend?: Function | undefined;
|
|
17
14
|
};
|
|
18
15
|
/**
|
|
19
16
|
* @typedef {Object} TextLayerBuilderOptions
|
|
20
|
-
* @property {
|
|
17
|
+
* @property {PDFPageProxy} pdfPage
|
|
18
|
+
* @property {TextHighlighter} [highlighter] - Optional object that will handle
|
|
21
19
|
* highlighting text from the find controller.
|
|
22
20
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
23
|
-
* @property {
|
|
24
|
-
* OffscreenCanvas if needed.
|
|
21
|
+
* @property {function} [onAppend]
|
|
25
22
|
*/
|
|
26
23
|
/**
|
|
27
24
|
* The text layer builder provides text selection functionality for the PDF.
|
|
@@ -29,41 +26,32 @@ export type TextLayerBuilderOptions = {
|
|
|
29
26
|
* contain text that matches the PDF text they are overlaying.
|
|
30
27
|
*/
|
|
31
28
|
export class TextLayerBuilder {
|
|
32
|
-
|
|
29
|
+
static "__#68@#textLayers": Map<any, any>;
|
|
30
|
+
static "__#68@#selectionChangeAbortController": null;
|
|
31
|
+
static "__#68@#removeGlobalSelectionListener"(textLayerDiv: any): void;
|
|
32
|
+
static "__#68@#enableGlobalSelectionListener"(): void;
|
|
33
|
+
constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: {
|
|
34
|
+
pdfPage: any;
|
|
33
35
|
highlighter?: null | undefined;
|
|
34
36
|
accessibilityManager?: null | undefined;
|
|
35
|
-
isOffscreenCanvasSupported?: boolean | undefined;
|
|
36
37
|
enablePermissions?: boolean | undefined;
|
|
38
|
+
onAppend?: null | undefined;
|
|
37
39
|
});
|
|
38
|
-
|
|
39
|
-
renderingDone: boolean;
|
|
40
|
-
textDivs: any[];
|
|
41
|
-
textDivProperties: WeakMap<WeakKey, any>;
|
|
42
|
-
textLayerRenderTask: import("../src/display/text_layer.js").TextLayerRenderTask | null;
|
|
40
|
+
pdfPage: any;
|
|
43
41
|
highlighter: any;
|
|
44
42
|
accessibilityManager: any;
|
|
45
|
-
isOffscreenCanvasSupported: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Callback used to attach the textLayer to the DOM.
|
|
48
|
-
* @type {function}
|
|
49
|
-
*/
|
|
50
|
-
onAppend: Function;
|
|
51
43
|
div: HTMLDivElement;
|
|
52
|
-
get numTextDivs(): number;
|
|
53
44
|
/**
|
|
54
45
|
* Renders the text layer.
|
|
55
46
|
* @param {PageViewport} viewport
|
|
47
|
+
* @param {Object} [textContentParams]
|
|
56
48
|
*/
|
|
57
|
-
render(viewport: PageViewport): Promise<void>;
|
|
49
|
+
render(viewport: PageViewport, textContentParams?: Object | undefined): Promise<void>;
|
|
58
50
|
hide(): void;
|
|
59
51
|
show(): void;
|
|
60
52
|
/**
|
|
61
53
|
* Cancel rendering of the text layer.
|
|
62
54
|
*/
|
|
63
55
|
cancel(): void;
|
|
64
|
-
/**
|
|
65
|
-
* @param {ReadableStream | TextContent} source
|
|
66
|
-
*/
|
|
67
|
-
setTextContentSource(source: ReadableStream | TextContent): void;
|
|
68
56
|
#private;
|
|
69
57
|
}
|