pdfjs-dist 2.5.207 → 2.6.347
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 +867 -216
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +10214 -8547
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.js +2023 -1046
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.min.js +22 -0
- package/es5/build/pdf.worker.js +11136 -8144
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/build/pdf.worker.min.js +22 -0
- package/es5/image_decoders/pdf.image_decoders.js +12529 -0
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
- package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/pdf_viewer.css +8 -5
- package/es5/web/pdf_viewer.js +195 -51
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +24 -16
- 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 +479 -43
- package/lib/core/cff_parser.js +643 -615
- package/lib/core/chunked_stream.js +64 -50
- package/lib/core/colorspace.js +126 -104
- package/lib/core/crypto.js +37 -0
- package/lib/core/document.js +128 -75
- package/lib/core/evaluator.js +3015 -2754
- package/lib/core/fonts.js +47 -46
- package/lib/core/function.js +79 -6
- package/lib/core/image.js +364 -357
- package/lib/core/image_utils.js +109 -8
- package/lib/core/jpg.js +8 -3
- package/lib/core/obj.js +255 -34
- package/lib/core/operator_list.js +17 -15
- package/lib/core/parser.js +40 -3
- package/lib/core/pattern.js +24 -11
- package/lib/core/primitives.js +112 -53
- package/lib/core/type1_parser.js +2 -0
- package/lib/core/worker.js +102 -37
- package/lib/core/writer.js +242 -0
- package/lib/display/annotation_layer.js +51 -10
- package/lib/display/annotation_storage.js +89 -0
- package/lib/display/api.js +140 -54
- package/lib/display/canvas.js +215 -46
- package/lib/display/display_utils.js +55 -18
- package/lib/display/fetch_stream.js +6 -0
- package/lib/display/font_loader.js +26 -15
- package/lib/display/metadata.js +1 -7
- package/lib/display/network.js +0 -14
- package/lib/display/node_utils.js +87 -0
- package/lib/display/optional_content_config.js +184 -0
- package/lib/display/svg.js +1 -1
- package/lib/display/text_layer.js +4 -1
- package/lib/pdf.js +2 -2
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/is_node.js +1 -1
- package/lib/shared/util.js +13 -10
- package/lib/test/unit/annotation_spec.js +520 -50
- package/lib/test/unit/annotation_storage_spec.js +83 -0
- package/lib/test/unit/api_spec.js +16 -6
- package/lib/test/unit/cmap_spec.js +4 -4
- package/lib/test/unit/colorspace_spec.js +216 -24
- package/lib/test/unit/crypto_spec.js +51 -4
- package/lib/test/unit/custom_spec.js +129 -1
- package/lib/test/unit/document_spec.js +112 -1
- package/lib/test/unit/evaluator_spec.js +29 -10
- package/lib/test/unit/jasmine-boot.js +1 -1
- package/lib/test/unit/metadata_spec.js +3 -3
- package/lib/test/unit/primitives_spec.js +242 -63
- package/lib/test/unit/test_utils.js +42 -89
- package/lib/test/unit/testreporter.js +17 -6
- package/lib/test/unit/util_spec.js +13 -12
- package/lib/test/unit/writer_spec.js +84 -0
- package/lib/web/annotation_layer_builder.js +13 -9
- package/lib/web/app.js +231 -26
- package/lib/web/app_options.js +1 -6
- package/lib/web/base_tree_viewer.js +100 -0
- package/lib/web/base_viewer.js +53 -4
- package/lib/web/download_manager.js +3 -10
- package/lib/web/firefox_print_service.js +32 -12
- package/lib/web/firefoxcom.js +20 -6
- package/lib/web/interfaces.js +1 -1
- package/lib/web/pdf_attachment_viewer.js +80 -38
- package/lib/web/pdf_find_controller.js +2 -1
- package/lib/web/pdf_layer_viewer.js +208 -0
- package/lib/web/pdf_outline_viewer.js +24 -57
- package/lib/web/pdf_page_view.js +29 -6
- package/lib/web/pdf_print_service.js +13 -11
- package/lib/web/pdf_sidebar.js +46 -25
- package/lib/web/pdf_thumbnail_view.js +16 -3
- package/lib/web/pdf_thumbnail_viewer.js +17 -1
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/preferences.js +1 -1
- package/lib/web/toolbar.js +1 -1
- package/lib/web/ui_utils.js +7 -1
- package/package.json +3 -1
- package/types/display/annotation_layer.d.ts +61 -0
- package/types/display/annotation_storage.d.ts +36 -0
- package/types/display/api.d.ts +1107 -0
- package/types/display/api_compatibility.d.ts +1 -0
- package/types/display/canvas.d.ts +4 -0
- package/types/display/content_disposition.d.ts +7 -0
- package/types/display/display_utils.d.ts +243 -0
- package/types/display/fetch_stream.d.ts +67 -0
- package/types/display/font_loader.d.ts +19 -0
- package/types/display/metadata.d.ts +9 -0
- package/types/display/network.d.ts +80 -0
- package/types/display/network_utils.d.ts +14 -0
- package/types/display/node_stream.d.ts +72 -0
- package/types/display/node_utils.d.ts +6 -0
- package/types/display/optional_content_config.d.ts +12 -0
- package/types/display/pattern_helper.d.ts +5 -0
- package/types/display/svg.d.ts +2 -0
- package/types/display/text_layer.d.ts +83 -0
- package/types/display/transport_stream.d.ts +57 -0
- package/types/display/webgl.d.ts +20 -0
- package/types/display/worker_options.d.ts +27 -0
- package/types/display/xml_parser.d.ts +35 -0
- package/types/pdf.d.ts +33 -0
- package/types/shared/compatibility.d.ts +1 -0
- package/types/shared/is_node.d.ts +1 -0
- package/types/shared/message_handler.d.ts +62 -0
- package/types/shared/util.d.ts +421 -0
- package/web/images/shadow.png +0 -0
- package/web/pdf_viewer.css +8 -5
- package/web/pdf_viewer.js +109 -33
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +1 -9
- package/es5/web/images/texture.png +0 -0
- package/web/images/texture.png +0 -0
package/es5/web/pdf_viewer.js
CHANGED
@@ -245,8 +245,8 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(18);
|
|
245
245
|
|
246
246
|
var _pdf_viewer = __w_pdfjs_require__(20);
|
247
247
|
|
248
|
-
var pdfjsVersion = '2.
|
249
|
-
var pdfjsBuild = '
|
248
|
+
var pdfjsVersion = '2.6.347';
|
249
|
+
var pdfjsBuild = '3be9c65f';
|
250
250
|
|
251
251
|
/***/ }),
|
252
252
|
/* 1 */
|
@@ -278,10 +278,12 @@ var AnnotationLayerBuilder = /*#__PURE__*/function () {
|
|
278
278
|
pdfPage = _ref.pdfPage,
|
279
279
|
linkService = _ref.linkService,
|
280
280
|
downloadManager = _ref.downloadManager,
|
281
|
+
_ref$annotationStorag = _ref.annotationStorage,
|
282
|
+
annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
|
281
283
|
_ref$imageResourcesPa = _ref.imageResourcesPath,
|
282
284
|
imageResourcesPath = _ref$imageResourcesPa === void 0 ? "" : _ref$imageResourcesPa,
|
283
285
|
_ref$renderInteractiv = _ref.renderInteractiveForms,
|
284
|
-
renderInteractiveForms = _ref$renderInteractiv === void 0 ?
|
286
|
+
renderInteractiveForms = _ref$renderInteractiv === void 0 ? true : _ref$renderInteractiv,
|
285
287
|
_ref$l10n = _ref.l10n,
|
286
288
|
l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n;
|
287
289
|
|
@@ -294,6 +296,7 @@ var AnnotationLayerBuilder = /*#__PURE__*/function () {
|
|
294
296
|
this.imageResourcesPath = imageResourcesPath;
|
295
297
|
this.renderInteractiveForms = renderInteractiveForms;
|
296
298
|
this.l10n = l10n;
|
299
|
+
this.annotationStorage = annotationStorage;
|
297
300
|
this.div = null;
|
298
301
|
this._cancelled = false;
|
299
302
|
}
|
@@ -304,13 +307,17 @@ var AnnotationLayerBuilder = /*#__PURE__*/function () {
|
|
304
307
|
var _this = this;
|
305
308
|
|
306
309
|
var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display";
|
307
|
-
this.pdfPage.getAnnotations({
|
310
|
+
return this.pdfPage.getAnnotations({
|
308
311
|
intent: intent
|
309
312
|
}).then(function (annotations) {
|
310
313
|
if (_this._cancelled) {
|
311
314
|
return;
|
312
315
|
}
|
313
316
|
|
317
|
+
if (annotations.length === 0) {
|
318
|
+
return;
|
319
|
+
}
|
320
|
+
|
314
321
|
var parameters = {
|
315
322
|
viewport: viewport.clone({
|
316
323
|
dontFlip: true
|
@@ -321,16 +328,13 @@ var AnnotationLayerBuilder = /*#__PURE__*/function () {
|
|
321
328
|
imageResourcesPath: _this.imageResourcesPath,
|
322
329
|
renderInteractiveForms: _this.renderInteractiveForms,
|
323
330
|
linkService: _this.linkService,
|
324
|
-
downloadManager: _this.downloadManager
|
331
|
+
downloadManager: _this.downloadManager,
|
332
|
+
annotationStorage: _this.annotationStorage
|
325
333
|
};
|
326
334
|
|
327
335
|
if (_this.div) {
|
328
336
|
_pdfjsLib.AnnotationLayer.update(parameters);
|
329
337
|
} else {
|
330
|
-
if (annotations.length === 0) {
|
331
|
-
return;
|
332
|
-
}
|
333
|
-
|
334
338
|
_this.div = document.createElement("div");
|
335
339
|
_this.div.className = "annotationLayer";
|
336
340
|
|
@@ -373,16 +377,18 @@ var DefaultAnnotationLayerFactory = /*#__PURE__*/function () {
|
|
373
377
|
_createClass(DefaultAnnotationLayerFactory, [{
|
374
378
|
key: "createAnnotationLayerBuilder",
|
375
379
|
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
|
376
|
-
var
|
377
|
-
var
|
378
|
-
var
|
380
|
+
var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
381
|
+
var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
382
|
+
var renderInteractiveForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
383
|
+
var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _ui_utils.NullL10n;
|
379
384
|
return new AnnotationLayerBuilder({
|
380
385
|
pageDiv: pageDiv,
|
381
386
|
pdfPage: pdfPage,
|
382
387
|
imageResourcesPath: imageResourcesPath,
|
383
388
|
renderInteractiveForms: renderInteractiveForms,
|
384
389
|
linkService: new _pdf_link_service.SimpleLinkService(),
|
385
|
-
l10n: l10n
|
390
|
+
l10n: l10n,
|
391
|
+
annotationStorage: annotationStorage
|
386
392
|
});
|
387
393
|
}
|
388
394
|
}]);
|
@@ -436,6 +442,7 @@ exports.getOutputScale = getOutputScale;
|
|
436
442
|
exports.scrollIntoView = scrollIntoView;
|
437
443
|
exports.watchScroll = watchScroll;
|
438
444
|
exports.binarySearchFirstItem = binarySearchFirstItem;
|
445
|
+
exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
|
439
446
|
exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
|
440
447
|
exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
|
441
448
|
exports.moveToEndOfArray = moveToEndOfArray;
|
@@ -959,7 +966,7 @@ function getPDFFileNameFromURL(url) {
|
|
959
966
|
return suggestedFilename || defaultFilename;
|
960
967
|
}
|
961
968
|
|
962
|
-
function
|
969
|
+
function normalizeWheelEventDirection(evt) {
|
963
970
|
var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);
|
964
971
|
var angle = Math.atan2(evt.deltaY, evt.deltaX);
|
965
972
|
|
@@ -967,6 +974,11 @@ function normalizeWheelEventDelta(evt) {
|
|
967
974
|
delta = -delta;
|
968
975
|
}
|
969
976
|
|
977
|
+
return delta;
|
978
|
+
}
|
979
|
+
|
980
|
+
function normalizeWheelEventDelta(evt) {
|
981
|
+
var delta = normalizeWheelEventDirection(evt);
|
970
982
|
var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
|
971
983
|
var MOUSE_DOM_DELTA_LINE_MODE = 1;
|
972
984
|
var MOUSE_PIXELS_PER_LINE = 30;
|
@@ -1282,6 +1294,24 @@ var runtime = function (exports) {
|
|
1282
1294
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
1283
1295
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
1284
1296
|
|
1297
|
+
function define(obj, key, value) {
|
1298
|
+
Object.defineProperty(obj, key, {
|
1299
|
+
value: value,
|
1300
|
+
enumerable: true,
|
1301
|
+
configurable: true,
|
1302
|
+
writable: true
|
1303
|
+
});
|
1304
|
+
return obj[key];
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
try {
|
1308
|
+
define({}, "");
|
1309
|
+
} catch (err) {
|
1310
|
+
define = function define(obj, key, value) {
|
1311
|
+
return obj[key] = value;
|
1312
|
+
};
|
1313
|
+
}
|
1314
|
+
|
1285
1315
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
1286
1316
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
1287
1317
|
var generator = Object.create(protoGenerator.prototype);
|
@@ -1334,13 +1364,13 @@ var runtime = function (exports) {
|
|
1334
1364
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
1335
1365
|
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
1336
1366
|
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
1337
|
-
|
1367
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
1338
1368
|
|
1339
1369
|
function defineIteratorMethods(prototype) {
|
1340
1370
|
["next", "throw", "return"].forEach(function (method) {
|
1341
|
-
prototype
|
1371
|
+
define(prototype, method, function (arg) {
|
1342
1372
|
return this._invoke(method, arg);
|
1343
|
-
};
|
1373
|
+
});
|
1344
1374
|
});
|
1345
1375
|
}
|
1346
1376
|
|
@@ -1354,10 +1384,7 @@ var runtime = function (exports) {
|
|
1354
1384
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
1355
1385
|
} else {
|
1356
1386
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
1357
|
-
|
1358
|
-
if (!(toStringTagSymbol in genFun)) {
|
1359
|
-
genFun[toStringTagSymbol] = "GeneratorFunction";
|
1360
|
-
}
|
1387
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
1361
1388
|
}
|
1362
1389
|
|
1363
1390
|
genFun.prototype = Object.create(Gp);
|
@@ -1553,7 +1580,7 @@ var runtime = function (exports) {
|
|
1553
1580
|
}
|
1554
1581
|
|
1555
1582
|
defineIteratorMethods(Gp);
|
1556
|
-
Gp
|
1583
|
+
define(Gp, toStringTagSymbol, "Generator");
|
1557
1584
|
|
1558
1585
|
Gp[iteratorSymbol] = function () {
|
1559
1586
|
return this;
|
@@ -2802,7 +2829,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
2802
2829
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
2803
2830
|
|
2804
2831
|
;
|
2805
|
-
var DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false;
|
2806
2832
|
|
2807
2833
|
function _download(blobUrl, filename) {
|
2808
2834
|
var a = document.createElement("a");
|
@@ -2824,13 +2850,8 @@ function _download(blobUrl, filename) {
|
|
2824
2850
|
}
|
2825
2851
|
|
2826
2852
|
var DownloadManager = /*#__PURE__*/function () {
|
2827
|
-
function DownloadManager(
|
2828
|
-
var _ref$disableCreateObj = _ref.disableCreateObjectURL,
|
2829
|
-
disableCreateObjectURL = _ref$disableCreateObj === void 0 ? DISABLE_CREATE_OBJECT_URL : _ref$disableCreateObj;
|
2830
|
-
|
2853
|
+
function DownloadManager() {
|
2831
2854
|
_classCallCheck(this, DownloadManager);
|
2832
|
-
|
2833
|
-
this.disableCreateObjectURL = disableCreateObjectURL;
|
2834
2855
|
}
|
2835
2856
|
|
2836
2857
|
_createClass(DownloadManager, [{
|
@@ -2852,13 +2873,15 @@ var DownloadManager = /*#__PURE__*/function () {
|
|
2852
2873
|
return;
|
2853
2874
|
}
|
2854
2875
|
|
2855
|
-
var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType,
|
2876
|
+
var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL);
|
2856
2877
|
|
2857
2878
|
_download(blobUrl, filename);
|
2858
2879
|
}
|
2859
2880
|
}, {
|
2860
2881
|
key: "download",
|
2861
2882
|
value: function download(blob, url, filename) {
|
2883
|
+
var sourceEventType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "download";
|
2884
|
+
|
2862
2885
|
if (navigator.msSaveBlob) {
|
2863
2886
|
if (!navigator.msSaveBlob(blob, filename)) {
|
2864
2887
|
this.downloadUrl(url, filename);
|
@@ -2867,7 +2890,7 @@ var DownloadManager = /*#__PURE__*/function () {
|
|
2867
2890
|
return;
|
2868
2891
|
}
|
2869
2892
|
|
2870
|
-
if (
|
2893
|
+
if (_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) {
|
2871
2894
|
this.downloadUrl(url, filename);
|
2872
2895
|
return;
|
2873
2896
|
}
|
@@ -4601,7 +4624,8 @@ var PDFFindController = /*#__PURE__*/function () {
|
|
4601
4624
|
source: this,
|
4602
4625
|
state: state,
|
4603
4626
|
previous: previous,
|
4604
|
-
matchesCount: this._requestMatchesCount()
|
4627
|
+
matchesCount: this._requestMatchesCount(),
|
4628
|
+
rawQuery: this._state ? this._state.query : null
|
4605
4629
|
});
|
4606
4630
|
}
|
4607
4631
|
}, {
|
@@ -5441,10 +5465,12 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5441
5465
|
this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
|
5442
5466
|
this.viewport = defaultViewport;
|
5443
5467
|
this.pdfPageRotate = defaultViewport.rotation;
|
5468
|
+
this._annotationStorage = options.annotationStorage || null;
|
5469
|
+
this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
|
5444
5470
|
this.hasRestrictedScaling = false;
|
5445
5471
|
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
|
5446
5472
|
this.imageResourcesPath = options.imageResourcesPath || "";
|
5447
|
-
this.renderInteractiveForms = options.renderInteractiveForms
|
5473
|
+
this.renderInteractiveForms = typeof options.renderInteractiveForms === "boolean" ? options.renderInteractiveForms : true;
|
5448
5474
|
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
|
5449
5475
|
this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
|
5450
5476
|
this.eventBus = options.eventBus;
|
@@ -5493,6 +5519,52 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5493
5519
|
this.pdfPage.cleanup();
|
5494
5520
|
}
|
5495
5521
|
}
|
5522
|
+
}, {
|
5523
|
+
key: "_renderAnnotationLayer",
|
5524
|
+
value: function () {
|
5525
|
+
var _renderAnnotationLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
5526
|
+
var error;
|
5527
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
5528
|
+
while (1) {
|
5529
|
+
switch (_context.prev = _context.next) {
|
5530
|
+
case 0:
|
5531
|
+
error = null;
|
5532
|
+
_context.prev = 1;
|
5533
|
+
_context.next = 4;
|
5534
|
+
return this.annotationLayer.render(this.viewport, "display");
|
5535
|
+
|
5536
|
+
case 4:
|
5537
|
+
_context.next = 9;
|
5538
|
+
break;
|
5539
|
+
|
5540
|
+
case 6:
|
5541
|
+
_context.prev = 6;
|
5542
|
+
_context.t0 = _context["catch"](1);
|
5543
|
+
error = _context.t0;
|
5544
|
+
|
5545
|
+
case 9:
|
5546
|
+
_context.prev = 9;
|
5547
|
+
this.eventBus.dispatch("annotationlayerrendered", {
|
5548
|
+
source: this,
|
5549
|
+
pageNumber: this.id,
|
5550
|
+
error: error
|
5551
|
+
});
|
5552
|
+
return _context.finish(9);
|
5553
|
+
|
5554
|
+
case 12:
|
5555
|
+
case "end":
|
5556
|
+
return _context.stop();
|
5557
|
+
}
|
5558
|
+
}
|
5559
|
+
}, _callee, this, [[1, 6, 9, 12]]);
|
5560
|
+
}));
|
5561
|
+
|
5562
|
+
function _renderAnnotationLayer() {
|
5563
|
+
return _renderAnnotationLayer2.apply(this, arguments);
|
5564
|
+
}
|
5565
|
+
|
5566
|
+
return _renderAnnotationLayer;
|
5567
|
+
}()
|
5496
5568
|
}, {
|
5497
5569
|
key: "_resetZoomLayer",
|
5498
5570
|
value: function _resetZoomLayer() {
|
@@ -5569,12 +5641,17 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5569
5641
|
}, {
|
5570
5642
|
key: "update",
|
5571
5643
|
value: function update(scale, rotation) {
|
5644
|
+
var optionalContentConfigPromise = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
5572
5645
|
this.scale = scale || this.scale;
|
5573
5646
|
|
5574
5647
|
if (typeof rotation !== "undefined") {
|
5575
5648
|
this.rotation = rotation;
|
5576
5649
|
}
|
5577
5650
|
|
5651
|
+
if (optionalContentConfigPromise instanceof Promise) {
|
5652
|
+
this._optionalContentConfigPromise = optionalContentConfigPromise;
|
5653
|
+
}
|
5654
|
+
|
5578
5655
|
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
|
5579
5656
|
this.viewport = this.viewport.clone({
|
5580
5657
|
scale: this.scale * _ui_utils.CSS_UNITS,
|
@@ -5713,7 +5790,7 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5713
5790
|
}
|
5714
5791
|
|
5715
5792
|
if (redrawAnnotations && this.annotationLayer) {
|
5716
|
-
this.
|
5793
|
+
this._renderAnnotationLayer();
|
5717
5794
|
}
|
5718
5795
|
}
|
5719
5796
|
}, {
|
@@ -5795,22 +5872,22 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5795
5872
|
}
|
5796
5873
|
|
5797
5874
|
var finishPaintTask = /*#__PURE__*/function () {
|
5798
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function
|
5799
|
-
return _regenerator["default"].wrap(function
|
5875
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(error) {
|
5876
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
5800
5877
|
while (1) {
|
5801
|
-
switch (
|
5878
|
+
switch (_context2.prev = _context2.next) {
|
5802
5879
|
case 0:
|
5803
5880
|
if (paintTask === _this.paintTask) {
|
5804
5881
|
_this.paintTask = null;
|
5805
5882
|
}
|
5806
5883
|
|
5807
5884
|
if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
|
5808
|
-
|
5885
|
+
_context2.next = 4;
|
5809
5886
|
break;
|
5810
5887
|
}
|
5811
5888
|
|
5812
5889
|
_this.error = null;
|
5813
|
-
return
|
5890
|
+
return _context2.abrupt("return");
|
5814
5891
|
|
5815
5892
|
case 4:
|
5816
5893
|
_this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
|
@@ -5833,7 +5910,7 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5833
5910
|
});
|
5834
5911
|
|
5835
5912
|
if (!error) {
|
5836
|
-
|
5913
|
+
_context2.next = 12;
|
5837
5914
|
break;
|
5838
5915
|
}
|
5839
5916
|
|
@@ -5841,10 +5918,10 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5841
5918
|
|
5842
5919
|
case 12:
|
5843
5920
|
case "end":
|
5844
|
-
return
|
5921
|
+
return _context2.stop();
|
5845
5922
|
}
|
5846
5923
|
}
|
5847
|
-
},
|
5924
|
+
}, _callee2);
|
5848
5925
|
}));
|
5849
5926
|
|
5850
5927
|
return function finishPaintTask(_x) {
|
@@ -5871,10 +5948,10 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5871
5948
|
|
5872
5949
|
if (this.annotationLayerFactory) {
|
5873
5950
|
if (!this.annotationLayer) {
|
5874
|
-
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
|
5951
|
+
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this._annotationStorage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
|
5875
5952
|
}
|
5876
5953
|
|
5877
|
-
this.
|
5954
|
+
this._renderAnnotationLayer();
|
5878
5955
|
}
|
5879
5956
|
|
5880
5957
|
div.setAttribute("data-loaded", true);
|
@@ -5959,7 +6036,8 @@ var PDFPageView = /*#__PURE__*/function () {
|
|
5959
6036
|
transform: transform,
|
5960
6037
|
viewport: this.viewport,
|
5961
6038
|
enableWebGL: this.enableWebGL,
|
5962
|
-
renderInteractiveForms: this.renderInteractiveForms
|
6039
|
+
renderInteractiveForms: this.renderInteractiveForms,
|
6040
|
+
optionalContentConfigPromise: this._optionalContentConfigPromise
|
5963
6041
|
};
|
5964
6042
|
var renderTask = this.pdfPage.render(renderContext);
|
5965
6043
|
|
@@ -6410,6 +6488,12 @@ var _pdf_link_service = __w_pdfjs_require__(7);
|
|
6410
6488
|
|
6411
6489
|
var _text_layer_builder = __w_pdfjs_require__(8);
|
6412
6490
|
|
6491
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
6492
|
+
|
6493
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
6494
|
+
|
6495
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
6496
|
+
|
6413
6497
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6414
6498
|
|
6415
6499
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
@@ -6481,6 +6565,11 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6481
6565
|
this._name = this.constructor.name;
|
6482
6566
|
this.container = options.container;
|
6483
6567
|
this.viewer = options.viewer || options.container.firstElementChild;
|
6568
|
+
|
6569
|
+
if (!(this.container instanceof HTMLDivElement && this.viewer instanceof HTMLDivElement)) {
|
6570
|
+
throw new Error("Invalid `container` and/or `viewer` option.");
|
6571
|
+
}
|
6572
|
+
|
6484
6573
|
this.eventBus = options.eventBus;
|
6485
6574
|
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
|
6486
6575
|
this.downloadManager = options.downloadManager || null;
|
@@ -6488,7 +6577,7 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6488
6577
|
this.removePageBorders = options.removePageBorders || false;
|
6489
6578
|
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
|
6490
6579
|
this.imageResourcesPath = options.imageResourcesPath || "";
|
6491
|
-
this.renderInteractiveForms = options.renderInteractiveForms
|
6580
|
+
this.renderInteractiveForms = typeof options.renderInteractiveForms === "boolean" ? options.renderInteractiveForms : true;
|
6492
6581
|
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
|
6493
6582
|
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
|
6494
6583
|
this.enableWebGL = options.enableWebGL || false;
|
@@ -6588,6 +6677,8 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6588
6677
|
|
6589
6678
|
var pagesCount = pdfDocument.numPages;
|
6590
6679
|
var firstPagePromise = pdfDocument.getPage(1);
|
6680
|
+
var annotationStorage = pdfDocument.annotationStorage;
|
6681
|
+
var optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
|
6591
6682
|
|
6592
6683
|
this._pagesCapability.promise.then(function () {
|
6593
6684
|
_this2.eventBus.dispatch("pagesloaded", {
|
@@ -6625,6 +6716,7 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6625
6716
|
firstPagePromise.then(function (firstPdfPage) {
|
6626
6717
|
_this2._firstPageCapability.resolve(firstPdfPage);
|
6627
6718
|
|
6719
|
+
_this2._optionalContentConfigPromise = optionalContentConfigPromise;
|
6628
6720
|
var scale = _this2.currentScale;
|
6629
6721
|
var viewport = firstPdfPage.getViewport({
|
6630
6722
|
scale: scale * _ui_utils.CSS_UNITS
|
@@ -6638,6 +6730,8 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6638
6730
|
id: pageNum,
|
6639
6731
|
scale: scale,
|
6640
6732
|
defaultViewport: viewport.clone(),
|
6733
|
+
annotationStorage: annotationStorage,
|
6734
|
+
optionalContentConfigPromise: optionalContentConfigPromise,
|
6641
6735
|
renderingQueue: _this2.renderingQueue,
|
6642
6736
|
textLayerFactory: textLayerFactory,
|
6643
6737
|
textLayerMode: _this2.textLayerMode,
|
@@ -6756,6 +6850,7 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
6756
6850
|
this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
|
6757
6851
|
this._location = null;
|
6758
6852
|
this._pagesRotation = 0;
|
6853
|
+
this._optionalContentConfigPromise = null;
|
6759
6854
|
this._pagesRequests = new WeakMap();
|
6760
6855
|
this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
|
6761
6856
|
this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
|
@@ -7243,12 +7338,14 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
7243
7338
|
}, {
|
7244
7339
|
key: "createAnnotationLayerBuilder",
|
7245
7340
|
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
|
7246
|
-
var
|
7247
|
-
var
|
7248
|
-
var
|
7341
|
+
var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
7342
|
+
var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
7343
|
+
var renderInteractiveForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
7344
|
+
var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _ui_utils.NullL10n;
|
7249
7345
|
return new _annotation_layer_builder.AnnotationLayerBuilder({
|
7250
7346
|
pageDiv: pageDiv,
|
7251
7347
|
pdfPage: pdfPage,
|
7348
|
+
annotationStorage: annotationStorage,
|
7252
7349
|
imageResourcesPath: imageResourcesPath,
|
7253
7350
|
renderInteractiveForms: renderInteractiveForms,
|
7254
7351
|
linkService: this.linkService,
|
@@ -7274,9 +7371,8 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
7274
7371
|
return pagesOverview;
|
7275
7372
|
}
|
7276
7373
|
|
7277
|
-
var isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]);
|
7278
7374
|
return pagesOverview.map(function (size) {
|
7279
|
-
if (
|
7375
|
+
if ((0, _ui_utils.isPortraitOrientation)(size)) {
|
7280
7376
|
return size;
|
7281
7377
|
}
|
7282
7378
|
|
@@ -7537,6 +7633,54 @@ var BaseViewer = /*#__PURE__*/function () {
|
|
7537
7633
|
|
7538
7634
|
return true;
|
7539
7635
|
}
|
7636
|
+
}, {
|
7637
|
+
key: "optionalContentConfigPromise",
|
7638
|
+
get: function get() {
|
7639
|
+
if (!this.pdfDocument) {
|
7640
|
+
return Promise.resolve(null);
|
7641
|
+
}
|
7642
|
+
|
7643
|
+
if (!this._optionalContentConfigPromise) {
|
7644
|
+
return this.pdfDocument.getOptionalContentConfig();
|
7645
|
+
}
|
7646
|
+
|
7647
|
+
return this._optionalContentConfigPromise;
|
7648
|
+
},
|
7649
|
+
set: function set(promise) {
|
7650
|
+
if (!(promise instanceof Promise)) {
|
7651
|
+
throw new Error("Invalid optionalContentConfigPromise: ".concat(promise));
|
7652
|
+
}
|
7653
|
+
|
7654
|
+
if (!this.pdfDocument) {
|
7655
|
+
return;
|
7656
|
+
}
|
7657
|
+
|
7658
|
+
if (!this._optionalContentConfigPromise) {
|
7659
|
+
return;
|
7660
|
+
}
|
7661
|
+
|
7662
|
+
this._optionalContentConfigPromise = promise;
|
7663
|
+
|
7664
|
+
var _iterator = _createForOfIteratorHelper(this._pages),
|
7665
|
+
_step;
|
7666
|
+
|
7667
|
+
try {
|
7668
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
7669
|
+
var pageView = _step.value;
|
7670
|
+
pageView.update(pageView.scale, pageView.rotation, promise);
|
7671
|
+
}
|
7672
|
+
} catch (err) {
|
7673
|
+
_iterator.e(err);
|
7674
|
+
} finally {
|
7675
|
+
_iterator.f();
|
7676
|
+
}
|
7677
|
+
|
7678
|
+
this.update();
|
7679
|
+
this.eventBus.dispatch("optionalcontentconfigchanged", {
|
7680
|
+
source: this,
|
7681
|
+
promise: promise
|
7682
|
+
});
|
7683
|
+
}
|
7540
7684
|
}, {
|
7541
7685
|
key: "scrollMode",
|
7542
7686
|
get: function get() {
|