pdfjs-serverless 0.1.0 → 0.2.1
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 +11 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +236 -200
- package/dist/types/external/webL10n/l10n.d.ts +0 -0
- package/dist/types/src/display/annotation_layer.d.ts +203 -0
- package/dist/types/src/display/annotation_storage.d.ts +89 -0
- package/dist/types/src/display/api.d.ts +1472 -0
- package/dist/types/src/display/base_factory.d.ts +54 -0
- package/dist/types/src/display/canvas.d.ts +208 -0
- package/dist/types/src/display/display_utils.d.ts +277 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +182 -0
- package/dist/types/src/display/editor/editor.d.ts +308 -0
- package/dist/types/src/display/editor/freetext.d.ts +72 -0
- package/dist/types/src/display/editor/ink.d.ts +95 -0
- package/dist/types/src/display/editor/stamp.d.ts +22 -0
- package/dist/types/src/display/editor/tools.d.ts +324 -0
- package/dist/types/src/display/font_loader.d.ts +43 -0
- package/dist/types/src/display/metadata.d.ts +11 -0
- package/dist/types/src/display/optional_content_config.d.ts +13 -0
- package/dist/types/src/display/pattern_helper.d.ts +73 -0
- package/dist/types/src/display/text_layer.d.ts +151 -0
- package/dist/types/src/display/transport_stream.d.ts +68 -0
- package/dist/types/src/display/worker_options.d.ts +27 -0
- package/dist/types/src/display/xfa_layer.d.ts +46 -0
- package/dist/types/src/display/xfa_text.d.ts +19 -0
- package/dist/types/src/pdf.d.ts +50 -0
- package/dist/types/src/shared/image_utils.d.ts +17 -0
- package/dist/types/src/shared/message_handler.d.ts +43 -0
- package/dist/types/src/shared/murmurhash3.d.ts +7 -0
- package/dist/types/src/shared/scripting_utils.d.ts +12 -0
- package/dist/types/src/shared/util.d.ts +396 -0
- package/dist/types/web/annotation_editor_layer_builder.d.ts +50 -0
- package/dist/types/web/annotation_layer_builder.d.ts +83 -0
- package/dist/types/web/app_options.d.ts +14 -0
- package/dist/types/web/download_manager.d.ts +14 -0
- package/dist/types/web/event_utils.d.ts +75 -0
- package/dist/types/web/generic_scripting.d.ts +8 -0
- package/dist/types/web/genericl10n.d.ts +13 -0
- package/dist/types/web/interfaces.d.ts +163 -0
- package/dist/types/web/l10n_utils.d.ts +7 -0
- package/dist/types/web/pdf_find_controller.d.ts +108 -0
- package/dist/types/web/pdf_find_utils.d.ts +16 -0
- package/dist/types/web/pdf_history.d.ts +168 -0
- package/dist/types/web/pdf_link_service.d.ts +243 -0
- package/dist/types/web/pdf_page_view.d.ts +209 -0
- package/dist/types/web/pdf_rendering_queue.d.ts +53 -0
- package/dist/types/web/pdf_scripting_manager.component.d.ts +5 -0
- package/dist/types/web/pdf_scripting_manager.d.ts +61 -0
- package/dist/types/web/pdf_single_page_viewer.d.ts +7 -0
- package/dist/types/web/pdf_thumbnail_view.d.ts +131 -0
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +104 -0
- package/dist/types/web/pdf_viewer.component.d.ts +24 -0
- package/dist/types/web/pdf_viewer.d.ts +455 -0
- package/dist/types/web/struct_tree_layer_builder.d.ts +7 -0
- package/dist/types/web/text_accessibility.d.ts +42 -0
- package/dist/types/web/text_highlighter.d.ts +63 -0
- package/dist/types/web/text_layer_builder.d.ts +64 -0
- package/dist/types/web/ui_utils.d.ts +288 -0
- package/dist/types/web/xfa_layer_builder.d.ts +41 -0
- package/package.json +9 -7
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
export type ExternalLinkParameters = {
|
|
2
|
+
/**
|
|
3
|
+
* - An absolute URL.
|
|
4
|
+
*/
|
|
5
|
+
url: string;
|
|
6
|
+
/**
|
|
7
|
+
* - The link target. The default value is
|
|
8
|
+
* `LinkTarget.NONE`.
|
|
9
|
+
*/
|
|
10
|
+
target?: {
|
|
11
|
+
NONE: number;
|
|
12
|
+
SELF: number;
|
|
13
|
+
BLANK: number;
|
|
14
|
+
PARENT: number;
|
|
15
|
+
TOP: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* - The link relationship. The default value is
|
|
19
|
+
* `DEFAULT_LINK_REL`.
|
|
20
|
+
*/
|
|
21
|
+
rel?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* - Whether the link should be enabled. The
|
|
24
|
+
* default value is true.
|
|
25
|
+
*/
|
|
26
|
+
enabled?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
export type EventBus = import("./event_utils").EventBus;
|
|
29
|
+
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
30
|
+
export type PDFLinkServiceOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* - The application event bus.
|
|
33
|
+
*/
|
|
34
|
+
eventBus: EventBus;
|
|
35
|
+
/**
|
|
36
|
+
* - Specifies the `target` attribute
|
|
37
|
+
* for external links. Must use one of the values from {LinkTarget}.
|
|
38
|
+
* Defaults to using no target.
|
|
39
|
+
*/
|
|
40
|
+
externalLinkTarget?: number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* - Specifies the `rel` attribute for
|
|
43
|
+
* external links. Defaults to stripping the referrer.
|
|
44
|
+
*/
|
|
45
|
+
externalLinkRel?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* - Ignores the zoom argument,
|
|
48
|
+
* thus preserving the current zoom level in the viewer, when navigating
|
|
49
|
+
* to internal destinations. The default value is `false`.
|
|
50
|
+
*/
|
|
51
|
+
ignoreDestinationZoom?: boolean | undefined;
|
|
52
|
+
};
|
|
53
|
+
export namespace LinkTarget {
|
|
54
|
+
let NONE: number;
|
|
55
|
+
let SELF: number;
|
|
56
|
+
let BLANK: number;
|
|
57
|
+
let PARENT: number;
|
|
58
|
+
let TOP: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} PDFLinkServiceOptions
|
|
62
|
+
* @property {EventBus} eventBus - The application event bus.
|
|
63
|
+
* @property {number} [externalLinkTarget] - Specifies the `target` attribute
|
|
64
|
+
* for external links. Must use one of the values from {LinkTarget}.
|
|
65
|
+
* Defaults to using no target.
|
|
66
|
+
* @property {string} [externalLinkRel] - Specifies the `rel` attribute for
|
|
67
|
+
* external links. Defaults to stripping the referrer.
|
|
68
|
+
* @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,
|
|
69
|
+
* thus preserving the current zoom level in the viewer, when navigating
|
|
70
|
+
* to internal destinations. The default value is `false`.
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Performs navigation functions inside PDF, such as opening specified page,
|
|
74
|
+
* or destination.
|
|
75
|
+
* @implements {IPDFLinkService}
|
|
76
|
+
*/
|
|
77
|
+
export class PDFLinkService implements IPDFLinkService {
|
|
78
|
+
static "__#42@#isValidExplicitDestination"(dest: any): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @param {PDFLinkServiceOptions} options
|
|
81
|
+
*/
|
|
82
|
+
constructor({ eventBus, externalLinkTarget, externalLinkRel, ignoreDestinationZoom, }?: PDFLinkServiceOptions);
|
|
83
|
+
eventBus: import("./event_utils").EventBus;
|
|
84
|
+
externalLinkTarget: number;
|
|
85
|
+
externalLinkRel: string;
|
|
86
|
+
externalLinkEnabled: boolean;
|
|
87
|
+
_ignoreDestinationZoom: boolean;
|
|
88
|
+
baseUrl: any;
|
|
89
|
+
pdfDocument: any;
|
|
90
|
+
pdfViewer: any;
|
|
91
|
+
pdfHistory: any;
|
|
92
|
+
setDocument(pdfDocument: any, baseUrl?: null): void;
|
|
93
|
+
setViewer(pdfViewer: any): void;
|
|
94
|
+
setHistory(pdfHistory: any): void;
|
|
95
|
+
/**
|
|
96
|
+
* @type {number}
|
|
97
|
+
*/
|
|
98
|
+
get pagesCount(): number;
|
|
99
|
+
/**
|
|
100
|
+
* @param {number} value
|
|
101
|
+
*/
|
|
102
|
+
set page(arg: number);
|
|
103
|
+
/**
|
|
104
|
+
* @type {number}
|
|
105
|
+
*/
|
|
106
|
+
get page(): number;
|
|
107
|
+
/**
|
|
108
|
+
* @param {number} value
|
|
109
|
+
*/
|
|
110
|
+
set rotation(arg: number);
|
|
111
|
+
/**
|
|
112
|
+
* @type {number}
|
|
113
|
+
*/
|
|
114
|
+
get rotation(): number;
|
|
115
|
+
/**
|
|
116
|
+
* @type {boolean}
|
|
117
|
+
*/
|
|
118
|
+
get isInPresentationMode(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* This method will, when available, also update the browser history.
|
|
121
|
+
*
|
|
122
|
+
* @param {string|Array} dest - The named, or explicit, PDF destination.
|
|
123
|
+
*/
|
|
124
|
+
goToDestination(dest: string | any[]): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* This method will, when available, also update the browser history.
|
|
127
|
+
*
|
|
128
|
+
* @param {number|string} val - The page number, or page label.
|
|
129
|
+
*/
|
|
130
|
+
goToPage(val: number | string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Wrapper around the `addLinkAttributes` helper function.
|
|
133
|
+
* @param {HTMLAnchorElement} link
|
|
134
|
+
* @param {string} url
|
|
135
|
+
* @param {boolean} [newWindow]
|
|
136
|
+
*/
|
|
137
|
+
addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
|
|
138
|
+
/**
|
|
139
|
+
* @param {string|Array} dest - The PDF destination object.
|
|
140
|
+
* @returns {string} The hyperlink to the PDF object.
|
|
141
|
+
*/
|
|
142
|
+
getDestinationHash(dest: string | any[]): string;
|
|
143
|
+
/**
|
|
144
|
+
* Prefix the full url on anchor links to make sure that links are resolved
|
|
145
|
+
* relative to the current URL instead of the one defined in <base href>.
|
|
146
|
+
* @param {string} anchor - The anchor hash, including the #.
|
|
147
|
+
* @returns {string} The hyperlink to the PDF object.
|
|
148
|
+
*/
|
|
149
|
+
getAnchorUrl(anchor: string): string;
|
|
150
|
+
/**
|
|
151
|
+
* @param {string} hash
|
|
152
|
+
*/
|
|
153
|
+
setHash(hash: string): void;
|
|
154
|
+
/**
|
|
155
|
+
* @param {string} action
|
|
156
|
+
*/
|
|
157
|
+
executeNamedAction(action: string): void;
|
|
158
|
+
/**
|
|
159
|
+
* @param {Object} action
|
|
160
|
+
*/
|
|
161
|
+
executeSetOCGState(action: Object): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* @param {number} pageNum - page number.
|
|
164
|
+
* @param {Object} pageRef - reference to the page.
|
|
165
|
+
*/
|
|
166
|
+
cachePageRef(pageNum: number, pageRef: Object): void;
|
|
167
|
+
/**
|
|
168
|
+
* @ignore
|
|
169
|
+
*/
|
|
170
|
+
_cachedPageNumber(pageRef: any): any;
|
|
171
|
+
#private;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @implements {IPDFLinkService}
|
|
175
|
+
*/
|
|
176
|
+
export class SimpleLinkService implements IPDFLinkService {
|
|
177
|
+
externalLinkEnabled: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* @type {number}
|
|
180
|
+
*/
|
|
181
|
+
get pagesCount(): number;
|
|
182
|
+
/**
|
|
183
|
+
* @param {number} value
|
|
184
|
+
*/
|
|
185
|
+
set page(arg: number);
|
|
186
|
+
/**
|
|
187
|
+
* @type {number}
|
|
188
|
+
*/
|
|
189
|
+
get page(): number;
|
|
190
|
+
/**
|
|
191
|
+
* @param {number} value
|
|
192
|
+
*/
|
|
193
|
+
set rotation(arg: number);
|
|
194
|
+
/**
|
|
195
|
+
* @type {number}
|
|
196
|
+
*/
|
|
197
|
+
get rotation(): number;
|
|
198
|
+
/**
|
|
199
|
+
* @type {boolean}
|
|
200
|
+
*/
|
|
201
|
+
get isInPresentationMode(): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* @param {string|Array} dest - The named, or explicit, PDF destination.
|
|
204
|
+
*/
|
|
205
|
+
goToDestination(dest: string | any[]): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* @param {number|string} val - The page number, or page label.
|
|
208
|
+
*/
|
|
209
|
+
goToPage(val: number | string): void;
|
|
210
|
+
/**
|
|
211
|
+
* @param {HTMLAnchorElement} link
|
|
212
|
+
* @param {string} url
|
|
213
|
+
* @param {boolean} [newWindow]
|
|
214
|
+
*/
|
|
215
|
+
addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
|
|
216
|
+
/**
|
|
217
|
+
* @param dest - The PDF destination object.
|
|
218
|
+
* @returns {string} The hyperlink to the PDF object.
|
|
219
|
+
*/
|
|
220
|
+
getDestinationHash(dest: any): string;
|
|
221
|
+
/**
|
|
222
|
+
* @param hash - The PDF parameters/hash.
|
|
223
|
+
* @returns {string} The hyperlink to the PDF object.
|
|
224
|
+
*/
|
|
225
|
+
getAnchorUrl(hash: any): string;
|
|
226
|
+
/**
|
|
227
|
+
* @param {string} hash
|
|
228
|
+
*/
|
|
229
|
+
setHash(hash: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* @param {string} action
|
|
232
|
+
*/
|
|
233
|
+
executeNamedAction(action: string): void;
|
|
234
|
+
/**
|
|
235
|
+
* @param {Object} action
|
|
236
|
+
*/
|
|
237
|
+
executeSetOCGState(action: Object): void;
|
|
238
|
+
/**
|
|
239
|
+
* @param {number} pageNum - page number.
|
|
240
|
+
* @param {Object} pageRef - reference to the page.
|
|
241
|
+
*/
|
|
242
|
+
cachePageRef(pageNum: number, pageRef: Object): void;
|
|
243
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export type PageViewport = import("../src/display/display_utils").PageViewport;
|
|
2
|
+
export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
|
|
3
|
+
export type EventBus = import("./event_utils").EventBus;
|
|
4
|
+
export type IL10n = import("./interfaces").IL10n;
|
|
5
|
+
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
6
|
+
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
7
|
+
export type PDFPageViewOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* - The viewer element.
|
|
10
|
+
*/
|
|
11
|
+
container?: HTMLDivElement | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* - The application event bus.
|
|
14
|
+
*/
|
|
15
|
+
eventBus: EventBus;
|
|
16
|
+
/**
|
|
17
|
+
* - The page unique ID (normally its number).
|
|
18
|
+
*/
|
|
19
|
+
id: number;
|
|
20
|
+
/**
|
|
21
|
+
* - The page scale display.
|
|
22
|
+
*/
|
|
23
|
+
scale?: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* - The page viewport.
|
|
26
|
+
*/
|
|
27
|
+
defaultViewport: PageViewport;
|
|
28
|
+
/**
|
|
29
|
+
* -
|
|
30
|
+
* A promise that is resolved with an {@link OptionalContentConfig } instance.
|
|
31
|
+
* The default value is `null`.
|
|
32
|
+
*/
|
|
33
|
+
optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* - The rendering queue object.
|
|
36
|
+
*/
|
|
37
|
+
renderingQueue?: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* - Controls if the text layer used for
|
|
40
|
+
* selection and searching is created. The constants from {TextLayerMode}
|
|
41
|
+
* should be used. The default value is `TextLayerMode.ENABLE`.
|
|
42
|
+
*/
|
|
43
|
+
textLayerMode?: number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* - Controls if the annotation layer is
|
|
46
|
+
* created, and if interactive form elements or `AnnotationStorage`-data are
|
|
47
|
+
* being rendered. The constants from {@link AnnotationMode } should be used;
|
|
48
|
+
* see also {@link RenderParameters } and {@link GetOperatorListParameters }.
|
|
49
|
+
* The default value is `AnnotationMode.ENABLE_FORMS`.
|
|
50
|
+
*/
|
|
51
|
+
annotationMode?: number | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* - Path for image resources, mainly
|
|
54
|
+
* for annotation icons. Include trailing slash.
|
|
55
|
+
*/
|
|
56
|
+
imageResourcesPath?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* - Allows to use an
|
|
59
|
+
* OffscreenCanvas if needed.
|
|
60
|
+
*/
|
|
61
|
+
isOffscreenCanvasSupported?: boolean | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* - The maximum supported canvas size in
|
|
64
|
+
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
|
65
|
+
* CSS-only zooming. The default value is 4096 * 4096 (16 mega-pixels).
|
|
66
|
+
*/
|
|
67
|
+
maxCanvasPixels?: number | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* - Overwrites background and foreground colors
|
|
70
|
+
* with user defined ones in order to improve readability in high contrast
|
|
71
|
+
* mode.
|
|
72
|
+
*/
|
|
73
|
+
pageColors?: Object | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* - Localization service.
|
|
76
|
+
*/
|
|
77
|
+
l10n?: import("./interfaces").IL10n | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* - The function that is used to lookup
|
|
80
|
+
* the necessary layer-properties.
|
|
81
|
+
*/
|
|
82
|
+
layerProperties?: Function | undefined;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @implements {IRenderableView}
|
|
86
|
+
*/
|
|
87
|
+
export class PDFPageView implements IRenderableView {
|
|
88
|
+
/**
|
|
89
|
+
* @param {PDFPageViewOptions} options
|
|
90
|
+
*/
|
|
91
|
+
constructor(options: PDFPageViewOptions);
|
|
92
|
+
id: number;
|
|
93
|
+
renderingId: string;
|
|
94
|
+
pdfPage: any;
|
|
95
|
+
pageLabel: string | null;
|
|
96
|
+
rotation: number;
|
|
97
|
+
scale: number;
|
|
98
|
+
viewport: import("../src/display/display_utils").PageViewport;
|
|
99
|
+
pdfPageRotate: number;
|
|
100
|
+
_optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
|
|
101
|
+
imageResourcesPath: string;
|
|
102
|
+
isOffscreenCanvasSupported: boolean;
|
|
103
|
+
maxCanvasPixels: any;
|
|
104
|
+
pageColors: Object | null;
|
|
105
|
+
eventBus: import("./event_utils").EventBus;
|
|
106
|
+
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
|
|
107
|
+
l10n: {
|
|
108
|
+
getLanguage(): Promise<string>;
|
|
109
|
+
getDirection(): Promise<string>;
|
|
110
|
+
get(key: any, args?: null, fallback?: any): Promise<any>;
|
|
111
|
+
translate(element: any): Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
renderTask: any;
|
|
114
|
+
resume: (() => void) | null;
|
|
115
|
+
_isStandalone: boolean | undefined;
|
|
116
|
+
_container: HTMLDivElement | undefined;
|
|
117
|
+
_annotationCanvasMap: any;
|
|
118
|
+
annotationLayer: AnnotationLayerBuilder | null;
|
|
119
|
+
annotationEditorLayer: AnnotationEditorLayerBuilder | null;
|
|
120
|
+
textLayer: TextLayerBuilder | null;
|
|
121
|
+
zoomLayer: ParentNode | null;
|
|
122
|
+
xfaLayer: XfaLayerBuilder | null;
|
|
123
|
+
structTreeLayer: any;
|
|
124
|
+
div: HTMLDivElement;
|
|
125
|
+
set renderingState(arg: number);
|
|
126
|
+
get renderingState(): number;
|
|
127
|
+
setPdfPage(pdfPage: any): void;
|
|
128
|
+
destroy(): void;
|
|
129
|
+
get _textHighlighter(): any;
|
|
130
|
+
/**
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
private _resetZoomLayer;
|
|
134
|
+
reset({ keepZoomLayer, keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, }?: {
|
|
135
|
+
keepZoomLayer?: boolean | undefined;
|
|
136
|
+
keepAnnotationLayer?: boolean | undefined;
|
|
137
|
+
keepAnnotationEditorLayer?: boolean | undefined;
|
|
138
|
+
keepXfaLayer?: boolean | undefined;
|
|
139
|
+
keepTextLayer?: boolean | undefined;
|
|
140
|
+
}): void;
|
|
141
|
+
/**
|
|
142
|
+
* @typedef {Object} PDFPageViewUpdateParameters
|
|
143
|
+
* @property {number} [scale] The new scale, if specified.
|
|
144
|
+
* @property {number} [rotation] The new rotation, if specified.
|
|
145
|
+
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]
|
|
146
|
+
* A promise that is resolved with an {@link OptionalContentConfig}
|
|
147
|
+
* instance. The default value is `null`.
|
|
148
|
+
* @property {number} [drawingDelay]
|
|
149
|
+
*/
|
|
150
|
+
/**
|
|
151
|
+
* Update e.g. the scale and/or rotation of the page.
|
|
152
|
+
* @param {PDFPageViewUpdateParameters}
|
|
153
|
+
*/
|
|
154
|
+
update({ scale, rotation, optionalContentConfigPromise, drawingDelay, }: {
|
|
155
|
+
/**
|
|
156
|
+
* The new scale, if specified.
|
|
157
|
+
*/
|
|
158
|
+
scale?: number | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* The new rotation, if specified.
|
|
161
|
+
*/
|
|
162
|
+
rotation?: number | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* A promise that is resolved with an {@link OptionalContentConfig }instance. The default value is `null`.
|
|
165
|
+
*/
|
|
166
|
+
optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
|
|
167
|
+
drawingDelay?: number | undefined;
|
|
168
|
+
}): void;
|
|
169
|
+
/**
|
|
170
|
+
* PLEASE NOTE: Most likely you want to use the `this.reset()` method,
|
|
171
|
+
* rather than calling this one directly.
|
|
172
|
+
*/
|
|
173
|
+
cancelRendering({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, cancelExtraDelay, }?: {
|
|
174
|
+
keepAnnotationLayer?: boolean | undefined;
|
|
175
|
+
keepAnnotationEditorLayer?: boolean | undefined;
|
|
176
|
+
keepXfaLayer?: boolean | undefined;
|
|
177
|
+
keepTextLayer?: boolean | undefined;
|
|
178
|
+
cancelExtraDelay?: number | undefined;
|
|
179
|
+
}): void;
|
|
180
|
+
cssTransform({ target, redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: {
|
|
181
|
+
target: any;
|
|
182
|
+
redrawAnnotationLayer?: boolean | undefined;
|
|
183
|
+
redrawAnnotationEditorLayer?: boolean | undefined;
|
|
184
|
+
redrawXfaLayer?: boolean | undefined;
|
|
185
|
+
redrawTextLayer?: boolean | undefined;
|
|
186
|
+
hideTextLayer?: boolean | undefined;
|
|
187
|
+
}): void;
|
|
188
|
+
get width(): number;
|
|
189
|
+
get height(): number;
|
|
190
|
+
getPagePoint(x: any, y: any): any[];
|
|
191
|
+
draw(): Promise<any>;
|
|
192
|
+
canvas: HTMLCanvasElement | undefined;
|
|
193
|
+
outputScale: OutputScale | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* @param {string|null} label
|
|
196
|
+
*/
|
|
197
|
+
setPageLabel(label: string | null): void;
|
|
198
|
+
/**
|
|
199
|
+
* For use by the `PDFThumbnailView.setImage`-method.
|
|
200
|
+
* @ignore
|
|
201
|
+
*/
|
|
202
|
+
get thumbnailCanvas(): HTMLCanvasElement | null | undefined;
|
|
203
|
+
#private;
|
|
204
|
+
}
|
|
205
|
+
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
|
|
206
|
+
import { AnnotationEditorLayerBuilder } from "./annotation_editor_layer_builder.js";
|
|
207
|
+
import { TextLayerBuilder } from "./text_layer_builder.js";
|
|
208
|
+
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
|
|
209
|
+
import { OutputScale } from "./ui_utils.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
2
|
+
export type PDFViewer = import("./pdf_viewer").PDFViewer;
|
|
3
|
+
export type PDFThumbnailViewer = import("./pdf_thumbnail_viewer").PDFThumbnailViewer;
|
|
4
|
+
/**
|
|
5
|
+
* Controls rendering of the views for pages and thumbnails.
|
|
6
|
+
*/
|
|
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
|
+
isThumbnailViewEnabled: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @param {PDFViewer} pdfViewer
|
|
18
|
+
*/
|
|
19
|
+
setViewer(pdfViewer: PDFViewer): void;
|
|
20
|
+
/**
|
|
21
|
+
* @param {PDFThumbnailViewer} pdfThumbnailViewer
|
|
22
|
+
*/
|
|
23
|
+
setThumbnailViewer(pdfThumbnailViewer: PDFThumbnailViewer): void;
|
|
24
|
+
/**
|
|
25
|
+
* @param {IRenderableView} view
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
isHighestPriority(view: IRenderableView): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @param {Object} currentlyVisiblePages
|
|
31
|
+
*/
|
|
32
|
+
renderHighestPriority(currentlyVisiblePages: Object): void;
|
|
33
|
+
/**
|
|
34
|
+
* @param {Object} visible
|
|
35
|
+
* @param {Array} views
|
|
36
|
+
* @param {boolean} scrolledDown
|
|
37
|
+
* @param {boolean} [preRenderExtra]
|
|
38
|
+
*/
|
|
39
|
+
getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean | undefined): any;
|
|
40
|
+
/**
|
|
41
|
+
* @param {IRenderableView} view
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
isViewFinished(view: IRenderableView): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Render a page or thumbnail view. This calls the appropriate function
|
|
47
|
+
* based on the views state. If the view is already rendered it will return
|
|
48
|
+
* `false`.
|
|
49
|
+
*
|
|
50
|
+
* @param {IRenderableView} view
|
|
51
|
+
*/
|
|
52
|
+
renderView(view: IRenderableView): boolean;
|
|
53
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type EventBus = import("./event_utils").EventBus;
|
|
2
|
+
export type PDFScriptingManagerOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* - The application event bus.
|
|
5
|
+
*/
|
|
6
|
+
eventBus: EventBus;
|
|
7
|
+
/**
|
|
8
|
+
* - The path and filename of the scripting
|
|
9
|
+
* bundle.
|
|
10
|
+
*/
|
|
11
|
+
sandboxBundleSrc: string;
|
|
12
|
+
/**
|
|
13
|
+
* - The factory that is used when
|
|
14
|
+
* initializing scripting; must contain a `createScripting` method.
|
|
15
|
+
* PLEASE NOTE: Primarily intended for the default viewer use-case.
|
|
16
|
+
*/
|
|
17
|
+
externalServices?: Object | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* - The function that is used to lookup
|
|
20
|
+
* the necessary document properties.
|
|
21
|
+
*/
|
|
22
|
+
docProperties?: Function | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} PDFScriptingManagerOptions
|
|
26
|
+
* @property {EventBus} eventBus - The application event bus.
|
|
27
|
+
* @property {string} sandboxBundleSrc - The path and filename of the scripting
|
|
28
|
+
* bundle.
|
|
29
|
+
* @property {Object} [externalServices] - The factory that is used when
|
|
30
|
+
* initializing scripting; must contain a `createScripting` method.
|
|
31
|
+
* PLEASE NOTE: Primarily intended for the default viewer use-case.
|
|
32
|
+
* @property {function} [docProperties] - The function that is used to lookup
|
|
33
|
+
* the necessary document properties.
|
|
34
|
+
*/
|
|
35
|
+
export class PDFScriptingManager {
|
|
36
|
+
/**
|
|
37
|
+
* @param {PDFScriptingManagerOptions} options
|
|
38
|
+
*/
|
|
39
|
+
constructor({ eventBus, sandboxBundleSrc, externalServices, docProperties, }: PDFScriptingManagerOptions);
|
|
40
|
+
setViewer(pdfViewer: any): void;
|
|
41
|
+
setDocument(pdfDocument: any): Promise<void>;
|
|
42
|
+
dispatchWillSave(): Promise<any>;
|
|
43
|
+
dispatchDidSave(): Promise<any>;
|
|
44
|
+
dispatchWillPrint(): Promise<any>;
|
|
45
|
+
dispatchDidPrint(): Promise<any>;
|
|
46
|
+
get destroyPromise(): any;
|
|
47
|
+
get ready(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private get _internalEvents();
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
private get _pageOpenPending();
|
|
56
|
+
/**
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private get _visitedPages();
|
|
60
|
+
#private;
|
|
61
|
+
}
|