pdfjs-serverless 0.1.0 → 0.2.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 +11 -8
- package/dist/index.d.ts +1 -1
- 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 +6 -7
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type EventBus = import("./event_utils").EventBus;
|
|
2
|
+
export type IL10n = import("./interfaces").IL10n;
|
|
3
|
+
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
4
|
+
export type IRenderableView = import("./interfaces").IRenderableView;
|
|
5
|
+
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
6
|
+
export type PDFThumbnailViewOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* - The viewer element.
|
|
9
|
+
*/
|
|
10
|
+
container: HTMLDivElement;
|
|
11
|
+
/**
|
|
12
|
+
* - The application event bus.
|
|
13
|
+
*/
|
|
14
|
+
eventBus: EventBus;
|
|
15
|
+
/**
|
|
16
|
+
* - The thumbnail's unique ID (normally its number).
|
|
17
|
+
*/
|
|
18
|
+
id: number;
|
|
19
|
+
/**
|
|
20
|
+
* - The page viewport.
|
|
21
|
+
*/
|
|
22
|
+
defaultViewport: PageViewport;
|
|
23
|
+
/**
|
|
24
|
+
* -
|
|
25
|
+
* A promise that is resolved with an {@link OptionalContentConfig } instance.
|
|
26
|
+
* The default value is `null`.
|
|
27
|
+
*/
|
|
28
|
+
optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* - The navigation/linking service.
|
|
31
|
+
*/
|
|
32
|
+
linkService: IPDFLinkService;
|
|
33
|
+
/**
|
|
34
|
+
* - The rendering queue object.
|
|
35
|
+
*/
|
|
36
|
+
renderingQueue: PDFRenderingQueue;
|
|
37
|
+
/**
|
|
38
|
+
* - Localization service.
|
|
39
|
+
*/
|
|
40
|
+
l10n: IL10n;
|
|
41
|
+
/**
|
|
42
|
+
* - Overwrites background and foreground colors
|
|
43
|
+
* with user defined ones in order to improve readability in high contrast
|
|
44
|
+
* mode.
|
|
45
|
+
*/
|
|
46
|
+
pageColors?: Object | undefined;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @implements {IRenderableView}
|
|
50
|
+
*/
|
|
51
|
+
export class PDFThumbnailView implements IRenderableView {
|
|
52
|
+
/**
|
|
53
|
+
* @param {PDFThumbnailViewOptions} options
|
|
54
|
+
*/
|
|
55
|
+
constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, l10n, pageColors, }: PDFThumbnailViewOptions);
|
|
56
|
+
id: number;
|
|
57
|
+
renderingId: string;
|
|
58
|
+
pageLabel: string | null;
|
|
59
|
+
pdfPage: any;
|
|
60
|
+
rotation: number;
|
|
61
|
+
viewport: PageViewport;
|
|
62
|
+
pdfPageRotate: any;
|
|
63
|
+
_optionalContentConfigPromise: Promise<OptionalContentConfig> | null;
|
|
64
|
+
pageColors: Object | null;
|
|
65
|
+
eventBus: import("./event_utils").EventBus;
|
|
66
|
+
linkService: import("./interfaces").IPDFLinkService;
|
|
67
|
+
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
68
|
+
renderTask: any;
|
|
69
|
+
renderingState: number;
|
|
70
|
+
resume: (() => void) | null;
|
|
71
|
+
l10n: import("./interfaces").IL10n;
|
|
72
|
+
anchor: HTMLAnchorElement;
|
|
73
|
+
div: HTMLDivElement;
|
|
74
|
+
_placeholderImg: HTMLDivElement;
|
|
75
|
+
canvasWidth: number | undefined;
|
|
76
|
+
canvasHeight: number | undefined;
|
|
77
|
+
scale: number | undefined;
|
|
78
|
+
setPdfPage(pdfPage: any): void;
|
|
79
|
+
reset(): void;
|
|
80
|
+
update({ rotation }: {
|
|
81
|
+
rotation?: null | undefined;
|
|
82
|
+
}): void;
|
|
83
|
+
/**
|
|
84
|
+
* PLEASE NOTE: Most likely you want to use the `this.reset()` method,
|
|
85
|
+
* rather than calling this one directly.
|
|
86
|
+
*/
|
|
87
|
+
cancelRendering(): void;
|
|
88
|
+
/**
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
private _getPageDrawContext;
|
|
92
|
+
/**
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private _convertCanvasToImage;
|
|
96
|
+
image: HTMLImageElement | undefined;
|
|
97
|
+
draw(): Promise<any>;
|
|
98
|
+
setImage(pageView: any): void;
|
|
99
|
+
/**
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
private _reduceImage;
|
|
103
|
+
get _thumbPageTitle(): Promise<string>;
|
|
104
|
+
get _thumbPageCanvas(): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* @param {string|null} label
|
|
107
|
+
*/
|
|
108
|
+
setPageLabel(label: string | null): void;
|
|
109
|
+
#private;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {Object} PDFThumbnailViewOptions
|
|
113
|
+
* @property {HTMLDivElement} container - The viewer element.
|
|
114
|
+
* @property {EventBus} eventBus - The application event bus.
|
|
115
|
+
* @property {number} id - The thumbnail's unique ID (normally its number).
|
|
116
|
+
* @property {PageViewport} defaultViewport - The page viewport.
|
|
117
|
+
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
|
|
118
|
+
* A promise that is resolved with an {@link OptionalContentConfig} instance.
|
|
119
|
+
* The default value is `null`.
|
|
120
|
+
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
|
121
|
+
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
|
122
|
+
* @property {IL10n} l10n - Localization service.
|
|
123
|
+
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
124
|
+
* with user defined ones in order to improve readability in high contrast
|
|
125
|
+
* mode.
|
|
126
|
+
*/
|
|
127
|
+
export class TempImageFactory {
|
|
128
|
+
static "__#51@#tempCanvas": null;
|
|
129
|
+
static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
|
|
130
|
+
static destroyCanvas(): void;
|
|
131
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
|
|
2
|
+
export type EventBus = import("./event_utils").EventBus;
|
|
3
|
+
export type IL10n = import("./interfaces").IL10n;
|
|
4
|
+
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
|
5
|
+
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
6
|
+
export type PDFThumbnailViewerOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* - The container for the thumbnail
|
|
9
|
+
* elements.
|
|
10
|
+
*/
|
|
11
|
+
container: HTMLDivElement;
|
|
12
|
+
/**
|
|
13
|
+
* - The application event bus.
|
|
14
|
+
*/
|
|
15
|
+
eventBus: EventBus;
|
|
16
|
+
/**
|
|
17
|
+
* - The navigation/linking service.
|
|
18
|
+
*/
|
|
19
|
+
linkService: IPDFLinkService;
|
|
20
|
+
/**
|
|
21
|
+
* - The rendering queue object.
|
|
22
|
+
*/
|
|
23
|
+
renderingQueue: PDFRenderingQueue;
|
|
24
|
+
/**
|
|
25
|
+
* - Localization service.
|
|
26
|
+
*/
|
|
27
|
+
l10n: IL10n;
|
|
28
|
+
/**
|
|
29
|
+
* - Overwrites background and foreground colors
|
|
30
|
+
* with user defined ones in order to improve readability in high contrast
|
|
31
|
+
* mode.
|
|
32
|
+
*/
|
|
33
|
+
pageColors?: Object | undefined;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} PDFThumbnailViewerOptions
|
|
37
|
+
* @property {HTMLDivElement} container - The container for the thumbnail
|
|
38
|
+
* elements.
|
|
39
|
+
* @property {EventBus} eventBus - The application event bus.
|
|
40
|
+
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
|
41
|
+
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
|
42
|
+
* @property {IL10n} l10n - Localization service.
|
|
43
|
+
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
|
44
|
+
* with user defined ones in order to improve readability in high contrast
|
|
45
|
+
* mode.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Viewer control to display thumbnails for pages in a PDF document.
|
|
49
|
+
*/
|
|
50
|
+
export class PDFThumbnailViewer {
|
|
51
|
+
/**
|
|
52
|
+
* @param {PDFThumbnailViewerOptions} options
|
|
53
|
+
*/
|
|
54
|
+
constructor({ container, eventBus, linkService, renderingQueue, l10n, pageColors, }: PDFThumbnailViewerOptions);
|
|
55
|
+
container: HTMLDivElement;
|
|
56
|
+
eventBus: import("./event_utils").EventBus;
|
|
57
|
+
linkService: import("./interfaces").IPDFLinkService;
|
|
58
|
+
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
|
59
|
+
l10n: import("./interfaces").IL10n;
|
|
60
|
+
pageColors: Object | null;
|
|
61
|
+
scroll: {
|
|
62
|
+
right: boolean;
|
|
63
|
+
down: boolean;
|
|
64
|
+
lastX: any;
|
|
65
|
+
lastY: any;
|
|
66
|
+
_eventHandler: (evt: any) => void;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
private _scrollUpdated;
|
|
72
|
+
getThumbnail(index: any): any;
|
|
73
|
+
/**
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
private _getVisibleThumbs;
|
|
77
|
+
scrollThumbnailIntoView(pageNumber: any): void;
|
|
78
|
+
_currentPageNumber: any;
|
|
79
|
+
set pagesRotation(arg: any);
|
|
80
|
+
get pagesRotation(): any;
|
|
81
|
+
_pagesRotation: any;
|
|
82
|
+
cleanup(): void;
|
|
83
|
+
/**
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
private _resetView;
|
|
87
|
+
_thumbnails: any[] | undefined;
|
|
88
|
+
_pageLabels: any[] | null | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* @param {PDFDocumentProxy} pdfDocument
|
|
91
|
+
*/
|
|
92
|
+
setDocument(pdfDocument: PDFDocumentProxy): void;
|
|
93
|
+
pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private _cancelRendering;
|
|
98
|
+
/**
|
|
99
|
+
* @param {Array|null} labels
|
|
100
|
+
*/
|
|
101
|
+
setPageLabels(labels: any[] | null): void;
|
|
102
|
+
forceRendering(): boolean;
|
|
103
|
+
#private;
|
|
104
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
|
|
2
|
+
import { DownloadManager } from "./download_manager.js";
|
|
3
|
+
import { EventBus } from "./event_utils.js";
|
|
4
|
+
import { FindState } from "./pdf_find_controller.js";
|
|
5
|
+
import { GenericL10n } from "./genericl10n.js";
|
|
6
|
+
import { LinkTarget } from "./pdf_link_service.js";
|
|
7
|
+
import { NullL10n } from "./l10n_utils.js";
|
|
8
|
+
import { parseQueryString } from "./ui_utils.js";
|
|
9
|
+
import { PDFFindController } from "./pdf_find_controller.js";
|
|
10
|
+
import { PDFHistory } from "./pdf_history.js";
|
|
11
|
+
import { PDFLinkService } from "./pdf_link_service.js";
|
|
12
|
+
import { PDFPageView } from "./pdf_page_view.js";
|
|
13
|
+
import { PDFScriptingManager } from "./pdf_scripting_manager.component.js";
|
|
14
|
+
import { PDFSinglePageViewer } from "./pdf_single_page_viewer.js";
|
|
15
|
+
import { PDFViewer } from "./pdf_viewer.js";
|
|
16
|
+
import { ProgressBar } from "./ui_utils.js";
|
|
17
|
+
import { RenderingStates } from "./ui_utils.js";
|
|
18
|
+
import { ScrollMode } from "./ui_utils.js";
|
|
19
|
+
import { SimpleLinkService } from "./pdf_link_service.js";
|
|
20
|
+
import { SpreadMode } from "./ui_utils.js";
|
|
21
|
+
import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js";
|
|
22
|
+
import { TextLayerBuilder } from "./text_layer_builder.js";
|
|
23
|
+
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
|
|
24
|
+
export { AnnotationLayerBuilder, DownloadManager, EventBus, FindState, GenericL10n, LinkTarget, NullL10n, parseQueryString, PDFFindController, PDFHistory, PDFLinkService, PDFPageView, PDFScriptingManager, PDFSinglePageViewer, PDFViewer, ProgressBar, RenderingStates, ScrollMode, SimpleLinkService, SpreadMode, StructTreeLayerBuilder, TextLayerBuilder, XfaLayerBuilder };
|