@progress/kendo-pdfviewer-common 0.4.2-develop.1 → 0.5.0-develop.2
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 +6 -1
- package/dist/es/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/es/annotations/annotation-layer-builder.js +14 -4
- package/dist/es/annotations/annotation-layer.js +358 -337
- package/dist/es/annotations/draw-layer-builder.js +5 -1
- package/dist/es/annotations/helpers/annotation-storage.js +14 -0
- package/dist/es/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es/annotations/shared/event_utils.js +6 -0
- package/dist/es/text/text-layer-builder.js +13 -1
- package/dist/es/utils.js +3 -2
- package/dist/es/widget/page.js +22 -0
- package/dist/es/widget/pdfviewer.js +24 -13
- package/dist/es2015/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/es2015/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/es2015/annotations/annotation-layer-builder.js +14 -4
- package/dist/es2015/annotations/annotation-layer.js +358 -337
- package/dist/es2015/annotations/draw-layer-builder.js +5 -1
- package/dist/es2015/annotations/helpers/annotation-storage.js +14 -0
- package/dist/es2015/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es2015/annotations/shared/event_utils.js +6 -0
- package/dist/es2015/text/text-layer-builder.js +13 -1
- package/dist/es2015/utils.js +3 -2
- package/dist/es2015/widget/page.js +22 -0
- package/dist/es2015/widget/pdfviewer.js +24 -13
- package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +3 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.js +25 -0
- package/dist/npm/annotations/annotation-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer-builder.js +14 -4
- package/dist/npm/annotations/annotation-layer.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer.js +358 -337
- package/dist/npm/annotations/draw-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/draw-layer-builder.js +5 -1
- package/dist/npm/annotations/helpers/annotation-storage.d.ts +10 -0
- package/dist/npm/annotations/helpers/annotation-storage.js +14 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +1 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/npm/annotations/shared/event_utils.d.ts +4 -0
- package/dist/npm/annotations/shared/event_utils.js +6 -0
- package/dist/npm/text/text-layer-builder.d.ts +3 -1
- package/dist/npm/text/text-layer-builder.js +13 -1
- package/dist/npm/utils.d.ts +1 -0
- package/dist/npm/utils.js +5 -3
- package/dist/npm/widget/page.js +22 -0
- package/dist/npm/widget/pdfviewer.d.ts +1 -0
- package/dist/npm/widget/pdfviewer.js +23 -12
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DrawLayer } from "./draw-layer";
|
|
1
2
|
/**
|
|
2
3
|
* @typedef {Object} DrawLayerBuilderOptions
|
|
3
4
|
* @property {number} pageIndex
|
|
@@ -16,6 +17,7 @@ declare class DrawLayerBuilder {
|
|
|
16
17
|
render(intent?: string): Promise<void>;
|
|
17
18
|
cancel(): void;
|
|
18
19
|
setParent(parent: any): void;
|
|
19
|
-
getDrawLayer():
|
|
20
|
+
getDrawLayer(): DrawLayer;
|
|
21
|
+
destroy(): void;
|
|
20
22
|
}
|
|
21
23
|
export { DrawLayerBuilder };
|
|
@@ -50,10 +50,11 @@ class DrawLayerBuilder {
|
|
|
50
50
|
}
|
|
51
51
|
cancel() {
|
|
52
52
|
// this._cancelled = true;
|
|
53
|
+
var _a;
|
|
53
54
|
if (!tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
|
|
57
|
+
(_a = tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
57
58
|
tslib_1.__classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
|
|
58
59
|
}
|
|
59
60
|
setParent(parent) {
|
|
@@ -63,6 +64,9 @@ class DrawLayerBuilder {
|
|
|
63
64
|
getDrawLayer() {
|
|
64
65
|
return tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
|
|
65
66
|
}
|
|
67
|
+
destroy() {
|
|
68
|
+
this.cancel();
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
exports.DrawLayerBuilder = DrawLayerBuilder;
|
|
68
72
|
_DrawLayerBuilder_drawLayer = new WeakMap();
|
|
@@ -12,6 +12,16 @@ declare class AnnotationStorage {
|
|
|
12
12
|
onResetModified: any;
|
|
13
13
|
onAnnotationEditor: any;
|
|
14
14
|
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Get the value for the storage - used purely for debugging purposes.
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
getStorage(): Map<any, any>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the modified flag for the storage - used purely for debugging purposes.
|
|
22
|
+
* @returns {Object}
|
|
23
|
+
*/
|
|
24
|
+
getModified(): boolean;
|
|
15
25
|
/**
|
|
16
26
|
* Get the value for a given key if it exists, or return the default value.
|
|
17
27
|
* @param {string} key
|
|
@@ -49,6 +49,20 @@ class AnnotationStorage {
|
|
|
49
49
|
this.onResetModified = null;
|
|
50
50
|
this.onAnnotationEditor = null;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the value for the storage - used purely for debugging purposes.
|
|
54
|
+
* @returns {Object}
|
|
55
|
+
*/
|
|
56
|
+
getStorage() {
|
|
57
|
+
return tslib_1.__classPrivateFieldGet(this, _AnnotationStorage_storage, "f");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the modified flag for the storage - used purely for debugging purposes.
|
|
61
|
+
* @returns {Object}
|
|
62
|
+
*/
|
|
63
|
+
getModified() {
|
|
64
|
+
return tslib_1.__classPrivateFieldGet(this, _AnnotationStorage_modified, "f");
|
|
65
|
+
}
|
|
52
66
|
/**
|
|
53
67
|
* Get the value for a given key if it exists, or return the default value.
|
|
54
68
|
* @param {string} key
|
|
@@ -32,5 +32,6 @@ declare class TextAccessibilityManager {
|
|
|
32
32
|
* @returns {string|null} The id in the struct tree if any.
|
|
33
33
|
*/
|
|
34
34
|
moveElementInDOM(container: any, element: any, contentElement: any, isRemovable: any): any;
|
|
35
|
+
destroy(): void;
|
|
35
36
|
}
|
|
36
37
|
export { TextAccessibilityManager };
|
|
@@ -181,6 +181,11 @@ class TextAccessibilityManager {
|
|
|
181
181
|
}
|
|
182
182
|
return id;
|
|
183
183
|
}
|
|
184
|
+
destroy() {
|
|
185
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_textNodes, new Map(), "f");
|
|
186
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_waitingElements, new Map(), "f");
|
|
187
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_textChildren, null, "f");
|
|
188
|
+
}
|
|
184
189
|
}
|
|
185
190
|
exports.TextAccessibilityManager = TextAccessibilityManager;
|
|
186
191
|
_a = TextAccessibilityManager, _TextAccessibilityManager_enabled = new WeakMap(), _TextAccessibilityManager_textChildren = new WeakMap(), _TextAccessibilityManager_textNodes = new WeakMap(), _TextAccessibilityManager_waitingElements = new WeakMap(), _TextAccessibilityManager_instances = new WeakSet(), _TextAccessibilityManager_compareElementPositions = function _TextAccessibilityManager_compareElementPositions(e1, e2) {
|
|
@@ -67,6 +67,12 @@ class EventBus {
|
|
|
67
67
|
constructor() {
|
|
68
68
|
_EventBus_listeners.set(this, Object.create(null));
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Returs the current event listeners - used purely for debugging purposes.
|
|
72
|
+
*/
|
|
73
|
+
getListeners() {
|
|
74
|
+
return tslib_1.__classPrivateFieldGet(this, _EventBus_listeners, "f");
|
|
75
|
+
}
|
|
70
76
|
/**
|
|
71
77
|
* @param {string} eventName
|
|
72
78
|
* @param {function} listener
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextAccessibilityManager } from "../annotations/helpers/text-accessibility-manager";
|
|
1
2
|
/**
|
|
2
3
|
* The text layer builder provides text selection functionality for the PDF.
|
|
3
4
|
* It does this by creating overlay divs over the PDF's text. These divs
|
|
@@ -7,7 +8,7 @@ declare class TextLayerBuilder {
|
|
|
7
8
|
#private;
|
|
8
9
|
pdfPage: any;
|
|
9
10
|
div: any;
|
|
10
|
-
accessibilityManager:
|
|
11
|
+
accessibilityManager: TextAccessibilityManager;
|
|
11
12
|
constructor({ pdfPage, accessibilityManager, styles, onAppend }: {
|
|
12
13
|
pdfPage: any;
|
|
13
14
|
accessibilityManager: any;
|
|
@@ -26,5 +27,6 @@ declare class TextLayerBuilder {
|
|
|
26
27
|
* Cancel rendering of the text layer.
|
|
27
28
|
*/
|
|
28
29
|
cancel(): void;
|
|
30
|
+
destroy(): void;
|
|
29
31
|
}
|
|
30
32
|
export { TextLayerBuilder };
|
|
@@ -127,13 +127,25 @@ class TextLayerBuilder {
|
|
|
127
127
|
* Cancel rendering of the text layer.
|
|
128
128
|
*/
|
|
129
129
|
cancel() {
|
|
130
|
-
var _b, _c;
|
|
130
|
+
var _b, _c, _d;
|
|
131
131
|
(_b = tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
132
132
|
tslib_1.__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
133
133
|
// this.highlighter?.disable();
|
|
134
134
|
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
135
|
+
(_d = this.accessibilityManager) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
135
136
|
tslib_1.__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
136
137
|
}
|
|
138
|
+
destroy() {
|
|
139
|
+
var _b, _c;
|
|
140
|
+
pdf_mjs_1.TextLayer.cleanup();
|
|
141
|
+
this.cancel();
|
|
142
|
+
this.pdfPage = null;
|
|
143
|
+
// this.highlighter = null;
|
|
144
|
+
(_b = this.accessibilityManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
145
|
+
this.accessibilityManager = null;
|
|
146
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
147
|
+
this.div = null;
|
|
148
|
+
}
|
|
137
149
|
}
|
|
138
150
|
exports.TextLayerBuilder = TextLayerBuilder;
|
|
139
151
|
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
package/dist/npm/utils.d.ts
CHANGED
package/dist/npm/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.getDevicePixelRatio = 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");
|
|
@@ -415,10 +415,10 @@ exports.scrollToPage = scrollToPage;
|
|
|
415
415
|
*/
|
|
416
416
|
const currentPage = (rootElement) => {
|
|
417
417
|
const scrollElement = rootElement.querySelector('.k-pdf-viewer-canvas');
|
|
418
|
-
const page = rootElement.querySelector('.k-page');
|
|
418
|
+
const page = rootElement.querySelector('.k-page:not(.k-blank-page)');
|
|
419
419
|
return scrollElement && page
|
|
420
420
|
? Math.floor(Math.round(scrollElement.scrollTop) /
|
|
421
|
-
(page.offsetHeight + page.offsetTop) +
|
|
421
|
+
Math.max(1, page.offsetHeight + page.offsetTop) +
|
|
422
422
|
0.01)
|
|
423
423
|
: 0;
|
|
424
424
|
};
|
|
@@ -500,3 +500,5 @@ const createCanvas = (page, zoom = 1, cssClass = '') => {
|
|
|
500
500
|
styles
|
|
501
501
|
};
|
|
502
502
|
};
|
|
503
|
+
const getDevicePixelRatio = () => (window === null || window === void 0 ? void 0 : window.devicePixelRatio) || 1;
|
|
504
|
+
exports.getDevicePixelRatio = getDevicePixelRatio;
|
package/dist/npm/widget/page.js
CHANGED
|
@@ -92,12 +92,31 @@ class Page extends component_1.Component {
|
|
|
92
92
|
// todo: ported from pdf.js
|
|
93
93
|
this.pdfViewer = options.pdfViewer;
|
|
94
94
|
this.pdfPage = options.pdfPage;
|
|
95
|
+
tslib_1.__classPrivateFieldSet(this, _Page_annotationMode, this.pdfViewer.getAnnotationMode(), "f");
|
|
95
96
|
this.resetState();
|
|
96
97
|
}
|
|
97
98
|
destroy() {
|
|
99
|
+
var _a, _b, _c, _d, _e;
|
|
98
100
|
this.destroyTextLayer();
|
|
101
|
+
if (this.canvas) {
|
|
102
|
+
this.canvas.width = 0;
|
|
103
|
+
this.canvas.height = 0;
|
|
104
|
+
this.canvas.remove();
|
|
105
|
+
this.canvas = null;
|
|
106
|
+
}
|
|
107
|
+
if (this.canvasForPrint) {
|
|
108
|
+
this.canvasForPrint.width = 0;
|
|
109
|
+
this.canvasForPrint.height = 0;
|
|
110
|
+
this.canvasForPrint.remove();
|
|
111
|
+
this.canvasForPrint = null;
|
|
112
|
+
}
|
|
113
|
+
(_a = this.drawLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
114
|
+
(_b = this.annotationLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
115
|
+
(_c = this.annotationEditorLayer) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
116
|
+
(_d = this.div) === null || _d === void 0 ? void 0 : _d.remove();
|
|
99
117
|
this.div = null;
|
|
100
118
|
this.pdfViewer = null;
|
|
119
|
+
(_e = this.pdfPage) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
101
120
|
this.pdfPage = null;
|
|
102
121
|
}
|
|
103
122
|
get isEditing() {
|
|
@@ -128,6 +147,9 @@ class Page extends component_1.Component {
|
|
|
128
147
|
return viewport;
|
|
129
148
|
}
|
|
130
149
|
destroyTextLayer() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_a = this.textLayer) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
152
|
+
(_b = this.textLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
131
153
|
this.removeTextLayer();
|
|
132
154
|
this.textLayer = null;
|
|
133
155
|
}
|
|
@@ -39,6 +39,7 @@ export declare class PdfViewer extends Component {
|
|
|
39
39
|
set annotationEditorParams({ type, value }: any);
|
|
40
40
|
get annotationEditorMode(): any;
|
|
41
41
|
set annotationEditorMode({ mode, editId, isFromKeyboard }: any);
|
|
42
|
+
getAnnotationMode(): number;
|
|
42
43
|
getPrintUnits(): number;
|
|
43
44
|
extendOptions(options: any): void;
|
|
44
45
|
setOptions(options: any): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
2
|
+
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_annotationMode, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.PdfViewer = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -52,6 +52,7 @@ class PdfViewer extends main_1.Component {
|
|
|
52
52
|
zoomLevel: DEFAULT_ZOOM_LEVEL,
|
|
53
53
|
zoomBeforePrint: false,
|
|
54
54
|
zoomLevelForPrint: 3,
|
|
55
|
+
renderForms: false,
|
|
55
56
|
searchMatchScrollLeftOffset: 0,
|
|
56
57
|
// add some default offset, so that the found match
|
|
57
58
|
// does not appear on the top edge of the page when navigated to
|
|
@@ -63,6 +64,7 @@ class PdfViewer extends main_1.Component {
|
|
|
63
64
|
pageWheelThrottleDelay: 200,
|
|
64
65
|
// ported from pdf.js
|
|
65
66
|
printResolution: 100,
|
|
67
|
+
renderScale: 1.4,
|
|
66
68
|
loadOnDemand: false,
|
|
67
69
|
loadOnDemandPageSize: 2,
|
|
68
70
|
messages: {
|
|
@@ -124,7 +126,7 @@ class PdfViewer extends main_1.Component {
|
|
|
124
126
|
// #annotationEditorHighlightColors = null;
|
|
125
127
|
// #annotationEditorMode = AnnotationEditorType.NONE;
|
|
126
128
|
// #annotationEditorUIManager = null;
|
|
127
|
-
|
|
129
|
+
_PdfViewer_annotationMode.set(this, utils_2.AnnotationMode.ENABLE);
|
|
128
130
|
// #containerTopLeft = null;
|
|
129
131
|
// #enableHWA = false;
|
|
130
132
|
// #enableHighlightFloatingButton = false;
|
|
@@ -184,7 +186,7 @@ class PdfViewer extends main_1.Component {
|
|
|
184
186
|
// as this can only be obtained by JS
|
|
185
187
|
this.tryTriggerScroll = (e) => {
|
|
186
188
|
let isPageChanged = false;
|
|
187
|
-
const pageNumber =
|
|
189
|
+
const pageNumber = this.getCurrentPageIndex() + 1;
|
|
188
190
|
if (pageNumber !== this.state.activePageNumber && (pageNumber >= 1 && pageNumber <= this.state.pdfDocument.numPages)) {
|
|
189
191
|
isPageChanged = true;
|
|
190
192
|
this.state.activePageNumber = pageNumber;
|
|
@@ -221,6 +223,7 @@ class PdfViewer extends main_1.Component {
|
|
|
221
223
|
return;
|
|
222
224
|
}
|
|
223
225
|
e.preventDefault();
|
|
226
|
+
e.stopPropagation();
|
|
224
227
|
const wheelDelta = (0, main_1.mousewheelDelta)(e);
|
|
225
228
|
const zoomModifier = wheelDelta < 0 ? 1 : -1;
|
|
226
229
|
const zoomLevel = this.state.zoomLevel + (zoomModifier * this.options.zoomRate);
|
|
@@ -239,6 +242,8 @@ class PdfViewer extends main_1.Component {
|
|
|
239
242
|
this.wrapper = this.element;
|
|
240
243
|
this.initEventBus();
|
|
241
244
|
tslib_1.__classPrivateFieldSet(this, _PdfViewer_eventAbortController, new AbortController(), "f");
|
|
245
|
+
if (this.options.renderForms)
|
|
246
|
+
tslib_1.__classPrivateFieldSet(this, _PdfViewer_annotationMode, utils_2.AnnotationMode.ENABLE_FORMS, "f");
|
|
242
247
|
this.resetState();
|
|
243
248
|
this.bindEvents();
|
|
244
249
|
this.initLinkService();
|
|
@@ -329,6 +334,9 @@ class PdfViewer extends main_1.Component {
|
|
|
329
334
|
}
|
|
330
335
|
updater();
|
|
331
336
|
}
|
|
337
|
+
getAnnotationMode() {
|
|
338
|
+
return tslib_1.__classPrivateFieldGet(this, _PdfViewer_annotationMode, "f");
|
|
339
|
+
}
|
|
332
340
|
getPrintUnits() {
|
|
333
341
|
return this.options.printResolution / pdf_mjs_1.PixelsPerInch.PDF;
|
|
334
342
|
}
|
|
@@ -743,20 +751,15 @@ class PdfViewer extends main_1.Component {
|
|
|
743
751
|
if (zoom <= 0) {
|
|
744
752
|
return;
|
|
745
753
|
}
|
|
746
|
-
const renderScale = (0, utils_1.
|
|
754
|
+
const renderScale = this.options.renderScale * (0, utils_1.getDevicePixelRatio)();
|
|
747
755
|
let scaleNum = zoom * renderScale;
|
|
748
756
|
if (printUnits) {
|
|
749
757
|
scaleNum = zoom || renderScale;
|
|
750
758
|
}
|
|
751
|
-
// const scaleNum = zoom * renderScale;
|
|
752
759
|
// changing the viewport dimensions here requires changes in
|
|
753
760
|
// page.getPrintContentAsync for the printing dimensions
|
|
754
761
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
755
762
|
const { adjustedWidth, adjustedHeight, adjustRatio } = (0, utils_1.adjustCanvasSize)(viewport.width, viewport.height);
|
|
756
|
-
// const styles = {
|
|
757
|
-
// width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
758
|
-
// height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
759
|
-
// };
|
|
760
763
|
// use PageView.setLayerDimensions
|
|
761
764
|
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
762
765
|
const styles = {
|
|
@@ -854,7 +857,7 @@ class PdfViewer extends main_1.Component {
|
|
|
854
857
|
// optionalContentConfigPromise,
|
|
855
858
|
// renderingQueue: this.renderingQueue,
|
|
856
859
|
textLayerMode: ui_utils_1.TextLayerMode.ENABLE,
|
|
857
|
-
annotationMode:
|
|
860
|
+
annotationMode: this.getAnnotationMode(),
|
|
858
861
|
// imageResourcesPath: this.imageResourcesPath,
|
|
859
862
|
// maxCanvasPixels: this.maxCanvasPixels,
|
|
860
863
|
// pageColors,
|
|
@@ -943,8 +946,16 @@ class PdfViewer extends main_1.Component {
|
|
|
943
946
|
// and then revert
|
|
944
947
|
serializedAnnotationStorage = {};
|
|
945
948
|
originalAnnotationStorage = options.pdf.annotationStorage.getAll();
|
|
949
|
+
// With the form filling functionality enabled, values could be coming as pure JSON objects,
|
|
950
|
+
// thus the additional assertion.
|
|
946
951
|
Object.keys(originalAnnotationStorage).forEach((key) => {
|
|
947
|
-
|
|
952
|
+
var _a;
|
|
953
|
+
if (typeof ((_a = originalAnnotationStorage[key]) === null || _a === void 0 ? void 0 : _a.toJSON) === "function") {
|
|
954
|
+
serializedAnnotationStorage[key] = originalAnnotationStorage[key].toJSON();
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
serializedAnnotationStorage[key] = originalAnnotationStorage[key];
|
|
958
|
+
}
|
|
948
959
|
});
|
|
949
960
|
Object.keys(originalAnnotationStorage).forEach((key) => {
|
|
950
961
|
options.pdf.annotationStorage.remove(key);
|
|
@@ -1632,7 +1643,7 @@ class PdfViewer extends main_1.Component {
|
|
|
1632
1643
|
}
|
|
1633
1644
|
}
|
|
1634
1645
|
exports.PdfViewer = PdfViewer;
|
|
1635
|
-
_PdfViewer_annotationEditorMode = new WeakMap(), _PdfViewer_switchAnnotationEditorModeTimeoutId = new WeakMap(), _PdfViewer_eventAbortController = new WeakMap(), _PdfViewer_onPageRenderedCallback = new WeakMap(), _PdfViewer_instances = new WeakSet(), _PdfViewer_switchToEditAnnotationMode = function _PdfViewer_switchToEditAnnotationMode() {
|
|
1646
|
+
_PdfViewer_annotationEditorMode = new WeakMap(), _PdfViewer_switchAnnotationEditorModeTimeoutId = new WeakMap(), _PdfViewer_annotationMode = new WeakMap(), _PdfViewer_eventAbortController = new WeakMap(), _PdfViewer_onPageRenderedCallback = new WeakMap(), _PdfViewer_instances = new WeakSet(), _PdfViewer_switchToEditAnnotationMode = function _PdfViewer_switchToEditAnnotationMode() {
|
|
1636
1647
|
// const visible = this._getVisiblePages();
|
|
1637
1648
|
// const visible = this._getVisiblePages();
|
|
1638
1649
|
const pagesToRefresh = [];
|
package/package.json
CHANGED