pdfjs-dist 2.0.943 → 2.4.456
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/CODE_OF_CONDUCT.md +15 -0
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8286 -14230
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +25500 -26628
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +2887 -4094
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +855 -778
- package/lib/core/arithmetic_decoder.js +325 -311
- package/lib/core/bidi.js +117 -50
- package/lib/core/ccitt.js +251 -89
- package/lib/core/ccitt_stream.js +26 -16
- package/lib/core/cff_parser.js +525 -197
- package/lib/core/charsets.js +6 -5
- package/lib/core/chunked_stream.js +541 -406
- package/lib/core/cmap.js +368 -253
- package/lib/core/colorspace.js +781 -800
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +609 -422
- package/lib/core/document.js +649 -481
- package/lib/core/encodings.js +33 -24
- package/lib/core/evaluator.js +1471 -736
- package/lib/core/font_renderer.js +289 -149
- package/lib/core/fonts.js +1067 -413
- package/lib/core/function.js +517 -287
- package/lib/core/glyphlist.js +4529 -4527
- package/lib/core/image.js +232 -114
- package/lib/core/image_utils.js +94 -0
- package/lib/core/jbig2.js +711 -342
- package/lib/core/jbig2_stream.js +31 -19
- package/lib/core/jpeg_stream.js +151 -26
- package/lib/core/jpg.js +433 -181
- package/lib/core/jpx.js +551 -143
- package/lib/core/jpx_stream.js +40 -28
- package/lib/core/metrics.js +2931 -2931
- package/lib/core/murmurhash3.js +104 -97
- package/lib/core/obj.js +1561 -1053
- package/lib/core/operator_list.js +192 -64
- package/lib/core/parser.js +1162 -864
- package/lib/core/pattern.js +224 -75
- package/lib/core/pdf_manager.js +154 -285
- package/lib/core/primitives.js +145 -69
- package/lib/core/ps_parser.js +212 -162
- package/lib/core/standard_fonts.js +245 -244
- package/lib/core/stream.js +353 -81
- package/lib/core/type1_parser.js +218 -68
- package/lib/core/unicode.js +1682 -1655
- package/lib/core/worker.js +233 -302
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +808 -862
- package/lib/display/api.js +1778 -1462
- package/lib/display/api_compatibility.js +14 -9
- package/lib/display/canvas.js +463 -140
- package/lib/display/content_disposition.js +86 -58
- package/lib/display/display_utils.js +524 -0
- package/lib/display/fetch_stream.js +202 -274
- package/lib/display/font_loader.js +311 -333
- package/lib/display/metadata.js +98 -88
- package/lib/display/network.js +343 -347
- package/lib/display/network_utils.js +46 -26
- package/lib/display/node_stream.js +326 -404
- package/lib/display/pattern_helper.js +168 -69
- package/lib/display/svg.js +1296 -885
- package/lib/display/text_layer.js +229 -103
- package/lib/display/transport_stream.js +290 -250
- package/lib/display/webgl.js +116 -83
- package/lib/display/worker_options.js +6 -5
- package/lib/display/xml_parser.js +358 -337
- package/lib/examples/node/domstubs.js +95 -39
- package/lib/pdf.js +49 -31
- package/lib/pdf.worker.js +7 -5
- package/lib/shared/compatibility.js +3 -145
- package/lib/shared/is_node.js +8 -7
- package/lib/shared/message_handler.js +367 -314
- package/lib/shared/util.js +421 -415
- package/lib/test/unit/annotation_spec.js +1570 -690
- package/lib/test/unit/api_spec.js +855 -493
- package/lib/test/unit/bidi_spec.js +12 -12
- package/lib/test/unit/cff_parser_spec.js +88 -61
- package/lib/test/unit/clitests_helper.js +9 -12
- package/lib/test/unit/cmap_spec.js +140 -88
- package/lib/test/unit/colorspace_spec.js +204 -152
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +194 -182
- package/lib/test/unit/custom_spec.js +50 -64
- package/lib/test/unit/display_svg_spec.js +53 -38
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +17 -22
- package/lib/test/unit/encodings_spec.js +15 -57
- package/lib/test/unit/evaluator_spec.js +90 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +219 -205
- package/lib/test/unit/jasmine-boot.js +68 -39
- package/lib/test/unit/message_handler_spec.js +187 -160
- package/lib/test/unit/metadata_spec.js +87 -34
- package/lib/test/unit/murmurhash3_spec.js +13 -13
- package/lib/test/unit/network_spec.js +26 -59
- package/lib/test/unit/network_utils_spec.js +187 -121
- package/lib/test/unit/node_stream_spec.js +98 -90
- package/lib/test/unit/parser_spec.js +173 -131
- package/lib/test/unit/pdf_find_controller_spec.js +148 -67
- package/lib/test/unit/pdf_find_utils_spec.js +35 -34
- package/lib/test/unit/pdf_history_spec.js +45 -33
- package/lib/test/unit/primitives_spec.js +161 -126
- package/lib/test/unit/stream_spec.js +22 -15
- package/lib/test/unit/test_utils.js +149 -98
- package/lib/test/unit/testreporter.js +36 -18
- package/lib/test/unit/type1_parser_spec.js +46 -44
- package/lib/test/unit/ui_utils_spec.js +388 -372
- package/lib/test/unit/unicode_spec.js +49 -46
- package/lib/test/unit/util_spec.js +144 -248
- package/lib/web/annotation_layer_builder.js +75 -95
- package/lib/web/app.js +1538 -1147
- package/lib/web/app_options.js +116 -104
- package/lib/web/base_viewer.js +950 -775
- package/lib/web/chromecom.js +217 -225
- package/lib/web/debugger.js +236 -148
- package/lib/web/download_manager.js +50 -50
- package/lib/web/firefox_print_service.js +51 -33
- package/lib/web/firefoxcom.js +225 -352
- package/lib/web/genericcom.js +30 -93
- package/lib/web/genericl10n.js +26 -143
- package/lib/web/grab_to_pan.js +57 -33
- package/lib/web/interfaces.js +105 -232
- package/lib/web/overlay_manager.js +73 -227
- package/lib/web/password_prompt.js +44 -62
- package/lib/web/pdf_attachment_viewer.js +118 -123
- package/lib/web/pdf_cursor_tools.js +89 -93
- package/lib/web/pdf_document_properties.js +242 -281
- package/lib/web/pdf_find_bar.js +157 -163
- package/lib/web/pdf_find_controller.js +598 -454
- package/lib/web/pdf_find_utils.js +32 -16
- package/lib/web/pdf_history.js +481 -355
- package/lib/web/pdf_link_service.js +355 -323
- package/lib/web/pdf_outline_viewer.js +167 -152
- package/lib/web/pdf_page_view.js +511 -457
- package/lib/web/pdf_presentation_mode.js +347 -335
- package/lib/web/pdf_print_service.js +133 -103
- package/lib/web/pdf_rendering_queue.js +98 -100
- package/lib/web/pdf_sidebar.js +323 -299
- package/lib/web/pdf_sidebar_resizer.js +107 -108
- package/lib/web/pdf_single_page_viewer.js +94 -146
- package/lib/web/pdf_thumbnail_view.js +319 -269
- package/lib/web/pdf_thumbnail_viewer.js +219 -199
- package/lib/web/pdf_viewer.component.js +111 -32
- package/lib/web/pdf_viewer.js +61 -101
- package/lib/web/preferences.js +87 -272
- package/lib/web/secondary_toolbar.js +207 -220
- package/lib/web/text_layer_builder.js +322 -322
- package/lib/web/toolbar.js +227 -180
- package/lib/web/ui_utils.js +476 -421
- package/lib/web/view_history.js +59 -208
- package/lib/web/viewer_compatibility.js +9 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +36 -22
- package/web/pdf_viewer.js +4407 -4516
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/display/dom_utils.js +0 -441
- package/lib/shared/streams_polyfill.js +0 -39
- package/lib/shared/url_polyfill.js +0 -50
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/web/dom_events.js +0 -140
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,234 +19,254 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.PDFThumbnailViewer =
|
27
|
+
exports.PDFThumbnailViewer = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _ui_utils = require("./ui_utils.js");
|
30
30
|
|
31
|
-
var
|
31
|
+
var _pdf_thumbnail_view = require("./pdf_thumbnail_view.js");
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36
|
-
|
37
|
-
var THUMBNAIL_SCROLL_MARGIN = -19;
|
38
|
-
var THUMBNAIL_SELECTED_CLASS = 'selected';
|
39
|
-
|
40
|
-
var PDFThumbnailViewer = function () {
|
41
|
-
function PDFThumbnailViewer(_ref) {
|
42
|
-
var container = _ref.container,
|
43
|
-
linkService = _ref.linkService,
|
44
|
-
renderingQueue = _ref.renderingQueue,
|
45
|
-
_ref$l10n = _ref.l10n,
|
46
|
-
l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n;
|
47
|
-
|
48
|
-
_classCallCheck(this, PDFThumbnailViewer);
|
33
|
+
const THUMBNAIL_SCROLL_MARGIN = -19;
|
34
|
+
const THUMBNAIL_SELECTED_CLASS = "selected";
|
49
35
|
|
36
|
+
class PDFThumbnailViewer {
|
37
|
+
constructor({
|
38
|
+
container,
|
39
|
+
linkService,
|
40
|
+
renderingQueue,
|
41
|
+
l10n = _ui_utils.NullL10n
|
42
|
+
}) {
|
50
43
|
this.container = container;
|
51
44
|
this.linkService = linkService;
|
52
45
|
this.renderingQueue = renderingQueue;
|
53
46
|
this.l10n = l10n;
|
54
47
|
this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this));
|
48
|
+
|
55
49
|
this._resetView();
|
56
50
|
}
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}, {
|
74
|
-
key: 'scrollThumbnailIntoView',
|
75
|
-
value: function scrollThumbnailIntoView(pageNumber) {
|
76
|
-
if (!this.pdfDocument) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
var thumbnailView = this._thumbnails[pageNumber - 1];
|
80
|
-
if (!thumbnailView) {
|
81
|
-
console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
if (pageNumber !== this._currentPageNumber) {
|
85
|
-
var prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];
|
86
|
-
prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);
|
87
|
-
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
|
88
|
-
}
|
89
|
-
var visibleThumbs = this._getVisibleThumbs();
|
90
|
-
var numVisibleThumbs = visibleThumbs.views.length;
|
91
|
-
if (numVisibleThumbs > 0) {
|
92
|
-
var first = visibleThumbs.first.id;
|
93
|
-
var last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first;
|
94
|
-
var shouldScroll = false;
|
95
|
-
if (pageNumber <= first || pageNumber >= last) {
|
96
|
-
shouldScroll = true;
|
97
|
-
} else {
|
98
|
-
visibleThumbs.views.some(function (view) {
|
99
|
-
if (view.id !== pageNumber) {
|
100
|
-
return false;
|
101
|
-
}
|
102
|
-
shouldScroll = view.percent < 100;
|
103
|
-
return true;
|
104
|
-
});
|
105
|
-
}
|
106
|
-
if (shouldScroll) {
|
107
|
-
(0, _ui_utils.scrollIntoView)(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN });
|
108
|
-
}
|
109
|
-
}
|
110
|
-
this._currentPageNumber = pageNumber;
|
111
|
-
}
|
112
|
-
}, {
|
113
|
-
key: 'cleanup',
|
114
|
-
value: function cleanup() {
|
115
|
-
_pdf_thumbnail_view.PDFThumbnailView.cleanup();
|
116
|
-
}
|
117
|
-
}, {
|
118
|
-
key: '_resetView',
|
119
|
-
value: function _resetView() {
|
120
|
-
this._thumbnails = [];
|
121
|
-
this._currentPageNumber = 1;
|
122
|
-
this._pageLabels = null;
|
123
|
-
this._pagesRotation = 0;
|
124
|
-
this._pagesRequests = [];
|
125
|
-
this.container.textContent = '';
|
126
|
-
}
|
127
|
-
}, {
|
128
|
-
key: 'setDocument',
|
129
|
-
value: function setDocument(pdfDocument) {
|
130
|
-
var _this = this;
|
131
|
-
|
132
|
-
if (this.pdfDocument) {
|
133
|
-
this._cancelRendering();
|
134
|
-
this._resetView();
|
135
|
-
}
|
136
|
-
this.pdfDocument = pdfDocument;
|
137
|
-
if (!pdfDocument) {
|
138
|
-
return;
|
139
|
-
}
|
140
|
-
pdfDocument.getPage(1).then(function (firstPage) {
|
141
|
-
var pagesCount = pdfDocument.numPages;
|
142
|
-
var viewport = firstPage.getViewport(1.0);
|
143
|
-
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
144
|
-
var thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({
|
145
|
-
container: _this.container,
|
146
|
-
id: pageNum,
|
147
|
-
defaultViewport: viewport.clone(),
|
148
|
-
linkService: _this.linkService,
|
149
|
-
renderingQueue: _this.renderingQueue,
|
150
|
-
disableCanvasToImageConversion: false,
|
151
|
-
l10n: _this.l10n
|
152
|
-
});
|
153
|
-
_this._thumbnails.push(thumbnail);
|
154
|
-
}
|
155
|
-
var thumbnailView = _this._thumbnails[_this._currentPageNumber - 1];
|
156
|
-
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
|
157
|
-
}).catch(function (reason) {
|
158
|
-
console.error('Unable to initialize thumbnail viewer', reason);
|
159
|
-
});
|
52
|
+
_scrollUpdated() {
|
53
|
+
this.renderingQueue.renderHighestPriority();
|
54
|
+
}
|
55
|
+
|
56
|
+
getThumbnail(index) {
|
57
|
+
return this._thumbnails[index];
|
58
|
+
}
|
59
|
+
|
60
|
+
_getVisibleThumbs() {
|
61
|
+
return (0, _ui_utils.getVisibleElements)(this.container, this._thumbnails);
|
62
|
+
}
|
63
|
+
|
64
|
+
scrollThumbnailIntoView(pageNumber) {
|
65
|
+
if (!this.pdfDocument) {
|
66
|
+
return;
|
160
67
|
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
}
|
168
|
-
}
|
68
|
+
|
69
|
+
const thumbnailView = this._thumbnails[pageNumber - 1];
|
70
|
+
|
71
|
+
if (!thumbnailView) {
|
72
|
+
console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');
|
73
|
+
return;
|
169
74
|
}
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
75
|
+
|
76
|
+
if (pageNumber !== this._currentPageNumber) {
|
77
|
+
const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];
|
78
|
+
prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);
|
79
|
+
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
|
80
|
+
}
|
81
|
+
|
82
|
+
const visibleThumbs = this._getVisibleThumbs();
|
83
|
+
|
84
|
+
const numVisibleThumbs = visibleThumbs.views.length;
|
85
|
+
|
86
|
+
if (numVisibleThumbs > 0) {
|
87
|
+
const first = visibleThumbs.first.id;
|
88
|
+
const last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first;
|
89
|
+
let shouldScroll = false;
|
90
|
+
|
91
|
+
if (pageNumber <= first || pageNumber >= last) {
|
92
|
+
shouldScroll = true;
|
181
93
|
} else {
|
182
|
-
|
94
|
+
visibleThumbs.views.some(function (view) {
|
95
|
+
if (view.id !== pageNumber) {
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
|
99
|
+
shouldScroll = view.percent < 100;
|
100
|
+
return true;
|
101
|
+
});
|
183
102
|
}
|
184
|
-
|
185
|
-
|
186
|
-
|
103
|
+
|
104
|
+
if (shouldScroll) {
|
105
|
+
(0, _ui_utils.scrollIntoView)(thumbnailView.div, {
|
106
|
+
top: THUMBNAIL_SCROLL_MARGIN
|
107
|
+
});
|
187
108
|
}
|
188
109
|
}
|
189
|
-
}, {
|
190
|
-
key: '_ensurePdfPageLoaded',
|
191
|
-
value: function _ensurePdfPageLoaded(thumbView) {
|
192
|
-
var _this2 = this;
|
193
110
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
111
|
+
this._currentPageNumber = pageNumber;
|
112
|
+
}
|
113
|
+
|
114
|
+
get pagesRotation() {
|
115
|
+
return this._pagesRotation;
|
116
|
+
}
|
117
|
+
|
118
|
+
set pagesRotation(rotation) {
|
119
|
+
if (!(0, _ui_utils.isValidRotation)(rotation)) {
|
120
|
+
throw new Error("Invalid thumbnails rotation angle.");
|
121
|
+
}
|
122
|
+
|
123
|
+
if (!this.pdfDocument) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
|
127
|
+
if (this._pagesRotation === rotation) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
|
131
|
+
this._pagesRotation = rotation;
|
132
|
+
|
133
|
+
for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
|
134
|
+
this._thumbnails[i].update(rotation);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
cleanup() {
|
139
|
+
_pdf_thumbnail_view.PDFThumbnailView.cleanup();
|
140
|
+
}
|
141
|
+
|
142
|
+
_resetView() {
|
143
|
+
this._thumbnails = [];
|
144
|
+
this._currentPageNumber = 1;
|
145
|
+
this._pageLabels = null;
|
146
|
+
this._pagesRotation = 0;
|
147
|
+
this._pagesRequests = new WeakMap();
|
148
|
+
this.container.textContent = "";
|
149
|
+
}
|
150
|
+
|
151
|
+
setDocument(pdfDocument) {
|
152
|
+
if (this.pdfDocument) {
|
153
|
+
this._cancelRendering();
|
154
|
+
|
155
|
+
this._resetView();
|
156
|
+
}
|
157
|
+
|
158
|
+
this.pdfDocument = pdfDocument;
|
159
|
+
|
160
|
+
if (!pdfDocument) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
|
164
|
+
pdfDocument.getPage(1).then(firstPdfPage => {
|
165
|
+
const pagesCount = pdfDocument.numPages;
|
166
|
+
const viewport = firstPdfPage.getViewport({
|
167
|
+
scale: 1
|
208
168
|
});
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
if (thumbView) {
|
220
|
-
this._ensurePdfPageLoaded(thumbView).then(function () {
|
221
|
-
_this3.renderingQueue.renderView(thumbView);
|
169
|
+
|
170
|
+
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
171
|
+
const thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({
|
172
|
+
container: this.container,
|
173
|
+
id: pageNum,
|
174
|
+
defaultViewport: viewport.clone(),
|
175
|
+
linkService: this.linkService,
|
176
|
+
renderingQueue: this.renderingQueue,
|
177
|
+
disableCanvasToImageConversion: false,
|
178
|
+
l10n: this.l10n
|
222
179
|
});
|
223
|
-
|
224
|
-
|
225
|
-
return false;
|
226
|
-
}
|
227
|
-
}, {
|
228
|
-
key: 'pagesRotation',
|
229
|
-
get: function get() {
|
230
|
-
return this._pagesRotation;
|
231
|
-
},
|
232
|
-
set: function set(rotation) {
|
233
|
-
if (!(0, _ui_utils.isValidRotation)(rotation)) {
|
234
|
-
throw new Error('Invalid thumbnails rotation angle.');
|
180
|
+
|
181
|
+
this._thumbnails.push(thumbnail);
|
235
182
|
}
|
236
|
-
|
237
|
-
|
183
|
+
|
184
|
+
const firstThumbnailView = this._thumbnails[0];
|
185
|
+
|
186
|
+
if (firstThumbnailView) {
|
187
|
+
firstThumbnailView.setPdfPage(firstPdfPage);
|
238
188
|
}
|
239
|
-
|
240
|
-
|
189
|
+
|
190
|
+
const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
|
191
|
+
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
|
192
|
+
}).catch(reason => {
|
193
|
+
console.error("Unable to initialize thumbnail viewer", reason);
|
194
|
+
});
|
195
|
+
}
|
196
|
+
|
197
|
+
_cancelRendering() {
|
198
|
+
for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
|
199
|
+
if (this._thumbnails[i]) {
|
200
|
+
this._thumbnails[i].cancelRendering();
|
241
201
|
}
|
242
|
-
|
243
|
-
|
244
|
-
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
setPageLabels(labels) {
|
206
|
+
if (!this.pdfDocument) {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
|
210
|
+
if (!labels) {
|
211
|
+
this._pageLabels = null;
|
212
|
+
} else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
|
213
|
+
this._pageLabels = null;
|
214
|
+
console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.");
|
215
|
+
} else {
|
216
|
+
this._pageLabels = labels;
|
217
|
+
}
|
218
|
+
|
219
|
+
for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
|
220
|
+
const label = this._pageLabels && this._pageLabels[i];
|
221
|
+
|
222
|
+
this._thumbnails[i].setPageLabel(label);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
_ensurePdfPageLoaded(thumbView) {
|
227
|
+
if (thumbView.pdfPage) {
|
228
|
+
return Promise.resolve(thumbView.pdfPage);
|
229
|
+
}
|
230
|
+
|
231
|
+
if (this._pagesRequests.has(thumbView)) {
|
232
|
+
return this._pagesRequests.get(thumbView);
|
233
|
+
}
|
234
|
+
|
235
|
+
const promise = this.pdfDocument.getPage(thumbView.id).then(pdfPage => {
|
236
|
+
if (!thumbView.pdfPage) {
|
237
|
+
thumbView.setPdfPage(pdfPage);
|
245
238
|
}
|
239
|
+
|
240
|
+
this._pagesRequests.delete(thumbView);
|
241
|
+
|
242
|
+
return pdfPage;
|
243
|
+
}).catch(reason => {
|
244
|
+
console.error("Unable to get page for thumb view", reason);
|
245
|
+
|
246
|
+
this._pagesRequests.delete(thumbView);
|
247
|
+
});
|
248
|
+
|
249
|
+
this._pagesRequests.set(thumbView, promise);
|
250
|
+
|
251
|
+
return promise;
|
252
|
+
}
|
253
|
+
|
254
|
+
forceRendering() {
|
255
|
+
const visibleThumbs = this._getVisibleThumbs();
|
256
|
+
|
257
|
+
const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, this.scroll.down);
|
258
|
+
|
259
|
+
if (thumbView) {
|
260
|
+
this._ensurePdfPageLoaded(thumbView).then(() => {
|
261
|
+
this.renderingQueue.renderView(thumbView);
|
262
|
+
});
|
263
|
+
|
264
|
+
return true;
|
246
265
|
}
|
247
|
-
}]);
|
248
266
|
|
249
|
-
|
250
|
-
}
|
267
|
+
return false;
|
268
|
+
}
|
269
|
+
|
270
|
+
}
|
251
271
|
|
252
272
|
exports.PDFThumbnailViewer = PDFThumbnailViewer;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,50 +19,129 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
|
27
|
+
Object.defineProperty(exports, "AnnotationLayerBuilder", {
|
28
|
+
enumerable: true,
|
29
|
+
get: function () {
|
30
|
+
return _annotation_layer_builder.AnnotationLayerBuilder;
|
31
|
+
}
|
32
|
+
});
|
33
|
+
Object.defineProperty(exports, "DefaultAnnotationLayerFactory", {
|
34
|
+
enumerable: true,
|
35
|
+
get: function () {
|
36
|
+
return _annotation_layer_builder.DefaultAnnotationLayerFactory;
|
37
|
+
}
|
38
|
+
});
|
39
|
+
Object.defineProperty(exports, "DefaultTextLayerFactory", {
|
40
|
+
enumerable: true,
|
41
|
+
get: function () {
|
42
|
+
return _text_layer_builder.DefaultTextLayerFactory;
|
43
|
+
}
|
44
|
+
});
|
45
|
+
Object.defineProperty(exports, "TextLayerBuilder", {
|
46
|
+
enumerable: true,
|
47
|
+
get: function () {
|
48
|
+
return _text_layer_builder.TextLayerBuilder;
|
49
|
+
}
|
50
|
+
});
|
51
|
+
Object.defineProperty(exports, "EventBus", {
|
52
|
+
enumerable: true,
|
53
|
+
get: function () {
|
54
|
+
return _ui_utils.EventBus;
|
55
|
+
}
|
56
|
+
});
|
57
|
+
Object.defineProperty(exports, "NullL10n", {
|
58
|
+
enumerable: true,
|
59
|
+
get: function () {
|
60
|
+
return _ui_utils.NullL10n;
|
61
|
+
}
|
62
|
+
});
|
63
|
+
Object.defineProperty(exports, "ProgressBar", {
|
64
|
+
enumerable: true,
|
65
|
+
get: function () {
|
66
|
+
return _ui_utils.ProgressBar;
|
67
|
+
}
|
68
|
+
});
|
69
|
+
Object.defineProperty(exports, "PDFLinkService", {
|
70
|
+
enumerable: true,
|
71
|
+
get: function () {
|
72
|
+
return _pdf_link_service.PDFLinkService;
|
73
|
+
}
|
74
|
+
});
|
75
|
+
Object.defineProperty(exports, "SimpleLinkService", {
|
76
|
+
enumerable: true,
|
77
|
+
get: function () {
|
78
|
+
return _pdf_link_service.SimpleLinkService;
|
79
|
+
}
|
80
|
+
});
|
81
|
+
Object.defineProperty(exports, "DownloadManager", {
|
82
|
+
enumerable: true,
|
83
|
+
get: function () {
|
84
|
+
return _download_manager.DownloadManager;
|
85
|
+
}
|
86
|
+
});
|
87
|
+
Object.defineProperty(exports, "GenericL10n", {
|
88
|
+
enumerable: true,
|
89
|
+
get: function () {
|
90
|
+
return _genericl10n.GenericL10n;
|
91
|
+
}
|
92
|
+
});
|
93
|
+
Object.defineProperty(exports, "PDFFindController", {
|
94
|
+
enumerable: true,
|
95
|
+
get: function () {
|
96
|
+
return _pdf_find_controller.PDFFindController;
|
97
|
+
}
|
98
|
+
});
|
99
|
+
Object.defineProperty(exports, "PDFHistory", {
|
100
|
+
enumerable: true,
|
101
|
+
get: function () {
|
102
|
+
return _pdf_history.PDFHistory;
|
103
|
+
}
|
104
|
+
});
|
105
|
+
Object.defineProperty(exports, "PDFPageView", {
|
106
|
+
enumerable: true,
|
107
|
+
get: function () {
|
108
|
+
return _pdf_page_view.PDFPageView;
|
109
|
+
}
|
110
|
+
});
|
111
|
+
Object.defineProperty(exports, "PDFSinglePageViewer", {
|
112
|
+
enumerable: true,
|
113
|
+
get: function () {
|
114
|
+
return _pdf_single_page_viewer.PDFSinglePageViewer;
|
115
|
+
}
|
116
|
+
});
|
117
|
+
Object.defineProperty(exports, "PDFViewer", {
|
118
|
+
enumerable: true,
|
119
|
+
get: function () {
|
120
|
+
return _pdf_viewer.PDFViewer;
|
121
|
+
}
|
122
|
+
});
|
28
123
|
|
29
|
-
var _annotation_layer_builder = require(
|
124
|
+
var _annotation_layer_builder = require("./annotation_layer_builder.js");
|
30
125
|
|
31
|
-
var _text_layer_builder = require(
|
126
|
+
var _text_layer_builder = require("./text_layer_builder.js");
|
32
127
|
|
33
|
-
var _ui_utils = require(
|
128
|
+
var _ui_utils = require("./ui_utils.js");
|
34
129
|
|
35
|
-
var _pdf_link_service = require(
|
130
|
+
var _pdf_link_service = require("./pdf_link_service.js");
|
36
131
|
|
37
|
-
var _download_manager = require(
|
132
|
+
var _download_manager = require("./download_manager.js");
|
38
133
|
|
39
|
-
var _genericl10n = require(
|
134
|
+
var _genericl10n = require("./genericl10n.js");
|
40
135
|
|
41
|
-
var _pdf_find_controller = require(
|
136
|
+
var _pdf_find_controller = require("./pdf_find_controller.js");
|
42
137
|
|
43
|
-
var _pdf_history = require(
|
138
|
+
var _pdf_history = require("./pdf_history.js");
|
44
139
|
|
45
|
-
var _pdf_page_view = require(
|
140
|
+
var _pdf_page_view = require("./pdf_page_view.js");
|
46
141
|
|
47
|
-
var _pdf_single_page_viewer = require(
|
142
|
+
var _pdf_single_page_viewer = require("./pdf_single_page_viewer.js");
|
48
143
|
|
49
|
-
var _pdf_viewer = require(
|
144
|
+
var _pdf_viewer = require("./pdf_viewer.js");
|
50
145
|
|
51
|
-
|
52
|
-
|
53
|
-
exports.PDFViewer = _pdf_viewer.PDFViewer;
|
54
|
-
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
|
55
|
-
exports.PDFPageView = _pdf_page_view.PDFPageView;
|
56
|
-
exports.PDFLinkService = _pdf_link_service.PDFLinkService;
|
57
|
-
exports.SimpleLinkService = _pdf_link_service.SimpleLinkService;
|
58
|
-
exports.TextLayerBuilder = _text_layer_builder.TextLayerBuilder;
|
59
|
-
exports.DefaultTextLayerFactory = _text_layer_builder.DefaultTextLayerFactory;
|
60
|
-
exports.AnnotationLayerBuilder = _annotation_layer_builder.AnnotationLayerBuilder;
|
61
|
-
exports.DefaultAnnotationLayerFactory = _annotation_layer_builder.DefaultAnnotationLayerFactory;
|
62
|
-
exports.PDFHistory = _pdf_history.PDFHistory;
|
63
|
-
exports.PDFFindController = _pdf_find_controller.PDFFindController;
|
64
|
-
exports.EventBus = _ui_utils.EventBus;
|
65
|
-
exports.DownloadManager = _download_manager.DownloadManager;
|
66
|
-
exports.ProgressBar = _ui_utils.ProgressBar;
|
67
|
-
exports.GenericL10n = _genericl10n.GenericL10n;
|
68
|
-
exports.NullL10n = _ui_utils.NullL10n;
|
146
|
+
const pdfjsVersion = '2.4.456';
|
147
|
+
const pdfjsBuild = '228a591c';
|