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.

Files changed (133) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +867 -216
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +10214 -8547
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/es5/build/pdf.js +2023 -1046
  9. package/es5/build/pdf.js.map +1 -1
  10. package/es5/build/pdf.min.js +22 -0
  11. package/es5/build/pdf.worker.js +11136 -8144
  12. package/es5/build/pdf.worker.js.map +1 -1
  13. package/es5/build/pdf.worker.min.js +22 -0
  14. package/es5/image_decoders/pdf.image_decoders.js +12529 -0
  15. package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
  16. package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
  17. package/es5/web/images/shadow.png +0 -0
  18. package/es5/web/pdf_viewer.css +8 -5
  19. package/es5/web/pdf_viewer.js +195 -51
  20. package/es5/web/pdf_viewer.js.map +1 -1
  21. package/image_decoders/pdf.image_decoders.js +24 -16
  22. package/image_decoders/pdf.image_decoders.js.map +1 -1
  23. package/image_decoders/pdf.image_decoders.min.js +1 -1
  24. package/lib/core/annotation.js +479 -43
  25. package/lib/core/cff_parser.js +643 -615
  26. package/lib/core/chunked_stream.js +64 -50
  27. package/lib/core/colorspace.js +126 -104
  28. package/lib/core/crypto.js +37 -0
  29. package/lib/core/document.js +128 -75
  30. package/lib/core/evaluator.js +3015 -2754
  31. package/lib/core/fonts.js +47 -46
  32. package/lib/core/function.js +79 -6
  33. package/lib/core/image.js +364 -357
  34. package/lib/core/image_utils.js +109 -8
  35. package/lib/core/jpg.js +8 -3
  36. package/lib/core/obj.js +255 -34
  37. package/lib/core/operator_list.js +17 -15
  38. package/lib/core/parser.js +40 -3
  39. package/lib/core/pattern.js +24 -11
  40. package/lib/core/primitives.js +112 -53
  41. package/lib/core/type1_parser.js +2 -0
  42. package/lib/core/worker.js +102 -37
  43. package/lib/core/writer.js +242 -0
  44. package/lib/display/annotation_layer.js +51 -10
  45. package/lib/display/annotation_storage.js +89 -0
  46. package/lib/display/api.js +140 -54
  47. package/lib/display/canvas.js +215 -46
  48. package/lib/display/display_utils.js +55 -18
  49. package/lib/display/fetch_stream.js +6 -0
  50. package/lib/display/font_loader.js +26 -15
  51. package/lib/display/metadata.js +1 -7
  52. package/lib/display/network.js +0 -14
  53. package/lib/display/node_utils.js +87 -0
  54. package/lib/display/optional_content_config.js +184 -0
  55. package/lib/display/svg.js +1 -1
  56. package/lib/display/text_layer.js +4 -1
  57. package/lib/pdf.js +2 -2
  58. package/lib/pdf.worker.js +2 -2
  59. package/lib/shared/is_node.js +1 -1
  60. package/lib/shared/util.js +13 -10
  61. package/lib/test/unit/annotation_spec.js +520 -50
  62. package/lib/test/unit/annotation_storage_spec.js +83 -0
  63. package/lib/test/unit/api_spec.js +16 -6
  64. package/lib/test/unit/cmap_spec.js +4 -4
  65. package/lib/test/unit/colorspace_spec.js +216 -24
  66. package/lib/test/unit/crypto_spec.js +51 -4
  67. package/lib/test/unit/custom_spec.js +129 -1
  68. package/lib/test/unit/document_spec.js +112 -1
  69. package/lib/test/unit/evaluator_spec.js +29 -10
  70. package/lib/test/unit/jasmine-boot.js +1 -1
  71. package/lib/test/unit/metadata_spec.js +3 -3
  72. package/lib/test/unit/primitives_spec.js +242 -63
  73. package/lib/test/unit/test_utils.js +42 -89
  74. package/lib/test/unit/testreporter.js +17 -6
  75. package/lib/test/unit/util_spec.js +13 -12
  76. package/lib/test/unit/writer_spec.js +84 -0
  77. package/lib/web/annotation_layer_builder.js +13 -9
  78. package/lib/web/app.js +231 -26
  79. package/lib/web/app_options.js +1 -6
  80. package/lib/web/base_tree_viewer.js +100 -0
  81. package/lib/web/base_viewer.js +53 -4
  82. package/lib/web/download_manager.js +3 -10
  83. package/lib/web/firefox_print_service.js +32 -12
  84. package/lib/web/firefoxcom.js +20 -6
  85. package/lib/web/interfaces.js +1 -1
  86. package/lib/web/pdf_attachment_viewer.js +80 -38
  87. package/lib/web/pdf_find_controller.js +2 -1
  88. package/lib/web/pdf_layer_viewer.js +208 -0
  89. package/lib/web/pdf_outline_viewer.js +24 -57
  90. package/lib/web/pdf_page_view.js +29 -6
  91. package/lib/web/pdf_print_service.js +13 -11
  92. package/lib/web/pdf_sidebar.js +46 -25
  93. package/lib/web/pdf_thumbnail_view.js +16 -3
  94. package/lib/web/pdf_thumbnail_viewer.js +17 -1
  95. package/lib/web/pdf_viewer.component.js +2 -2
  96. package/lib/web/preferences.js +1 -1
  97. package/lib/web/toolbar.js +1 -1
  98. package/lib/web/ui_utils.js +7 -1
  99. package/package.json +3 -1
  100. package/types/display/annotation_layer.d.ts +61 -0
  101. package/types/display/annotation_storage.d.ts +36 -0
  102. package/types/display/api.d.ts +1107 -0
  103. package/types/display/api_compatibility.d.ts +1 -0
  104. package/types/display/canvas.d.ts +4 -0
  105. package/types/display/content_disposition.d.ts +7 -0
  106. package/types/display/display_utils.d.ts +243 -0
  107. package/types/display/fetch_stream.d.ts +67 -0
  108. package/types/display/font_loader.d.ts +19 -0
  109. package/types/display/metadata.d.ts +9 -0
  110. package/types/display/network.d.ts +80 -0
  111. package/types/display/network_utils.d.ts +14 -0
  112. package/types/display/node_stream.d.ts +72 -0
  113. package/types/display/node_utils.d.ts +6 -0
  114. package/types/display/optional_content_config.d.ts +12 -0
  115. package/types/display/pattern_helper.d.ts +5 -0
  116. package/types/display/svg.d.ts +2 -0
  117. package/types/display/text_layer.d.ts +83 -0
  118. package/types/display/transport_stream.d.ts +57 -0
  119. package/types/display/webgl.d.ts +20 -0
  120. package/types/display/worker_options.d.ts +27 -0
  121. package/types/display/xml_parser.d.ts +35 -0
  122. package/types/pdf.d.ts +33 -0
  123. package/types/shared/compatibility.d.ts +1 -0
  124. package/types/shared/is_node.d.ts +1 -0
  125. package/types/shared/message_handler.d.ts +62 -0
  126. package/types/shared/util.d.ts +421 -0
  127. package/web/images/shadow.png +0 -0
  128. package/web/pdf_viewer.css +8 -5
  129. package/web/pdf_viewer.js +109 -33
  130. package/web/pdf_viewer.js.map +1 -1
  131. package/webpack.js +1 -9
  132. package/es5/web/images/texture.png +0 -0
  133. package/web/images/texture.png +0 -0
@@ -21,7 +21,7 @@
21
21
  bottom: 0;
22
22
  overflow: hidden;
23
23
  opacity: 0.2;
24
- line-height: 1.0;
24
+ line-height: 1;
25
25
  }
26
26
 
27
27
  .textLayer > span {
@@ -168,7 +168,7 @@
168
168
  .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,
169
169
  .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before {
170
170
  background-color: rgba(0, 0, 0, 1);
171
- content: '';
171
+ content: "";
172
172
  display: block;
173
173
  position: absolute;
174
174
  }
@@ -308,13 +308,16 @@
308
308
  border: none;
309
309
  }
310
310
 
311
- .pdfViewer.scrollHorizontal, .pdfViewer.scrollWrapped, .spread {
311
+ .pdfViewer.scrollHorizontal,
312
+ .pdfViewer.scrollWrapped,
313
+ .spread {
312
314
  margin-left: 3.5px;
313
315
  margin-right: 3.5px;
314
316
  text-align: center;
315
317
  }
316
318
 
317
- .pdfViewer.scrollHorizontal, .spread {
319
+ .pdfViewer.scrollHorizontal,
320
+ .spread {
318
321
  white-space: nowrap;
319
322
  }
320
323
 
@@ -364,7 +367,7 @@
364
367
  top: 0;
365
368
  right: 0;
366
369
  bottom: 0;
367
- background: url('images/loading-icon.gif') center no-repeat;
370
+ background: url("images/loading-icon.gif") center no-repeat;
368
371
  }
369
372
 
370
373
  .pdfPresentationMode .pdfViewer {
package/web/pdf_viewer.js CHANGED
@@ -245,8 +245,8 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(15);
245
245
 
246
246
  var _pdf_viewer = __w_pdfjs_require__(17);
247
247
 
248
- const pdfjsVersion = '2.5.207';
249
- const pdfjsBuild = '0974d605';
248
+ const pdfjsVersion = '2.6.347';
249
+ const pdfjsBuild = '3be9c65f';
250
250
 
251
251
  /***/ }),
252
252
  /* 1 */
@@ -272,8 +272,9 @@ class AnnotationLayerBuilder {
272
272
  pdfPage,
273
273
  linkService,
274
274
  downloadManager,
275
+ annotationStorage = null,
275
276
  imageResourcesPath = "",
276
- renderInteractiveForms = false,
277
+ renderInteractiveForms = true,
277
278
  l10n = _ui_utils.NullL10n
278
279
  }) {
279
280
  this.pageDiv = pageDiv;
@@ -283,18 +284,23 @@ class AnnotationLayerBuilder {
283
284
  this.imageResourcesPath = imageResourcesPath;
284
285
  this.renderInteractiveForms = renderInteractiveForms;
285
286
  this.l10n = l10n;
287
+ this.annotationStorage = annotationStorage;
286
288
  this.div = null;
287
289
  this._cancelled = false;
288
290
  }
289
291
 
290
292
  render(viewport, intent = "display") {
291
- this.pdfPage.getAnnotations({
293
+ return this.pdfPage.getAnnotations({
292
294
  intent
293
295
  }).then(annotations => {
294
296
  if (this._cancelled) {
295
297
  return;
296
298
  }
297
299
 
300
+ if (annotations.length === 0) {
301
+ return;
302
+ }
303
+
298
304
  const parameters = {
299
305
  viewport: viewport.clone({
300
306
  dontFlip: true
@@ -305,16 +311,13 @@ class AnnotationLayerBuilder {
305
311
  imageResourcesPath: this.imageResourcesPath,
306
312
  renderInteractiveForms: this.renderInteractiveForms,
307
313
  linkService: this.linkService,
308
- downloadManager: this.downloadManager
314
+ downloadManager: this.downloadManager,
315
+ annotationStorage: this.annotationStorage
309
316
  };
310
317
 
311
318
  if (this.div) {
312
319
  _pdfjsLib.AnnotationLayer.update(parameters);
313
320
  } else {
314
- if (annotations.length === 0) {
315
- return;
316
- }
317
-
318
321
  this.div = document.createElement("div");
319
322
  this.div.className = "annotationLayer";
320
323
  this.pageDiv.appendChild(this.div);
@@ -344,14 +347,15 @@ class AnnotationLayerBuilder {
344
347
  exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
345
348
 
346
349
  class DefaultAnnotationLayerFactory {
347
- createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) {
350
+ createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = true, l10n = _ui_utils.NullL10n) {
348
351
  return new AnnotationLayerBuilder({
349
352
  pageDiv,
350
353
  pdfPage,
351
354
  imageResourcesPath,
352
355
  renderInteractiveForms,
353
356
  linkService: new _pdf_link_service.SimpleLinkService(),
354
- l10n
357
+ l10n,
358
+ annotationStorage
355
359
  });
356
360
  }
357
361
 
@@ -403,6 +407,7 @@ exports.getOutputScale = getOutputScale;
403
407
  exports.scrollIntoView = scrollIntoView;
404
408
  exports.watchScroll = watchScroll;
405
409
  exports.binarySearchFirstItem = binarySearchFirstItem;
410
+ exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
406
411
  exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
407
412
  exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
408
413
  exports.moveToEndOfArray = moveToEndOfArray;
@@ -840,7 +845,7 @@ function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") {
840
845
  return suggestedFilename || defaultFilename;
841
846
  }
842
847
 
843
- function normalizeWheelEventDelta(evt) {
848
+ function normalizeWheelEventDirection(evt) {
844
849
  let delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);
845
850
  const angle = Math.atan2(evt.deltaY, evt.deltaX);
846
851
 
@@ -848,6 +853,11 @@ function normalizeWheelEventDelta(evt) {
848
853
  delta = -delta;
849
854
  }
850
855
 
856
+ return delta;
857
+ }
858
+
859
+ function normalizeWheelEventDelta(evt) {
860
+ let delta = normalizeWheelEventDirection(evt);
851
861
  const MOUSE_DOM_DELTA_PIXEL_MODE = 0;
852
862
  const MOUSE_DOM_DELTA_LINE_MODE = 1;
853
863
  const MOUSE_PIXELS_PER_LINE = 30;
@@ -1951,7 +1961,6 @@ var _pdfjsLib = __w_pdfjs_require__(2);
1951
1961
  var _viewer_compatibility = __w_pdfjs_require__(7);
1952
1962
 
1953
1963
  ;
1954
- const DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false;
1955
1964
 
1956
1965
  function download(blobUrl, filename) {
1957
1966
  const a = document.createElement("a");
@@ -1973,12 +1982,6 @@ function download(blobUrl, filename) {
1973
1982
  }
1974
1983
 
1975
1984
  class DownloadManager {
1976
- constructor({
1977
- disableCreateObjectURL = DISABLE_CREATE_OBJECT_URL
1978
- }) {
1979
- this.disableCreateObjectURL = disableCreateObjectURL;
1980
- }
1981
-
1982
1985
  downloadUrl(url, filename) {
1983
1986
  if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
1984
1987
  return;
@@ -1995,11 +1998,11 @@ class DownloadManager {
1995
1998
  return;
1996
1999
  }
1997
2000
 
1998
- const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, this.disableCreateObjectURL);
2001
+ const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL);
1999
2002
  download(blobUrl, filename);
2000
2003
  }
2001
2004
 
2002
- download(blob, url, filename) {
2005
+ download(blob, url, filename, sourceEventType = "download") {
2003
2006
  if (navigator.msSaveBlob) {
2004
2007
  if (!navigator.msSaveBlob(blob, filename)) {
2005
2008
  this.downloadUrl(url, filename);
@@ -2008,7 +2011,7 @@ class DownloadManager {
2008
2011
  return;
2009
2012
  }
2010
2013
 
2011
- if (this.disableCreateObjectURL) {
2014
+ if (_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) {
2012
2015
  this.downloadUrl(url, filename);
2013
2016
  return;
2014
2017
  }
@@ -3603,7 +3606,8 @@ class PDFFindController {
3603
3606
  source: this,
3604
3607
  state,
3605
3608
  previous,
3606
- matchesCount: this._requestMatchesCount()
3609
+ matchesCount: this._requestMatchesCount(),
3610
+ rawQuery: this._state ? this._state.query : null
3607
3611
  });
3608
3612
  }
3609
3613
 
@@ -4329,10 +4333,12 @@ class PDFPageView {
4329
4333
  this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
4330
4334
  this.viewport = defaultViewport;
4331
4335
  this.pdfPageRotate = defaultViewport.rotation;
4336
+ this._annotationStorage = options.annotationStorage || null;
4337
+ this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
4332
4338
  this.hasRestrictedScaling = false;
4333
4339
  this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
4334
4340
  this.imageResourcesPath = options.imageResourcesPath || "";
4335
- this.renderInteractiveForms = options.renderInteractiveForms || false;
4341
+ this.renderInteractiveForms = typeof options.renderInteractiveForms === "boolean" ? options.renderInteractiveForms : true;
4336
4342
  this.useOnlyCssZoom = options.useOnlyCssZoom || false;
4337
4343
  this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
4338
4344
  this.eventBus = options.eventBus;
@@ -4379,6 +4385,22 @@ class PDFPageView {
4379
4385
  }
4380
4386
  }
4381
4387
 
4388
+ async _renderAnnotationLayer() {
4389
+ let error = null;
4390
+
4391
+ try {
4392
+ await this.annotationLayer.render(this.viewport, "display");
4393
+ } catch (ex) {
4394
+ error = ex;
4395
+ } finally {
4396
+ this.eventBus.dispatch("annotationlayerrendered", {
4397
+ source: this,
4398
+ pageNumber: this.id,
4399
+ error
4400
+ });
4401
+ }
4402
+ }
4403
+
4382
4404
  _resetZoomLayer(removeFromDOM = false) {
4383
4405
  if (!this.zoomLayer) {
4384
4406
  return;
@@ -4446,13 +4468,17 @@ class PDFPageView {
4446
4468
  div.appendChild(this.loadingIconDiv);
4447
4469
  }
4448
4470
 
4449
- update(scale, rotation) {
4471
+ update(scale, rotation, optionalContentConfigPromise = null) {
4450
4472
  this.scale = scale || this.scale;
4451
4473
 
4452
4474
  if (typeof rotation !== "undefined") {
4453
4475
  this.rotation = rotation;
4454
4476
  }
4455
4477
 
4478
+ if (optionalContentConfigPromise instanceof Promise) {
4479
+ this._optionalContentConfigPromise = optionalContentConfigPromise;
4480
+ }
4481
+
4456
4482
  const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
4457
4483
  this.viewport = this.viewport.clone({
4458
4484
  scale: this.scale * _ui_utils.CSS_UNITS,
@@ -4586,7 +4612,7 @@ class PDFPageView {
4586
4612
  }
4587
4613
 
4588
4614
  if (redrawAnnotations && this.annotationLayer) {
4589
- this.annotationLayer.render(this.viewport, "display");
4615
+ this._renderAnnotationLayer();
4590
4616
  }
4591
4617
  }
4592
4618
 
@@ -4725,10 +4751,10 @@ class PDFPageView {
4725
4751
 
4726
4752
  if (this.annotationLayerFactory) {
4727
4753
  if (!this.annotationLayer) {
4728
- this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
4754
+ this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this._annotationStorage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
4729
4755
  }
4730
4756
 
4731
- this.annotationLayer.render(this.viewport, "display");
4757
+ this._renderAnnotationLayer();
4732
4758
  }
4733
4759
 
4734
4760
  div.setAttribute("data-loaded", true);
@@ -4815,7 +4841,8 @@ class PDFPageView {
4815
4841
  transform,
4816
4842
  viewport: this.viewport,
4817
4843
  enableWebGL: this.enableWebGL,
4818
- renderInteractiveForms: this.renderInteractiveForms
4844
+ renderInteractiveForms: this.renderInteractiveForms,
4845
+ optionalContentConfigPromise: this._optionalContentConfigPromise
4819
4846
  };
4820
4847
  const renderTask = this.pdfPage.render(renderContext);
4821
4848
 
@@ -5238,6 +5265,11 @@ class BaseViewer {
5238
5265
  this._name = this.constructor.name;
5239
5266
  this.container = options.container;
5240
5267
  this.viewer = options.viewer || options.container.firstElementChild;
5268
+
5269
+ if (!(this.container instanceof HTMLDivElement && this.viewer instanceof HTMLDivElement)) {
5270
+ throw new Error("Invalid `container` and/or `viewer` option.");
5271
+ }
5272
+
5241
5273
  this.eventBus = options.eventBus;
5242
5274
  this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
5243
5275
  this.downloadManager = options.downloadManager || null;
@@ -5245,7 +5277,7 @@ class BaseViewer {
5245
5277
  this.removePageBorders = options.removePageBorders || false;
5246
5278
  this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
5247
5279
  this.imageResourcesPath = options.imageResourcesPath || "";
5248
- this.renderInteractiveForms = options.renderInteractiveForms || false;
5280
+ this.renderInteractiveForms = typeof options.renderInteractiveForms === "boolean" ? options.renderInteractiveForms : true;
5249
5281
  this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
5250
5282
  this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
5251
5283
  this.enableWebGL = options.enableWebGL || false;
@@ -5476,6 +5508,8 @@ class BaseViewer {
5476
5508
 
5477
5509
  const pagesCount = pdfDocument.numPages;
5478
5510
  const firstPagePromise = pdfDocument.getPage(1);
5511
+ const annotationStorage = pdfDocument.annotationStorage;
5512
+ const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
5479
5513
 
5480
5514
  this._pagesCapability.promise.then(() => {
5481
5515
  this.eventBus.dispatch("pagesloaded", {
@@ -5513,6 +5547,7 @@ class BaseViewer {
5513
5547
  firstPagePromise.then(firstPdfPage => {
5514
5548
  this._firstPageCapability.resolve(firstPdfPage);
5515
5549
 
5550
+ this._optionalContentConfigPromise = optionalContentConfigPromise;
5516
5551
  const scale = this.currentScale;
5517
5552
  const viewport = firstPdfPage.getViewport({
5518
5553
  scale: scale * _ui_utils.CSS_UNITS
@@ -5526,6 +5561,8 @@ class BaseViewer {
5526
5561
  id: pageNum,
5527
5562
  scale,
5528
5563
  defaultViewport: viewport.clone(),
5564
+ annotationStorage,
5565
+ optionalContentConfigPromise,
5529
5566
  renderingQueue: this.renderingQueue,
5530
5567
  textLayerFactory,
5531
5568
  textLayerMode: this.textLayerMode,
@@ -5637,6 +5674,7 @@ class BaseViewer {
5637
5674
  this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
5638
5675
  this._location = null;
5639
5676
  this._pagesRotation = 0;
5677
+ this._optionalContentConfigPromise = null;
5640
5678
  this._pagesRequests = new WeakMap();
5641
5679
  this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
5642
5680
  this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
@@ -6108,10 +6146,11 @@ class BaseViewer {
6108
6146
  });
6109
6147
  }
6110
6148
 
6111
- createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) {
6149
+ createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) {
6112
6150
  return new _annotation_layer_builder.AnnotationLayerBuilder({
6113
6151
  pageDiv,
6114
6152
  pdfPage,
6153
+ annotationStorage,
6115
6154
  imageResourcesPath,
6116
6155
  renderInteractiveForms,
6117
6156
  linkService: this.linkService,
@@ -6150,9 +6189,8 @@ class BaseViewer {
6150
6189
  return pagesOverview;
6151
6190
  }
6152
6191
 
6153
- const isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]);
6154
6192
  return pagesOverview.map(function (size) {
6155
- if (isFirstPagePortrait === (0, _ui_utils.isPortraitOrientation)(size)) {
6193
+ if ((0, _ui_utils.isPortraitOrientation)(size)) {
6156
6194
  return size;
6157
6195
  }
6158
6196
 
@@ -6164,6 +6202,44 @@ class BaseViewer {
6164
6202
  });
6165
6203
  }
6166
6204
 
6205
+ get optionalContentConfigPromise() {
6206
+ if (!this.pdfDocument) {
6207
+ return Promise.resolve(null);
6208
+ }
6209
+
6210
+ if (!this._optionalContentConfigPromise) {
6211
+ return this.pdfDocument.getOptionalContentConfig();
6212
+ }
6213
+
6214
+ return this._optionalContentConfigPromise;
6215
+ }
6216
+
6217
+ set optionalContentConfigPromise(promise) {
6218
+ if (!(promise instanceof Promise)) {
6219
+ throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);
6220
+ }
6221
+
6222
+ if (!this.pdfDocument) {
6223
+ return;
6224
+ }
6225
+
6226
+ if (!this._optionalContentConfigPromise) {
6227
+ return;
6228
+ }
6229
+
6230
+ this._optionalContentConfigPromise = promise;
6231
+
6232
+ for (const pageView of this._pages) {
6233
+ pageView.update(pageView.scale, pageView.rotation, promise);
6234
+ }
6235
+
6236
+ this.update();
6237
+ this.eventBus.dispatch("optionalcontentconfigchanged", {
6238
+ source: this,
6239
+ promise
6240
+ });
6241
+ }
6242
+
6167
6243
  get scrollMode() {
6168
6244
  return this._scrollMode;
6169
6245
  }