pdfjs-dist 2.2.228 → 2.3.200
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/bower.json +1 -1
- package/build/pdf.js +8851 -8582
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +8717 -8394
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +3014 -2864
- 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 +203 -39
- package/lib/core/chunked_stream.js +32 -9
- package/lib/core/core_utils.js +48 -22
- package/lib/core/document.js +44 -33
- package/lib/core/evaluator.js +68 -32
- package/lib/core/fonts.js +2 -2
- package/lib/core/glyphlist.js +1 -0
- package/lib/core/image.js +1 -1
- package/lib/core/jbig2.js +23 -6
- package/lib/core/jpg.js +54 -23
- package/lib/core/jpx.js +23 -6
- package/lib/core/obj.js +18 -16
- package/lib/core/operator_list.js +17 -14
- package/lib/core/parser.js +9 -12
- package/lib/core/pattern.js +22 -7
- package/lib/core/pdf_manager.js +4 -4
- package/lib/core/primitives.js +63 -42
- package/lib/core/stream.js +14 -0
- package/lib/core/type1_parser.js +9 -1
- package/lib/core/worker.js +17 -56
- package/lib/display/annotation_layer.js +194 -85
- package/lib/display/api.js +331 -213
- package/lib/display/canvas.js +6 -1
- package/lib/display/content_disposition.js +1 -1
- package/lib/display/display_utils.js +48 -18
- package/lib/display/network_utils.js +6 -0
- package/lib/display/pattern_helper.js +22 -5
- package/lib/display/svg.js +1 -1
- package/lib/display/text_layer.js +62 -53
- package/lib/display/xml_parser.js +1 -1
- package/lib/pdf.js +2 -3
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/compatibility.js +23 -19
- package/lib/shared/message_handler.js +163 -196
- package/lib/shared/streams_polyfill.js +1 -1
- package/lib/shared/util.js +288 -196
- package/lib/test/unit/annotation_spec.js +687 -93
- package/lib/test/unit/api_spec.js +72 -27
- package/lib/test/unit/display_utils_spec.js +1 -1
- package/lib/test/unit/evaluator_spec.js +21 -5
- package/lib/test/unit/fetch_stream_spec.js +3 -1
- package/lib/test/unit/message_handler_spec.js +10 -6
- package/lib/test/unit/network_spec.js +3 -1
- package/lib/test/unit/network_utils_spec.js +14 -0
- package/lib/test/unit/node_stream_spec.js +3 -3
- package/lib/test/unit/primitives_spec.js +2 -2
- package/lib/test/unit/type1_parser_spec.js +1 -1
- package/lib/test/unit/ui_utils_spec.js +1 -1
- package/lib/test/unit/util_spec.js +10 -10
- package/lib/web/app.js +47 -35
- package/lib/web/app_options.js +4 -4
- package/lib/web/base_viewer.js +36 -12
- package/lib/web/chromecom.js +1 -3
- package/lib/web/download_manager.js +1 -1
- package/lib/web/firefox_print_service.js +7 -4
- package/lib/web/firefoxcom.js +10 -5
- package/lib/web/interfaces.js +4 -0
- package/lib/web/pdf_document_properties.js +1 -1
- package/lib/web/pdf_history.js +1 -1
- package/lib/web/pdf_link_service.js +7 -3
- package/lib/web/pdf_outline_viewer.js +2 -1
- package/lib/web/pdf_page_view.js +12 -16
- package/lib/web/pdf_print_service.js +3 -5
- package/lib/web/pdf_sidebar.js +3 -0
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/toolbar.js +2 -0
- package/lib/web/ui_utils.js +1 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +5 -9
- package/web/pdf_viewer.js +60 -45
- package/web/pdf_viewer.js.map +1 -1
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/url_polyfill.js +0 -56
package/lib/display/canvas.js
CHANGED
@@ -1093,15 +1093,20 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
|
|
1093
1093
|
consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
|
1094
1094
|
var ctx = this.ctx;
|
1095
1095
|
var strokeColor = this.current.strokeColor;
|
1096
|
-
ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth);
|
1097
1096
|
ctx.globalAlpha = this.current.strokeAlpha;
|
1098
1097
|
|
1099
1098
|
if (strokeColor && strokeColor.hasOwnProperty('type') && strokeColor.type === 'Pattern') {
|
1100
1099
|
ctx.save();
|
1100
|
+
var transform = ctx.mozCurrentTransform;
|
1101
|
+
|
1102
|
+
var scale = _util.Util.singularValueDecompose2dScale(transform)[0];
|
1103
|
+
|
1101
1104
|
ctx.strokeStyle = strokeColor.getPattern(ctx, this);
|
1105
|
+
ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale);
|
1102
1106
|
ctx.stroke();
|
1103
1107
|
ctx.restore();
|
1104
1108
|
} else {
|
1109
|
+
ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth);
|
1105
1110
|
ctx.stroke();
|
1106
1111
|
}
|
1107
1112
|
|
@@ -30,7 +30,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
30
30
|
|
31
31
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
32
32
|
|
33
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
33
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
34
34
|
|
35
35
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
36
36
|
|
@@ -37,7 +37,19 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
37
37
|
|
38
38
|
var _util = require("../shared/util");
|
39
39
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
41
|
+
|
42
|
+
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); }
|
43
|
+
|
44
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
45
|
+
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
47
|
+
|
48
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
49
|
+
|
50
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
51
|
+
|
52
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
41
53
|
|
42
54
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
43
55
|
|
@@ -458,17 +470,23 @@ function () {
|
|
458
470
|
|
459
471
|
exports.PageViewport = PageViewport;
|
460
472
|
|
461
|
-
var RenderingCancelledException =
|
473
|
+
var RenderingCancelledException =
|
474
|
+
/*#__PURE__*/
|
475
|
+
function (_BaseException) {
|
476
|
+
_inherits(RenderingCancelledException, _BaseException);
|
477
|
+
|
462
478
|
function RenderingCancelledException(msg, type) {
|
463
|
-
|
464
|
-
|
479
|
+
var _this2;
|
480
|
+
|
481
|
+
_classCallCheck(this, RenderingCancelledException);
|
482
|
+
|
483
|
+
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(RenderingCancelledException).call(this, msg));
|
484
|
+
_this2.type = type;
|
485
|
+
return _this2;
|
465
486
|
}
|
466
487
|
|
467
|
-
RenderingCancelledException.prototype = new Error();
|
468
|
-
RenderingCancelledException.prototype.name = 'RenderingCancelledException';
|
469
|
-
RenderingCancelledException.constructor = RenderingCancelledException;
|
470
488
|
return RenderingCancelledException;
|
471
|
-
}();
|
489
|
+
}(_util.BaseException);
|
472
490
|
|
473
491
|
exports.RenderingCancelledException = RenderingCancelledException;
|
474
492
|
var LinkTarget = {
|
@@ -485,16 +503,28 @@ function addLinkAttributes(link) {
|
|
485
503
|
var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
486
504
|
url = _ref7.url,
|
487
505
|
target = _ref7.target,
|
488
|
-
rel = _ref7.rel
|
506
|
+
rel = _ref7.rel,
|
507
|
+
_ref7$enabled = _ref7.enabled,
|
508
|
+
enabled = _ref7$enabled === void 0 ? true : _ref7$enabled;
|
489
509
|
|
490
|
-
|
510
|
+
(0, _util.assert)(url && typeof url === 'string', 'addLinkAttributes: A valid "url" parameter must provided.');
|
511
|
+
var urlNullRemoved = (0, _util.removeNullCharacters)(url);
|
491
512
|
|
492
|
-
if (
|
493
|
-
|
494
|
-
|
495
|
-
link.
|
496
|
-
link.
|
513
|
+
if (enabled) {
|
514
|
+
link.href = link.title = urlNullRemoved;
|
515
|
+
} else {
|
516
|
+
link.href = '';
|
517
|
+
link.title = "Disabled: ".concat(urlNullRemoved);
|
518
|
+
|
519
|
+
link.onclick = function () {
|
520
|
+
return false;
|
521
|
+
};
|
497
522
|
}
|
523
|
+
|
524
|
+
var LinkTargetValues = Object.values(LinkTarget);
|
525
|
+
var targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
|
526
|
+
link.target = LinkTargetStringMap[targetIndex];
|
527
|
+
link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL;
|
498
528
|
}
|
499
529
|
|
500
530
|
function getFilenameFromUrl(url) {
|
@@ -648,7 +678,7 @@ function isFetchSupported() {
|
|
648
678
|
|
649
679
|
function isValidFetchUrl(url, baseUrl) {
|
650
680
|
try {
|
651
|
-
var _ref8 = baseUrl ? new
|
681
|
+
var _ref8 = baseUrl ? new URL(url, baseUrl) : new URL(url),
|
652
682
|
protocol = _ref8.protocol;
|
653
683
|
|
654
684
|
return protocol === 'http:' || protocol === 'https:';
|
@@ -679,8 +709,8 @@ function releaseImageResources(img) {
|
|
679
709
|
(0, _util.assert)(img instanceof Image, 'Invalid `img` parameter.');
|
680
710
|
var url = img.src;
|
681
711
|
|
682
|
-
if (typeof url === 'string' && url.startsWith('blob:') &&
|
683
|
-
|
712
|
+
if (typeof url === 'string' && url.startsWith('blob:') && URL.revokeObjectURL) {
|
713
|
+
URL.revokeObjectURL(url);
|
684
714
|
}
|
685
715
|
|
686
716
|
img.removeAttribute('src');
|
@@ -79,6 +79,12 @@ function extractFilenameFromHeader(getResponseHeader) {
|
|
79
79
|
if (contentDisposition) {
|
80
80
|
var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
|
81
81
|
|
82
|
+
if (filename.includes('%')) {
|
83
|
+
try {
|
84
|
+
filename = decodeURIComponent(filename);
|
85
|
+
} catch (ex) {}
|
86
|
+
}
|
87
|
+
|
82
88
|
if (/\.pdf$/i.test(filename)) {
|
83
89
|
return filename;
|
84
90
|
}
|
@@ -30,17 +30,32 @@ exports.TilingPattern = void 0;
|
|
30
30
|
var _util = require("../shared/util");
|
31
31
|
|
32
32
|
var ShadingIRs = {};
|
33
|
+
|
34
|
+
function applyBoundingBox(ctx, bbox) {
|
35
|
+
if (!bbox || typeof Path2D === 'undefined') {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
var width = bbox[2] - bbox[0];
|
40
|
+
var height = bbox[3] - bbox[1];
|
41
|
+
var region = new Path2D();
|
42
|
+
region.rect(bbox[0], bbox[1], width, height);
|
43
|
+
ctx.clip(region);
|
44
|
+
}
|
45
|
+
|
33
46
|
ShadingIRs.RadialAxial = {
|
34
47
|
fromIR: function RadialAxial_fromIR(raw) {
|
35
48
|
var type = raw[1];
|
36
|
-
var
|
37
|
-
var
|
38
|
-
var
|
39
|
-
var
|
40
|
-
var
|
49
|
+
var bbox = raw[2];
|
50
|
+
var colorStops = raw[3];
|
51
|
+
var p0 = raw[4];
|
52
|
+
var p1 = raw[5];
|
53
|
+
var r0 = raw[6];
|
54
|
+
var r1 = raw[7];
|
41
55
|
return {
|
42
56
|
type: 'Pattern',
|
43
57
|
getPattern: function RadialAxial_getPattern(ctx) {
|
58
|
+
applyBoundingBox(ctx, bbox);
|
44
59
|
var grad;
|
45
60
|
|
46
61
|
if (type === 'axial') {
|
@@ -268,10 +283,12 @@ ShadingIRs.Mesh = {
|
|
268
283
|
var figures = raw[4];
|
269
284
|
var bounds = raw[5];
|
270
285
|
var matrix = raw[6];
|
286
|
+
var bbox = raw[7];
|
271
287
|
var background = raw[8];
|
272
288
|
return {
|
273
289
|
type: 'Pattern',
|
274
290
|
getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
|
291
|
+
applyBoundingBox(ctx, bbox);
|
275
292
|
var scale;
|
276
293
|
|
277
294
|
if (shadingFill) {
|
package/lib/display/svg.js
CHANGED
@@ -46,7 +46,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
46
46
|
|
47
47
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
48
48
|
|
49
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
49
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
50
50
|
|
51
51
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
52
52
|
|
@@ -40,12 +40,9 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
40
40
|
return !NonWhitespaceRegexp.test(str);
|
41
41
|
}
|
42
42
|
|
43
|
-
var styleBuf = ['left: ', 0, 'px; top: ', 0, 'px; font-size: ', 0, 'px; font-family: ', '', ';'];
|
44
|
-
|
45
43
|
function appendText(task, geom, styles) {
|
46
44
|
var textDiv = document.createElement('span');
|
47
45
|
var textDivProperties = {
|
48
|
-
style: null,
|
49
46
|
angle: 0,
|
50
47
|
canvasWidth: 0,
|
51
48
|
isWhitespace: false,
|
@@ -85,8 +82,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
85
82
|
fontAscent = (1 + style.descent) * fontAscent;
|
86
83
|
}
|
87
84
|
|
88
|
-
var left;
|
89
|
-
var top;
|
85
|
+
var left, top;
|
90
86
|
|
91
87
|
if (angle === 0) {
|
92
88
|
left = tx[4];
|
@@ -96,12 +92,10 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
96
92
|
top = tx[5] - fontAscent * Math.cos(angle);
|
97
93
|
}
|
98
94
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
textDivProperties.style = styleBuf.join('');
|
104
|
-
textDiv.setAttribute('style', textDivProperties.style);
|
95
|
+
textDiv.style.left = "".concat(left, "px");
|
96
|
+
textDiv.style.top = "".concat(top, "px");
|
97
|
+
textDiv.style.fontSize = "".concat(fontHeight, "px");
|
98
|
+
textDiv.style.fontFamily = style.fontFamily;
|
105
99
|
textDiv.textContent = geom.str;
|
106
100
|
|
107
101
|
if (task._fontInspectorEnabled) {
|
@@ -483,7 +477,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
483
477
|
_this._layoutTextCtx.canvas.height = 0;
|
484
478
|
_this._layoutTextCtx = null;
|
485
479
|
}
|
486
|
-
});
|
480
|
+
})["catch"](function () {});
|
487
481
|
}
|
488
482
|
|
489
483
|
TextLayerRenderTask.prototype = {
|
@@ -515,30 +509,32 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
515
509
|
}
|
516
510
|
},
|
517
511
|
_layoutText: function _layoutText(textDiv) {
|
518
|
-
var textLayerFrag = this._container;
|
519
|
-
|
520
512
|
var textDivProperties = this._textDivProperties.get(textDiv);
|
521
513
|
|
522
514
|
if (textDivProperties.isWhitespace) {
|
523
515
|
return;
|
524
516
|
}
|
525
517
|
|
526
|
-
var
|
527
|
-
var fontFamily = textDiv.style.fontFamily;
|
518
|
+
var transform = '';
|
528
519
|
|
529
|
-
if (
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
}
|
520
|
+
if (textDivProperties.canvasWidth !== 0) {
|
521
|
+
var _textDiv$style = textDiv.style,
|
522
|
+
fontSize = _textDiv$style.fontSize,
|
523
|
+
fontFamily = _textDiv$style.fontFamily;
|
534
524
|
|
535
|
-
|
525
|
+
if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) {
|
526
|
+
this._layoutTextCtx.font = "".concat(fontSize, " ").concat(fontFamily);
|
527
|
+
this._layoutTextLastFontSize = fontSize;
|
528
|
+
this._layoutTextLastFontFamily = fontFamily;
|
529
|
+
}
|
536
530
|
|
537
|
-
|
531
|
+
var _this$_layoutTextCtx$ = this._layoutTextCtx.measureText(textDiv.textContent),
|
532
|
+
width = _this$_layoutTextCtx$.width;
|
538
533
|
|
539
|
-
|
540
|
-
|
541
|
-
|
534
|
+
if (width > 0) {
|
535
|
+
textDivProperties.scale = textDivProperties.canvasWidth / width;
|
536
|
+
transform = "scaleX(".concat(textDivProperties.scale, ")");
|
537
|
+
}
|
542
538
|
}
|
543
539
|
|
544
540
|
if (textDivProperties.angle !== 0) {
|
@@ -546,13 +542,16 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
546
542
|
}
|
547
543
|
|
548
544
|
if (transform.length > 0) {
|
549
|
-
|
545
|
+
if (this._enhanceTextSelection) {
|
546
|
+
textDivProperties.originalTransform = transform;
|
547
|
+
}
|
548
|
+
|
550
549
|
textDiv.style.transform = transform;
|
551
550
|
}
|
552
551
|
|
553
552
|
this._textDivProperties.set(textDiv, textDivProperties);
|
554
553
|
|
555
|
-
|
554
|
+
this._container.appendChild(textDiv);
|
556
555
|
},
|
557
556
|
_render: function TextLayer_render(timeout) {
|
558
557
|
var _this2 = this;
|
@@ -620,55 +619,65 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
620
619
|
this._bounds = null;
|
621
620
|
}
|
622
621
|
|
622
|
+
var NO_PADDING = '0 0 0 0';
|
623
|
+
var transformBuf = [],
|
624
|
+
paddingBuf = [];
|
625
|
+
|
623
626
|
for (var i = 0, ii = this._textDivs.length; i < ii; i++) {
|
624
627
|
var div = this._textDivs[i];
|
625
628
|
|
626
|
-
var
|
629
|
+
var divProps = this._textDivProperties.get(div);
|
627
630
|
|
628
|
-
if (
|
631
|
+
if (divProps.isWhitespace) {
|
629
632
|
continue;
|
630
633
|
}
|
631
634
|
|
632
635
|
if (expandDivs) {
|
633
|
-
|
634
|
-
|
636
|
+
transformBuf.length = 0;
|
637
|
+
paddingBuf.length = 0;
|
635
638
|
|
636
|
-
if (
|
637
|
-
|
639
|
+
if (divProps.originalTransform) {
|
640
|
+
transformBuf.push(divProps.originalTransform);
|
638
641
|
}
|
639
642
|
|
640
|
-
if (
|
641
|
-
|
643
|
+
if (divProps.paddingTop > 0) {
|
644
|
+
paddingBuf.push("".concat(divProps.paddingTop, "px"));
|
645
|
+
transformBuf.push("translateY(".concat(-divProps.paddingTop, "px)"));
|
646
|
+
} else {
|
647
|
+
paddingBuf.push(0);
|
642
648
|
}
|
643
649
|
|
644
|
-
if (
|
645
|
-
|
646
|
-
|
650
|
+
if (divProps.paddingRight > 0) {
|
651
|
+
paddingBuf.push("".concat(divProps.paddingRight / divProps.scale, "px"));
|
652
|
+
} else {
|
653
|
+
paddingBuf.push(0);
|
647
654
|
}
|
648
655
|
|
649
|
-
if (
|
650
|
-
|
651
|
-
|
656
|
+
if (divProps.paddingBottom > 0) {
|
657
|
+
paddingBuf.push("".concat(divProps.paddingBottom, "px"));
|
658
|
+
} else {
|
659
|
+
paddingBuf.push(0);
|
652
660
|
}
|
653
661
|
|
654
|
-
if (
|
655
|
-
|
662
|
+
if (divProps.paddingLeft > 0) {
|
663
|
+
paddingBuf.push("".concat(divProps.paddingLeft / divProps.scale, "px"));
|
664
|
+
transformBuf.push("translateX(".concat(-divProps.paddingLeft / divProps.scale, "px)"));
|
665
|
+
} else {
|
666
|
+
paddingBuf.push(0);
|
656
667
|
}
|
657
668
|
|
658
|
-
|
659
|
-
padding += ' padding-bottom: ' + divProperties.paddingBottom + 'px;';
|
660
|
-
}
|
669
|
+
var padding = paddingBuf.join(' ');
|
661
670
|
|
662
|
-
if (padding !==
|
663
|
-
div.
|
671
|
+
if (padding !== NO_PADDING) {
|
672
|
+
div.style.padding = padding;
|
664
673
|
}
|
665
674
|
|
666
|
-
if (
|
667
|
-
div.style.transform =
|
675
|
+
if (transformBuf.length) {
|
676
|
+
div.style.transform = transformBuf.join(' ');
|
668
677
|
}
|
669
678
|
} else {
|
670
|
-
div.style.padding =
|
671
|
-
div.style.transform =
|
679
|
+
div.style.padding = null;
|
680
|
+
div.style.transform = divProps.originalTransform;
|
672
681
|
}
|
673
682
|
}
|
674
683
|
}
|
@@ -32,7 +32,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
32
32
|
|
33
33
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
34
34
|
|
35
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
35
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
36
36
|
|
37
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
38
38
|
|
package/lib/pdf.js
CHANGED
@@ -21,8 +21,8 @@
|
|
21
21
|
*/
|
22
22
|
'use strict';
|
23
23
|
|
24
|
-
var pdfjsVersion = '2.
|
25
|
-
var pdfjsBuild = '
|
24
|
+
var pdfjsVersion = '2.3.200';
|
25
|
+
var pdfjsBuild = '4ae3f9fc';
|
26
26
|
|
27
27
|
var pdfjsSharedUtil = require('./shared/util.js');
|
28
28
|
|
@@ -93,7 +93,6 @@ exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
|
|
93
93
|
exports.shadow = pdfjsSharedUtil.shadow;
|
94
94
|
exports.Util = pdfjsSharedUtil.Util;
|
95
95
|
exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
|
96
|
-
exports.URL = pdfjsSharedUtil.URL;
|
97
96
|
exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException;
|
98
97
|
exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
|
99
98
|
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
|
package/lib/pdf.worker.js
CHANGED
@@ -128,7 +128,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
128
128
|
return;
|
129
129
|
}
|
130
130
|
|
131
|
-
require('core-js/
|
131
|
+
require('core-js/es/string/starts-with');
|
132
132
|
})();
|
133
133
|
|
134
134
|
(function checkStringEndsWith() {
|
@@ -136,7 +136,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
136
136
|
return;
|
137
137
|
}
|
138
138
|
|
139
|
-
require('core-js/
|
139
|
+
require('core-js/es/string/ends-with');
|
140
140
|
})();
|
141
141
|
|
142
142
|
(function checkStringIncludes() {
|
@@ -144,7 +144,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
144
144
|
return;
|
145
145
|
}
|
146
146
|
|
147
|
-
require('core-js/
|
147
|
+
require('core-js/es/string/includes');
|
148
148
|
})();
|
149
149
|
|
150
150
|
(function checkArrayIncludes() {
|
@@ -152,7 +152,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
152
152
|
return;
|
153
153
|
}
|
154
154
|
|
155
|
-
require('core-js/
|
155
|
+
require('core-js/es/array/includes');
|
156
156
|
})();
|
157
157
|
|
158
158
|
(function checkArrayFrom() {
|
@@ -160,7 +160,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
160
160
|
return;
|
161
161
|
}
|
162
162
|
|
163
|
-
require('core-js/
|
163
|
+
require('core-js/es/array/from');
|
164
164
|
})();
|
165
165
|
|
166
166
|
(function checkObjectAssign() {
|
@@ -168,7 +168,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
168
168
|
return;
|
169
169
|
}
|
170
170
|
|
171
|
-
require('core-js/
|
171
|
+
require('core-js/es/object/assign');
|
172
172
|
})();
|
173
173
|
|
174
174
|
(function checkMathLog2() {
|
@@ -176,7 +176,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
176
176
|
return;
|
177
177
|
}
|
178
178
|
|
179
|
-
Math.log2 = require('core-js/
|
179
|
+
Math.log2 = require('core-js/es/math/log2');
|
180
180
|
})();
|
181
181
|
|
182
182
|
(function checkNumberIsNaN() {
|
@@ -184,7 +184,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
184
184
|
return;
|
185
185
|
}
|
186
186
|
|
187
|
-
Number.isNaN = require('core-js/
|
187
|
+
Number.isNaN = require('core-js/es/number/is-nan');
|
188
188
|
})();
|
189
189
|
|
190
190
|
(function checkNumberIsInteger() {
|
@@ -192,7 +192,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
192
192
|
return;
|
193
193
|
}
|
194
194
|
|
195
|
-
Number.isInteger = require('core-js/
|
195
|
+
Number.isInteger = require('core-js/es/number/is-integer');
|
196
196
|
})();
|
197
197
|
|
198
198
|
(function checkPromise() {
|
@@ -200,7 +200,11 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
200
200
|
return;
|
201
201
|
}
|
202
202
|
|
203
|
-
globalScope.Promise = require('core-js/
|
203
|
+
globalScope.Promise = require('core-js/es/promise/index');
|
204
|
+
})();
|
205
|
+
|
206
|
+
(function checkURL() {
|
207
|
+
globalScope.URL = require('core-js/web/url');
|
204
208
|
})();
|
205
209
|
|
206
210
|
(function checkWeakMap() {
|
@@ -208,7 +212,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
208
212
|
return;
|
209
213
|
}
|
210
214
|
|
211
|
-
globalScope.WeakMap = require('core-js/
|
215
|
+
globalScope.WeakMap = require('core-js/es/weak-map/index');
|
212
216
|
})();
|
213
217
|
|
214
218
|
(function checkWeakSet() {
|
@@ -216,15 +220,15 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
216
220
|
return;
|
217
221
|
}
|
218
222
|
|
219
|
-
globalScope.WeakSet = require('core-js/
|
223
|
+
globalScope.WeakSet = require('core-js/es/weak-set/index');
|
220
224
|
})();
|
221
225
|
|
222
226
|
(function checkStringCodePointAt() {
|
223
|
-
if (String.codePointAt) {
|
227
|
+
if (String.prototype.codePointAt) {
|
224
228
|
return;
|
225
229
|
}
|
226
230
|
|
227
|
-
|
231
|
+
require('core-js/es/string/code-point-at');
|
228
232
|
})();
|
229
233
|
|
230
234
|
(function checkStringFromCodePoint() {
|
@@ -232,7 +236,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
232
236
|
return;
|
233
237
|
}
|
234
238
|
|
235
|
-
String.fromCodePoint = require('core-js/
|
239
|
+
String.fromCodePoint = require('core-js/es/string/from-code-point');
|
236
240
|
})();
|
237
241
|
|
238
242
|
(function checkSymbol() {
|
@@ -240,7 +244,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
240
244
|
return;
|
241
245
|
}
|
242
246
|
|
243
|
-
require('core-js/
|
247
|
+
require('core-js/es/symbol/index');
|
244
248
|
})();
|
245
249
|
|
246
250
|
(function checkStringPadStart() {
|
@@ -248,7 +252,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
248
252
|
return;
|
249
253
|
}
|
250
254
|
|
251
|
-
require('core-js/
|
255
|
+
require('core-js/es/string/pad-start');
|
252
256
|
})();
|
253
257
|
|
254
258
|
(function checkStringPadEnd() {
|
@@ -256,7 +260,7 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
256
260
|
return;
|
257
261
|
}
|
258
262
|
|
259
|
-
require('core-js/
|
263
|
+
require('core-js/es/string/pad-end');
|
260
264
|
})();
|
261
265
|
|
262
266
|
(function checkObjectValues() {
|
@@ -264,6 +268,6 @@ if (!globalScope._pdfjsCompatibilityChecked) {
|
|
264
268
|
return;
|
265
269
|
}
|
266
270
|
|
267
|
-
Object.values = require('core-js/
|
271
|
+
Object.values = require('core-js/es/object/values');
|
268
272
|
})();
|
269
273
|
}
|