@progress/kendo-pdfviewer-common 0.3.0-dev.202409251137 → 0.3.0-dev.202410100645
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/dist/es/annotations/annotation-editor-layer-builder.js +139 -0
- package/dist/es/annotations/annotation-editor-layer.js +780 -0
- package/dist/es/annotations/annotation-editor-ui-manager.js +1690 -0
- package/dist/es/annotations/annotation-layer-builder.js +217 -0
- package/dist/es/annotations/annotation-layer.js +2793 -0
- package/dist/es/annotations/draw-layer-builder.js +65 -0
- package/dist/es/annotations/draw-layer.js +220 -0
- package/dist/es/annotations/editors/annotation-editor.js +1519 -0
- package/dist/es/annotations/editors/free-text-editor.js +783 -0
- package/dist/es/annotations/editors/highlight-editor.js +717 -0
- package/dist/es/annotations/editors/outliner.js +747 -0
- package/dist/es/annotations/helpers/annotation-storage.js +294 -0
- package/dist/es/annotations/helpers/color-manager.js +72 -0
- package/dist/es/annotations/helpers/command-manager.js +133 -0
- package/dist/es/annotations/helpers/id-manager.js +34 -0
- package/dist/es/annotations/helpers/image-manager.js +176 -0
- package/dist/es/annotations/helpers/text-accessibility-manager.js +212 -0
- package/dist/es/annotations/helpers/tools.js +19 -0
- package/dist/es/annotations/shared/display_utils.js +1024 -0
- package/dist/es/annotations/shared/event_utils.js +213 -0
- package/dist/es/annotations/shared/murmurhash3.js +126 -0
- package/dist/es/annotations/shared/scripting_utils.js +90 -0
- package/dist/es/annotations/shared/ui_utils.js +823 -0
- package/dist/es/annotations/shared/utils.js +909 -0
- package/dist/es/annotations.js +68 -0
- package/dist/es/common/component.js +33 -0
- package/dist/es/common/core.js +91 -0
- package/dist/es/common/dom.js +11 -0
- package/dist/es/common/main.js +4 -0
- package/dist/es/common/math.js +1 -0
- package/dist/es/enums/PdfViewerInteractionMode.js +6 -0
- package/dist/es/links/link-service.js +505 -0
- package/dist/es/main.js +2 -0
- package/dist/es/scroller.js +29 -30
- package/dist/es/text/text-layer-builder.js +288 -0
- package/dist/es/utils.js +42 -14
- package/dist/es/widget/page.js +762 -0
- package/dist/es/widget/pdfviewer.js +1659 -0
- package/dist/es2015/annotations/annotation-editor-layer-builder.js +139 -0
- package/dist/es2015/annotations/annotation-editor-layer.js +780 -0
- package/dist/es2015/annotations/annotation-editor-ui-manager.js +1690 -0
- package/dist/es2015/annotations/annotation-layer-builder.js +217 -0
- package/dist/es2015/annotations/annotation-layer.js +2793 -0
- package/dist/es2015/annotations/draw-layer-builder.js +65 -0
- package/dist/es2015/annotations/draw-layer.js +220 -0
- package/dist/es2015/annotations/editors/annotation-editor.js +1519 -0
- package/dist/es2015/annotations/editors/free-text-editor.js +783 -0
- package/dist/es2015/annotations/editors/highlight-editor.js +717 -0
- package/dist/es2015/annotations/editors/outliner.js +747 -0
- package/dist/es2015/annotations/helpers/annotation-storage.js +294 -0
- package/dist/es2015/annotations/helpers/color-manager.js +72 -0
- package/dist/es2015/annotations/helpers/command-manager.js +133 -0
- package/dist/es2015/annotations/helpers/id-manager.js +34 -0
- package/dist/es2015/annotations/helpers/image-manager.js +176 -0
- package/dist/es2015/annotations/helpers/text-accessibility-manager.js +212 -0
- package/dist/es2015/annotations/helpers/tools.js +19 -0
- package/dist/es2015/annotations/shared/display_utils.js +1024 -0
- package/dist/es2015/annotations/shared/event_utils.js +213 -0
- package/dist/es2015/annotations/shared/murmurhash3.js +126 -0
- package/dist/es2015/annotations/shared/scripting_utils.js +90 -0
- package/dist/es2015/annotations/shared/ui_utils.js +823 -0
- package/dist/es2015/annotations/shared/utils.js +909 -0
- package/dist/es2015/annotations.js +68 -0
- package/dist/es2015/common/component.js +33 -0
- package/dist/es2015/common/core.js +91 -0
- package/dist/es2015/common/dom.js +11 -0
- package/dist/es2015/common/main.js +4 -0
- package/dist/es2015/common/math.js +1 -0
- package/dist/es2015/enums/PdfViewerInteractionMode.js +6 -0
- package/dist/es2015/links/link-service.js +505 -0
- package/dist/es2015/main.js +2 -0
- package/dist/es2015/scroller.js +29 -30
- package/dist/es2015/text/text-layer-builder.js +288 -0
- package/dist/es2015/utils.js +42 -14
- package/dist/es2015/widget/page.js +762 -0
- package/dist/es2015/widget/pdfviewer.js +1659 -0
- package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +39 -0
- package/dist/npm/annotations/annotation-editor-layer-builder.js +142 -0
- package/dist/npm/annotations/annotation-editor-layer.d.ts +196 -0
- package/dist/npm/annotations/annotation-editor-layer.js +783 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +281 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.js +1694 -0
- package/dist/npm/annotations/annotation-layer-builder.d.ts +58 -0
- package/dist/npm/annotations/annotation-layer-builder.js +220 -0
- package/dist/npm/annotations/annotation-layer.d.ts +134 -0
- package/dist/npm/annotations/annotation-layer.js +2794 -0
- package/dist/npm/annotations/draw-layer-builder.d.ts +21 -0
- package/dist/npm/annotations/draw-layer-builder.js +68 -0
- package/dist/npm/annotations/draw-layer.d.ts +33 -0
- package/dist/npm/annotations/draw-layer.js +223 -0
- package/dist/npm/annotations/editors/annotation-editor.d.ts +349 -0
- package/dist/npm/annotations/editors/annotation-editor.js +1523 -0
- package/dist/npm/annotations/editors/free-text-editor.d.ts +108 -0
- package/dist/npm/annotations/editors/free-text-editor.js +786 -0
- package/dist/npm/annotations/editors/highlight-editor.d.ts +114 -0
- package/dist/npm/annotations/editors/highlight-editor.js +717 -0
- package/dist/npm/annotations/editors/outliner.d.ts +51 -0
- package/dist/npm/annotations/editors/outliner.js +750 -0
- package/dist/npm/annotations/helpers/annotation-storage.d.ts +98 -0
- package/dist/npm/annotations/helpers/annotation-storage.js +299 -0
- package/dist/npm/annotations/helpers/color-manager.d.ts +6 -0
- package/dist/npm/annotations/helpers/color-manager.js +76 -0
- package/dist/npm/annotations/helpers/command-manager.d.ts +42 -0
- package/dist/npm/annotations/helpers/command-manager.js +137 -0
- package/dist/npm/annotations/helpers/id-manager.d.ts +6 -0
- package/dist/npm/annotations/helpers/id-manager.js +38 -0
- package/dist/npm/annotations/helpers/image-manager.d.ts +18 -0
- package/dist/npm/annotations/helpers/image-manager.js +180 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +36 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.js +215 -0
- package/dist/npm/annotations/helpers/tools.d.ts +1 -0
- package/dist/npm/annotations/helpers/tools.js +23 -0
- package/dist/npm/annotations/shared/display_utils.d.ts +6 -0
- package/dist/npm/annotations/shared/display_utils.js +1030 -0
- package/dist/npm/annotations/shared/event_utils.d.ts +33 -0
- package/dist/npm/annotations/shared/event_utils.js +165 -0
- package/dist/npm/annotations/shared/murmurhash3.d.ts +8 -0
- package/dist/npm/annotations/shared/murmurhash3.js +129 -0
- package/dist/npm/annotations/shared/scripting_utils.d.ts +17 -0
- package/dist/npm/annotations/shared/scripting_utils.js +93 -0
- package/dist/npm/annotations/shared/ui_utils.d.ts +54 -0
- package/dist/npm/annotations/shared/ui_utils.js +250 -0
- package/dist/npm/annotations/shared/utils.d.ts +148 -0
- package/dist/npm/annotations/shared/utils.js +872 -0
- package/dist/npm/annotations.d.ts +23 -0
- package/dist/npm/annotations.js +72 -0
- package/dist/npm/common/component.d.ts +9 -0
- package/dist/npm/common/component.js +37 -0
- package/dist/npm/common/core.d.ts +18 -0
- package/dist/npm/common/core.js +112 -0
- package/dist/npm/common/dom.d.ts +3 -0
- package/dist/npm/common/dom.js +17 -0
- package/dist/npm/common/main.d.ts +4 -0
- package/dist/npm/common/main.js +7 -0
- package/dist/npm/common/math.d.ts +1 -0
- package/dist/npm/common/math.js +5 -0
- package/dist/npm/enums/PdfViewerInteractionMode.d.ts +4 -0
- package/dist/npm/enums/PdfViewerInteractionMode.js +9 -0
- package/dist/npm/links/link-service.d.ts +116 -0
- package/dist/npm/links/link-service.js +501 -0
- package/dist/npm/main.d.ts +2 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/scroller.d.ts +7 -3
- package/dist/npm/scroller.js +32 -32
- package/dist/npm/text/text-layer-builder.d.ts +30 -0
- package/dist/npm/text/text-layer-builder.js +291 -0
- package/dist/npm/utils.d.ts +27 -3
- package/dist/npm/utils.js +51 -19
- package/dist/npm/widget/page.d.ts +75 -0
- package/dist/npm/widget/page.js +763 -0
- package/dist/npm/widget/pdfviewer.d.ts +222 -0
- package/dist/npm/widget/pdfviewer.js +1663 -0
- package/package.json +13 -9
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text layer builder provides text selection functionality for the PDF.
|
|
3
|
+
* It does this by creating overlay divs over the PDF's text. These divs
|
|
4
|
+
* contain text that matches the PDF text they are overlaying.
|
|
5
|
+
*/
|
|
6
|
+
declare class TextLayerBuilder {
|
|
7
|
+
#private;
|
|
8
|
+
pdfPage: any;
|
|
9
|
+
div: any;
|
|
10
|
+
accessibilityManager: any;
|
|
11
|
+
constructor({ pdfPage, accessibilityManager, styles, onAppend, }: {
|
|
12
|
+
pdfPage: any;
|
|
13
|
+
accessibilityManager: any;
|
|
14
|
+
styles: any;
|
|
15
|
+
onAppend?: any;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Renders the text layer.
|
|
19
|
+
* @param {PageViewport} viewport
|
|
20
|
+
* @param {Object} [textContentParams]
|
|
21
|
+
*/
|
|
22
|
+
render(viewport: any, textContentParams?: any): Promise<void>;
|
|
23
|
+
hide(): void;
|
|
24
|
+
show(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Cancel rendering of the text layer.
|
|
27
|
+
*/
|
|
28
|
+
cancel(): void;
|
|
29
|
+
}
|
|
30
|
+
export { TextLayerBuilder };
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright 2012 Mozilla Foundation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var _TextLayerBuilder_instances, _a, _TextLayerBuilder_onAppend, _TextLayerBuilder_textLayer, _TextLayerBuilder_textLayers, _TextLayerBuilder_selectionChangeAbortController, _TextLayerBuilder_bindMouse, _TextLayerBuilder_removeGlobalSelectionListener, _TextLayerBuilder_enableGlobalSelectionListener;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.TextLayerBuilder = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const pdf_mjs_1 = require("pdfjs-dist/legacy/build/pdf.mjs");
|
|
21
|
+
const dom_1 = require("../common/dom");
|
|
22
|
+
/**
|
|
23
|
+
* The text layer builder provides text selection functionality for the PDF.
|
|
24
|
+
* It does this by creating overlay divs over the PDF's text. These divs
|
|
25
|
+
* contain text that matches the PDF text they are overlaying.
|
|
26
|
+
*/
|
|
27
|
+
class TextLayerBuilder {
|
|
28
|
+
constructor({ pdfPage,
|
|
29
|
+
// highlighter = null,
|
|
30
|
+
accessibilityManager,
|
|
31
|
+
// enablePermissions = false,
|
|
32
|
+
// todo: fix styles
|
|
33
|
+
styles, onAppend = null, }) {
|
|
34
|
+
_TextLayerBuilder_instances.add(this);
|
|
35
|
+
// todo: props
|
|
36
|
+
this.pdfPage = null;
|
|
37
|
+
// highlighter = null;
|
|
38
|
+
this.div = null;
|
|
39
|
+
this.accessibilityManager = null;
|
|
40
|
+
// todo: props
|
|
41
|
+
// #enablePermissions = false;
|
|
42
|
+
_TextLayerBuilder_onAppend.set(this, null);
|
|
43
|
+
// #renderingDone = false;
|
|
44
|
+
_TextLayerBuilder_textLayer.set(this, null);
|
|
45
|
+
this.pdfPage = pdfPage;
|
|
46
|
+
// this.highlighter = highlighter;
|
|
47
|
+
this.accessibilityManager = accessibilityManager;
|
|
48
|
+
// this.#enablePermissions = enablePermissions === true;
|
|
49
|
+
tslib_1.__classPrivateFieldSet(this, _TextLayerBuilder_onAppend, onAppend, "f");
|
|
50
|
+
this.div = document.createElement("div");
|
|
51
|
+
this.div.tabIndex = 0;
|
|
52
|
+
// this.div.className = "textLayer";
|
|
53
|
+
// todo: fix classes
|
|
54
|
+
this.div.classList.add("k-text-layer");
|
|
55
|
+
// todo: fix styles
|
|
56
|
+
Object.keys(styles).forEach((key) => (this.div.style[key] = styles[key]));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Renders the text layer.
|
|
60
|
+
* @param {PageViewport} viewport
|
|
61
|
+
* @param {Object} [textContentParams]
|
|
62
|
+
*/
|
|
63
|
+
render(viewport_1) {
|
|
64
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (viewport, textContentParams = null) {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
// if (this.#renderingDone && this.#textLayer) {
|
|
67
|
+
if (tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) {
|
|
68
|
+
tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f").update({
|
|
69
|
+
viewport,
|
|
70
|
+
onBefore: this.hide.bind(this),
|
|
71
|
+
});
|
|
72
|
+
this.show();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.cancel();
|
|
76
|
+
tslib_1.__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, new pdf_mjs_1.TextLayer({
|
|
77
|
+
textContentSource: this.pdfPage.streamTextContent(textContentParams || {
|
|
78
|
+
// includeMarkedContent: true,
|
|
79
|
+
// setting this to false requires removing "await"
|
|
80
|
+
// in page.ts when calling this.#renderTextLayer()
|
|
81
|
+
includeMarkedContent: false,
|
|
82
|
+
disableNormalization: true,
|
|
83
|
+
}),
|
|
84
|
+
container: this.div,
|
|
85
|
+
viewport,
|
|
86
|
+
}), "f");
|
|
87
|
+
// const { textDivs, textContentItemsStr } = this.#textLayer;
|
|
88
|
+
const { textDivs } = tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f");
|
|
89
|
+
// this.highlighter?.setTextMapping(textDivs, textContentItemsStr);
|
|
90
|
+
(_a = this.accessibilityManager) === null || _a === void 0 ? void 0 : _a.setTextMapping(textDivs);
|
|
91
|
+
yield tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f").render();
|
|
92
|
+
// this.#renderingDone = true;
|
|
93
|
+
// todo: manually add "k-marked-content" class
|
|
94
|
+
// as pdf.js text layer cannot render it
|
|
95
|
+
const markedContentElements = Array.from(this.div.querySelectorAll(".markedContent") || []) || [];
|
|
96
|
+
markedContentElements.forEach(x => (0, dom_1.addClass)("k-marked-content", x));
|
|
97
|
+
if (markedContentElements && markedContentElements.length > 0) {
|
|
98
|
+
const endOfContent = document.createElement("div");
|
|
99
|
+
endOfContent.className = "endOfContent";
|
|
100
|
+
this.div.append(endOfContent);
|
|
101
|
+
tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_instances, "m", _TextLayerBuilder_bindMouse).call(this, endOfContent);
|
|
102
|
+
}
|
|
103
|
+
// Ensure that the textLayer is appended to the DOM *before* handling
|
|
104
|
+
// e.g. a pending search operation.
|
|
105
|
+
(_b = tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, this.div);
|
|
106
|
+
// this.highlighter?.enable();
|
|
107
|
+
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.enable();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
hide() {
|
|
111
|
+
// if (!this.div.hidden && this.#renderingDone) {
|
|
112
|
+
if (!this.div.hidden) {
|
|
113
|
+
// We turn off the highlighter in order to avoid to scroll into view an
|
|
114
|
+
// element of the text layer which could be hidden.
|
|
115
|
+
// this.highlighter?.disable();
|
|
116
|
+
this.div.hidden = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
show() {
|
|
120
|
+
// if (this.div.hidden && this.#renderingDone) {
|
|
121
|
+
if (this.div.hidden) {
|
|
122
|
+
this.div.hidden = false;
|
|
123
|
+
// this.highlighter?.enable();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Cancel rendering of the text layer.
|
|
128
|
+
*/
|
|
129
|
+
cancel() {
|
|
130
|
+
var _b, _c;
|
|
131
|
+
(_b = tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
132
|
+
tslib_1.__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
133
|
+
// this.highlighter?.disable();
|
|
134
|
+
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
135
|
+
tslib_1.__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.TextLayerBuilder = TextLayerBuilder;
|
|
139
|
+
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
|
140
|
+
const { div } = this;
|
|
141
|
+
// div.addEventListener("mousedown", () => {
|
|
142
|
+
// div.classList.add("selecting");
|
|
143
|
+
// });
|
|
144
|
+
// div.addEventListener("copy", event => {
|
|
145
|
+
// if (!this.#enablePermissions) {
|
|
146
|
+
// const selection = document.getSelection();
|
|
147
|
+
// event.clipboardData.setData(
|
|
148
|
+
// "text/plain",
|
|
149
|
+
// removeNullCharacters(normalizeUnicode(selection.toString()))
|
|
150
|
+
// );
|
|
151
|
+
// }
|
|
152
|
+
// event.preventDefault();
|
|
153
|
+
// event.stopPropagation();
|
|
154
|
+
// });
|
|
155
|
+
tslib_1.__classPrivateFieldGet(_a, _a, "f", _TextLayerBuilder_textLayers).set(div, end);
|
|
156
|
+
tslib_1.__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_enableGlobalSelectionListener).call(_a);
|
|
157
|
+
}, _TextLayerBuilder_removeGlobalSelectionListener = function _TextLayerBuilder_removeGlobalSelectionListener(textLayerDiv) {
|
|
158
|
+
var _b;
|
|
159
|
+
tslib_1.__classPrivateFieldGet(this, _a, "f", _TextLayerBuilder_textLayers).delete(textLayerDiv);
|
|
160
|
+
if (tslib_1.__classPrivateFieldGet(this, _a, "f", _TextLayerBuilder_textLayers).size === 0) {
|
|
161
|
+
(_b = tslib_1.__classPrivateFieldGet(this, _a, "f", _TextLayerBuilder_selectionChangeAbortController)) === null || _b === void 0 ? void 0 : _b.abort();
|
|
162
|
+
tslib_1.__classPrivateFieldSet(this, _a, null, "f", _TextLayerBuilder_selectionChangeAbortController);
|
|
163
|
+
}
|
|
164
|
+
}, _TextLayerBuilder_enableGlobalSelectionListener = function _TextLayerBuilder_enableGlobalSelectionListener() {
|
|
165
|
+
// if (this.#selectionChangeAbortController) {
|
|
166
|
+
// // document-level event listeners already installed
|
|
167
|
+
// return;
|
|
168
|
+
// }
|
|
169
|
+
// this.#selectionChangeAbortController = new AbortController();
|
|
170
|
+
// const { signal } = this.#selectionChangeAbortController;
|
|
171
|
+
// const reset = (end, textLayer) => {
|
|
172
|
+
// if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
|
173
|
+
// textLayer.append(end);
|
|
174
|
+
// end.style.width = "";
|
|
175
|
+
// end.style.height = "";
|
|
176
|
+
// }
|
|
177
|
+
// textLayer.classList.remove("selecting");
|
|
178
|
+
// };
|
|
179
|
+
// let isPointerDown = false;
|
|
180
|
+
// document.addEventListener(
|
|
181
|
+
// "pointerdown",
|
|
182
|
+
// () => {
|
|
183
|
+
// isPointerDown = true;
|
|
184
|
+
// },
|
|
185
|
+
// { signal }
|
|
186
|
+
// );
|
|
187
|
+
// document.addEventListener(
|
|
188
|
+
// "pointerup",
|
|
189
|
+
// () => {
|
|
190
|
+
// isPointerDown = false;
|
|
191
|
+
// this.#textLayers.forEach(reset);
|
|
192
|
+
// },
|
|
193
|
+
// { signal }
|
|
194
|
+
// );
|
|
195
|
+
// window.addEventListener(
|
|
196
|
+
// "blur",
|
|
197
|
+
// () => {
|
|
198
|
+
// isPointerDown = false;
|
|
199
|
+
// this.#textLayers.forEach(reset);
|
|
200
|
+
// },
|
|
201
|
+
// { signal }
|
|
202
|
+
// );
|
|
203
|
+
// document.addEventListener(
|
|
204
|
+
// "keyup",
|
|
205
|
+
// () => {
|
|
206
|
+
// if (!isPointerDown) {
|
|
207
|
+
// this.#textLayers.forEach(reset);
|
|
208
|
+
// }
|
|
209
|
+
// },
|
|
210
|
+
// { signal }
|
|
211
|
+
// );
|
|
212
|
+
// if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
|
213
|
+
// // eslint-disable-next-line no-var
|
|
214
|
+
// var isFirefox, prevRange;
|
|
215
|
+
// }
|
|
216
|
+
// document.addEventListener(
|
|
217
|
+
// "selectionchange",
|
|
218
|
+
// () => {
|
|
219
|
+
// const selection = document.getSelection();
|
|
220
|
+
// if (selection.rangeCount === 0) {
|
|
221
|
+
// this.#textLayers.forEach(reset);
|
|
222
|
+
// return;
|
|
223
|
+
// }
|
|
224
|
+
// // Even though the spec says that .rangeCount should be 0 or 1, Firefox
|
|
225
|
+
// // creates multiple ranges when selecting across multiple pages.
|
|
226
|
+
// // Make sure to collect all the .textLayer elements where the selection
|
|
227
|
+
// // is happening.
|
|
228
|
+
// const activeTextLayers = new Set();
|
|
229
|
+
// for (let i = 0; i < selection.rangeCount; i++) {
|
|
230
|
+
// const range = selection.getRangeAt(i);
|
|
231
|
+
// for (const textLayerDiv of this.#textLayers.keys()) {
|
|
232
|
+
// if (
|
|
233
|
+
// !activeTextLayers.has(textLayerDiv) &&
|
|
234
|
+
// range.intersectsNode(textLayerDiv)
|
|
235
|
+
// ) {
|
|
236
|
+
// activeTextLayers.add(textLayerDiv);
|
|
237
|
+
// }
|
|
238
|
+
// }
|
|
239
|
+
// }
|
|
240
|
+
// for (const [textLayerDiv, endDiv] of this.#textLayers) {
|
|
241
|
+
// if (activeTextLayers.has(textLayerDiv)) {
|
|
242
|
+
// textLayerDiv.classList.add("selecting");
|
|
243
|
+
// } else {
|
|
244
|
+
// reset(endDiv, textLayerDiv);
|
|
245
|
+
// }
|
|
246
|
+
// }
|
|
247
|
+
// if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
|
248
|
+
// return;
|
|
249
|
+
// }
|
|
250
|
+
// if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) {
|
|
251
|
+
// isFirefox ??=
|
|
252
|
+
// getComputedStyle(
|
|
253
|
+
// this.#textLayers.values().next().value
|
|
254
|
+
// ).getPropertyValue("-moz-user-select") === "none";
|
|
255
|
+
// if (isFirefox) {
|
|
256
|
+
// return;
|
|
257
|
+
// }
|
|
258
|
+
// }
|
|
259
|
+
// // In non-Firefox browsers, when hovering over an empty space (thus,
|
|
260
|
+
// // on .endOfContent), the selection will expand to cover all the
|
|
261
|
+
// // text between the current selection and .endOfContent. By moving
|
|
262
|
+
// // .endOfContent to right after (or before, depending on which side
|
|
263
|
+
// // of the selection the user is moving), we limit the selection jump
|
|
264
|
+
// // to at most cover the enteirety of the <span> where the selection
|
|
265
|
+
// // is being modified.
|
|
266
|
+
// const range = selection.getRangeAt(0);
|
|
267
|
+
// const modifyStart =
|
|
268
|
+
// prevRange &&
|
|
269
|
+
// (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 ||
|
|
270
|
+
// range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);
|
|
271
|
+
// let anchor = modifyStart ? range.startContainer : range.endContainer;
|
|
272
|
+
// if (anchor.nodeType === Node.TEXT_NODE) {
|
|
273
|
+
// anchor = anchor.parentNode;
|
|
274
|
+
// }
|
|
275
|
+
// const parentTextLayer = anchor.parentElement.closest(".textLayer");
|
|
276
|
+
// const endDiv = this.#textLayers.get(parentTextLayer);
|
|
277
|
+
// if (endDiv) {
|
|
278
|
+
// endDiv.style.width = parentTextLayer.style.width;
|
|
279
|
+
// endDiv.style.height = parentTextLayer.style.height;
|
|
280
|
+
// anchor.parentElement.insertBefore(
|
|
281
|
+
// endDiv,
|
|
282
|
+
// modifyStart ? anchor : anchor.nextSibling
|
|
283
|
+
// );
|
|
284
|
+
// }
|
|
285
|
+
// prevRange = range.cloneRange();
|
|
286
|
+
// },
|
|
287
|
+
// { signal }
|
|
288
|
+
// );
|
|
289
|
+
};
|
|
290
|
+
_TextLayerBuilder_textLayers = { value: new Map() };
|
|
291
|
+
_TextLayerBuilder_selectionChangeAbortController = { value: null };
|
package/dist/npm/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SaveOptions } from '@progress/kendo-file-saver';
|
|
2
|
-
import { PDFPageProxy, PDFDocumentProxy } from
|
|
3
|
-
import { TypedArray } from
|
|
2
|
+
import { PDFPageProxy, PDFDocumentProxy } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
3
|
+
import { TypedArray } from "pdfjs-dist/types/src/display/api";
|
|
4
4
|
/**
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
@@ -29,8 +29,10 @@ export interface PDFReadParameters {
|
|
|
29
29
|
* @hidden
|
|
30
30
|
*/
|
|
31
31
|
export interface PDFReadOptions extends PDFReadParameters {
|
|
32
|
+
rootElement?: HTMLElement | null;
|
|
32
33
|
dom: HTMLDivElement;
|
|
33
34
|
zoom: number;
|
|
35
|
+
enableAnnotations: boolean;
|
|
34
36
|
done: DoneFn;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
@@ -40,15 +42,18 @@ export interface PDFReloadParameters {
|
|
|
40
42
|
pdfDoc: PDFDocumentProxy;
|
|
41
43
|
zoom: number;
|
|
42
44
|
dom: HTMLElement;
|
|
43
|
-
rootElement?: HTMLElement;
|
|
45
|
+
rootElement?: HTMLElement | null;
|
|
44
46
|
loadOnDemand?: boolean;
|
|
45
47
|
done: (pdfPages: PDFPageProxy[]) => void;
|
|
46
48
|
error: ErrorFn;
|
|
49
|
+
enableAnnotations: boolean;
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* @hidden
|
|
50
53
|
*/
|
|
51
54
|
export declare const DEFAULT_ZOOM_LEVEL = 1.25;
|
|
55
|
+
export declare const scale: () => number;
|
|
56
|
+
export declare const parsePdfFromBase64String: (base64String: string) => string;
|
|
52
57
|
/**
|
|
53
58
|
* @hidden
|
|
54
59
|
*/
|
|
@@ -72,6 +77,12 @@ export declare const reloadDocument: (params: PDFReloadParameters) => void;
|
|
|
72
77
|
* @hidden
|
|
73
78
|
*/
|
|
74
79
|
export declare const print: (pages: PDFPageProxy[], done: () => void, error: ErrorFn) => void;
|
|
80
|
+
export declare const createElement: <T>(name: string, className: string, styles: {
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
}) => T;
|
|
83
|
+
export declare const transforms: {
|
|
84
|
+
[rotation: string]: string;
|
|
85
|
+
};
|
|
75
86
|
export declare const renderPage: (page: PDFPageProxy, emptyPage: any, error: ErrorFn) => any;
|
|
76
87
|
/**
|
|
77
88
|
* @hidden
|
|
@@ -99,3 +110,16 @@ export declare const scrollToPage: (rootElement: HTMLElement, pageNumber: number
|
|
|
99
110
|
* @returns The page number.
|
|
100
111
|
*/
|
|
101
112
|
export declare const currentPage: (rootElement: HTMLElement) => number;
|
|
113
|
+
/**
|
|
114
|
+
* @hidden
|
|
115
|
+
*
|
|
116
|
+
* related to https://github.com/telerik/kendo-pdfviewer-common/issues/6
|
|
117
|
+
* the bigger the canvas size, the worse the performance;
|
|
118
|
+
* if initial size after scaling is greater than browser limits,
|
|
119
|
+
* we are limiting it to the limits, then halving it for performance.
|
|
120
|
+
*/
|
|
121
|
+
export declare const adjustCanvasSize: (targetWidth: number, targetHeight: number) => {
|
|
122
|
+
adjustedWidth: number;
|
|
123
|
+
adjustedHeight: number;
|
|
124
|
+
adjustRatio: number;
|
|
125
|
+
};
|
package/dist/npm/utils.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.currentPage = exports.scrollToPage = exports.calculateZoomLevel = exports.goToPreviousSearchMatch = exports.goToNextSearchMatch = exports.renderPage = exports.print = exports.reloadDocument = exports.loadPDF = exports.download = exports.removeChildren = exports.DEFAULT_ZOOM_LEVEL = void 0;
|
|
3
|
+
exports.adjustCanvasSize = exports.currentPage = exports.scrollToPage = exports.calculateZoomLevel = exports.goToPreviousSearchMatch = exports.goToNextSearchMatch = exports.renderPage = exports.transforms = exports.createElement = exports.print = exports.reloadDocument = exports.loadPDF = exports.download = exports.removeChildren = exports.parsePdfFromBase64String = exports.scale = exports.DEFAULT_ZOOM_LEVEL = void 0;
|
|
4
4
|
const kendo_file_saver_1 = require("@progress/kendo-file-saver");
|
|
5
5
|
const kendo_common_1 = require("@progress/kendo-common");
|
|
6
6
|
const pdf_mjs_1 = require("pdfjs-dist/legacy/build/pdf.mjs");
|
|
7
|
+
const annotations_1 = require("./annotations");
|
|
7
8
|
const MAX_CANVAS_WIDTH_HEIGHT_CHROME = 65535;
|
|
8
9
|
const MAX_CANVAS_AREA_CHROME_SAFARI = 268435456;
|
|
9
10
|
const MAX_CANVAS_WIDTH_HEIGHT_FIREFOX = 32767;
|
|
@@ -27,16 +28,18 @@ const isFirefox = (userAgent) => {
|
|
|
27
28
|
*/
|
|
28
29
|
exports.DEFAULT_ZOOM_LEVEL = 1.25;
|
|
29
30
|
const scale = () => (isIOS() ? devicePixelRatio : devicePixelRatio * 3);
|
|
31
|
+
exports.scale = scale;
|
|
30
32
|
const parsePdfFromBase64String = (base64String) => {
|
|
31
33
|
return atob(base64String.replace(/^(data:application\/pdf;base64,)/gi, ''));
|
|
32
34
|
};
|
|
35
|
+
exports.parsePdfFromBase64String = parsePdfFromBase64String;
|
|
33
36
|
const getDocumentParameters = (options) => {
|
|
34
37
|
let params = {
|
|
35
38
|
verbosity: 0,
|
|
36
39
|
isEvalSupported: false
|
|
37
40
|
};
|
|
38
41
|
if (typeof options.data === 'string') {
|
|
39
|
-
params.data = parsePdfFromBase64String(options.data);
|
|
42
|
+
params.data = (0, exports.parsePdfFromBase64String)(options.data);
|
|
40
43
|
}
|
|
41
44
|
else if (typeof options.url === 'string') {
|
|
42
45
|
params.url = options.url;
|
|
@@ -88,7 +91,7 @@ exports.download = download;
|
|
|
88
91
|
*/
|
|
89
92
|
const loadPDF = (options) => {
|
|
90
93
|
const params = getDocumentParameters(options);
|
|
91
|
-
const { dom, zoom, done, error } = options;
|
|
94
|
+
const { dom, zoom, done, error, rootElement, enableAnnotations } = options;
|
|
92
95
|
const loadOnDemandPageSize = options.loadOnDemandPageSize || 2;
|
|
93
96
|
(0, pdf_mjs_1.getDocument)(params)
|
|
94
97
|
.promise.then((pdfDoc) => {
|
|
@@ -100,7 +103,7 @@ const loadPDF = (options) => {
|
|
|
100
103
|
}).then(({ pages, pdfDoc }) => {
|
|
101
104
|
Promise.all(pages)
|
|
102
105
|
.then((all) => all.map((page, i) => {
|
|
103
|
-
const emptyPage = createEmptyPage(page, zoom);
|
|
106
|
+
const emptyPage = createEmptyPage(page, zoom, pdfDoc, enableAnnotations, rootElement);
|
|
104
107
|
appendPage(dom, emptyPage.pageElement, i);
|
|
105
108
|
if (options.loadOnDemand) {
|
|
106
109
|
// If LOD is enabled, render the first two(default) or X pages initially.
|
|
@@ -140,7 +143,7 @@ exports.loadPDF = loadPDF;
|
|
|
140
143
|
* @hidden
|
|
141
144
|
*/
|
|
142
145
|
const reloadDocument = (params) => {
|
|
143
|
-
const { pdfDoc, zoom, dom, done, error, loadOnDemand, rootElement } = params;
|
|
146
|
+
const { pdfDoc, zoom, dom, done, error, loadOnDemand, rootElement, enableAnnotations } = params;
|
|
144
147
|
const pages = [];
|
|
145
148
|
let currentPageIndex = 0;
|
|
146
149
|
// Save the index of the current page in view before we reload the document.
|
|
@@ -154,7 +157,7 @@ const reloadDocument = (params) => {
|
|
|
154
157
|
.then((all) => all.map((page, i) => {
|
|
155
158
|
// Set 'rendered' back to false so that the pages can be re-rendered when scrolling.
|
|
156
159
|
page._pageInfo.rendered = false;
|
|
157
|
-
const emptyPage = createEmptyPage(page, zoom);
|
|
160
|
+
const emptyPage = createEmptyPage(page, zoom, pdfDoc, enableAnnotations, rootElement);
|
|
158
161
|
appendPage(dom, emptyPage.pageElement, i);
|
|
159
162
|
// If on demand is not enabled, proceed as usual.
|
|
160
163
|
if (!loadOnDemand) {
|
|
@@ -182,7 +185,7 @@ exports.reloadDocument = reloadDocument;
|
|
|
182
185
|
const print = (pages, done, error) => {
|
|
183
186
|
const dom = document.createElement('div');
|
|
184
187
|
const allDone = pages.map(() => false);
|
|
185
|
-
const scaleNum = scale();
|
|
188
|
+
const scaleNum = (0, exports.scale)();
|
|
186
189
|
pages.forEach((page, index) => {
|
|
187
190
|
const viewport = renderCanvas(page, (el) => {
|
|
188
191
|
dom.appendChild(el);
|
|
@@ -219,13 +222,17 @@ const openPrintDialog = (dom, width, height, done, onError) => {
|
|
|
219
222
|
printDialog.addEventListener('afterprint', onAfterPrint);
|
|
220
223
|
}
|
|
221
224
|
};
|
|
222
|
-
const createEmptyPage = (page, zoom) => {
|
|
225
|
+
const createEmptyPage = (page, zoom, pdfDoc, enableAnnotations, rootElement) => {
|
|
223
226
|
const { canvasContext, viewport, pageElement, styles } = createCanvas(page, zoom, 'k-page');
|
|
224
227
|
return {
|
|
225
228
|
canvasContext,
|
|
226
229
|
viewport,
|
|
227
230
|
pageElement,
|
|
228
|
-
styles
|
|
231
|
+
styles,
|
|
232
|
+
zoom,
|
|
233
|
+
pdfDoc,
|
|
234
|
+
enableAnnotations,
|
|
235
|
+
rootElement
|
|
229
236
|
};
|
|
230
237
|
};
|
|
231
238
|
const renderCanvas = (page, done, error) => {
|
|
@@ -251,19 +258,20 @@ const createElement = function (name, className, styles) {
|
|
|
251
258
|
Object.keys(styles).forEach((key) => (element.style[key] = styles[key]));
|
|
252
259
|
return element;
|
|
253
260
|
};
|
|
254
|
-
|
|
261
|
+
exports.createElement = createElement;
|
|
262
|
+
exports.transforms = {
|
|
255
263
|
'0': '',
|
|
256
264
|
'90': 'rotate(90deg) translateY(-100%)',
|
|
257
265
|
'180': 'rotate(180deg) translate(-100%, -100%)',
|
|
258
266
|
'270': 'rotate(270deg) translateX(-100%)'
|
|
259
267
|
};
|
|
260
268
|
const renderPage = (page, emptyPage, error) => {
|
|
261
|
-
const { canvasContext, viewport, pageElement, styles } = emptyPage;
|
|
269
|
+
const { canvasContext, viewport, pageElement, styles, zoom, pdfDoc, enableAnnotations, rootElement } = emptyPage;
|
|
262
270
|
page._pageInfo.renderInProgress = true;
|
|
263
271
|
page.render({ canvasContext, viewport })
|
|
264
272
|
.promise.then(() => {
|
|
265
273
|
page.getTextContent().then((textContent) => {
|
|
266
|
-
const textLayer = createElement('div', 'k-text-layer', styles);
|
|
274
|
+
const textLayer = (0, exports.createElement)('div', 'k-text-layer', styles);
|
|
267
275
|
new pdf_mjs_1.TextLayer({
|
|
268
276
|
textContentSource: textContent,
|
|
269
277
|
container: textLayer,
|
|
@@ -272,8 +280,8 @@ const renderPage = (page, emptyPage, error) => {
|
|
|
272
280
|
textLayer.style.width = textLayer.style.width.replace(/px/g, 'pt');
|
|
273
281
|
textLayer.style.height = textLayer.style.height.replace(/px/g, 'pt');
|
|
274
282
|
const rotation = textLayer.getAttribute('data-main-rotation') || '0';
|
|
275
|
-
if (transforms[rotation]) {
|
|
276
|
-
textLayer.style.transform = transforms[rotation];
|
|
283
|
+
if (exports.transforms[rotation]) {
|
|
284
|
+
textLayer.style.transform = exports.transforms[rotation];
|
|
277
285
|
textLayer.style.transformOrigin = 'top left';
|
|
278
286
|
}
|
|
279
287
|
textLayer.querySelectorAll('span').forEach((el) => {
|
|
@@ -281,9 +289,32 @@ const renderPage = (page, emptyPage, error) => {
|
|
|
281
289
|
el.style.fontSize = el.style.fontSize.replace(/px/g, 'pt');
|
|
282
290
|
}
|
|
283
291
|
});
|
|
284
|
-
pageElement.
|
|
292
|
+
pageElement.prepend(textLayer); // Use prepend to ensure the element is always inserted before the annotation layer.
|
|
285
293
|
}).catch(error);
|
|
286
294
|
});
|
|
295
|
+
if (enableAnnotations) {
|
|
296
|
+
page.getAnnotations({ intent: 'display' }).then((annotations) => {
|
|
297
|
+
const annotationLayer = (0, exports.createElement)('div', 'k-annotations-layer', {
|
|
298
|
+
position: 'absolute',
|
|
299
|
+
top: '0',
|
|
300
|
+
left: '0',
|
|
301
|
+
overflow: 'hidden',
|
|
302
|
+
height: styles.height,
|
|
303
|
+
width: styles.width,
|
|
304
|
+
pointerEvents: 'none'
|
|
305
|
+
});
|
|
306
|
+
pageElement.appendChild(annotationLayer);
|
|
307
|
+
for (const annotation of annotations) {
|
|
308
|
+
switch (annotation.subtype) {
|
|
309
|
+
case 'Link':
|
|
310
|
+
new annotations_1.LinkAnnotation(annotationLayer, viewport, annotation, pdfDoc, zoom, rootElement);
|
|
311
|
+
break;
|
|
312
|
+
default:
|
|
313
|
+
null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
287
318
|
})
|
|
288
319
|
.then(() => {
|
|
289
320
|
page._pageInfo.rendered = true;
|
|
@@ -441,16 +472,17 @@ const adjustCanvasSize = (targetWidth, targetHeight) => {
|
|
|
441
472
|
adjustRatio: adjustRatio !== 1 ? adjustRatio / 2 : 1
|
|
442
473
|
};
|
|
443
474
|
};
|
|
475
|
+
exports.adjustCanvasSize = adjustCanvasSize;
|
|
444
476
|
const createCanvas = (page, zoom = 1, cssClass = '') => {
|
|
445
|
-
const scaleNum = scale();
|
|
477
|
+
const scaleNum = (0, exports.scale)();
|
|
446
478
|
const viewport = page.getViewport({ scale: scaleNum });
|
|
447
|
-
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
479
|
+
const { adjustedWidth, adjustedHeight, adjustRatio } = (0, exports.adjustCanvasSize)(viewport.width, viewport.height);
|
|
448
480
|
const styles = {
|
|
449
481
|
width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
450
482
|
height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
451
483
|
};
|
|
452
|
-
const pageElement = createElement('div', cssClass, styles);
|
|
453
|
-
const canvas = createElement('canvas', '', {
|
|
484
|
+
const pageElement = (0, exports.createElement)('div', cssClass, styles);
|
|
485
|
+
const canvas = (0, exports.createElement)('canvas', '', {
|
|
454
486
|
width: '100%',
|
|
455
487
|
height: '100%'
|
|
456
488
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { PDFPageProxy } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
2
|
+
import { TextAccessibilityManager } from "../annotations/helpers/text-accessibility-manager";
|
|
3
|
+
import { Component } from "../common/component";
|
|
4
|
+
import { TextLayerBuilder } from "../text/text-layer-builder";
|
|
5
|
+
import { AnnotationLayerBuilder } from "../annotations/annotation-layer-builder";
|
|
6
|
+
import { DrawLayerBuilder } from "../annotations/draw-layer-builder";
|
|
7
|
+
import { AnnotationEditorLayerBuilder } from "../annotations/annotation-editor-layer-builder";
|
|
8
|
+
import { PdfViewer } from "./pdfviewer";
|
|
9
|
+
import { EventBus } from "../annotations/shared/event_utils";
|
|
10
|
+
export declare class Page extends Component {
|
|
11
|
+
#private;
|
|
12
|
+
eventBus: EventBus;
|
|
13
|
+
zoomLayer: any;
|
|
14
|
+
div: any;
|
|
15
|
+
viewport: any;
|
|
16
|
+
id: any;
|
|
17
|
+
_accessibilityManager: TextAccessibilityManager;
|
|
18
|
+
_annotationCanvasMap: any;
|
|
19
|
+
renderTask: any;
|
|
20
|
+
pdfPageRotate: any;
|
|
21
|
+
rotation: any;
|
|
22
|
+
scale: number;
|
|
23
|
+
pdfViewer: PdfViewer;
|
|
24
|
+
xfaLayer: any;
|
|
25
|
+
element: HTMLDivElement;
|
|
26
|
+
canvas: any;
|
|
27
|
+
canvasForPrint: any;
|
|
28
|
+
textLayer: TextLayerBuilder;
|
|
29
|
+
textLayerBuilder: TextLayerBuilder;
|
|
30
|
+
textAccessibilityManager: TextAccessibilityManager;
|
|
31
|
+
annotationLayer: AnnotationLayerBuilder;
|
|
32
|
+
drawLayer: DrawLayerBuilder;
|
|
33
|
+
annotationEditorLayer: AnnotationEditorLayerBuilder;
|
|
34
|
+
options: any;
|
|
35
|
+
state: any;
|
|
36
|
+
pdfPage: PDFPageProxy;
|
|
37
|
+
constructor(element: any, options: any);
|
|
38
|
+
destroy(): void;
|
|
39
|
+
get isEditing(): boolean;
|
|
40
|
+
get rawWidth(): any;
|
|
41
|
+
get rawHeight(): any;
|
|
42
|
+
setState(newState: any): void;
|
|
43
|
+
resetState(): void;
|
|
44
|
+
initScale(): void;
|
|
45
|
+
createPromise(): Promise<any>;
|
|
46
|
+
getViewport(options?: {
|
|
47
|
+
scale: number;
|
|
48
|
+
}): import("pdfjs-dist/types/src/display/display_utils").PageViewport | {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
};
|
|
52
|
+
destroyTextLayer(): void;
|
|
53
|
+
removeTextLayer(): void;
|
|
54
|
+
getPrintContentAsync(): Promise<any>;
|
|
55
|
+
loadForPrintAsync({ zoomLevel, force }: {
|
|
56
|
+
zoomLevel?: number;
|
|
57
|
+
force?: boolean;
|
|
58
|
+
}): any;
|
|
59
|
+
renderForPrintAsync(): Promise<void>;
|
|
60
|
+
isBlank(): string;
|
|
61
|
+
setBlank(isBlank: any): void;
|
|
62
|
+
get renderingState(): number;
|
|
63
|
+
setPdfPage(pdfPage: any): void;
|
|
64
|
+
hasEditableAnnotations(): boolean;
|
|
65
|
+
_resetZoomLayer(removeFromDOM?: boolean): void;
|
|
66
|
+
reset({ keepZoomLayer, keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, }?: {
|
|
67
|
+
keepZoomLayer?: boolean;
|
|
68
|
+
keepAnnotationLayer?: boolean;
|
|
69
|
+
keepAnnotationEditorLayer?: boolean;
|
|
70
|
+
keepXfaLayer?: boolean;
|
|
71
|
+
keepTextLayer?: boolean;
|
|
72
|
+
}): void;
|
|
73
|
+
toggleEditingMode(isEditing: any): void;
|
|
74
|
+
draw(): Promise<void>;
|
|
75
|
+
}
|