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
@@ -186,11 +186,11 @@ function () {
|
|
186
186
|
|
187
187
|
var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
|
188
188
|
|
189
|
-
container.style.transform =
|
190
|
-
container.style.transformOrigin = -rect[0]
|
189
|
+
container.style.transform = "matrix(".concat(viewport.transform.join(','), ")");
|
190
|
+
container.style.transformOrigin = "-".concat(rect[0], "px -").concat(rect[1], "px");
|
191
191
|
|
192
192
|
if (!ignoreBorder && data.borderStyle.width > 0) {
|
193
|
-
container.style.borderWidth = data.borderStyle.width
|
193
|
+
container.style.borderWidth = "".concat(data.borderStyle.width, "px");
|
194
194
|
|
195
195
|
if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
|
196
196
|
width = width - 2 * data.borderStyle.width;
|
@@ -201,7 +201,7 @@ function () {
|
|
201
201
|
var verticalRadius = data.borderStyle.verticalCornerRadius;
|
202
202
|
|
203
203
|
if (horizontalRadius > 0 || verticalRadius > 0) {
|
204
|
-
var radius = horizontalRadius
|
204
|
+
var radius = "".concat(horizontalRadius, "px / ").concat(verticalRadius, "px");
|
205
205
|
container.style.borderRadius = radius;
|
206
206
|
}
|
207
207
|
|
@@ -237,10 +237,10 @@ function () {
|
|
237
237
|
}
|
238
238
|
}
|
239
239
|
|
240
|
-
container.style.left = rect[0]
|
241
|
-
container.style.top = rect[1]
|
242
|
-
container.style.width = width
|
243
|
-
container.style.height = height
|
240
|
+
container.style.left = "".concat(rect[0], "px");
|
241
|
+
container.style.top = "".concat(rect[1], "px");
|
242
|
+
container.style.width = "".concat(width, "px");
|
243
|
+
container.style.height = "".concat(height, "px");
|
244
244
|
return container;
|
245
245
|
}
|
246
246
|
}, {
|
@@ -295,18 +295,18 @@ function (_AnnotationElement) {
|
|
295
295
|
var data = this.data,
|
296
296
|
linkService = this.linkService;
|
297
297
|
var link = document.createElement('a');
|
298
|
-
(0, _display_utils.addLinkAttributes)(link, {
|
299
|
-
url: data.url,
|
300
|
-
target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
|
301
|
-
rel: linkService.externalLinkRel
|
302
|
-
});
|
303
298
|
|
304
|
-
if (
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
299
|
+
if (data.url) {
|
300
|
+
(0, _display_utils.addLinkAttributes)(link, {
|
301
|
+
url: data.url,
|
302
|
+
target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
|
303
|
+
rel: linkService.externalLinkRel,
|
304
|
+
enabled: linkService.externalLinkEnabled
|
305
|
+
});
|
306
|
+
} else if (data.action) {
|
307
|
+
this._bindNamedAction(link, data.action);
|
308
|
+
} else {
|
309
|
+
this._bindLink(link, data.dest);
|
310
310
|
}
|
311
311
|
|
312
312
|
this.container.appendChild(link);
|
@@ -449,7 +449,7 @@ function (_WidgetAnnotationElem) {
|
|
449
449
|
var fieldWidth = this.data.rect[2] - this.data.rect[0];
|
450
450
|
var combWidth = fieldWidth / this.data.maxLen;
|
451
451
|
element.classList.add('comb');
|
452
|
-
element.style.letterSpacing =
|
452
|
+
element.style.letterSpacing = "calc(".concat(combWidth, "px - 1ch)");
|
453
453
|
}
|
454
454
|
} else {
|
455
455
|
element = document.createElement('div');
|
@@ -476,7 +476,7 @@ function (_WidgetAnnotationElem) {
|
|
476
476
|
key: "_setTextStyle",
|
477
477
|
value: function _setTextStyle(element, font) {
|
478
478
|
var style = element.style;
|
479
|
-
style.fontSize = this.data.fontSize
|
479
|
+
style.fontSize = "".concat(this.data.fontSize, "px");
|
480
480
|
style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr';
|
481
481
|
|
482
482
|
if (!font) {
|
@@ -485,7 +485,7 @@ function (_WidgetAnnotationElem) {
|
|
485
485
|
|
486
486
|
style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal';
|
487
487
|
style.fontStyle = font.italic ? 'italic' : 'normal';
|
488
|
-
var fontFamily = font.loadedName ?
|
488
|
+
var fontFamily = font.loadedName ? "\"".concat(font.loadedName, "\", ") : '';
|
489
489
|
var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
|
490
490
|
style.fontFamily = fontFamily + fallbackName;
|
491
491
|
}
|
@@ -607,17 +607,36 @@ function (_WidgetAnnotationElem4) {
|
|
607
607
|
}
|
608
608
|
}
|
609
609
|
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
optionElement.textContent = option.displayValue;
|
614
|
-
optionElement.value = option.exportValue;
|
610
|
+
var _iteratorNormalCompletion = true;
|
611
|
+
var _didIteratorError = false;
|
612
|
+
var _iteratorError = undefined;
|
615
613
|
|
616
|
-
|
617
|
-
|
618
|
-
|
614
|
+
try {
|
615
|
+
for (var _iterator = this.data.options[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
616
|
+
var option = _step.value;
|
617
|
+
var optionElement = document.createElement('option');
|
618
|
+
optionElement.textContent = option.displayValue;
|
619
|
+
optionElement.value = option.exportValue;
|
619
620
|
|
620
|
-
|
621
|
+
if (this.data.fieldValue.includes(option.displayValue)) {
|
622
|
+
optionElement.setAttribute('selected', true);
|
623
|
+
}
|
624
|
+
|
625
|
+
selectElement.appendChild(optionElement);
|
626
|
+
}
|
627
|
+
} catch (err) {
|
628
|
+
_didIteratorError = true;
|
629
|
+
_iteratorError = err;
|
630
|
+
} finally {
|
631
|
+
try {
|
632
|
+
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
|
633
|
+
_iterator["return"]();
|
634
|
+
}
|
635
|
+
} finally {
|
636
|
+
if (_didIteratorError) {
|
637
|
+
throw _iteratorError;
|
638
|
+
}
|
639
|
+
}
|
621
640
|
}
|
622
641
|
|
623
642
|
this.container.appendChild(selectElement);
|
@@ -650,7 +669,7 @@ function (_AnnotationElement4) {
|
|
650
669
|
return this.container;
|
651
670
|
}
|
652
671
|
|
653
|
-
var selector =
|
672
|
+
var selector = "[data-annotation-id=\"".concat(this.data.parentId, "\"]");
|
654
673
|
var parentElement = this.layer.querySelector(selector);
|
655
674
|
|
656
675
|
if (!parentElement) {
|
@@ -667,8 +686,8 @@ function (_AnnotationElement4) {
|
|
667
686
|
});
|
668
687
|
var parentLeft = parseFloat(parentElement.style.left);
|
669
688
|
var parentWidth = parseFloat(parentElement.style.width);
|
670
|
-
this.container.style.transformOrigin = -(parentLeft + parentWidth
|
671
|
-
this.container.style.left = parentLeft + parentWidth
|
689
|
+
this.container.style.transformOrigin = "-".concat(parentLeft + parentWidth, "px -").concat(parentElement.style.top);
|
690
|
+
this.container.style.left = "".concat(parentLeft + parentWidth, "px");
|
672
691
|
this.container.appendChild(popup.render());
|
673
692
|
return this.container;
|
674
693
|
}
|
@@ -972,20 +991,37 @@ function (_AnnotationElement9) {
|
|
972
991
|
var width = data.rect[2] - data.rect[0];
|
973
992
|
var height = data.rect[3] - data.rect[1];
|
974
993
|
var svg = this.svgFactory.create(width, height);
|
975
|
-
var vertices = data.vertices;
|
976
994
|
var points = [];
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
995
|
+
var _iteratorNormalCompletion2 = true;
|
996
|
+
var _didIteratorError2 = false;
|
997
|
+
var _iteratorError2 = undefined;
|
998
|
+
|
999
|
+
try {
|
1000
|
+
for (var _iterator2 = data.vertices[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
1001
|
+
var coordinate = _step2.value;
|
1002
|
+
var x = coordinate.x - data.rect[0];
|
1003
|
+
var y = data.rect[3] - coordinate.y;
|
1004
|
+
points.push(x + ',' + y);
|
1005
|
+
}
|
1006
|
+
} catch (err) {
|
1007
|
+
_didIteratorError2 = true;
|
1008
|
+
_iteratorError2 = err;
|
1009
|
+
} finally {
|
1010
|
+
try {
|
1011
|
+
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
|
1012
|
+
_iterator2["return"]();
|
1013
|
+
}
|
1014
|
+
} finally {
|
1015
|
+
if (_didIteratorError2) {
|
1016
|
+
throw _iteratorError2;
|
1017
|
+
}
|
1018
|
+
}
|
982
1019
|
}
|
983
1020
|
|
984
1021
|
points = points.join(' ');
|
985
|
-
var borderWidth = data.borderStyle.width;
|
986
1022
|
var polyline = this.svgFactory.createElement(this.svgElementName);
|
987
1023
|
polyline.setAttribute('points', points);
|
988
|
-
polyline.setAttribute('stroke-width',
|
1024
|
+
polyline.setAttribute('stroke-width', data.borderStyle.width);
|
989
1025
|
polyline.setAttribute('stroke', 'transparent');
|
990
1026
|
polyline.setAttribute('fill', 'none');
|
991
1027
|
svg.appendChild(polyline);
|
@@ -1072,29 +1108,64 @@ function (_AnnotationElement11) {
|
|
1072
1108
|
var width = data.rect[2] - data.rect[0];
|
1073
1109
|
var height = data.rect[3] - data.rect[1];
|
1074
1110
|
var svg = this.svgFactory.create(width, height);
|
1075
|
-
var
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
var
|
1083
|
-
var
|
1084
|
-
|
1085
|
-
|
1111
|
+
var _iteratorNormalCompletion3 = true;
|
1112
|
+
var _didIteratorError3 = false;
|
1113
|
+
var _iteratorError3 = undefined;
|
1114
|
+
|
1115
|
+
try {
|
1116
|
+
for (var _iterator3 = data.inkLists[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
1117
|
+
var inkList = _step3.value;
|
1118
|
+
var points = [];
|
1119
|
+
var _iteratorNormalCompletion4 = true;
|
1120
|
+
var _didIteratorError4 = false;
|
1121
|
+
var _iteratorError4 = undefined;
|
1122
|
+
|
1123
|
+
try {
|
1124
|
+
for (var _iterator4 = inkList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
1125
|
+
var coordinate = _step4.value;
|
1126
|
+
var x = coordinate.x - data.rect[0];
|
1127
|
+
var y = data.rect[3] - coordinate.y;
|
1128
|
+
points.push("".concat(x, ",").concat(y));
|
1129
|
+
}
|
1130
|
+
} catch (err) {
|
1131
|
+
_didIteratorError4 = true;
|
1132
|
+
_iteratorError4 = err;
|
1133
|
+
} finally {
|
1134
|
+
try {
|
1135
|
+
if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
|
1136
|
+
_iterator4["return"]();
|
1137
|
+
}
|
1138
|
+
} finally {
|
1139
|
+
if (_didIteratorError4) {
|
1140
|
+
throw _iteratorError4;
|
1141
|
+
}
|
1142
|
+
}
|
1143
|
+
}
|
1086
1144
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
polyline.setAttribute('fill', 'none');
|
1145
|
+
points = points.join(' ');
|
1146
|
+
var polyline = this.svgFactory.createElement(this.svgElementName);
|
1147
|
+
polyline.setAttribute('points', points);
|
1148
|
+
polyline.setAttribute('stroke-width', data.borderStyle.width);
|
1149
|
+
polyline.setAttribute('stroke', 'transparent');
|
1150
|
+
polyline.setAttribute('fill', 'none');
|
1094
1151
|
|
1095
|
-
|
1152
|
+
this._createPopup(this.container, polyline, data);
|
1096
1153
|
|
1097
|
-
|
1154
|
+
svg.appendChild(polyline);
|
1155
|
+
}
|
1156
|
+
} catch (err) {
|
1157
|
+
_didIteratorError3 = true;
|
1158
|
+
_iteratorError3 = err;
|
1159
|
+
} finally {
|
1160
|
+
try {
|
1161
|
+
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
|
1162
|
+
_iterator3["return"]();
|
1163
|
+
}
|
1164
|
+
} finally {
|
1165
|
+
if (_didIteratorError3) {
|
1166
|
+
throw _iteratorError3;
|
1167
|
+
}
|
1168
|
+
}
|
1098
1169
|
}
|
1099
1170
|
|
1100
1171
|
this.container.append(svg);
|
@@ -1315,39 +1386,77 @@ function () {
|
|
1315
1386
|
_createClass(AnnotationLayer, null, [{
|
1316
1387
|
key: "render",
|
1317
1388
|
value: function render(parameters) {
|
1318
|
-
|
1319
|
-
|
1389
|
+
var _iteratorNormalCompletion5 = true;
|
1390
|
+
var _didIteratorError5 = false;
|
1391
|
+
var _iteratorError5 = undefined;
|
1320
1392
|
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1393
|
+
try {
|
1394
|
+
for (var _iterator5 = parameters.annotations[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
1395
|
+
var data = _step5.value;
|
1324
1396
|
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
page: parameters.page,
|
1329
|
-
viewport: parameters.viewport,
|
1330
|
-
linkService: parameters.linkService,
|
1331
|
-
downloadManager: parameters.downloadManager,
|
1332
|
-
imageResourcesPath: parameters.imageResourcesPath || '',
|
1333
|
-
renderInteractiveForms: parameters.renderInteractiveForms || false,
|
1334
|
-
svgFactory: new _display_utils.DOMSVGFactory()
|
1335
|
-
});
|
1397
|
+
if (!data) {
|
1398
|
+
continue;
|
1399
|
+
}
|
1336
1400
|
|
1337
|
-
|
1338
|
-
|
1401
|
+
var element = AnnotationElementFactory.create({
|
1402
|
+
data: data,
|
1403
|
+
layer: parameters.div,
|
1404
|
+
page: parameters.page,
|
1405
|
+
viewport: parameters.viewport,
|
1406
|
+
linkService: parameters.linkService,
|
1407
|
+
downloadManager: parameters.downloadManager,
|
1408
|
+
imageResourcesPath: parameters.imageResourcesPath || '',
|
1409
|
+
renderInteractiveForms: parameters.renderInteractiveForms || false,
|
1410
|
+
svgFactory: new _display_utils.DOMSVGFactory()
|
1411
|
+
});
|
1412
|
+
|
1413
|
+
if (element.isRenderable) {
|
1414
|
+
parameters.div.appendChild(element.render());
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
} catch (err) {
|
1418
|
+
_didIteratorError5 = true;
|
1419
|
+
_iteratorError5 = err;
|
1420
|
+
} finally {
|
1421
|
+
try {
|
1422
|
+
if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) {
|
1423
|
+
_iterator5["return"]();
|
1424
|
+
}
|
1425
|
+
} finally {
|
1426
|
+
if (_didIteratorError5) {
|
1427
|
+
throw _iteratorError5;
|
1428
|
+
}
|
1339
1429
|
}
|
1340
1430
|
}
|
1341
1431
|
}
|
1342
1432
|
}, {
|
1343
1433
|
key: "update",
|
1344
1434
|
value: function update(parameters) {
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1435
|
+
var _iteratorNormalCompletion6 = true;
|
1436
|
+
var _didIteratorError6 = false;
|
1437
|
+
var _iteratorError6 = undefined;
|
1348
1438
|
|
1349
|
-
|
1350
|
-
|
1439
|
+
try {
|
1440
|
+
for (var _iterator6 = parameters.annotations[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
1441
|
+
var data = _step6.value;
|
1442
|
+
var element = parameters.div.querySelector("[data-annotation-id=\"".concat(data.id, "\"]"));
|
1443
|
+
|
1444
|
+
if (element) {
|
1445
|
+
element.style.transform = "matrix(".concat(parameters.viewport.transform.join(','), ")");
|
1446
|
+
}
|
1447
|
+
}
|
1448
|
+
} catch (err) {
|
1449
|
+
_didIteratorError6 = true;
|
1450
|
+
_iteratorError6 = err;
|
1451
|
+
} finally {
|
1452
|
+
try {
|
1453
|
+
if (!_iteratorNormalCompletion6 && _iterator6["return"] != null) {
|
1454
|
+
_iterator6["return"]();
|
1455
|
+
}
|
1456
|
+
} finally {
|
1457
|
+
if (_didIteratorError6) {
|
1458
|
+
throw _iteratorError6;
|
1459
|
+
}
|
1351
1460
|
}
|
1352
1461
|
}
|
1353
1462
|
|