pdfjs-dist 2.6.347 → 2.7.570
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/README.md +3 -3
- package/bower.json +1 -1
- package/build/pdf.js +2050 -1087
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +18219 -10436
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.d.ts +1 -0
- package/es5/build/pdf.js +6623 -6654
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.min.js +1 -1
- package/es5/build/pdf.worker.js +20815 -13888
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/build/pdf.worker.min.js +1 -1
- package/es5/image_decoders/pdf.image_decoders.js +3817 -4946
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -1
- package/es5/image_decoders/pdf.image_decoders.min.js +1 -1
- package/es5/web/pdf_viewer.css +18 -15
- package/es5/web/pdf_viewer.js +1094 -514
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +774 -168
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +556 -108
- package/lib/core/cff_parser.js +7 -1
- package/lib/core/charsets.js +1 -1
- package/lib/core/cmap.js +20 -1
- package/lib/core/core_utils.js +162 -3
- package/lib/core/crypto.js +1 -1
- package/lib/core/default_appearance.js +132 -0
- package/lib/core/document.js +115 -9
- package/lib/core/encodings.js +1 -1
- package/lib/core/evaluator.js +168 -74
- package/lib/core/fonts.js +97 -11
- package/lib/core/function.js +5 -10
- package/lib/core/glyphlist.js +11 -4529
- package/lib/core/image_utils.js +30 -1
- package/lib/core/jpg.js +1 -1
- package/lib/core/jpx.js +5 -5
- package/lib/core/murmurhash3.js +1 -1
- package/lib/core/obj.js +123 -39
- package/lib/core/pattern.js +4 -4
- package/lib/core/primitives.js +24 -5
- package/lib/core/standard_fonts.js +1 -1
- package/lib/core/stream.js +5 -1
- package/lib/core/unicode.js +15 -1387
- package/lib/core/worker.js +58 -17
- package/lib/core/writer.js +68 -4
- package/lib/display/annotation_layer.js +712 -119
- package/lib/display/annotation_storage.js +21 -4
- package/lib/display/api.js +88 -18
- package/lib/display/canvas.js +414 -375
- package/lib/display/display_utils.js +11 -4
- package/lib/display/fetch_stream.js +3 -3
- package/lib/display/font_loader.js +2 -3
- package/lib/display/metadata.js +54 -20
- package/lib/display/node_stream.js +1 -1
- package/lib/display/optional_content_config.js +1 -1
- package/lib/display/pattern_helper.js +109 -113
- package/lib/display/svg.js +5 -5
- package/lib/display/text_layer.js +54 -54
- package/lib/display/transport_stream.js +4 -4
- package/lib/display/webgl.js +65 -68
- package/lib/examples/node/domstubs.js +9 -4
- package/lib/pdf.js +2 -2
- package/lib/pdf.sandbox.js +311 -0
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/scripting_utils.js +84 -0
- package/lib/shared/util.js +129 -14
- package/lib/{display → shared}/xml_parser.js +112 -4
- package/lib/test/unit/annotation_spec.js +831 -109
- package/lib/test/unit/annotation_storage_spec.js +28 -10
- package/lib/test/unit/api_spec.js +190 -160
- package/lib/test/unit/bidi_spec.js +6 -6
- package/lib/test/unit/cff_parser_spec.js +73 -73
- package/lib/test/unit/clitests_helper.js +2 -0
- package/lib/test/unit/cmap_spec.js +48 -74
- package/lib/test/unit/core_utils_spec.js +34 -0
- package/lib/test/unit/crypto_spec.js +162 -199
- package/lib/test/unit/custom_spec.js +7 -18
- package/lib/test/unit/default_appearance_spec.js +54 -0
- package/lib/test/unit/display_svg_spec.js +24 -19
- package/lib/test/unit/display_utils_spec.js +1 -1
- package/lib/test/unit/document_spec.js +187 -20
- package/lib/test/unit/evaluator_spec.js +30 -30
- package/lib/test/unit/function_spec.js +165 -165
- package/lib/test/unit/jasmine-boot.js +52 -53
- package/lib/test/unit/metadata_spec.js +2 -2
- package/lib/test/unit/murmurhash3_spec.js +29 -16
- package/lib/test/unit/network_spec.js +21 -21
- package/lib/test/unit/pdf_find_controller_spec.js +131 -69
- package/lib/test/unit/pdf_find_utils_spec.js +10 -10
- package/lib/test/unit/scripting_spec.js +1104 -0
- package/lib/test/unit/stream_spec.js +8 -8
- package/lib/test/unit/test_utils.js +16 -19
- package/lib/test/unit/testreporter.js +11 -4
- package/lib/test/unit/type1_parser_spec.js +23 -23
- package/lib/test/unit/ui_utils_spec.js +78 -35
- package/lib/test/unit/unicode_spec.js +7 -7
- package/lib/test/unit/util_spec.js +26 -3
- package/lib/test/unit/writer_spec.js +16 -1
- package/lib/test/unit/xml_spec.js +117 -0
- package/lib/web/annotation_layer_builder.js +18 -6
- package/lib/web/app.js +579 -161
- package/lib/web/app_options.js +14 -0
- package/lib/web/base_tree_viewer.js +50 -0
- package/lib/web/base_viewer.js +350 -14
- package/lib/web/chromecom.js +9 -1
- package/lib/web/debugger.js +1 -2
- package/lib/web/download_manager.js +0 -15
- package/lib/web/firefox_print_service.js +6 -4
- package/lib/web/firefoxcom.js +84 -69
- package/lib/web/generic_scripting.js +55 -0
- package/lib/web/genericcom.js +9 -1
- package/lib/web/grab_to_pan.js +1 -1
- package/lib/web/interfaces.js +9 -3
- package/lib/web/pdf_attachment_viewer.js +1 -3
- package/lib/web/pdf_cursor_tools.js +20 -13
- package/lib/web/pdf_document_properties.js +48 -61
- package/lib/web/pdf_find_bar.js +1 -3
- package/lib/web/pdf_find_controller.js +58 -12
- package/lib/web/pdf_history.js +43 -21
- package/lib/web/pdf_layer_viewer.js +1 -9
- package/lib/web/pdf_link_service.js +108 -78
- package/lib/web/pdf_outline_viewer.js +166 -10
- package/lib/web/pdf_page_view.js +14 -14
- package/lib/web/pdf_presentation_mode.js +21 -31
- package/lib/web/pdf_rendering_queue.js +8 -1
- package/lib/web/pdf_sidebar.js +62 -107
- package/lib/web/pdf_sidebar_resizer.js +11 -21
- package/lib/web/pdf_single_page_viewer.js +8 -0
- package/lib/web/pdf_thumbnail_view.js +26 -26
- package/lib/web/pdf_thumbnail_viewer.js +13 -2
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/pdf_viewer.js +3 -1
- package/lib/web/preferences.js +33 -44
- package/lib/web/text_layer_builder.js +2 -9
- package/lib/web/ui_utils.js +78 -46
- package/lib/web/viewer_compatibility.js +1 -2
- package/package.json +4 -1
- package/types/display/annotation_layer.d.ts +18 -3
- package/types/display/api.d.ts +110 -54
- package/types/display/canvas.d.ts +1 -1
- package/types/display/display_utils.d.ts +96 -95
- package/types/display/fetch_stream.d.ts +2 -2
- package/types/display/metadata.d.ts +4 -0
- package/types/display/pattern_helper.d.ts +1 -1
- package/types/display/text_layer.d.ts +7 -7
- package/types/display/transport_stream.d.ts +1 -1
- package/types/shared/scripting_utils.d.ts +12 -0
- package/types/shared/util.d.ts +281 -250
- package/types/shared/xml_parser.d.ts +64 -0
- package/web/pdf_viewer.css +18 -15
- package/web/pdf_viewer.js +809 -408
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +1 -1
- package/types/display/xml_parser.d.ts +0 -35
package/web/pdf_viewer.js
CHANGED
@@ -30,198 +30,113 @@
|
|
30
30
|
else
|
31
31
|
root["pdfjs-dist/web/pdf_viewer"] = root.pdfjsViewer = factory();
|
32
32
|
})(this, function() {
|
33
|
-
return /******/ (
|
34
|
-
/******/
|
35
|
-
/******/ var
|
36
|
-
/******/
|
37
|
-
/******/ // The require function
|
38
|
-
/******/ function __w_pdfjs_require__(moduleId) {
|
39
|
-
/******/
|
40
|
-
/******/ // Check if module is in cache
|
41
|
-
/******/ if(installedModules[moduleId]) {
|
42
|
-
/******/ return installedModules[moduleId].exports;
|
43
|
-
/******/ }
|
44
|
-
/******/ // Create a new module (and put it into the cache)
|
45
|
-
/******/ var module = installedModules[moduleId] = {
|
46
|
-
/******/ i: moduleId,
|
47
|
-
/******/ l: false,
|
48
|
-
/******/ exports: {}
|
49
|
-
/******/ };
|
50
|
-
/******/
|
51
|
-
/******/ // Execute the module function
|
52
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
|
53
|
-
/******/
|
54
|
-
/******/ // Flag the module as loaded
|
55
|
-
/******/ module.l = true;
|
56
|
-
/******/
|
57
|
-
/******/ // Return the exports of the module
|
58
|
-
/******/ return module.exports;
|
59
|
-
/******/ }
|
60
|
-
/******/
|
61
|
-
/******/
|
62
|
-
/******/ // expose the modules object (__webpack_modules__)
|
63
|
-
/******/ __w_pdfjs_require__.m = modules;
|
64
|
-
/******/
|
65
|
-
/******/ // expose the module cache
|
66
|
-
/******/ __w_pdfjs_require__.c = installedModules;
|
67
|
-
/******/
|
68
|
-
/******/ // define getter function for harmony exports
|
69
|
-
/******/ __w_pdfjs_require__.d = function(exports, name, getter) {
|
70
|
-
/******/ if(!__w_pdfjs_require__.o(exports, name)) {
|
71
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
72
|
-
/******/ }
|
73
|
-
/******/ };
|
74
|
-
/******/
|
75
|
-
/******/ // define __esModule on exports
|
76
|
-
/******/ __w_pdfjs_require__.r = function(exports) {
|
77
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
78
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
79
|
-
/******/ }
|
80
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
81
|
-
/******/ };
|
82
|
-
/******/
|
83
|
-
/******/ // create a fake namespace object
|
84
|
-
/******/ // mode & 1: value is a module id, require it
|
85
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
86
|
-
/******/ // mode & 4: return value when already ns object
|
87
|
-
/******/ // mode & 8|1: behave like require
|
88
|
-
/******/ __w_pdfjs_require__.t = function(value, mode) {
|
89
|
-
/******/ if(mode & 1) value = __w_pdfjs_require__(value);
|
90
|
-
/******/ if(mode & 8) return value;
|
91
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
92
|
-
/******/ var ns = Object.create(null);
|
93
|
-
/******/ __w_pdfjs_require__.r(ns);
|
94
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
95
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
96
|
-
/******/ return ns;
|
97
|
-
/******/ };
|
98
|
-
/******/
|
99
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
100
|
-
/******/ __w_pdfjs_require__.n = function(module) {
|
101
|
-
/******/ var getter = module && module.__esModule ?
|
102
|
-
/******/ function getDefault() { return module['default']; } :
|
103
|
-
/******/ function getModuleExports() { return module; };
|
104
|
-
/******/ __w_pdfjs_require__.d(getter, 'a', getter);
|
105
|
-
/******/ return getter;
|
106
|
-
/******/ };
|
107
|
-
/******/
|
108
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
109
|
-
/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
110
|
-
/******/
|
111
|
-
/******/ // __webpack_public_path__
|
112
|
-
/******/ __w_pdfjs_require__.p = "";
|
113
|
-
/******/
|
114
|
-
/******/
|
115
|
-
/******/ // Load entry module and return exports
|
116
|
-
/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
|
117
|
-
/******/ })
|
118
|
-
/************************************************************************/
|
119
|
-
/******/ ([
|
33
|
+
return /******/ (() => { // webpackBootstrap
|
34
|
+
/******/ "use strict";
|
35
|
+
/******/ var __webpack_modules__ = ([
|
120
36
|
/* 0 */
|
121
|
-
/***/ (
|
37
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
122
38
|
|
123
|
-
"use strict";
|
124
39
|
|
125
40
|
|
126
|
-
Object.defineProperty(exports, "__esModule", {
|
41
|
+
Object.defineProperty(exports, "__esModule", ({
|
127
42
|
value: true
|
128
|
-
});
|
129
|
-
Object.defineProperty(exports, "AnnotationLayerBuilder", {
|
43
|
+
}));
|
44
|
+
Object.defineProperty(exports, "AnnotationLayerBuilder", ({
|
130
45
|
enumerable: true,
|
131
46
|
get: function () {
|
132
47
|
return _annotation_layer_builder.AnnotationLayerBuilder;
|
133
48
|
}
|
134
|
-
});
|
135
|
-
Object.defineProperty(exports, "DefaultAnnotationLayerFactory", {
|
49
|
+
}));
|
50
|
+
Object.defineProperty(exports, "DefaultAnnotationLayerFactory", ({
|
136
51
|
enumerable: true,
|
137
52
|
get: function () {
|
138
53
|
return _annotation_layer_builder.DefaultAnnotationLayerFactory;
|
139
54
|
}
|
140
|
-
});
|
141
|
-
Object.defineProperty(exports, "DefaultTextLayerFactory", {
|
55
|
+
}));
|
56
|
+
Object.defineProperty(exports, "DefaultTextLayerFactory", ({
|
142
57
|
enumerable: true,
|
143
58
|
get: function () {
|
144
59
|
return _text_layer_builder.DefaultTextLayerFactory;
|
145
60
|
}
|
146
|
-
});
|
147
|
-
Object.defineProperty(exports, "TextLayerBuilder", {
|
61
|
+
}));
|
62
|
+
Object.defineProperty(exports, "TextLayerBuilder", ({
|
148
63
|
enumerable: true,
|
149
64
|
get: function () {
|
150
65
|
return _text_layer_builder.TextLayerBuilder;
|
151
66
|
}
|
152
|
-
});
|
153
|
-
Object.defineProperty(exports, "EventBus", {
|
67
|
+
}));
|
68
|
+
Object.defineProperty(exports, "EventBus", ({
|
154
69
|
enumerable: true,
|
155
70
|
get: function () {
|
156
71
|
return _ui_utils.EventBus;
|
157
72
|
}
|
158
|
-
});
|
159
|
-
Object.defineProperty(exports, "NullL10n", {
|
73
|
+
}));
|
74
|
+
Object.defineProperty(exports, "NullL10n", ({
|
160
75
|
enumerable: true,
|
161
76
|
get: function () {
|
162
77
|
return _ui_utils.NullL10n;
|
163
78
|
}
|
164
|
-
});
|
165
|
-
Object.defineProperty(exports, "ProgressBar", {
|
79
|
+
}));
|
80
|
+
Object.defineProperty(exports, "ProgressBar", ({
|
166
81
|
enumerable: true,
|
167
82
|
get: function () {
|
168
83
|
return _ui_utils.ProgressBar;
|
169
84
|
}
|
170
|
-
});
|
171
|
-
Object.defineProperty(exports, "PDFLinkService", {
|
85
|
+
}));
|
86
|
+
Object.defineProperty(exports, "PDFLinkService", ({
|
172
87
|
enumerable: true,
|
173
88
|
get: function () {
|
174
89
|
return _pdf_link_service.PDFLinkService;
|
175
90
|
}
|
176
|
-
});
|
177
|
-
Object.defineProperty(exports, "SimpleLinkService", {
|
91
|
+
}));
|
92
|
+
Object.defineProperty(exports, "SimpleLinkService", ({
|
178
93
|
enumerable: true,
|
179
94
|
get: function () {
|
180
95
|
return _pdf_link_service.SimpleLinkService;
|
181
96
|
}
|
182
|
-
});
|
183
|
-
Object.defineProperty(exports, "DownloadManager", {
|
97
|
+
}));
|
98
|
+
Object.defineProperty(exports, "DownloadManager", ({
|
184
99
|
enumerable: true,
|
185
100
|
get: function () {
|
186
101
|
return _download_manager.DownloadManager;
|
187
102
|
}
|
188
|
-
});
|
189
|
-
Object.defineProperty(exports, "GenericL10n", {
|
103
|
+
}));
|
104
|
+
Object.defineProperty(exports, "GenericL10n", ({
|
190
105
|
enumerable: true,
|
191
106
|
get: function () {
|
192
107
|
return _genericl10n.GenericL10n;
|
193
108
|
}
|
194
|
-
});
|
195
|
-
Object.defineProperty(exports, "PDFFindController", {
|
109
|
+
}));
|
110
|
+
Object.defineProperty(exports, "PDFFindController", ({
|
196
111
|
enumerable: true,
|
197
112
|
get: function () {
|
198
113
|
return _pdf_find_controller.PDFFindController;
|
199
114
|
}
|
200
|
-
});
|
201
|
-
Object.defineProperty(exports, "PDFHistory", {
|
115
|
+
}));
|
116
|
+
Object.defineProperty(exports, "PDFHistory", ({
|
202
117
|
enumerable: true,
|
203
118
|
get: function () {
|
204
119
|
return _pdf_history.PDFHistory;
|
205
120
|
}
|
206
|
-
});
|
207
|
-
Object.defineProperty(exports, "PDFPageView", {
|
121
|
+
}));
|
122
|
+
Object.defineProperty(exports, "PDFPageView", ({
|
208
123
|
enumerable: true,
|
209
124
|
get: function () {
|
210
125
|
return _pdf_page_view.PDFPageView;
|
211
126
|
}
|
212
|
-
});
|
213
|
-
Object.defineProperty(exports, "PDFSinglePageViewer", {
|
127
|
+
}));
|
128
|
+
Object.defineProperty(exports, "PDFSinglePageViewer", ({
|
214
129
|
enumerable: true,
|
215
130
|
get: function () {
|
216
131
|
return _pdf_single_page_viewer.PDFSinglePageViewer;
|
217
132
|
}
|
218
|
-
});
|
219
|
-
Object.defineProperty(exports, "PDFViewer", {
|
133
|
+
}));
|
134
|
+
Object.defineProperty(exports, "PDFViewer", ({
|
220
135
|
enumerable: true,
|
221
136
|
get: function () {
|
222
137
|
return _pdf_viewer.PDFViewer;
|
223
138
|
}
|
224
|
-
});
|
139
|
+
}));
|
225
140
|
|
226
141
|
var _annotation_layer_builder = __w_pdfjs_require__(1);
|
227
142
|
|
@@ -245,19 +160,18 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(15);
|
|
245
160
|
|
246
161
|
var _pdf_viewer = __w_pdfjs_require__(17);
|
247
162
|
|
248
|
-
const pdfjsVersion = '2.
|
249
|
-
const pdfjsBuild = '
|
163
|
+
const pdfjsVersion = '2.7.570';
|
164
|
+
const pdfjsBuild = 'f2c7338b0';
|
250
165
|
|
251
166
|
/***/ }),
|
252
167
|
/* 1 */
|
253
|
-
/***/ (
|
168
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
254
169
|
|
255
|
-
"use strict";
|
256
170
|
|
257
171
|
|
258
|
-
Object.defineProperty(exports, "__esModule", {
|
172
|
+
Object.defineProperty(exports, "__esModule", ({
|
259
173
|
value: true
|
260
|
-
});
|
174
|
+
}));
|
261
175
|
exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
|
262
176
|
|
263
177
|
var _pdfjsLib = __w_pdfjs_require__(2);
|
@@ -275,7 +189,10 @@ class AnnotationLayerBuilder {
|
|
275
189
|
annotationStorage = null,
|
276
190
|
imageResourcesPath = "",
|
277
191
|
renderInteractiveForms = true,
|
278
|
-
l10n = _ui_utils.NullL10n
|
192
|
+
l10n = _ui_utils.NullL10n,
|
193
|
+
enableScripting = false,
|
194
|
+
hasJSActionsPromise = null,
|
195
|
+
mouseState = null
|
279
196
|
}) {
|
280
197
|
this.pageDiv = pageDiv;
|
281
198
|
this.pdfPage = pdfPage;
|
@@ -285,14 +202,17 @@ class AnnotationLayerBuilder {
|
|
285
202
|
this.renderInteractiveForms = renderInteractiveForms;
|
286
203
|
this.l10n = l10n;
|
287
204
|
this.annotationStorage = annotationStorage;
|
205
|
+
this.enableScripting = enableScripting;
|
206
|
+
this._hasJSActionsPromise = hasJSActionsPromise;
|
207
|
+
this._mouseState = mouseState;
|
288
208
|
this.div = null;
|
289
209
|
this._cancelled = false;
|
290
210
|
}
|
291
211
|
|
292
212
|
render(viewport, intent = "display") {
|
293
|
-
return this.pdfPage.getAnnotations({
|
213
|
+
return Promise.all([this.pdfPage.getAnnotations({
|
294
214
|
intent
|
295
|
-
}).then(annotations => {
|
215
|
+
}), this._hasJSActionsPromise]).then(([annotations, hasJSActions = false]) => {
|
296
216
|
if (this._cancelled) {
|
297
217
|
return;
|
298
218
|
}
|
@@ -312,7 +232,10 @@ class AnnotationLayerBuilder {
|
|
312
232
|
renderInteractiveForms: this.renderInteractiveForms,
|
313
233
|
linkService: this.linkService,
|
314
234
|
downloadManager: this.downloadManager,
|
315
|
-
annotationStorage: this.annotationStorage
|
235
|
+
annotationStorage: this.annotationStorage,
|
236
|
+
enableScripting: this.enableScripting,
|
237
|
+
hasJSActions,
|
238
|
+
mouseState: this._mouseState
|
316
239
|
};
|
317
240
|
|
318
241
|
if (this.div) {
|
@@ -347,7 +270,7 @@ class AnnotationLayerBuilder {
|
|
347
270
|
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
|
348
271
|
|
349
272
|
class DefaultAnnotationLayerFactory {
|
350
|
-
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = true, l10n = _ui_utils.NullL10n) {
|
273
|
+
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = true, l10n = _ui_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) {
|
351
274
|
return new AnnotationLayerBuilder({
|
352
275
|
pageDiv,
|
353
276
|
pdfPage,
|
@@ -355,7 +278,10 @@ class DefaultAnnotationLayerFactory {
|
|
355
278
|
renderInteractiveForms,
|
356
279
|
linkService: new _pdf_link_service.SimpleLinkService(),
|
357
280
|
l10n,
|
358
|
-
annotationStorage
|
281
|
+
annotationStorage,
|
282
|
+
enableScripting,
|
283
|
+
hasJSActionsPromise,
|
284
|
+
mouseState
|
359
285
|
});
|
360
286
|
}
|
361
287
|
|
@@ -365,9 +291,8 @@ exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
|
|
365
291
|
|
366
292
|
/***/ }),
|
367
293
|
/* 2 */
|
368
|
-
/***/ (
|
294
|
+
/***/ ((module) => {
|
369
295
|
|
370
|
-
"use strict";
|
371
296
|
|
372
297
|
|
373
298
|
let pdfjsLib;
|
@@ -382,36 +307,35 @@ module.exports = pdfjsLib;
|
|
382
307
|
|
383
308
|
/***/ }),
|
384
309
|
/* 3 */
|
385
|
-
/***/ (
|
310
|
+
/***/ ((__unused_webpack_module, exports) => {
|
386
311
|
|
387
|
-
"use strict";
|
388
312
|
|
389
313
|
|
390
|
-
Object.defineProperty(exports, "__esModule", {
|
314
|
+
Object.defineProperty(exports, "__esModule", ({
|
391
315
|
value: true
|
392
|
-
});
|
316
|
+
}));
|
317
|
+
exports.approximateFraction = approximateFraction;
|
318
|
+
exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
|
319
|
+
exports.binarySearchFirstItem = binarySearchFirstItem;
|
320
|
+
exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
|
321
|
+
exports.getOutputScale = getOutputScale;
|
322
|
+
exports.getPageSizeInches = getPageSizeInches;
|
323
|
+
exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
|
324
|
+
exports.getVisibleElements = getVisibleElements;
|
325
|
+
exports.isPortraitOrientation = isPortraitOrientation;
|
393
326
|
exports.isValidRotation = isValidRotation;
|
394
327
|
exports.isValidScrollMode = isValidScrollMode;
|
395
328
|
exports.isValidSpreadMode = isValidSpreadMode;
|
396
|
-
exports.
|
397
|
-
exports.clamp = clamp;
|
398
|
-
exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
|
329
|
+
exports.moveToEndOfArray = moveToEndOfArray;
|
399
330
|
exports.noContextMenuHandler = noContextMenuHandler;
|
331
|
+
exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
|
332
|
+
exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
|
400
333
|
exports.parseQueryString = parseQueryString;
|
401
|
-
exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
|
402
|
-
exports.getVisibleElements = getVisibleElements;
|
403
334
|
exports.roundToDivide = roundToDivide;
|
404
|
-
exports.getPageSizeInches = getPageSizeInches;
|
405
|
-
exports.approximateFraction = approximateFraction;
|
406
|
-
exports.getOutputScale = getOutputScale;
|
407
335
|
exports.scrollIntoView = scrollIntoView;
|
408
|
-
exports.watchScroll = watchScroll;
|
409
|
-
exports.binarySearchFirstItem = binarySearchFirstItem;
|
410
|
-
exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
|
411
|
-
exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
|
412
336
|
exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
|
413
|
-
exports.
|
414
|
-
exports.WaitOnType = exports.
|
337
|
+
exports.watchScroll = watchScroll;
|
338
|
+
exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.NullL10n = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE = exports.CSS_UNITS = exports.AutoPrintRegExp = exports.animationStarted = void 0;
|
415
339
|
const CSS_UNITS = 96.0 / 72.0;
|
416
340
|
exports.CSS_UNITS = CSS_UNITS;
|
417
341
|
const DEFAULT_SCALE_VALUE = "auto";
|
@@ -430,6 +354,7 @@ const SCROLLBAR_PADDING = 40;
|
|
430
354
|
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
|
431
355
|
const VERTICAL_PADDING = 5;
|
432
356
|
exports.VERTICAL_PADDING = VERTICAL_PADDING;
|
357
|
+
const LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
|
433
358
|
const PresentationModeState = {
|
434
359
|
UNKNOWN: 0,
|
435
360
|
NORMAL: 1,
|
@@ -437,6 +362,15 @@ const PresentationModeState = {
|
|
437
362
|
FULLSCREEN: 3
|
438
363
|
};
|
439
364
|
exports.PresentationModeState = PresentationModeState;
|
365
|
+
const SidebarView = {
|
366
|
+
UNKNOWN: -1,
|
367
|
+
NONE: 0,
|
368
|
+
THUMBS: 1,
|
369
|
+
OUTLINE: 2,
|
370
|
+
ATTACHMENTS: 3,
|
371
|
+
LAYERS: 4
|
372
|
+
};
|
373
|
+
exports.SidebarView = SidebarView;
|
440
374
|
const RendererType = {
|
441
375
|
CANVAS: "canvas",
|
442
376
|
SVG: "svg"
|
@@ -495,7 +429,7 @@ exports.NullL10n = NullL10n;
|
|
495
429
|
|
496
430
|
function getOutputScale(ctx) {
|
497
431
|
const devicePixelRatio = window.devicePixelRatio || 1;
|
498
|
-
const backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.
|
432
|
+
const backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
|
499
433
|
const pixelRatio = devicePixelRatio / backingStoreRatio;
|
500
434
|
return {
|
501
435
|
sx: pixelRatio,
|
@@ -718,7 +652,13 @@ function backtrackBeforeAllVisibleElements(index, views, top) {
|
|
718
652
|
return index;
|
719
653
|
}
|
720
654
|
|
721
|
-
function getVisibleElements(
|
655
|
+
function getVisibleElements({
|
656
|
+
scrollEl,
|
657
|
+
views,
|
658
|
+
sortByVisibility = false,
|
659
|
+
horizontal = false,
|
660
|
+
rtl = false
|
661
|
+
}) {
|
722
662
|
const top = scrollEl.scrollTop,
|
723
663
|
bottom = top + scrollEl.clientHeight;
|
724
664
|
const left = scrollEl.scrollLeft,
|
@@ -730,15 +670,16 @@ function getVisibleElements(scrollEl, views, sortByVisibility = false, horizonta
|
|
730
670
|
return elementBottom > top;
|
731
671
|
}
|
732
672
|
|
733
|
-
function
|
673
|
+
function isElementNextAfterViewHorizontally(view) {
|
734
674
|
const element = view.div;
|
735
|
-
const
|
736
|
-
|
675
|
+
const elementLeft = element.offsetLeft + element.clientLeft;
|
676
|
+
const elementRight = elementLeft + element.clientWidth;
|
677
|
+
return rtl ? elementLeft < right : elementRight > left;
|
737
678
|
}
|
738
679
|
|
739
680
|
const visible = [],
|
740
681
|
numViews = views.length;
|
741
|
-
let firstVisibleElementInd =
|
682
|
+
let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
|
742
683
|
|
743
684
|
if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
|
744
685
|
firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
|
@@ -770,13 +711,16 @@ function getVisibleElements(scrollEl, views, sortByVisibility = false, horizonta
|
|
770
711
|
|
771
712
|
const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
|
772
713
|
const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
|
773
|
-
const
|
714
|
+
const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
|
715
|
+
fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
|
716
|
+
const percent = fractionHeight * fractionWidth * 100 | 0;
|
774
717
|
visible.push({
|
775
718
|
id: view.id,
|
776
719
|
x: currentWidth,
|
777
720
|
y: currentHeight,
|
778
721
|
view,
|
779
|
-
percent
|
722
|
+
percent,
|
723
|
+
widthPercent: fractionWidth * 100 | 0
|
780
724
|
});
|
781
725
|
}
|
782
726
|
|
@@ -827,8 +771,8 @@ function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") {
|
|
827
771
|
return defaultFilename;
|
828
772
|
}
|
829
773
|
|
830
|
-
const reURI = /^(?:(?:[^:]+:)?\/\/[
|
831
|
-
const reFilename = /[
|
774
|
+
const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
|
775
|
+
const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
|
832
776
|
const splitURI = reURI.exec(url);
|
833
777
|
let suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
|
834
778
|
|
@@ -945,15 +889,17 @@ class EventBus {
|
|
945
889
|
this._listeners = Object.create(null);
|
946
890
|
}
|
947
891
|
|
948
|
-
on(eventName, listener) {
|
892
|
+
on(eventName, listener, options = null) {
|
949
893
|
this._on(eventName, listener, {
|
950
|
-
external: true
|
894
|
+
external: true,
|
895
|
+
once: options?.once
|
951
896
|
});
|
952
897
|
}
|
953
898
|
|
954
|
-
off(eventName, listener) {
|
899
|
+
off(eventName, listener, options = null) {
|
955
900
|
this._off(eventName, listener, {
|
956
|
-
external: true
|
901
|
+
external: true,
|
902
|
+
once: options?.once
|
957
903
|
});
|
958
904
|
}
|
959
905
|
|
@@ -966,16 +912,17 @@ class EventBus {
|
|
966
912
|
|
967
913
|
const args = Array.prototype.slice.call(arguments, 1);
|
968
914
|
let externalListeners;
|
969
|
-
eventListeners.slice(0).forEach(
|
915
|
+
eventListeners.slice(0).forEach(({
|
970
916
|
listener,
|
971
|
-
external
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
917
|
+
external,
|
918
|
+
once
|
919
|
+
}) => {
|
920
|
+
if (once) {
|
921
|
+
this._off(eventName, listener);
|
922
|
+
}
|
977
923
|
|
978
|
-
|
924
|
+
if (external) {
|
925
|
+
(externalListeners || (externalListeners = [])).push(listener);
|
979
926
|
return;
|
980
927
|
}
|
981
928
|
|
@@ -983,7 +930,7 @@ class EventBus {
|
|
983
930
|
});
|
984
931
|
|
985
932
|
if (externalListeners) {
|
986
|
-
externalListeners.forEach(
|
933
|
+
externalListeners.forEach(listener => {
|
987
934
|
listener.apply(null, args);
|
988
935
|
});
|
989
936
|
externalListeners = null;
|
@@ -991,15 +938,13 @@ class EventBus {
|
|
991
938
|
}
|
992
939
|
|
993
940
|
_on(eventName, listener, options = null) {
|
994
|
-
|
995
|
-
|
996
|
-
if (!eventListeners) {
|
997
|
-
this._listeners[eventName] = eventListeners = [];
|
998
|
-
}
|
941
|
+
var _this$_listeners;
|
999
942
|
|
943
|
+
const eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
|
1000
944
|
eventListeners.push({
|
1001
945
|
listener,
|
1002
|
-
external:
|
946
|
+
external: options?.external === true,
|
947
|
+
once: options?.once === true
|
1003
948
|
});
|
1004
949
|
}
|
1005
950
|
|
@@ -1074,7 +1019,8 @@ class ProgressBar {
|
|
1074
1019
|
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
|
1075
1020
|
|
1076
1021
|
if (scrollbarWidth > 0) {
|
1077
|
-
|
1022
|
+
const doc = document.documentElement;
|
1023
|
+
doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, `${scrollbarWidth}px`);
|
1078
1024
|
}
|
1079
1025
|
}
|
1080
1026
|
|
@@ -1085,7 +1031,6 @@ class ProgressBar {
|
|
1085
1031
|
|
1086
1032
|
this.visible = false;
|
1087
1033
|
this.bar.classList.add("hidden");
|
1088
|
-
document.body.classList.remove("loadingInProgress");
|
1089
1034
|
}
|
1090
1035
|
|
1091
1036
|
show() {
|
@@ -1094,7 +1039,6 @@ class ProgressBar {
|
|
1094
1039
|
}
|
1095
1040
|
|
1096
1041
|
this.visible = true;
|
1097
|
-
document.body.classList.add("loadingInProgress");
|
1098
1042
|
this.bar.classList.remove("hidden");
|
1099
1043
|
}
|
1100
1044
|
|
@@ -1121,16 +1065,27 @@ function moveToEndOfArray(arr, condition) {
|
|
1121
1065
|
}
|
1122
1066
|
}
|
1123
1067
|
|
1068
|
+
function getActiveOrFocusedElement() {
|
1069
|
+
let curRoot = document;
|
1070
|
+
let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
|
1071
|
+
|
1072
|
+
while (curActiveOrFocused && curActiveOrFocused.shadowRoot) {
|
1073
|
+
curRoot = curActiveOrFocused.shadowRoot;
|
1074
|
+
curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
return curActiveOrFocused;
|
1078
|
+
}
|
1079
|
+
|
1124
1080
|
/***/ }),
|
1125
1081
|
/* 4 */
|
1126
|
-
/***/ (
|
1082
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
1127
1083
|
|
1128
|
-
"use strict";
|
1129
1084
|
|
1130
1085
|
|
1131
|
-
Object.defineProperty(exports, "__esModule", {
|
1086
|
+
Object.defineProperty(exports, "__esModule", ({
|
1132
1087
|
value: true
|
1133
|
-
});
|
1088
|
+
}));
|
1134
1089
|
exports.SimpleLinkService = exports.PDFLinkService = void 0;
|
1135
1090
|
|
1136
1091
|
var _ui_utils = __w_pdfjs_require__(3);
|
@@ -1190,89 +1145,111 @@ class PDFLinkService {
|
|
1190
1145
|
}
|
1191
1146
|
|
1192
1147
|
navigateTo(dest) {
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
}) => {
|
1197
|
-
const destRef = explicitDest[0];
|
1198
|
-
let pageNumber;
|
1199
|
-
|
1200
|
-
if (destRef instanceof Object) {
|
1201
|
-
pageNumber = this._cachedPageNumber(destRef);
|
1202
|
-
|
1203
|
-
if (pageNumber === null) {
|
1204
|
-
this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
|
1205
|
-
this.cachePageRef(pageIndex + 1, destRef);
|
1206
|
-
goToDestination({
|
1207
|
-
namedDest,
|
1208
|
-
explicitDest
|
1209
|
-
});
|
1210
|
-
}).catch(() => {
|
1211
|
-
console.error(`PDFLinkService.navigateTo: "${destRef}" is not ` + `a valid page reference, for dest="${dest}".`);
|
1212
|
-
});
|
1213
|
-
return;
|
1214
|
-
}
|
1215
|
-
} else if (Number.isInteger(destRef)) {
|
1216
|
-
pageNumber = destRef + 1;
|
1217
|
-
} else {
|
1218
|
-
console.error(`PDFLinkService.navigateTo: "${destRef}" is not ` + `a valid destination reference, for dest="${dest}".`);
|
1219
|
-
return;
|
1220
|
-
}
|
1148
|
+
console.error("Deprecated method: `navigateTo`, use `goToDestination` instead.");
|
1149
|
+
this.goToDestination(dest);
|
1150
|
+
}
|
1221
1151
|
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
}
|
1152
|
+
_goToDestinationHelper(rawDest, namedDest = null, explicitDest) {
|
1153
|
+
const destRef = explicitDest[0];
|
1154
|
+
let pageNumber;
|
1226
1155
|
|
1227
|
-
|
1228
|
-
|
1229
|
-
this.pdfHistory.push({
|
1230
|
-
namedDest,
|
1231
|
-
explicitDest,
|
1232
|
-
pageNumber
|
1233
|
-
});
|
1234
|
-
}
|
1156
|
+
if (destRef instanceof Object) {
|
1157
|
+
pageNumber = this._cachedPageNumber(destRef);
|
1235
1158
|
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
ignoreDestinationZoom: this._ignoreDestinationZoom
|
1240
|
-
});
|
1241
|
-
};
|
1159
|
+
if (pageNumber === null) {
|
1160
|
+
this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
|
1161
|
+
this.cachePageRef(pageIndex + 1, destRef);
|
1242
1162
|
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
resolve({
|
1247
|
-
namedDest: dest,
|
1248
|
-
explicitDest: destArray
|
1249
|
-
});
|
1163
|
+
this._goToDestinationHelper(rawDest, namedDest, explicitDest);
|
1164
|
+
}).catch(() => {
|
1165
|
+
console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid page reference, for dest="${rawDest}".`);
|
1250
1166
|
});
|
1251
1167
|
return;
|
1252
1168
|
}
|
1169
|
+
} else if (Number.isInteger(destRef)) {
|
1170
|
+
pageNumber = destRef + 1;
|
1171
|
+
} else {
|
1172
|
+
console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid destination reference, for dest="${rawDest}".`);
|
1173
|
+
return;
|
1174
|
+
}
|
1253
1175
|
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1176
|
+
if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
|
1177
|
+
console.error(`PDFLinkService._goToDestinationHelper: "${pageNumber}" is not ` + `a valid page number, for dest="${rawDest}".`);
|
1178
|
+
return;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
if (this.pdfHistory) {
|
1182
|
+
this.pdfHistory.pushCurrentPosition();
|
1183
|
+
this.pdfHistory.push({
|
1184
|
+
namedDest,
|
1185
|
+
explicitDest,
|
1186
|
+
pageNumber
|
1257
1187
|
});
|
1258
|
-
}
|
1259
|
-
if (!Array.isArray(data.explicitDest)) {
|
1260
|
-
console.error(`PDFLinkService.navigateTo: "${data.explicitDest}" is` + ` not a valid destination array, for dest="${dest}".`);
|
1261
|
-
return;
|
1262
|
-
}
|
1188
|
+
}
|
1263
1189
|
|
1264
|
-
|
1190
|
+
this.pdfViewer.scrollPageIntoView({
|
1191
|
+
pageNumber,
|
1192
|
+
destArray: explicitDest,
|
1193
|
+
ignoreDestinationZoom: this._ignoreDestinationZoom
|
1265
1194
|
});
|
1266
1195
|
}
|
1267
1196
|
|
1268
|
-
|
1197
|
+
async goToDestination(dest) {
|
1198
|
+
if (!this.pdfDocument) {
|
1199
|
+
return;
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
let namedDest, explicitDest;
|
1203
|
+
|
1269
1204
|
if (typeof dest === "string") {
|
1270
|
-
|
1205
|
+
namedDest = dest;
|
1206
|
+
explicitDest = await this.pdfDocument.getDestination(dest);
|
1207
|
+
} else {
|
1208
|
+
namedDest = null;
|
1209
|
+
explicitDest = await dest;
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
if (!Array.isArray(explicitDest)) {
|
1213
|
+
console.error(`PDFLinkService.goToDestination: "${explicitDest}" is not ` + `a valid destination array, for dest="${dest}".`);
|
1214
|
+
return;
|
1271
1215
|
}
|
1272
1216
|
|
1273
|
-
|
1217
|
+
this._goToDestinationHelper(dest, namedDest, explicitDest);
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
goToPage(val) {
|
1221
|
+
if (!this.pdfDocument) {
|
1222
|
+
return;
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
|
1226
|
+
|
1227
|
+
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
|
1228
|
+
console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);
|
1229
|
+
return;
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
if (this.pdfHistory) {
|
1233
|
+
this.pdfHistory.pushCurrentPosition();
|
1234
|
+
this.pdfHistory.pushPage(pageNumber);
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
this.pdfViewer.scrollPageIntoView({
|
1238
|
+
pageNumber
|
1239
|
+
});
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
getDestinationHash(dest) {
|
1243
|
+
if (typeof dest === "string") {
|
1244
|
+
if (dest.length > 0) {
|
1245
|
+
return this.getAnchorUrl("#" + escape(dest));
|
1246
|
+
}
|
1247
|
+
} else if (Array.isArray(dest)) {
|
1274
1248
|
const str = JSON.stringify(dest);
|
1275
|
-
|
1249
|
+
|
1250
|
+
if (str.length > 0) {
|
1251
|
+
return this.getAnchorUrl("#" + escape(str));
|
1252
|
+
}
|
1276
1253
|
}
|
1277
1254
|
|
1278
1255
|
return this.getAnchorUrl("");
|
@@ -1283,6 +1260,10 @@ class PDFLinkService {
|
|
1283
1260
|
}
|
1284
1261
|
|
1285
1262
|
setHash(hash) {
|
1263
|
+
if (!this.pdfDocument) {
|
1264
|
+
return;
|
1265
|
+
}
|
1266
|
+
|
1286
1267
|
let pageNumber, dest;
|
1287
1268
|
|
1288
1269
|
if (hash.includes("=")) {
|
@@ -1350,7 +1331,7 @@ class PDFLinkService {
|
|
1350
1331
|
}
|
1351
1332
|
|
1352
1333
|
if ("nameddest" in params) {
|
1353
|
-
this.
|
1334
|
+
this.goToDestination(params.nameddest);
|
1354
1335
|
}
|
1355
1336
|
} else {
|
1356
1337
|
dest = unescape(hash);
|
@@ -1364,7 +1345,7 @@ class PDFLinkService {
|
|
1364
1345
|
} catch (ex) {}
|
1365
1346
|
|
1366
1347
|
if (typeof dest === "string" || isValidExplicitDestination(dest)) {
|
1367
|
-
this.
|
1348
|
+
this.goToDestination(dest);
|
1368
1349
|
return;
|
1369
1350
|
}
|
1370
1351
|
|
@@ -1389,17 +1370,11 @@ class PDFLinkService {
|
|
1389
1370
|
break;
|
1390
1371
|
|
1391
1372
|
case "NextPage":
|
1392
|
-
|
1393
|
-
this.page++;
|
1394
|
-
}
|
1395
|
-
|
1373
|
+
this.pdfViewer.nextPage();
|
1396
1374
|
break;
|
1397
1375
|
|
1398
1376
|
case "PrevPage":
|
1399
|
-
|
1400
|
-
this.page--;
|
1401
|
-
}
|
1402
|
-
|
1377
|
+
this.pdfViewer.previousPage();
|
1403
1378
|
break;
|
1404
1379
|
|
1405
1380
|
case "LastPage":
|
@@ -1438,6 +1413,10 @@ class PDFLinkService {
|
|
1438
1413
|
return this.pdfViewer.isPageVisible(pageNumber);
|
1439
1414
|
}
|
1440
1415
|
|
1416
|
+
isPageCached(pageNumber) {
|
1417
|
+
return this.pdfViewer.isPageCached(pageNumber);
|
1418
|
+
}
|
1419
|
+
|
1441
1420
|
}
|
1442
1421
|
|
1443
1422
|
exports.PDFLinkService = PDFLinkService;
|
@@ -1536,7 +1515,9 @@ class SimpleLinkService {
|
|
1536
1515
|
|
1537
1516
|
set rotation(value) {}
|
1538
1517
|
|
1539
|
-
|
1518
|
+
async goToDestination(dest) {}
|
1519
|
+
|
1520
|
+
goToPage(val) {}
|
1540
1521
|
|
1541
1522
|
getDestinationHash(dest) {
|
1542
1523
|
return "#";
|
@@ -1556,21 +1537,24 @@ class SimpleLinkService {
|
|
1556
1537
|
return true;
|
1557
1538
|
}
|
1558
1539
|
|
1540
|
+
isPageCached(pageNumber) {
|
1541
|
+
return true;
|
1542
|
+
}
|
1543
|
+
|
1559
1544
|
}
|
1560
1545
|
|
1561
1546
|
exports.SimpleLinkService = SimpleLinkService;
|
1562
1547
|
|
1563
1548
|
/***/ }),
|
1564
1549
|
/* 5 */
|
1565
|
-
/***/ (
|
1550
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
1566
1551
|
|
1567
|
-
"use strict";
|
1568
1552
|
|
1569
1553
|
|
1570
|
-
Object.defineProperty(exports, "__esModule", {
|
1554
|
+
Object.defineProperty(exports, "__esModule", ({
|
1571
1555
|
value: true
|
1572
|
-
});
|
1573
|
-
exports.
|
1556
|
+
}));
|
1557
|
+
exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
|
1574
1558
|
|
1575
1559
|
var _pdfjsLib = __w_pdfjs_require__(2);
|
1576
1560
|
|
@@ -1686,13 +1670,11 @@ class TextLayerBuilder {
|
|
1686
1670
|
}
|
1687
1671
|
|
1688
1672
|
const {
|
1689
|
-
findController,
|
1690
1673
|
textContentItemsStr
|
1691
1674
|
} = this;
|
1692
1675
|
let i = 0,
|
1693
1676
|
iIndex = 0;
|
1694
1677
|
const end = textContentItemsStr.length - 1;
|
1695
|
-
const queryLen = findController.state.query.length;
|
1696
1678
|
const result = [];
|
1697
1679
|
|
1698
1680
|
for (let m = 0, mm = matches.length; m < mm; m++) {
|
@@ -1713,12 +1695,7 @@ class TextLayerBuilder {
|
|
1713
1695
|
offset: matchIdx - iIndex
|
1714
1696
|
}
|
1715
1697
|
};
|
1716
|
-
|
1717
|
-
if (matchesLength) {
|
1718
|
-
matchIdx += matchesLength[m];
|
1719
|
-
} else {
|
1720
|
-
matchIdx += queryLen;
|
1721
|
-
}
|
1698
|
+
matchIdx += matchesLength[m];
|
1722
1699
|
|
1723
1700
|
while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
|
1724
1701
|
iIndex += textContentItemsStr[i].length;
|
@@ -1946,14 +1923,13 @@ exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
|
|
1946
1923
|
|
1947
1924
|
/***/ }),
|
1948
1925
|
/* 6 */
|
1949
|
-
/***/ (
|
1926
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
1950
1927
|
|
1951
|
-
"use strict";
|
1952
1928
|
|
1953
1929
|
|
1954
|
-
Object.defineProperty(exports, "__esModule", {
|
1930
|
+
Object.defineProperty(exports, "__esModule", ({
|
1955
1931
|
value: true
|
1956
|
-
});
|
1932
|
+
}));
|
1957
1933
|
exports.DownloadManager = void 0;
|
1958
1934
|
|
1959
1935
|
var _pdfjsLib = __w_pdfjs_require__(2);
|
@@ -1991,26 +1967,11 @@ class DownloadManager {
|
|
1991
1967
|
}
|
1992
1968
|
|
1993
1969
|
downloadData(data, filename, contentType) {
|
1994
|
-
if (navigator.msSaveBlob) {
|
1995
|
-
navigator.msSaveBlob(new Blob([data], {
|
1996
|
-
type: contentType
|
1997
|
-
}), filename);
|
1998
|
-
return;
|
1999
|
-
}
|
2000
|
-
|
2001
1970
|
const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL);
|
2002
1971
|
download(blobUrl, filename);
|
2003
1972
|
}
|
2004
1973
|
|
2005
1974
|
download(blob, url, filename, sourceEventType = "download") {
|
2006
|
-
if (navigator.msSaveBlob) {
|
2007
|
-
if (!navigator.msSaveBlob(blob, filename)) {
|
2008
|
-
this.downloadUrl(url, filename);
|
2009
|
-
}
|
2010
|
-
|
2011
|
-
return;
|
2012
|
-
}
|
2013
|
-
|
2014
1975
|
if (_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) {
|
2015
1976
|
this.downloadUrl(url, filename);
|
2016
1977
|
return;
|
@@ -2026,14 +1987,13 @@ exports.DownloadManager = DownloadManager;
|
|
2026
1987
|
|
2027
1988
|
/***/ }),
|
2028
1989
|
/* 7 */
|
2029
|
-
/***/ (
|
1990
|
+
/***/ ((__unused_webpack_module, exports) => {
|
2030
1991
|
|
2031
|
-
"use strict";
|
2032
1992
|
|
2033
1993
|
|
2034
|
-
Object.defineProperty(exports, "__esModule", {
|
1994
|
+
Object.defineProperty(exports, "__esModule", ({
|
2035
1995
|
value: true
|
2036
|
-
});
|
1996
|
+
}));
|
2037
1997
|
exports.viewerCompatibilityParams = void 0;
|
2038
1998
|
const compatibilityParams = Object.create(null);
|
2039
1999
|
{
|
@@ -2041,12 +2001,11 @@ const compatibilityParams = Object.create(null);
|
|
2041
2001
|
const platform = typeof navigator !== "undefined" && navigator.platform || "";
|
2042
2002
|
const maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1;
|
2043
2003
|
const isAndroid = /Android/.test(userAgent);
|
2044
|
-
const isIE = /Trident/.test(userAgent);
|
2045
2004
|
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
|
2046
2005
|
const isIOSChrome = /CriOS/.test(userAgent);
|
2047
2006
|
|
2048
2007
|
(function checkOnBlobSupport() {
|
2049
|
-
if (
|
2008
|
+
if (isIOSChrome) {
|
2050
2009
|
compatibilityParams.disableCreateObjectURL = true;
|
2051
2010
|
}
|
2052
2011
|
})();
|
@@ -2062,14 +2021,13 @@ exports.viewerCompatibilityParams = viewerCompatibilityParams;
|
|
2062
2021
|
|
2063
2022
|
/***/ }),
|
2064
2023
|
/* 8 */
|
2065
|
-
/***/ (
|
2024
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
2066
2025
|
|
2067
|
-
"use strict";
|
2068
2026
|
|
2069
2027
|
|
2070
|
-
Object.defineProperty(exports, "__esModule", {
|
2028
|
+
Object.defineProperty(exports, "__esModule", ({
|
2071
2029
|
value: true
|
2072
|
-
});
|
2030
|
+
}));
|
2073
2031
|
exports.GenericL10n = void 0;
|
2074
2032
|
|
2075
2033
|
__w_pdfjs_require__(9);
|
@@ -2112,9 +2070,8 @@ exports.GenericL10n = GenericL10n;
|
|
2112
2070
|
|
2113
2071
|
/***/ }),
|
2114
2072
|
/* 9 */
|
2115
|
-
/***/ (
|
2073
|
+
/***/ (() => {
|
2116
2074
|
|
2117
|
-
"use strict";
|
2118
2075
|
|
2119
2076
|
|
2120
2077
|
document.webL10n = function (window, document, undefined) {
|
@@ -2935,14 +2892,13 @@ document.webL10n = function (window, document, undefined) {
|
|
2935
2892
|
|
2936
2893
|
/***/ }),
|
2937
2894
|
/* 10 */
|
2938
|
-
/***/ (
|
2895
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
2939
2896
|
|
2940
|
-
"use strict";
|
2941
2897
|
|
2942
2898
|
|
2943
|
-
Object.defineProperty(exports, "__esModule", {
|
2899
|
+
Object.defineProperty(exports, "__esModule", ({
|
2944
2900
|
value: true
|
2945
|
-
});
|
2901
|
+
}));
|
2946
2902
|
exports.PDFFindController = exports.FindState = void 0;
|
2947
2903
|
|
2948
2904
|
var _pdfjsLib = __w_pdfjs_require__(2);
|
@@ -2982,9 +2938,43 @@ function normalize(text) {
|
|
2982
2938
|
normalizationRegex = new RegExp(`[${replace}]`, "g");
|
2983
2939
|
}
|
2984
2940
|
|
2985
|
-
|
2986
|
-
|
2941
|
+
let diffs = null;
|
2942
|
+
const normalizedText = text.replace(normalizationRegex, function (ch, index) {
|
2943
|
+
const normalizedCh = CHARACTERS_TO_NORMALIZE[ch],
|
2944
|
+
diff = normalizedCh.length - ch.length;
|
2945
|
+
|
2946
|
+
if (diff !== 0) {
|
2947
|
+
(diffs || (diffs = [])).push([index, diff]);
|
2948
|
+
}
|
2949
|
+
|
2950
|
+
return normalizedCh;
|
2987
2951
|
});
|
2952
|
+
return [normalizedText, diffs];
|
2953
|
+
}
|
2954
|
+
|
2955
|
+
function getOriginalIndex(matchIndex, diffs = null) {
|
2956
|
+
if (!diffs) {
|
2957
|
+
return matchIndex;
|
2958
|
+
}
|
2959
|
+
|
2960
|
+
let totalDiff = 0;
|
2961
|
+
|
2962
|
+
for (const [index, diff] of diffs) {
|
2963
|
+
const currentIndex = index + totalDiff;
|
2964
|
+
|
2965
|
+
if (currentIndex >= matchIndex) {
|
2966
|
+
break;
|
2967
|
+
}
|
2968
|
+
|
2969
|
+
if (currentIndex + diff > matchIndex) {
|
2970
|
+
totalDiff += matchIndex - currentIndex;
|
2971
|
+
break;
|
2972
|
+
}
|
2973
|
+
|
2974
|
+
totalDiff += diff;
|
2975
|
+
}
|
2976
|
+
|
2977
|
+
return matchIndex - totalDiff;
|
2988
2978
|
}
|
2989
2979
|
|
2990
2980
|
class PDFFindController {
|
@@ -3133,6 +3123,7 @@ class PDFFindController {
|
|
3133
3123
|
};
|
3134
3124
|
this._extractTextPromises = [];
|
3135
3125
|
this._pageContents = [];
|
3126
|
+
this._pageDiffs = [];
|
3136
3127
|
this._matchesCountTotal = 0;
|
3137
3128
|
this._pagesToSearch = null;
|
3138
3129
|
this._pendingFindMatches = Object.create(null);
|
@@ -3146,7 +3137,7 @@ class PDFFindController {
|
|
3146
3137
|
get _query() {
|
3147
3138
|
if (this._state.query !== this._rawQuery) {
|
3148
3139
|
this._rawQuery = this._state.query;
|
3149
|
-
this._normalizedQuery = normalize(this._state.query);
|
3140
|
+
[this._normalizedQuery] = normalize(this._state.query);
|
3150
3141
|
}
|
3151
3142
|
|
3152
3143
|
return this._normalizedQuery;
|
@@ -3243,8 +3234,9 @@ class PDFFindController {
|
|
3243
3234
|
return true;
|
3244
3235
|
}
|
3245
3236
|
|
3246
|
-
_calculatePhraseMatch(query, pageIndex, pageContent, entireWord) {
|
3247
|
-
const matches = []
|
3237
|
+
_calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
|
3238
|
+
const matches = [],
|
3239
|
+
matchesLength = [];
|
3248
3240
|
const queryLen = query.length;
|
3249
3241
|
let matchIdx = -queryLen;
|
3250
3242
|
|
@@ -3259,13 +3251,18 @@ class PDFFindController {
|
|
3259
3251
|
continue;
|
3260
3252
|
}
|
3261
3253
|
|
3262
|
-
|
3254
|
+
const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
|
3255
|
+
matchEnd = matchIdx + queryLen - 1,
|
3256
|
+
originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
|
3257
|
+
matches.push(originalMatchIdx);
|
3258
|
+
matchesLength.push(originalQueryLen);
|
3263
3259
|
}
|
3264
3260
|
|
3265
3261
|
this._pageMatches[pageIndex] = matches;
|
3262
|
+
this._pageMatchesLength[pageIndex] = matchesLength;
|
3266
3263
|
}
|
3267
3264
|
|
3268
|
-
_calculateWordMatch(query, pageIndex, pageContent, entireWord) {
|
3265
|
+
_calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
|
3269
3266
|
const matchesWithLength = [];
|
3270
3267
|
const queryArray = query.match(/\S+/g);
|
3271
3268
|
|
@@ -3285,9 +3282,12 @@ class PDFFindController {
|
|
3285
3282
|
continue;
|
3286
3283
|
}
|
3287
3284
|
|
3285
|
+
const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
|
3286
|
+
matchEnd = matchIdx + subqueryLen - 1,
|
3287
|
+
originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
|
3288
3288
|
matchesWithLength.push({
|
3289
|
-
match:
|
3290
|
-
matchLength:
|
3289
|
+
match: originalMatchIdx,
|
3290
|
+
matchLength: originalQueryLen,
|
3291
3291
|
skipped: false
|
3292
3292
|
});
|
3293
3293
|
}
|
@@ -3301,6 +3301,7 @@ class PDFFindController {
|
|
3301
3301
|
|
3302
3302
|
_calculateMatch(pageIndex) {
|
3303
3303
|
let pageContent = this._pageContents[pageIndex];
|
3304
|
+
const pageDiffs = this._pageDiffs[pageIndex];
|
3304
3305
|
let query = this._query;
|
3305
3306
|
const {
|
3306
3307
|
caseSensitive,
|
@@ -3318,9 +3319,9 @@ class PDFFindController {
|
|
3318
3319
|
}
|
3319
3320
|
|
3320
3321
|
if (phraseSearch) {
|
3321
|
-
this._calculatePhraseMatch(query, pageIndex, pageContent, entireWord);
|
3322
|
+
this._calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
|
3322
3323
|
} else {
|
3323
|
-
this._calculateWordMatch(query, pageIndex, pageContent, entireWord);
|
3324
|
+
this._calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
|
3324
3325
|
}
|
3325
3326
|
|
3326
3327
|
if (this._state.highlightAll) {
|
@@ -3365,11 +3366,12 @@ class PDFFindController {
|
|
3365
3366
|
strBuf.push(textItems[j].str);
|
3366
3367
|
}
|
3367
3368
|
|
3368
|
-
this._pageContents[i] = normalize(strBuf.join(""));
|
3369
|
+
[this._pageContents[i], this._pageDiffs[i]] = normalize(strBuf.join(""));
|
3369
3370
|
extractTextCapability.resolve(i);
|
3370
3371
|
}, reason => {
|
3371
3372
|
console.error(`Unable to get text content for page ${i + 1}`, reason);
|
3372
3373
|
this._pageContents[i] = "";
|
3374
|
+
this._pageDiffs[i] = null;
|
3373
3375
|
extractTextCapability.resolve(i);
|
3374
3376
|
});
|
3375
3377
|
});
|
@@ -3617,14 +3619,13 @@ exports.PDFFindController = PDFFindController;
|
|
3617
3619
|
|
3618
3620
|
/***/ }),
|
3619
3621
|
/* 11 */
|
3620
|
-
/***/ (
|
3622
|
+
/***/ ((__unused_webpack_module, exports) => {
|
3621
3623
|
|
3622
|
-
"use strict";
|
3623
3624
|
|
3624
3625
|
|
3625
|
-
Object.defineProperty(exports, "__esModule", {
|
3626
|
+
Object.defineProperty(exports, "__esModule", ({
|
3626
3627
|
value: true
|
3627
|
-
});
|
3628
|
+
}));
|
3628
3629
|
exports.getCharacterType = getCharacterType;
|
3629
3630
|
exports.CharacterType = void 0;
|
3630
3631
|
const CharacterType = {
|
@@ -3713,16 +3714,15 @@ function getCharacterType(charCode) {
|
|
3713
3714
|
|
3714
3715
|
/***/ }),
|
3715
3716
|
/* 12 */
|
3716
|
-
/***/ (
|
3717
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
3717
3718
|
|
3718
|
-
"use strict";
|
3719
3719
|
|
3720
3720
|
|
3721
|
-
Object.defineProperty(exports, "__esModule", {
|
3721
|
+
Object.defineProperty(exports, "__esModule", ({
|
3722
3722
|
value: true
|
3723
|
-
});
|
3724
|
-
exports.isDestHashesEqual = isDestHashesEqual;
|
3723
|
+
}));
|
3725
3724
|
exports.isDestArraysEqual = isDestArraysEqual;
|
3725
|
+
exports.isDestHashesEqual = isDestHashesEqual;
|
3726
3726
|
exports.PDFHistory = void 0;
|
3727
3727
|
|
3728
3728
|
var _ui_utils = __w_pdfjs_require__(3);
|
@@ -3749,19 +3749,17 @@ class PDFHistory {
|
|
3749
3749
|
this._isViewerInPresentationMode = false;
|
3750
3750
|
|
3751
3751
|
this.eventBus._on("presentationmodechanged", evt => {
|
3752
|
-
this._isViewerInPresentationMode = evt.
|
3752
|
+
this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL;
|
3753
3753
|
});
|
3754
3754
|
|
3755
3755
|
this.eventBus._on("pagesinit", () => {
|
3756
3756
|
this._isPagesLoaded = false;
|
3757
3757
|
|
3758
|
-
|
3759
|
-
this.eventBus._off("pagesloaded", onPagesLoaded);
|
3760
|
-
|
3758
|
+
this.eventBus._on("pagesloaded", evt => {
|
3761
3759
|
this._isPagesLoaded = !!evt.pagesCount;
|
3762
|
-
}
|
3763
|
-
|
3764
|
-
|
3760
|
+
}, {
|
3761
|
+
once: true
|
3762
|
+
});
|
3765
3763
|
});
|
3766
3764
|
}
|
3767
3765
|
|
@@ -3821,10 +3819,6 @@ class PDFHistory {
|
|
3821
3819
|
|
3822
3820
|
this._updateInternalState(destination, state.uid, true);
|
3823
3821
|
|
3824
|
-
if (this._uid > this._maxUid) {
|
3825
|
-
this._maxUid = this._uid;
|
3826
|
-
}
|
3827
|
-
|
3828
3822
|
if (destination.rotation !== undefined) {
|
3829
3823
|
this._initialRotation = destination.rotation;
|
3830
3824
|
}
|
@@ -3914,6 +3908,38 @@ class PDFHistory {
|
|
3914
3908
|
}
|
3915
3909
|
}
|
3916
3910
|
|
3911
|
+
pushPage(pageNumber) {
|
3912
|
+
if (!this._initialized) {
|
3913
|
+
return;
|
3914
|
+
}
|
3915
|
+
|
3916
|
+
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) {
|
3917
|
+
console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`);
|
3918
|
+
return;
|
3919
|
+
}
|
3920
|
+
|
3921
|
+
if (this._destination?.page === pageNumber) {
|
3922
|
+
return;
|
3923
|
+
}
|
3924
|
+
|
3925
|
+
if (this._popStateInProgress) {
|
3926
|
+
return;
|
3927
|
+
}
|
3928
|
+
|
3929
|
+
this._pushOrReplaceState({
|
3930
|
+
hash: `page=${pageNumber}`,
|
3931
|
+
page: pageNumber,
|
3932
|
+
rotation: this.linkService.rotation
|
3933
|
+
});
|
3934
|
+
|
3935
|
+
if (!this._popStateInProgress) {
|
3936
|
+
this._popStateInProgress = true;
|
3937
|
+
Promise.resolve().then(() => {
|
3938
|
+
this._popStateInProgress = false;
|
3939
|
+
});
|
3940
|
+
}
|
3941
|
+
}
|
3942
|
+
|
3917
3943
|
pushCurrentPosition() {
|
3918
3944
|
if (!this._initialized || this._popStateInProgress) {
|
3919
3945
|
return;
|
@@ -3970,7 +3996,7 @@ class PDFHistory {
|
|
3970
3996
|
|
3971
3997
|
let newUrl;
|
3972
3998
|
|
3973
|
-
if (this._updateUrl && destination
|
3999
|
+
if (this._updateUrl && destination?.hash) {
|
3974
4000
|
const baseUrl = document.location.href.split("#")[0];
|
3975
4001
|
|
3976
4002
|
if (!baseUrl.startsWith("file://")) {
|
@@ -3981,7 +4007,6 @@ class PDFHistory {
|
|
3981
4007
|
if (shouldReplace) {
|
3982
4008
|
window.history.replaceState(newState, "", newUrl);
|
3983
4009
|
} else {
|
3984
|
-
this._maxUid = this._uid;
|
3985
4010
|
window.history.pushState(newState, "", newUrl);
|
3986
4011
|
}
|
3987
4012
|
}
|
@@ -4044,7 +4069,7 @@ class PDFHistory {
|
|
4044
4069
|
|
4045
4070
|
const [perfEntry] = performance.getEntriesByType("navigation");
|
4046
4071
|
|
4047
|
-
if (
|
4072
|
+
if (perfEntry?.type !== "reload") {
|
4048
4073
|
return false;
|
4049
4074
|
}
|
4050
4075
|
} else {
|
@@ -4069,12 +4094,13 @@ class PDFHistory {
|
|
4069
4094
|
this._updateViewareaTimeout = null;
|
4070
4095
|
}
|
4071
4096
|
|
4072
|
-
if (removeTemporary && destination
|
4097
|
+
if (removeTemporary && destination?.temporary) {
|
4073
4098
|
delete destination.temporary;
|
4074
4099
|
}
|
4075
4100
|
|
4076
4101
|
this._destination = destination;
|
4077
4102
|
this._uid = uid;
|
4103
|
+
this._maxUid = Math.max(this._maxUid, uid);
|
4078
4104
|
this._numPositionUpdates = 0;
|
4079
4105
|
}
|
4080
4106
|
|
@@ -4175,16 +4201,12 @@ class PDFHistory {
|
|
4175
4201
|
|
4176
4202
|
this._updateInternalState(destination, state.uid, true);
|
4177
4203
|
|
4178
|
-
if (this._uid > this._maxUid) {
|
4179
|
-
this._maxUid = this._uid;
|
4180
|
-
}
|
4181
|
-
|
4182
4204
|
if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
|
4183
4205
|
this.linkService.rotation = destination.rotation;
|
4184
4206
|
}
|
4185
4207
|
|
4186
4208
|
if (destination.dest) {
|
4187
|
-
this.linkService.
|
4209
|
+
this.linkService.goToDestination(destination.dest);
|
4188
4210
|
} else if (destination.hash) {
|
4189
4211
|
this.linkService.setHash(destination.hash);
|
4190
4212
|
} else if (destination.page) {
|
@@ -4301,14 +4323,13 @@ function isDestArraysEqual(firstDest, secondDest) {
|
|
4301
4323
|
|
4302
4324
|
/***/ }),
|
4303
4325
|
/* 13 */
|
4304
|
-
/***/ (
|
4326
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
4305
4327
|
|
4306
|
-
"use strict";
|
4307
4328
|
|
4308
4329
|
|
4309
|
-
Object.defineProperty(exports, "__esModule", {
|
4330
|
+
Object.defineProperty(exports, "__esModule", ({
|
4310
4331
|
value: true
|
4311
|
-
});
|
4332
|
+
}));
|
4312
4333
|
exports.PDFPageView = void 0;
|
4313
4334
|
|
4314
4335
|
var _ui_utils = __w_pdfjs_require__(3);
|
@@ -4333,7 +4354,6 @@ class PDFPageView {
|
|
4333
4354
|
this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
|
4334
4355
|
this.viewport = defaultViewport;
|
4335
4356
|
this.pdfPageRotate = defaultViewport.rotation;
|
4336
|
-
this._annotationStorage = options.annotationStorage || null;
|
4337
4357
|
this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
|
4338
4358
|
this.hasRestrictedScaling = false;
|
4339
4359
|
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
|
@@ -4348,11 +4368,12 @@ class PDFPageView {
|
|
4348
4368
|
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
|
4349
4369
|
this.enableWebGL = options.enableWebGL || false;
|
4350
4370
|
this.l10n = options.l10n || _ui_utils.NullL10n;
|
4371
|
+
this.enableScripting = options.enableScripting || false;
|
4351
4372
|
this.paintTask = null;
|
4352
4373
|
this.paintedViewportMap = new WeakMap();
|
4353
4374
|
this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
|
4354
4375
|
this.resume = null;
|
4355
|
-
this.
|
4376
|
+
this._renderError = null;
|
4356
4377
|
this.annotationLayer = null;
|
4357
4378
|
this.textLayer = null;
|
4358
4379
|
this.zoomLayer = null;
|
@@ -4373,7 +4394,6 @@ class PDFPageView {
|
|
4373
4394
|
scale: this.scale * _ui_utils.CSS_UNITS,
|
4374
4395
|
rotation: totalRotation
|
4375
4396
|
});
|
4376
|
-
this.stats = pdfPage.stats;
|
4377
4397
|
this.reset();
|
4378
4398
|
}
|
4379
4399
|
|
@@ -4491,7 +4511,8 @@ class PDFPageView {
|
|
4491
4511
|
source: this,
|
4492
4512
|
pageNumber: this.id,
|
4493
4513
|
cssTransform: true,
|
4494
|
-
timestamp: performance.now()
|
4514
|
+
timestamp: performance.now(),
|
4515
|
+
error: this._renderError
|
4495
4516
|
});
|
4496
4517
|
return;
|
4497
4518
|
}
|
@@ -4513,7 +4534,8 @@ class PDFPageView {
|
|
4513
4534
|
source: this,
|
4514
4535
|
pageNumber: this.id,
|
4515
4536
|
cssTransform: true,
|
4516
|
-
timestamp: performance.now()
|
4537
|
+
timestamp: performance.now(),
|
4538
|
+
error: this._renderError
|
4517
4539
|
});
|
4518
4540
|
return;
|
4519
4541
|
}
|
@@ -4566,8 +4588,7 @@ class PDFPageView {
|
|
4566
4588
|
scaleY = width / height;
|
4567
4589
|
}
|
4568
4590
|
|
4569
|
-
|
4570
|
-
target.style.transform = cssTransform;
|
4591
|
+
target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
|
4571
4592
|
|
4572
4593
|
if (this.textLayer) {
|
4573
4594
|
const textLayerViewport = this.textLayer.viewport;
|
@@ -4607,7 +4628,7 @@ class PDFPageView {
|
|
4607
4628
|
break;
|
4608
4629
|
}
|
4609
4630
|
|
4610
|
-
textLayerDiv.style.transform =
|
4631
|
+
textLayerDiv.style.transform = `rotate(${textAbsRotation}deg) ` + `scale(${scale}) ` + `translate(${transX}, ${transY})`;
|
4611
4632
|
textLayerDiv.style.transformOrigin = "0% 0%";
|
4612
4633
|
}
|
4613
4634
|
|
@@ -4699,16 +4720,17 @@ class PDFPageView {
|
|
4699
4720
|
};
|
4700
4721
|
}
|
4701
4722
|
|
4702
|
-
const finishPaintTask = async error => {
|
4723
|
+
const finishPaintTask = async (error = null) => {
|
4703
4724
|
if (paintTask === this.paintTask) {
|
4704
4725
|
this.paintTask = null;
|
4705
4726
|
}
|
4706
4727
|
|
4707
4728
|
if (error instanceof _pdfjsLib.RenderingCancelledException) {
|
4708
|
-
this.
|
4729
|
+
this._renderError = null;
|
4709
4730
|
return;
|
4710
4731
|
}
|
4711
4732
|
|
4733
|
+
this._renderError = error;
|
4712
4734
|
this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
|
4713
4735
|
|
4714
4736
|
if (this.loadingIconDiv) {
|
@@ -4718,13 +4740,12 @@ class PDFPageView {
|
|
4718
4740
|
|
4719
4741
|
this._resetZoomLayer(true);
|
4720
4742
|
|
4721
|
-
this.error = error;
|
4722
|
-
this.stats = pdfPage.stats;
|
4723
4743
|
this.eventBus.dispatch("pagerendered", {
|
4724
4744
|
source: this,
|
4725
4745
|
pageNumber: this.id,
|
4726
4746
|
cssTransform: false,
|
4727
|
-
timestamp: performance.now()
|
4747
|
+
timestamp: performance.now(),
|
4748
|
+
error: this._renderError
|
4728
4749
|
});
|
4729
4750
|
|
4730
4751
|
if (error) {
|
@@ -4751,7 +4772,7 @@ class PDFPageView {
|
|
4751
4772
|
|
4752
4773
|
if (this.annotationLayerFactory) {
|
4753
4774
|
if (!this.annotationLayer) {
|
4754
|
-
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage,
|
4775
|
+
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this.renderInteractiveForms, this.l10n, this.enableScripting, null, null);
|
4755
4776
|
}
|
4756
4777
|
|
4757
4778
|
this._renderAnnotationLayer();
|
@@ -4922,15 +4943,17 @@ exports.PDFPageView = PDFPageView;
|
|
4922
4943
|
|
4923
4944
|
/***/ }),
|
4924
4945
|
/* 14 */
|
4925
|
-
/***/ (
|
4946
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
4926
4947
|
|
4927
|
-
"use strict";
|
4928
4948
|
|
4929
4949
|
|
4930
|
-
Object.defineProperty(exports, "__esModule", {
|
4950
|
+
Object.defineProperty(exports, "__esModule", ({
|
4931
4951
|
value: true
|
4932
|
-
});
|
4933
|
-
exports.
|
4952
|
+
}));
|
4953
|
+
exports.RenderingStates = exports.PDFRenderingQueue = void 0;
|
4954
|
+
|
4955
|
+
var _pdfjsLib = __w_pdfjs_require__(2);
|
4956
|
+
|
4934
4957
|
const CLEANUP_TIMEOUT = 30000;
|
4935
4958
|
const RenderingStates = {
|
4936
4959
|
INITIAL: 0,
|
@@ -5044,6 +5067,10 @@ class PDFRenderingQueue {
|
|
5044
5067
|
view.draw().finally(() => {
|
5045
5068
|
this.renderHighestPriority();
|
5046
5069
|
}).catch(reason => {
|
5070
|
+
if (reason instanceof _pdfjsLib.RenderingCancelledException) {
|
5071
|
+
return;
|
5072
|
+
}
|
5073
|
+
|
5047
5074
|
console.error(`renderView: "${reason}"`);
|
5048
5075
|
});
|
5049
5076
|
break;
|
@@ -5058,14 +5085,13 @@ exports.PDFRenderingQueue = PDFRenderingQueue;
|
|
5058
5085
|
|
5059
5086
|
/***/ }),
|
5060
5087
|
/* 15 */
|
5061
|
-
/***/ (
|
5088
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
5062
5089
|
|
5063
|
-
"use strict";
|
5064
5090
|
|
5065
5091
|
|
5066
|
-
Object.defineProperty(exports, "__esModule", {
|
5092
|
+
Object.defineProperty(exports, "__esModule", ({
|
5067
5093
|
value: true
|
5068
|
-
});
|
5094
|
+
}));
|
5069
5095
|
exports.PDFSinglePageViewer = void 0;
|
5070
5096
|
|
5071
5097
|
var _base_viewer = __w_pdfjs_require__(16);
|
@@ -5085,6 +5111,10 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer {
|
|
5085
5111
|
return (0, _pdfjsLib.shadow)(this, "_viewerElement", this._shadowViewer);
|
5086
5112
|
}
|
5087
5113
|
|
5114
|
+
get _pageWidthScaleFactor() {
|
5115
|
+
return 1;
|
5116
|
+
}
|
5117
|
+
|
5088
5118
|
_resetView() {
|
5089
5119
|
super._resetView();
|
5090
5120
|
|
@@ -5174,30 +5204,33 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer {
|
|
5174
5204
|
|
5175
5205
|
_updateSpreadMode() {}
|
5176
5206
|
|
5207
|
+
_getPageAdvance() {
|
5208
|
+
return 1;
|
5209
|
+
}
|
5210
|
+
|
5177
5211
|
}
|
5178
5212
|
|
5179
5213
|
exports.PDFSinglePageViewer = PDFSinglePageViewer;
|
5180
5214
|
|
5181
5215
|
/***/ }),
|
5182
5216
|
/* 16 */
|
5183
|
-
/***/ (
|
5217
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
5184
5218
|
|
5185
|
-
"use strict";
|
5186
5219
|
|
5187
5220
|
|
5188
|
-
Object.defineProperty(exports, "__esModule", {
|
5221
|
+
Object.defineProperty(exports, "__esModule", ({
|
5189
5222
|
value: true
|
5190
|
-
});
|
5223
|
+
}));
|
5191
5224
|
exports.BaseViewer = void 0;
|
5192
5225
|
|
5226
|
+
var _pdfjsLib = __w_pdfjs_require__(2);
|
5227
|
+
|
5193
5228
|
var _ui_utils = __w_pdfjs_require__(3);
|
5194
5229
|
|
5195
5230
|
var _pdf_rendering_queue = __w_pdfjs_require__(14);
|
5196
5231
|
|
5197
5232
|
var _annotation_layer_builder = __w_pdfjs_require__(1);
|
5198
5233
|
|
5199
|
-
var _pdfjsLib = __w_pdfjs_require__(2);
|
5200
|
-
|
5201
5234
|
var _pdf_page_view = __w_pdfjs_require__(13);
|
5202
5235
|
|
5203
5236
|
var _pdf_link_service = __w_pdfjs_require__(4);
|
@@ -5242,6 +5275,10 @@ function PDFPageViewBuffer(size) {
|
|
5242
5275
|
data.shift().destroy();
|
5243
5276
|
}
|
5244
5277
|
};
|
5278
|
+
|
5279
|
+
this.has = function (view) {
|
5280
|
+
return data.includes(view);
|
5281
|
+
};
|
5245
5282
|
}
|
5246
5283
|
|
5247
5284
|
function isSameScale(oldScale, newScale) {
|
@@ -5262,14 +5299,24 @@ class BaseViewer {
|
|
5262
5299
|
throw new Error("Cannot initialize BaseViewer.");
|
5263
5300
|
}
|
5264
5301
|
|
5302
|
+
const viewerVersion = '2.7.570';
|
5303
|
+
|
5304
|
+
if (_pdfjsLib.version !== viewerVersion) {
|
5305
|
+
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
|
5306
|
+
}
|
5307
|
+
|
5265
5308
|
this._name = this.constructor.name;
|
5266
5309
|
this.container = options.container;
|
5267
5310
|
this.viewer = options.viewer || options.container.firstElementChild;
|
5268
5311
|
|
5269
|
-
if (!(this.container
|
5312
|
+
if (!(this.container?.tagName.toUpperCase() === "DIV" && this.viewer?.tagName.toUpperCase() === "DIV")) {
|
5270
5313
|
throw new Error("Invalid `container` and/or `viewer` option.");
|
5271
5314
|
}
|
5272
5315
|
|
5316
|
+
if (getComputedStyle(this.container).position !== "absolute") {
|
5317
|
+
throw new Error("The `container` must be absolutely positioned.");
|
5318
|
+
}
|
5319
|
+
|
5273
5320
|
this.eventBus = options.eventBus;
|
5274
5321
|
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
|
5275
5322
|
this.downloadManager = options.downloadManager || null;
|
@@ -5284,6 +5331,8 @@ class BaseViewer {
|
|
5284
5331
|
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
|
5285
5332
|
this.maxCanvasPixels = options.maxCanvasPixels;
|
5286
5333
|
this.l10n = options.l10n || _ui_utils.NullL10n;
|
5334
|
+
this.enableScripting = options.enableScripting || false;
|
5335
|
+
this._mouseState = options.mouseState || null;
|
5287
5336
|
this.defaultRenderingQueue = !options.renderingQueue;
|
5288
5337
|
|
5289
5338
|
if (this.defaultRenderingQueue) {
|
@@ -5359,11 +5408,13 @@ class BaseViewer {
|
|
5359
5408
|
return false;
|
5360
5409
|
}
|
5361
5410
|
|
5411
|
+
const previous = this._currentPageNumber;
|
5362
5412
|
this._currentPageNumber = val;
|
5363
5413
|
this.eventBus.dispatch("pagechanging", {
|
5364
5414
|
source: this,
|
5365
5415
|
pageNumber: val,
|
5366
|
-
pageLabel: this._pageLabels && this._pageLabels[val - 1]
|
5416
|
+
pageLabel: this._pageLabels && this._pageLabels[val - 1],
|
5417
|
+
previous
|
5367
5418
|
});
|
5368
5419
|
|
5369
5420
|
if (resetCurrentPageView) {
|
@@ -5491,6 +5542,10 @@ class BaseViewer {
|
|
5491
5542
|
|
5492
5543
|
setDocument(pdfDocument) {
|
5493
5544
|
if (this.pdfDocument) {
|
5545
|
+
this.eventBus.dispatch("pagesdestroy", {
|
5546
|
+
source: this
|
5547
|
+
});
|
5548
|
+
|
5494
5549
|
this._cancelRendering();
|
5495
5550
|
|
5496
5551
|
this._resetView();
|
@@ -5508,7 +5563,6 @@ class BaseViewer {
|
|
5508
5563
|
|
5509
5564
|
const pagesCount = pdfDocument.numPages;
|
5510
5565
|
const firstPagePromise = pdfDocument.getPage(1);
|
5511
|
-
const annotationStorage = pdfDocument.annotationStorage;
|
5512
5566
|
const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
|
5513
5567
|
|
5514
5568
|
this._pagesCapability.promise.then(() => {
|
@@ -5561,7 +5615,6 @@ class BaseViewer {
|
|
5561
5615
|
id: pageNum,
|
5562
5616
|
scale,
|
5563
5617
|
defaultViewport: viewport.clone(),
|
5564
|
-
annotationStorage,
|
5565
5618
|
optionalContentConfigPromise,
|
5566
5619
|
renderingQueue: this.renderingQueue,
|
5567
5620
|
textLayerFactory,
|
@@ -5573,7 +5626,8 @@ class BaseViewer {
|
|
5573
5626
|
enableWebGL: this.enableWebGL,
|
5574
5627
|
useOnlyCssZoom: this.useOnlyCssZoom,
|
5575
5628
|
maxCanvasPixels: this.maxCanvasPixels,
|
5576
|
-
l10n: this.l10n
|
5629
|
+
l10n: this.l10n,
|
5630
|
+
enableScripting: this.enableScripting
|
5577
5631
|
});
|
5578
5632
|
|
5579
5633
|
this._pages.push(pageView);
|
@@ -5694,6 +5748,8 @@ class BaseViewer {
|
|
5694
5748
|
this._onAfterDraw = null;
|
5695
5749
|
}
|
5696
5750
|
|
5751
|
+
this._resetScriptingEvents();
|
5752
|
+
|
5697
5753
|
this.viewer.textContent = "";
|
5698
5754
|
|
5699
5755
|
this._updateScrollMode();
|
@@ -5765,6 +5821,14 @@ class BaseViewer {
|
|
5765
5821
|
}
|
5766
5822
|
}
|
5767
5823
|
|
5824
|
+
get _pageWidthScaleFactor() {
|
5825
|
+
if (this.spreadMode !== _ui_utils.SpreadMode.NONE && this.scrollMode !== _ui_utils.ScrollMode.HORIZONTAL && !this.isInPresentationMode) {
|
5826
|
+
return 2;
|
5827
|
+
}
|
5828
|
+
|
5829
|
+
return 1;
|
5830
|
+
}
|
5831
|
+
|
5768
5832
|
_setScale(value, noScroll = false) {
|
5769
5833
|
let scale = parseFloat(value);
|
5770
5834
|
|
@@ -5785,7 +5849,7 @@ class BaseViewer {
|
|
5785
5849
|
[hPadding, vPadding] = [vPadding, hPadding];
|
5786
5850
|
}
|
5787
5851
|
|
5788
|
-
const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale;
|
5852
|
+
const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor;
|
5789
5853
|
const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
|
5790
5854
|
|
5791
5855
|
switch (value) {
|
@@ -5831,6 +5895,20 @@ class BaseViewer {
|
|
5831
5895
|
});
|
5832
5896
|
}
|
5833
5897
|
|
5898
|
+
pageLabelToPageNumber(label) {
|
5899
|
+
if (!this._pageLabels) {
|
5900
|
+
return null;
|
5901
|
+
}
|
5902
|
+
|
5903
|
+
const i = this._pageLabels.indexOf(label);
|
5904
|
+
|
5905
|
+
if (i < 0) {
|
5906
|
+
return null;
|
5907
|
+
}
|
5908
|
+
|
5909
|
+
return i + 1;
|
5910
|
+
}
|
5911
|
+
|
5834
5912
|
scrollPageIntoView({
|
5835
5913
|
pageNumber,
|
5836
5914
|
destArray = null,
|
@@ -5887,6 +5965,8 @@ class BaseViewer {
|
|
5887
5965
|
if (y === null && this._location) {
|
5888
5966
|
x = this._location.left;
|
5889
5967
|
y = this._location.top;
|
5968
|
+
} else if (typeof y !== "number") {
|
5969
|
+
y = pageHeight;
|
5890
5970
|
}
|
5891
5971
|
|
5892
5972
|
break;
|
@@ -6017,6 +6097,10 @@ class BaseViewer {
|
|
6017
6097
|
return this.isInPresentationMode ? false : this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL;
|
6018
6098
|
}
|
6019
6099
|
|
6100
|
+
get _isContainerRtl() {
|
6101
|
+
return getComputedStyle(this.container).direction === "rtl";
|
6102
|
+
}
|
6103
|
+
|
6020
6104
|
get isInPresentationMode() {
|
6021
6105
|
return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
|
6022
6106
|
}
|
@@ -6056,7 +6140,13 @@ class BaseViewer {
|
|
6056
6140
|
}
|
6057
6141
|
|
6058
6142
|
_getVisiblePages() {
|
6059
|
-
return (0, _ui_utils.getVisibleElements)(
|
6143
|
+
return (0, _ui_utils.getVisibleElements)({
|
6144
|
+
scrollEl: this.container,
|
6145
|
+
views: this._pages,
|
6146
|
+
sortByVisibility: true,
|
6147
|
+
horizontal: this._isScrollModeHorizontal,
|
6148
|
+
rtl: this._isScrollModeHorizontal && this._isContainerRtl
|
6149
|
+
});
|
6060
6150
|
}
|
6061
6151
|
|
6062
6152
|
isPageVisible(pageNumber) {
|
@@ -6064,8 +6154,8 @@ class BaseViewer {
|
|
6064
6154
|
return false;
|
6065
6155
|
}
|
6066
6156
|
|
6067
|
-
if (pageNumber
|
6068
|
-
console.error(`${this._name}.isPageVisible: "${pageNumber}" is
|
6157
|
+
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
|
6158
|
+
console.error(`${this._name}.isPageVisible: "${pageNumber}" is not a valid page.`);
|
6069
6159
|
return false;
|
6070
6160
|
}
|
6071
6161
|
|
@@ -6074,6 +6164,25 @@ class BaseViewer {
|
|
6074
6164
|
});
|
6075
6165
|
}
|
6076
6166
|
|
6167
|
+
isPageCached(pageNumber) {
|
6168
|
+
if (!this.pdfDocument || !this._buffer) {
|
6169
|
+
return false;
|
6170
|
+
}
|
6171
|
+
|
6172
|
+
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
|
6173
|
+
console.error(`${this._name}.isPageCached: "${pageNumber}" is not a valid page.`);
|
6174
|
+
return false;
|
6175
|
+
}
|
6176
|
+
|
6177
|
+
const pageView = this._pages[pageNumber - 1];
|
6178
|
+
|
6179
|
+
if (!pageView) {
|
6180
|
+
return false;
|
6181
|
+
}
|
6182
|
+
|
6183
|
+
return this._buffer.has(pageView);
|
6184
|
+
}
|
6185
|
+
|
6077
6186
|
cleanup() {
|
6078
6187
|
for (let i = 0, ii = this._pages.length; i < ii; i++) {
|
6079
6188
|
if (this._pages[i] && this._pages[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
|
@@ -6146,16 +6255,19 @@ class BaseViewer {
|
|
6146
6255
|
});
|
6147
6256
|
}
|
6148
6257
|
|
6149
|
-
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) {
|
6258
|
+
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) {
|
6150
6259
|
return new _annotation_layer_builder.AnnotationLayerBuilder({
|
6151
6260
|
pageDiv,
|
6152
6261
|
pdfPage,
|
6153
|
-
annotationStorage,
|
6262
|
+
annotationStorage: annotationStorage || this.pdfDocument?.annotationStorage,
|
6154
6263
|
imageResourcesPath,
|
6155
6264
|
renderInteractiveForms,
|
6156
6265
|
linkService: this.linkService,
|
6157
6266
|
downloadManager: this.downloadManager,
|
6158
|
-
l10n
|
6267
|
+
l10n,
|
6268
|
+
enableScripting,
|
6269
|
+
hasJSActionsPromise: hasJSActionsPromise || this.pdfDocument?.hasJSActions(),
|
6270
|
+
mouseState: mouseState || this._mouseState
|
6159
6271
|
});
|
6160
6272
|
}
|
6161
6273
|
|
@@ -6338,27 +6450,285 @@ class BaseViewer {
|
|
6338
6450
|
return;
|
6339
6451
|
}
|
6340
6452
|
|
6453
|
+
if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
|
6454
|
+
this._setScale(this._currentScaleValue, true);
|
6455
|
+
}
|
6456
|
+
|
6341
6457
|
this._setCurrentPageNumber(pageNumber, true);
|
6342
6458
|
|
6343
6459
|
this.update();
|
6344
6460
|
}
|
6345
6461
|
|
6462
|
+
_getPageAdvance(currentPageNumber, previous = false) {
|
6463
|
+
if (this.isInPresentationMode) {
|
6464
|
+
return 1;
|
6465
|
+
}
|
6466
|
+
|
6467
|
+
switch (this._scrollMode) {
|
6468
|
+
case _ui_utils.ScrollMode.WRAPPED:
|
6469
|
+
{
|
6470
|
+
const {
|
6471
|
+
views
|
6472
|
+
} = this._getVisiblePages(),
|
6473
|
+
pageLayout = new Map();
|
6474
|
+
|
6475
|
+
for (const {
|
6476
|
+
id,
|
6477
|
+
y,
|
6478
|
+
percent,
|
6479
|
+
widthPercent
|
6480
|
+
} of views) {
|
6481
|
+
if (percent === 0 || widthPercent < 100) {
|
6482
|
+
continue;
|
6483
|
+
}
|
6484
|
+
|
6485
|
+
let yArray = pageLayout.get(y);
|
6486
|
+
|
6487
|
+
if (!yArray) {
|
6488
|
+
pageLayout.set(y, yArray || (yArray = []));
|
6489
|
+
}
|
6490
|
+
|
6491
|
+
yArray.push(id);
|
6492
|
+
}
|
6493
|
+
|
6494
|
+
for (const yArray of pageLayout.values()) {
|
6495
|
+
const currentIndex = yArray.indexOf(currentPageNumber);
|
6496
|
+
|
6497
|
+
if (currentIndex === -1) {
|
6498
|
+
continue;
|
6499
|
+
}
|
6500
|
+
|
6501
|
+
const numPages = yArray.length;
|
6502
|
+
|
6503
|
+
if (numPages === 1) {
|
6504
|
+
break;
|
6505
|
+
}
|
6506
|
+
|
6507
|
+
if (previous) {
|
6508
|
+
for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {
|
6509
|
+
const currentId = yArray[i],
|
6510
|
+
expectedId = yArray[i + 1] - 1;
|
6511
|
+
|
6512
|
+
if (currentId < expectedId) {
|
6513
|
+
return currentPageNumber - expectedId;
|
6514
|
+
}
|
6515
|
+
}
|
6516
|
+
} else {
|
6517
|
+
for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {
|
6518
|
+
const currentId = yArray[i],
|
6519
|
+
expectedId = yArray[i - 1] + 1;
|
6520
|
+
|
6521
|
+
if (currentId > expectedId) {
|
6522
|
+
return expectedId - currentPageNumber;
|
6523
|
+
}
|
6524
|
+
}
|
6525
|
+
}
|
6526
|
+
|
6527
|
+
if (previous) {
|
6528
|
+
const firstId = yArray[0];
|
6529
|
+
|
6530
|
+
if (firstId < currentPageNumber) {
|
6531
|
+
return currentPageNumber - firstId + 1;
|
6532
|
+
}
|
6533
|
+
} else {
|
6534
|
+
const lastId = yArray[numPages - 1];
|
6535
|
+
|
6536
|
+
if (lastId > currentPageNumber) {
|
6537
|
+
return lastId - currentPageNumber + 1;
|
6538
|
+
}
|
6539
|
+
}
|
6540
|
+
|
6541
|
+
break;
|
6542
|
+
}
|
6543
|
+
|
6544
|
+
break;
|
6545
|
+
}
|
6546
|
+
|
6547
|
+
case _ui_utils.ScrollMode.HORIZONTAL:
|
6548
|
+
{
|
6549
|
+
break;
|
6550
|
+
}
|
6551
|
+
|
6552
|
+
case _ui_utils.ScrollMode.VERTICAL:
|
6553
|
+
{
|
6554
|
+
if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
|
6555
|
+
break;
|
6556
|
+
}
|
6557
|
+
|
6558
|
+
const parity = this._spreadMode - 1;
|
6559
|
+
|
6560
|
+
if (previous && currentPageNumber % 2 !== parity) {
|
6561
|
+
break;
|
6562
|
+
} else if (!previous && currentPageNumber % 2 === parity) {
|
6563
|
+
break;
|
6564
|
+
}
|
6565
|
+
|
6566
|
+
const {
|
6567
|
+
views
|
6568
|
+
} = this._getVisiblePages(),
|
6569
|
+
expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;
|
6570
|
+
|
6571
|
+
for (const {
|
6572
|
+
id,
|
6573
|
+
percent,
|
6574
|
+
widthPercent
|
6575
|
+
} of views) {
|
6576
|
+
if (id !== expectedId) {
|
6577
|
+
continue;
|
6578
|
+
}
|
6579
|
+
|
6580
|
+
if (percent > 0 && widthPercent === 100) {
|
6581
|
+
return 2;
|
6582
|
+
}
|
6583
|
+
|
6584
|
+
break;
|
6585
|
+
}
|
6586
|
+
|
6587
|
+
break;
|
6588
|
+
}
|
6589
|
+
}
|
6590
|
+
|
6591
|
+
return 1;
|
6592
|
+
}
|
6593
|
+
|
6594
|
+
nextPage() {
|
6595
|
+
const currentPageNumber = this._currentPageNumber,
|
6596
|
+
pagesCount = this.pagesCount;
|
6597
|
+
|
6598
|
+
if (currentPageNumber >= pagesCount) {
|
6599
|
+
return false;
|
6600
|
+
}
|
6601
|
+
|
6602
|
+
const advance = this._getPageAdvance(currentPageNumber, false) || 1;
|
6603
|
+
this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
|
6604
|
+
return true;
|
6605
|
+
}
|
6606
|
+
|
6607
|
+
previousPage() {
|
6608
|
+
const currentPageNumber = this._currentPageNumber;
|
6609
|
+
|
6610
|
+
if (currentPageNumber <= 1) {
|
6611
|
+
return false;
|
6612
|
+
}
|
6613
|
+
|
6614
|
+
const advance = this._getPageAdvance(currentPageNumber, true) || 1;
|
6615
|
+
this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
|
6616
|
+
return true;
|
6617
|
+
}
|
6618
|
+
|
6619
|
+
initializeScriptingEvents() {
|
6620
|
+
if (!this.enableScripting || this._pageOpenPendingSet) {
|
6621
|
+
return;
|
6622
|
+
}
|
6623
|
+
|
6624
|
+
const eventBus = this.eventBus,
|
6625
|
+
pageOpenPendingSet = this._pageOpenPendingSet = new Set(),
|
6626
|
+
scriptingEvents = this._scriptingEvents || (this._scriptingEvents = Object.create(null));
|
6627
|
+
|
6628
|
+
const dispatchPageClose = pageNumber => {
|
6629
|
+
if (pageOpenPendingSet.has(pageNumber)) {
|
6630
|
+
return;
|
6631
|
+
}
|
6632
|
+
|
6633
|
+
eventBus.dispatch("pageclose", {
|
6634
|
+
source: this,
|
6635
|
+
pageNumber
|
6636
|
+
});
|
6637
|
+
};
|
6638
|
+
|
6639
|
+
const dispatchPageOpen = pageNumber => {
|
6640
|
+
const pageView = this._pages[pageNumber - 1];
|
6641
|
+
|
6642
|
+
if (pageView?.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) {
|
6643
|
+
pageOpenPendingSet.delete(pageNumber);
|
6644
|
+
eventBus.dispatch("pageopen", {
|
6645
|
+
source: this,
|
6646
|
+
pageNumber,
|
6647
|
+
actionsPromise: pageView.pdfPage?.getJSActions()
|
6648
|
+
});
|
6649
|
+
} else {
|
6650
|
+
pageOpenPendingSet.add(pageNumber);
|
6651
|
+
}
|
6652
|
+
};
|
6653
|
+
|
6654
|
+
scriptingEvents.onPageChanging = ({
|
6655
|
+
pageNumber,
|
6656
|
+
previous
|
6657
|
+
}) => {
|
6658
|
+
if (pageNumber === previous) {
|
6659
|
+
return;
|
6660
|
+
}
|
6661
|
+
|
6662
|
+
dispatchPageClose(previous);
|
6663
|
+
dispatchPageOpen(pageNumber);
|
6664
|
+
};
|
6665
|
+
|
6666
|
+
eventBus._on("pagechanging", scriptingEvents.onPageChanging);
|
6667
|
+
|
6668
|
+
scriptingEvents.onPageRendered = ({
|
6669
|
+
pageNumber
|
6670
|
+
}) => {
|
6671
|
+
if (!pageOpenPendingSet.has(pageNumber)) {
|
6672
|
+
return;
|
6673
|
+
}
|
6674
|
+
|
6675
|
+
if (pageNumber !== this._currentPageNumber) {
|
6676
|
+
return;
|
6677
|
+
}
|
6678
|
+
|
6679
|
+
dispatchPageOpen(pageNumber);
|
6680
|
+
};
|
6681
|
+
|
6682
|
+
eventBus._on("pagerendered", scriptingEvents.onPageRendered);
|
6683
|
+
|
6684
|
+
scriptingEvents.onPagesDestroy = () => {
|
6685
|
+
dispatchPageClose(this._currentPageNumber);
|
6686
|
+
};
|
6687
|
+
|
6688
|
+
eventBus._on("pagesdestroy", scriptingEvents.onPagesDestroy);
|
6689
|
+
|
6690
|
+
dispatchPageOpen(this._currentPageNumber);
|
6691
|
+
}
|
6692
|
+
|
6693
|
+
_resetScriptingEvents() {
|
6694
|
+
if (!this.enableScripting || !this._pageOpenPendingSet) {
|
6695
|
+
return;
|
6696
|
+
}
|
6697
|
+
|
6698
|
+
const eventBus = this.eventBus,
|
6699
|
+
scriptingEvents = this._scriptingEvents;
|
6700
|
+
|
6701
|
+
eventBus._off("pagechanging", scriptingEvents.onPageChanging);
|
6702
|
+
|
6703
|
+
scriptingEvents.onPageChanging = null;
|
6704
|
+
|
6705
|
+
eventBus._off("pagerendered", scriptingEvents.onPageRendered);
|
6706
|
+
|
6707
|
+
scriptingEvents.onPageRendered = null;
|
6708
|
+
|
6709
|
+
eventBus._off("pagesdestroy", scriptingEvents.onPagesDestroy);
|
6710
|
+
|
6711
|
+
scriptingEvents.onPagesDestroy = null;
|
6712
|
+
this._pageOpenPendingSet = null;
|
6713
|
+
}
|
6714
|
+
|
6346
6715
|
}
|
6347
6716
|
|
6348
6717
|
exports.BaseViewer = BaseViewer;
|
6349
6718
|
|
6350
6719
|
/***/ }),
|
6351
6720
|
/* 17 */
|
6352
|
-
/***/ (
|
6721
|
+
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
|
6353
6722
|
|
6354
|
-
"use strict";
|
6355
6723
|
|
6356
6724
|
|
6357
|
-
Object.defineProperty(exports, "__esModule", {
|
6725
|
+
Object.defineProperty(exports, "__esModule", ({
|
6358
6726
|
value: true
|
6359
|
-
});
|
6727
|
+
}));
|
6360
6728
|
exports.PDFViewer = void 0;
|
6361
6729
|
|
6730
|
+
var _ui_utils = __w_pdfjs_require__(3);
|
6731
|
+
|
6362
6732
|
var _base_viewer = __w_pdfjs_require__(16);
|
6363
6733
|
|
6364
6734
|
var _pdfjsLib = __w_pdfjs_require__(2);
|
@@ -6417,7 +6787,7 @@ class PDFViewer extends _base_viewer.BaseViewer {
|
|
6417
6787
|
break;
|
6418
6788
|
}
|
6419
6789
|
|
6420
|
-
if (page.id === currentId) {
|
6790
|
+
if (page.id === currentId && this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode === _ui_utils.SpreadMode.NONE) {
|
6421
6791
|
stillFullyVisible = true;
|
6422
6792
|
break;
|
6423
6793
|
}
|
@@ -6435,6 +6805,37 @@ class PDFViewer extends _base_viewer.BaseViewer {
|
|
6435
6805
|
exports.PDFViewer = PDFViewer;
|
6436
6806
|
|
6437
6807
|
/***/ })
|
6438
|
-
/******/
|
6808
|
+
/******/ ]);
|
6809
|
+
/************************************************************************/
|
6810
|
+
/******/ // The module cache
|
6811
|
+
/******/ var __webpack_module_cache__ = {};
|
6812
|
+
/******/
|
6813
|
+
/******/ // The require function
|
6814
|
+
/******/ function __w_pdfjs_require__(moduleId) {
|
6815
|
+
/******/ // Check if module is in cache
|
6816
|
+
/******/ if(__webpack_module_cache__[moduleId]) {
|
6817
|
+
/******/ return __webpack_module_cache__[moduleId].exports;
|
6818
|
+
/******/ }
|
6819
|
+
/******/ // Create a new module (and put it into the cache)
|
6820
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
6821
|
+
/******/ // no module.id needed
|
6822
|
+
/******/ // no module.loaded needed
|
6823
|
+
/******/ exports: {}
|
6824
|
+
/******/ };
|
6825
|
+
/******/
|
6826
|
+
/******/ // Execute the module function
|
6827
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
|
6828
|
+
/******/
|
6829
|
+
/******/ // Return the exports of the module
|
6830
|
+
/******/ return module.exports;
|
6831
|
+
/******/ }
|
6832
|
+
/******/
|
6833
|
+
/************************************************************************/
|
6834
|
+
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
6835
|
+
/******/ // startup
|
6836
|
+
/******/ // Load entry module and return exports
|
6837
|
+
/******/ return __w_pdfjs_require__(0);
|
6838
|
+
/******/ })()
|
6839
|
+
;
|
6439
6840
|
});
|
6440
6841
|
//# sourceMappingURL=pdf_viewer.js.map
|