pdfjs-dist 2.1.266 → 2.2.228
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/bower.json +1 -1
- package/build/pdf.js +3349 -2324
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +2804 -1975
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +431 -511
- 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 +294 -224
- package/lib/core/arithmetic_decoder.js +1 -1
- package/lib/core/bidi.js +1 -1
- package/lib/core/ccitt.js +1 -1
- package/lib/core/ccitt_stream.js +1 -1
- package/lib/core/cff_parser.js +61 -12
- package/lib/core/charsets.js +1 -1
- package/lib/core/chunked_stream.js +24 -14
- package/lib/core/cmap.js +17 -13
- package/lib/core/colorspace.js +1 -1
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +1 -1
- package/lib/core/document.js +47 -40
- package/lib/core/encodings.js +1 -1
- package/lib/core/evaluator.js +346 -279
- package/lib/core/font_renderer.js +1 -1
- package/lib/core/fonts.js +23 -11
- package/lib/core/function.js +1 -1
- package/lib/core/glyphlist.js +2 -2
- package/lib/core/image.js +2 -2
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +1 -1
- package/lib/core/jbig2_stream.js +1 -1
- package/lib/core/jpeg_stream.js +1 -1
- package/lib/core/jpg.js +2 -1
- package/lib/core/jpx.js +1 -1
- package/lib/core/jpx_stream.js +1 -1
- package/lib/core/metrics.js +13 -13
- package/lib/core/murmurhash3.js +37 -33
- package/lib/core/obj.js +245 -41
- package/lib/core/operator_list.js +43 -32
- package/lib/core/parser.js +228 -133
- package/lib/core/pattern.js +4 -2
- package/lib/core/pdf_manager.js +17 -15
- package/lib/core/primitives.js +40 -6
- package/lib/core/ps_parser.js +1 -1
- package/lib/core/standard_fonts.js +9 -9
- package/lib/core/stream.js +1 -1
- package/lib/core/type1_parser.js +1 -1
- package/lib/core/unicode.js +2 -2
- package/lib/core/worker.js +54 -171
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +112 -33
- package/lib/display/api.js +211 -123
- package/lib/display/api_compatibility.js +1 -1
- package/lib/display/canvas.js +40 -19
- package/lib/display/content_disposition.js +1 -1
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +19 -12
- package/lib/display/font_loader.js +11 -8
- package/lib/display/metadata.js +1 -1
- package/lib/display/network.js +563 -521
- package/lib/display/network_utils.js +1 -1
- package/lib/display/node_stream.js +21 -12
- package/lib/display/pattern_helper.js +24 -25
- package/lib/display/svg.js +1068 -565
- package/lib/display/text_layer.js +24 -14
- package/lib/display/transport_stream.js +192 -70
- package/lib/display/webgl.js +1 -1
- package/lib/display/worker_options.js +1 -1
- package/lib/display/xml_parser.js +1 -1
- package/lib/examples/node/domstubs.js +4 -1
- package/lib/pdf.js +20 -15
- package/lib/pdf.worker.js +3 -3
- package/lib/shared/compatibility.js +6 -6
- package/lib/shared/global_scope.js +1 -1
- package/lib/shared/is_node.js +2 -2
- package/lib/shared/message_handler.js +7 -7
- package/lib/shared/streams_polyfill.js +1 -1
- package/lib/shared/url_polyfill.js +1 -1
- package/lib/shared/util.js +13 -125
- package/lib/test/unit/annotation_spec.js +278 -93
- package/lib/test/unit/api_spec.js +198 -188
- package/lib/test/unit/bidi_spec.js +1 -1
- package/lib/test/unit/cff_parser_spec.js +15 -1
- package/lib/test/unit/clitests_helper.js +3 -3
- package/lib/test/unit/cmap_spec.js +20 -20
- package/lib/test/unit/colorspace_spec.js +17 -12
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +1 -1
- package/lib/test/unit/custom_spec.js +8 -8
- package/lib/test/unit/display_svg_spec.js +8 -8
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +7 -12
- package/lib/test/unit/encodings_spec.js +5 -5
- package/lib/test/unit/evaluator_spec.js +8 -10
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +1 -1
- package/lib/test/unit/jasmine-boot.js +4 -4
- package/lib/test/unit/message_handler_spec.js +1 -1
- package/lib/test/unit/metadata_spec.js +1 -1
- package/lib/test/unit/murmurhash3_spec.js +1 -1
- package/lib/test/unit/network_spec.js +5 -55
- package/lib/test/unit/network_utils_spec.js +51 -1
- package/lib/test/unit/node_stream_spec.js +8 -8
- package/lib/test/unit/parser_spec.js +150 -86
- package/lib/test/unit/pdf_find_controller_spec.js +1 -1
- package/lib/test/unit/pdf_find_utils_spec.js +1 -1
- package/lib/test/unit/pdf_history_spec.js +1 -1
- package/lib/test/unit/primitives_spec.js +30 -17
- package/lib/test/unit/stream_spec.js +1 -1
- package/lib/test/unit/test_utils.js +197 -43
- package/lib/test/unit/testreporter.js +1 -1
- package/lib/test/unit/type1_parser_spec.js +1 -1
- package/lib/test/unit/ui_utils_spec.js +20 -20
- package/lib/test/unit/unicode_spec.js +5 -5
- package/lib/test/unit/util_spec.js +1 -164
- package/lib/web/annotation_layer_builder.js +1 -1
- package/lib/web/app.js +104 -60
- package/lib/web/app_options.js +45 -37
- package/lib/web/base_viewer.js +7 -7
- package/lib/web/chromecom.js +8 -8
- package/lib/web/debugger.js +7 -7
- package/lib/web/download_manager.js +3 -2
- package/lib/web/firefox_print_service.js +4 -2
- package/lib/web/firefoxcom.js +50 -19
- package/lib/web/genericcom.js +8 -8
- package/lib/web/genericl10n.js +10 -10
- package/lib/web/grab_to_pan.js +3 -1
- package/lib/web/interfaces.js +13 -13
- package/lib/web/overlay_manager.js +10 -10
- package/lib/web/password_prompt.js +2 -2
- package/lib/web/pdf_attachment_viewer.js +1 -1
- package/lib/web/pdf_cursor_tools.js +1 -1
- package/lib/web/pdf_document_properties.js +188 -119
- package/lib/web/pdf_find_bar.js +1 -1
- package/lib/web/pdf_find_controller.js +3 -3
- package/lib/web/pdf_find_utils.js +1 -1
- package/lib/web/pdf_history.js +1 -1
- package/lib/web/pdf_link_service.js +2 -2
- package/lib/web/pdf_outline_viewer.js +53 -28
- package/lib/web/pdf_page_view.js +9 -18
- package/lib/web/pdf_presentation_mode.js +1 -1
- package/lib/web/pdf_print_service.js +5 -3
- package/lib/web/pdf_rendering_queue.js +4 -7
- package/lib/web/pdf_sidebar.js +24 -17
- package/lib/web/pdf_sidebar_resizer.js +1 -1
- package/lib/web/pdf_single_page_viewer.js +1 -1
- package/lib/web/pdf_thumbnail_view.js +2 -2
- package/lib/web/pdf_thumbnail_viewer.js +3 -3
- package/lib/web/pdf_viewer.component.js +3 -3
- package/lib/web/pdf_viewer.js +3 -3
- package/lib/web/preferences.js +30 -30
- package/lib/web/secondary_toolbar.js +1 -1
- package/lib/web/text_layer_builder.js +23 -45
- package/lib/web/toolbar.js +1 -1
- package/lib/web/ui_utils.js +14 -14
- package/lib/web/view_history.js +15 -15
- package/lib/web/viewer_compatibility.js +1 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +21 -10
- package/web/pdf_viewer.js +126 -194
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -494
- package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -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 2019 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.
|
@@ -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 2019 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.
|
@@ -32,7 +32,7 @@ var _util = require("../shared/util");
|
|
32
32
|
|
33
33
|
var _network_utils = require("./network_utils");
|
34
34
|
|
35
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
36
36
|
|
37
37
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
38
38
|
|
@@ -95,20 +95,24 @@ function () {
|
|
95
95
|
this.isHttp = this.url.protocol === 'http:' || this.url.protocol === 'https:';
|
96
96
|
this.isFsUrl = this.url.protocol === 'file:';
|
97
97
|
this.httpHeaders = this.isHttp && source.httpHeaders || {};
|
98
|
-
this.
|
98
|
+
this._fullRequestReader = null;
|
99
99
|
this._rangeRequestReaders = [];
|
100
100
|
}
|
101
101
|
|
102
102
|
_createClass(PDFNodeStream, [{
|
103
103
|
key: "getFullReader",
|
104
104
|
value: function getFullReader() {
|
105
|
-
(0, _util.assert)(!this.
|
106
|
-
this.
|
107
|
-
return this.
|
105
|
+
(0, _util.assert)(!this._fullRequestReader);
|
106
|
+
this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
|
107
|
+
return this._fullRequestReader;
|
108
108
|
}
|
109
109
|
}, {
|
110
110
|
key: "getRangeReader",
|
111
111
|
value: function getRangeReader(start, end) {
|
112
|
+
if (end <= this._progressiveDataLength) {
|
113
|
+
return null;
|
114
|
+
}
|
115
|
+
|
112
116
|
var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
|
113
117
|
|
114
118
|
this._rangeRequestReaders.push(rangeReader);
|
@@ -118,8 +122,8 @@ function () {
|
|
118
122
|
}, {
|
119
123
|
key: "cancelAllRequests",
|
120
124
|
value: function cancelAllRequests(reason) {
|
121
|
-
if (this.
|
122
|
-
this.
|
125
|
+
if (this._fullRequestReader) {
|
126
|
+
this._fullRequestReader.cancel(reason);
|
123
127
|
}
|
124
128
|
|
125
129
|
var readers = this._rangeRequestReaders.slice(0);
|
@@ -128,6 +132,11 @@ function () {
|
|
128
132
|
reader.cancel(reason);
|
129
133
|
});
|
130
134
|
}
|
135
|
+
}, {
|
136
|
+
key: "_progressiveDataLength",
|
137
|
+
get: function get() {
|
138
|
+
return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
|
139
|
+
}
|
131
140
|
}]);
|
132
141
|
|
133
142
|
return PDFNodeStream;
|
@@ -168,9 +177,9 @@ function () {
|
|
168
177
|
value: function () {
|
169
178
|
var _read = _asyncToGenerator(
|
170
179
|
/*#__PURE__*/
|
171
|
-
_regenerator
|
180
|
+
_regenerator["default"].mark(function _callee() {
|
172
181
|
var chunk, buffer;
|
173
|
-
return _regenerator
|
182
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
174
183
|
while (1) {
|
175
184
|
switch (_context.prev = _context.next) {
|
176
185
|
case 0:
|
@@ -334,9 +343,9 @@ function () {
|
|
334
343
|
value: function () {
|
335
344
|
var _read2 = _asyncToGenerator(
|
336
345
|
/*#__PURE__*/
|
337
|
-
_regenerator
|
346
|
+
_regenerator["default"].mark(function _callee2() {
|
338
347
|
var chunk, buffer;
|
339
|
-
return _regenerator
|
348
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
340
349
|
while (1) {
|
341
350
|
switch (_context2.prev = _context2.next) {
|
342
351
|
case 0:
|
@@ -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 2019 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.
|
@@ -361,42 +361,42 @@ var TilingPattern = function TilingPatternClosure() {
|
|
361
361
|
y0 = bbox[1],
|
362
362
|
x1 = bbox[2],
|
363
363
|
y1 = bbox[3];
|
364
|
-
var topLeft = [x0, y0];
|
365
|
-
var botRight = [x0 + xstep, y0 + ystep];
|
366
|
-
var width = botRight[0] - topLeft[0];
|
367
|
-
var height = botRight[1] - topLeft[1];
|
368
364
|
|
369
365
|
var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
|
370
366
|
|
371
367
|
var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform);
|
372
368
|
|
373
369
|
var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
|
374
|
-
|
375
|
-
|
376
|
-
var tmpCanvas = owner.cachedCanvases.getCanvas('pattern',
|
370
|
+
var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
|
371
|
+
var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
|
372
|
+
var tmpCanvas = owner.cachedCanvases.getCanvas('pattern', dimx.size, dimy.size, true);
|
377
373
|
var tmpCtx = tmpCanvas.context;
|
378
374
|
var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
|
379
375
|
graphics.groupLevel = owner.groupLevel;
|
380
376
|
this.setFillAndStrokeStyleToContext(graphics, paintType, color);
|
381
|
-
|
382
|
-
|
383
|
-
var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]];
|
384
|
-
graphics.transform.apply(graphics, tmpTranslate);
|
377
|
+
graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
|
378
|
+
graphics.transform(1, 0, 0, 1, -x0, -y0);
|
385
379
|
this.clipBbox(graphics, bbox, x0, y0, x1, y1);
|
386
380
|
graphics.executeOperatorList(operatorList);
|
381
|
+
this.ctx.transform(1, 0, 0, 1, x0, y0);
|
382
|
+
this.ctx.scale(1 / dimx.scale, 1 / dimy.scale);
|
387
383
|
return tmpCanvas.canvas;
|
388
384
|
},
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
385
|
+
getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) {
|
386
|
+
step = Math.abs(step);
|
387
|
+
var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize);
|
388
|
+
var size = Math.ceil(step * scale);
|
389
|
+
|
390
|
+
if (size >= maxSize) {
|
391
|
+
size = maxSize;
|
392
|
+
} else {
|
393
|
+
scale = size / step;
|
394
|
+
}
|
395
|
+
|
396
|
+
return {
|
397
|
+
scale: scale,
|
398
|
+
size: size
|
399
|
+
};
|
400
400
|
},
|
401
401
|
clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
|
402
402
|
if (Array.isArray(bbox) && bbox.length === 4) {
|
@@ -434,11 +434,10 @@ var TilingPattern = function TilingPatternClosure() {
|
|
434
434
|
}
|
435
435
|
},
|
436
436
|
getPattern: function TilingPattern_getPattern(ctx, owner) {
|
437
|
-
var temporaryPatternCanvas = this.createPatternCanvas(owner);
|
438
437
|
ctx = this.ctx;
|
439
438
|
ctx.setTransform.apply(ctx, this.baseTransform);
|
440
439
|
ctx.transform.apply(ctx, this.matrix);
|
441
|
-
this.
|
440
|
+
var temporaryPatternCanvas = this.createPatternCanvas(owner);
|
442
441
|
return ctx.createPattern(temporaryPatternCanvas, 'repeat');
|
443
442
|
}
|
444
443
|
};
|