pdfjs-dist 2.4.456 → 2.5.207

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 (101) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +4447 -4379
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +8549 -8507
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/es5/build/pdf.js +14755 -14540
  9. package/es5/build/pdf.js.map +1 -1
  10. package/es5/build/pdf.worker.js +9830 -9469
  11. package/es5/build/pdf.worker.js.map +1 -1
  12. package/es5/web/pdf_viewer.css +5 -9
  13. package/es5/web/pdf_viewer.js +157 -172
  14. package/es5/web/pdf_viewer.js.map +1 -1
  15. package/image_decoders/pdf.image_decoders.js +107 -93
  16. package/image_decoders/pdf.image_decoders.js.map +1 -1
  17. package/image_decoders/pdf.image_decoders.min.js +1 -1
  18. package/lib/README.md +2 -2
  19. package/lib/core/ccitt.js +7 -7
  20. package/lib/core/cff_parser.js +1 -1
  21. package/lib/core/chunked_stream.js +5 -5
  22. package/lib/core/cmap.js +13 -0
  23. package/lib/core/document.js +22 -18
  24. package/lib/core/evaluator.js +285 -247
  25. package/lib/core/font_renderer.js +7 -7
  26. package/lib/core/fonts.js +163 -147
  27. package/lib/core/function.js +4 -5
  28. package/lib/core/glyphlist.js +4523 -4523
  29. package/lib/core/image.js +19 -44
  30. package/lib/core/image_utils.js +123 -47
  31. package/lib/core/jpeg_stream.js +2 -116
  32. package/lib/core/jpg.js +47 -55
  33. package/lib/core/jpx.js +6 -6
  34. package/lib/core/metrics.js +2916 -2916
  35. package/lib/core/obj.js +18 -7
  36. package/lib/core/operator_list.js +5 -0
  37. package/lib/core/parser.js +1 -1
  38. package/lib/core/pdf_manager.js +2 -2
  39. package/lib/core/primitives.js +4 -0
  40. package/lib/core/standard_fonts.js +103 -103
  41. package/lib/core/type1_parser.js +6 -6
  42. package/lib/core/worker.js +31 -24
  43. package/lib/core/worker_stream.js +1 -1
  44. package/lib/display/annotation_layer.js +3 -0
  45. package/lib/display/api.js +29 -137
  46. package/lib/display/api_compatibility.js +11 -18
  47. package/lib/display/canvas.js +7 -34
  48. package/lib/display/content_disposition.js +4 -4
  49. package/lib/display/display_utils.js +6 -15
  50. package/lib/display/fetch_stream.js +3 -1
  51. package/lib/display/font_loader.js +2 -2
  52. package/lib/display/network.js +1 -1
  53. package/lib/display/node_stream.js +10 -8
  54. package/lib/display/pattern_helper.js +1 -1
  55. package/lib/display/svg.js +61 -31
  56. package/lib/display/text_layer.js +44 -32
  57. package/lib/display/transport_stream.js +3 -3
  58. package/lib/pdf.js +210 -48
  59. package/lib/pdf.worker.js +12 -4
  60. package/lib/shared/compatibility.js +2 -0
  61. package/lib/shared/is_node.js +1 -1
  62. package/lib/shared/message_handler.js +6 -6
  63. package/lib/shared/util.js +15 -9
  64. package/lib/test/unit/api_spec.js +165 -95
  65. package/lib/test/unit/cff_parser_spec.js +12 -12
  66. package/lib/test/unit/clitests_helper.js +1 -1
  67. package/lib/test/unit/display_svg_spec.js +1 -5
  68. package/lib/test/unit/jasmine-boot.js +2 -2
  69. package/lib/test/unit/node_stream_spec.js +5 -3
  70. package/lib/test/unit/parser_spec.js +3 -3
  71. package/lib/test/unit/test_utils.js +1 -1
  72. package/lib/test/unit/testreporter.js +4 -4
  73. package/lib/test/unit/ui_utils_spec.js +1 -55
  74. package/lib/test/unit/unicode_spec.js +1 -1
  75. package/lib/web/app.js +247 -159
  76. package/lib/web/app_options.js +16 -10
  77. package/lib/web/base_viewer.js +14 -6
  78. package/lib/web/download_manager.js +3 -1
  79. package/lib/web/firefox_print_service.js +1 -1
  80. package/lib/web/firefoxcom.js +16 -4
  81. package/lib/web/pdf_attachment_viewer.js +14 -7
  82. package/lib/web/pdf_document_properties.js +11 -16
  83. package/lib/web/pdf_find_bar.js +3 -3
  84. package/lib/web/pdf_find_controller.js +3 -3
  85. package/lib/web/pdf_history.js +7 -5
  86. package/lib/web/pdf_link_service.js +7 -8
  87. package/lib/web/pdf_page_view.js +1 -1
  88. package/lib/web/pdf_presentation_mode.js +6 -2
  89. package/lib/web/pdf_print_service.js +1 -1
  90. package/lib/web/pdf_single_page_viewer.js +2 -2
  91. package/lib/web/pdf_viewer.component.js +2 -2
  92. package/lib/web/pdf_viewer.js +2 -2
  93. package/lib/web/preferences.js +4 -1
  94. package/lib/web/text_layer_builder.js +1 -3
  95. package/lib/web/ui_utils.js +3 -55
  96. package/lib/web/view_history.js +8 -9
  97. package/lib/web/viewer_compatibility.js +14 -1
  98. package/package.json +1 -1
  99. package/web/pdf_viewer.css +5 -9
  100. package/web/pdf_viewer.js +97 -127
  101. package/web/pdf_viewer.js.map +1 -1
@@ -64,6 +64,7 @@ class Page {
64
64
  ref,
65
65
  fontCache,
66
66
  builtInCMapCache,
67
+ globalImageCache,
67
68
  pdfFunctionFactory
68
69
  }) {
69
70
  this.pdfManager = pdfManager;
@@ -73,6 +74,7 @@ class Page {
73
74
  this.ref = ref;
74
75
  this.fontCache = fontCache;
75
76
  this.builtInCMapCache = builtInCMapCache;
77
+ this.globalImageCache = globalImageCache;
76
78
  this.pdfFunctionFactory = pdfFunctionFactory;
77
79
  this.evaluatorOptions = pdfManager.evaluatorOptions;
78
80
  this.resourcesPromise = null;
@@ -194,8 +196,8 @@ class Page {
194
196
  const xref = this.xref;
195
197
  const streams = [];
196
198
 
197
- for (const stream of content) {
198
- streams.push(xref.fetchIfRef(stream));
199
+ for (const subStream of content) {
200
+ streams.push(xref.fetchIfRef(subStream));
199
201
  }
200
202
 
201
203
  stream = new _stream.StreamsSequenceStream(streams);
@@ -235,6 +237,7 @@ class Page {
235
237
  idFactory: this.idFactory,
236
238
  fontCache: this.fontCache,
237
239
  builtInCMapCache: this.builtInCMapCache,
240
+ globalImageCache: this.globalImageCache,
238
241
  options: this.evaluatorOptions,
239
242
  pdfFunctionFactory: this.pdfFunctionFactory
240
243
  });
@@ -267,7 +270,10 @@ class Page {
267
270
 
268
271
  for (const annotation of annotations) {
269
272
  if (isAnnotationRenderable(annotation, intent)) {
270
- opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));
273
+ opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
274
+ (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
275
+ return null;
276
+ }));
271
277
  }
272
278
  }
273
279
 
@@ -305,6 +311,7 @@ class Page {
305
311
  idFactory: this.idFactory,
306
312
  fontCache: this.fontCache,
307
313
  builtInCMapCache: this.builtInCMapCache,
314
+ globalImageCache: this.globalImageCache,
308
315
  options: this.evaluatorOptions,
309
316
  pdfFunctionFactory: this.pdfFunctionFactory
310
317
  });
@@ -339,20 +346,17 @@ class Page {
339
346
 
340
347
  get _parsedAnnotations() {
341
348
  const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
342
- const annotationRefs = this.annotations;
343
349
  const annotationPromises = [];
344
350
 
345
- for (let i = 0, ii = annotationRefs.length; i < ii; i++) {
346
- annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRefs[i], this.pdfManager, this.idFactory));
351
+ for (const annotationRef of this.annotations) {
352
+ annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory).catch(function (reason) {
353
+ (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
354
+ return null;
355
+ }));
347
356
  }
348
357
 
349
358
  return Promise.all(annotationPromises).then(function (annotations) {
350
- return annotations.filter(function isDefined(annotation) {
351
- return !!annotation;
352
- });
353
- }, function (reason) {
354
- (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
355
- return [];
359
+ return annotations.filter(annotation => !!annotation);
356
360
  });
357
361
  });
358
362
  return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
@@ -656,11 +660,11 @@ class PDFDocument {
656
660
  continue;
657
661
  }
658
662
 
659
- if (!docInfo["Custom"]) {
660
- docInfo["Custom"] = Object.create(null);
663
+ if (!docInfo.Custom) {
664
+ docInfo.Custom = Object.create(null);
661
665
  }
662
666
 
663
- docInfo["Custom"][key] = customValue;
667
+ docInfo.Custom[key] = customValue;
664
668
  }
665
669
  }
666
670
  }
@@ -693,7 +697,6 @@ class PDFDocument {
693
697
  catalog,
694
698
  linearization
695
699
  } = this;
696
- (0, _util.assert)(linearization && linearization.pageFirst === pageIndex);
697
700
 
698
701
  const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
699
702
 
@@ -732,6 +735,7 @@ class PDFDocument {
732
735
  ref,
733
736
  fontCache: catalog.fontCache,
734
737
  builtInCMapCache: catalog.builtInCMapCache,
738
+ globalImageCache: catalog.globalImageCache,
735
739
  pdfFunctionFactory: this.pdfFunctionFactory
736
740
  });
737
741
  });
@@ -751,8 +755,8 @@ class PDFDocument {
751
755
  return this.catalog.fontFallback(id, handler);
752
756
  }
753
757
 
754
- async cleanup() {
755
- return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)();
758
+ async cleanup(manuallyTriggered = false) {
759
+ return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
756
760
  }
757
761
 
758
762
  }