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
package/lib/core/obj.js CHANGED
@@ -38,6 +38,8 @@ var _crypto = require("./crypto.js");
38
38
 
39
39
  var _colorspace = require("./colorspace.js");
40
40
 
41
+ var _image_utils = require("./image_utils.js");
42
+
41
43
  function fetchDestination(dest) {
42
44
  return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
43
45
  }
@@ -54,6 +56,7 @@ class Catalog {
54
56
 
55
57
  this.fontCache = new _primitives.RefSetCache();
56
58
  this.builtInCMapCache = new Map();
59
+ this.globalImageCache = new _image_utils.GlobalImageCache();
57
60
  this.pageKidsCountCache = new _primitives.RefSetCache();
58
61
  }
59
62
 
@@ -484,7 +487,7 @@ class Catalog {
484
487
  NumCopies: Number.isInteger
485
488
  };
486
489
  const obj = this.catDict.get("ViewerPreferences");
487
- const prefs = Object.create(null);
490
+ let prefs = null;
488
491
 
489
492
  if ((0, _primitives.isDict)(obj)) {
490
493
  for (const key in ViewerPreferencesValidators) {
@@ -601,11 +604,18 @@ class Catalog {
601
604
  break;
602
605
 
603
606
  default:
604
- (0, _util.assert)(typeof value === "boolean");
607
+ if (typeof value !== "boolean") {
608
+ throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
609
+ }
610
+
605
611
  prefValue = value;
606
612
  }
607
613
 
608
614
  if (prefValue !== undefined) {
615
+ if (!prefs) {
616
+ prefs = Object.create(null);
617
+ }
618
+
609
619
  prefs[key] = prefValue;
610
620
  } else {
611
621
  (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
@@ -742,8 +752,9 @@ class Catalog {
742
752
  });
743
753
  }
744
754
 
745
- cleanup() {
755
+ cleanup(manuallyTriggered = false) {
746
756
  (0, _primitives.clearPrimitiveCaches)();
757
+ this.globalImageCache.clear(manuallyTriggered);
747
758
  this.pageKidsCountCache.clear();
748
759
  const promises = [];
749
760
  this.fontCache.forEach(function (promise) {
@@ -910,13 +921,13 @@ class Catalog {
910
921
  break;
911
922
  }
912
923
 
913
- kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
914
- if (!(0, _primitives.isDict)(kid)) {
924
+ kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
925
+ if (!(0, _primitives.isDict)(obj)) {
915
926
  throw new _util.FormatError("Kid node must be a dictionary.");
916
927
  }
917
928
 
918
- if (kid.has("Count")) {
919
- total += kid.get("Count");
929
+ if (obj.has("Count")) {
930
+ total += obj.get("Count");
920
931
  } else {
921
932
  total++;
922
933
  }
@@ -604,6 +604,11 @@ var OperatorList = function OperatorListClosure() {
604
604
  },
605
605
 
606
606
  addOpList(opList) {
607
+ if (!(opList instanceof OperatorList)) {
608
+ (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
609
+ return;
610
+ }
611
+
607
612
  Object.assign(this.dependencies, opList.dependencies);
608
613
 
609
614
  for (var i = 0, ii = opList.length; i < ii; i++) {
@@ -210,7 +210,7 @@ class Parser {
210
210
  } else if (state === 1) {
211
211
  state = ch === I ? 2 : 0;
212
212
  } else {
213
- (0, _util.assert)(state === 2);
213
+ (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
214
214
 
215
215
  if (ch === SPACE || ch === LF || ch === CR) {
216
216
  maybeEIPos = stream.pos;
@@ -91,8 +91,8 @@ class BasePdfManager {
91
91
  return this.pdfDocument.fontFallback(id, handler);
92
92
  }
93
93
 
94
- cleanup() {
95
- return this.pdfDocument.cleanup();
94
+ cleanup(manuallyTriggered = false) {
95
+ return this.pdfDocument.cleanup(manuallyTriggered);
96
96
  }
97
97
 
98
98
  async ensure(obj, prop, args) {
@@ -266,6 +266,10 @@ var RefSetCache = function RefSetCacheClosure() {
266
266
  }
267
267
 
268
268
  RefSetCache.prototype = {
269
+ get size() {
270
+ return Object.keys(this.dict).length;
271
+ },
272
+
269
273
  get: function RefSetCache_get(ref) {
270
274
  return this.dict[ref.toString()];
271
275
  },
@@ -29,11 +29,11 @@ exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForAr
29
29
  var _core_utils = require("./core_utils.js");
30
30
 
31
31
  const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
32
- t["ArialNarrow"] = "Helvetica";
32
+ t.ArialNarrow = "Helvetica";
33
33
  t["ArialNarrow-Bold"] = "Helvetica-Bold";
34
34
  t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
35
35
  t["ArialNarrow-Italic"] = "Helvetica-Oblique";
36
- t["ArialBlack"] = "Helvetica";
36
+ t.ArialBlack = "Helvetica";
37
37
  t["ArialBlack-Bold"] = "Helvetica-Bold";
38
38
  t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
39
39
  t["ArialBlack-Italic"] = "Helvetica-Oblique";
@@ -41,26 +41,26 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
41
41
  t["Arial-Black-Bold"] = "Helvetica-Bold";
42
42
  t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
43
43
  t["Arial-Black-Italic"] = "Helvetica-Oblique";
44
- t["Arial"] = "Helvetica";
44
+ t.Arial = "Helvetica";
45
45
  t["Arial-Bold"] = "Helvetica-Bold";
46
46
  t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
47
47
  t["Arial-Italic"] = "Helvetica-Oblique";
48
48
  t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
49
49
  t["Arial-BoldMT"] = "Helvetica-Bold";
50
50
  t["Arial-ItalicMT"] = "Helvetica-Oblique";
51
- t["ArialMT"] = "Helvetica";
51
+ t.ArialMT = "Helvetica";
52
52
  t["Courier-Bold"] = "Courier-Bold";
53
53
  t["Courier-BoldItalic"] = "Courier-BoldOblique";
54
54
  t["Courier-Italic"] = "Courier-Oblique";
55
- t["CourierNew"] = "Courier";
55
+ t.CourierNew = "Courier";
56
56
  t["CourierNew-Bold"] = "Courier-Bold";
57
57
  t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
58
58
  t["CourierNew-Italic"] = "Courier-Oblique";
59
59
  t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
60
60
  t["CourierNewPS-BoldMT"] = "Courier-Bold";
61
61
  t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
62
- t["CourierNewPSMT"] = "Courier";
63
- t["Helvetica"] = "Helvetica";
62
+ t.CourierNewPSMT = "Courier";
63
+ t.Helvetica = "Helvetica";
64
64
  t["Helvetica-Bold"] = "Helvetica-Bold";
65
65
  t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
66
66
  t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
@@ -69,37 +69,37 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
69
69
  t["Symbol-Bold"] = "Symbol";
70
70
  t["Symbol-BoldItalic"] = "Symbol";
71
71
  t["Symbol-Italic"] = "Symbol";
72
- t["TimesNewRoman"] = "Times-Roman";
72
+ t.TimesNewRoman = "Times-Roman";
73
73
  t["TimesNewRoman-Bold"] = "Times-Bold";
74
74
  t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
75
75
  t["TimesNewRoman-Italic"] = "Times-Italic";
76
- t["TimesNewRomanPS"] = "Times-Roman";
76
+ t.TimesNewRomanPS = "Times-Roman";
77
77
  t["TimesNewRomanPS-Bold"] = "Times-Bold";
78
78
  t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
79
79
  t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
80
80
  t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
81
81
  t["TimesNewRomanPS-Italic"] = "Times-Italic";
82
82
  t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
83
- t["TimesNewRomanPSMT"] = "Times-Roman";
83
+ t.TimesNewRomanPSMT = "Times-Roman";
84
84
  t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
85
85
  t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
86
86
  t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
87
87
  });
88
88
  exports.getStdFontMap = getStdFontMap;
89
89
  const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
90
- t["Calibri"] = "Helvetica";
90
+ t.Calibri = "Helvetica";
91
91
  t["Calibri-Bold"] = "Helvetica-Bold";
92
92
  t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
93
93
  t["Calibri-Italic"] = "Helvetica-Oblique";
94
- t["CenturyGothic"] = "Helvetica";
94
+ t.CenturyGothic = "Helvetica";
95
95
  t["CenturyGothic-Bold"] = "Helvetica-Bold";
96
96
  t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
97
97
  t["CenturyGothic-Italic"] = "Helvetica-Oblique";
98
- t["ComicSansMS"] = "Comic Sans MS";
98
+ t.ComicSansMS = "Comic Sans MS";
99
99
  t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
100
100
  t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
101
101
  t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
102
- t["LucidaConsole"] = "Courier";
102
+ t.LucidaConsole = "Courier";
103
103
  t["LucidaConsole-Bold"] = "Courier-Bold";
104
104
  t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
105
105
  t["LucidaConsole-Italic"] = "Courier-Oblique";
@@ -120,103 +120,103 @@ const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
120
120
  t["MS-PMincho-Bold"] = "MS PMincho-Bold";
121
121
  t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
122
122
  t["MS-PMincho-Italic"] = "MS PMincho-Italic";
123
- t["NuptialScript"] = "Times-Italic";
124
- t["SegoeUISymbol"] = "Helvetica";
125
- t["Wingdings"] = "ZapfDingbats";
123
+ t.NuptialScript = "Times-Italic";
124
+ t.SegoeUISymbol = "Helvetica";
125
+ t.Wingdings = "ZapfDingbats";
126
126
  t["Wingdings-Regular"] = "ZapfDingbats";
127
127
  });
128
128
  exports.getNonStdFontMap = getNonStdFontMap;
129
129
  const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
130
130
  t["Adobe Jenson"] = true;
131
131
  t["Adobe Text"] = true;
132
- t["Albertus"] = true;
133
- t["Aldus"] = true;
134
- t["Alexandria"] = true;
135
- t["Algerian"] = true;
132
+ t.Albertus = true;
133
+ t.Aldus = true;
134
+ t.Alexandria = true;
135
+ t.Algerian = true;
136
136
  t["American Typewriter"] = true;
137
- t["Antiqua"] = true;
138
- t["Apex"] = true;
139
- t["Arno"] = true;
140
- t["Aster"] = true;
141
- t["Aurora"] = true;
142
- t["Baskerville"] = true;
143
- t["Bell"] = true;
144
- t["Bembo"] = true;
137
+ t.Antiqua = true;
138
+ t.Apex = true;
139
+ t.Arno = true;
140
+ t.Aster = true;
141
+ t.Aurora = true;
142
+ t.Baskerville = true;
143
+ t.Bell = true;
144
+ t.Bembo = true;
145
145
  t["Bembo Schoolbook"] = true;
146
- t["Benguiat"] = true;
146
+ t.Benguiat = true;
147
147
  t["Berkeley Old Style"] = true;
148
148
  t["Bernhard Modern"] = true;
149
149
  t["Berthold City"] = true;
150
- t["Bodoni"] = true;
150
+ t.Bodoni = true;
151
151
  t["Bauer Bodoni"] = true;
152
152
  t["Book Antiqua"] = true;
153
- t["Bookman"] = true;
153
+ t.Bookman = true;
154
154
  t["Bordeaux Roman"] = true;
155
155
  t["Californian FB"] = true;
156
- t["Calisto"] = true;
157
- t["Calvert"] = true;
158
- t["Capitals"] = true;
159
- t["Cambria"] = true;
160
- t["Cartier"] = true;
161
- t["Caslon"] = true;
162
- t["Catull"] = true;
163
- t["Centaur"] = true;
156
+ t.Calisto = true;
157
+ t.Calvert = true;
158
+ t.Capitals = true;
159
+ t.Cambria = true;
160
+ t.Cartier = true;
161
+ t.Caslon = true;
162
+ t.Catull = true;
163
+ t.Centaur = true;
164
164
  t["Century Old Style"] = true;
165
165
  t["Century Schoolbook"] = true;
166
- t["Chaparral"] = true;
166
+ t.Chaparral = true;
167
167
  t["Charis SIL"] = true;
168
- t["Cheltenham"] = true;
168
+ t.Cheltenham = true;
169
169
  t["Cholla Slab"] = true;
170
- t["Clarendon"] = true;
171
- t["Clearface"] = true;
172
- t["Cochin"] = true;
173
- t["Colonna"] = true;
170
+ t.Clarendon = true;
171
+ t.Clearface = true;
172
+ t.Cochin = true;
173
+ t.Colonna = true;
174
174
  t["Computer Modern"] = true;
175
175
  t["Concrete Roman"] = true;
176
- t["Constantia"] = true;
176
+ t.Constantia = true;
177
177
  t["Cooper Black"] = true;
178
- t["Corona"] = true;
179
- t["Ecotype"] = true;
180
- t["Egyptienne"] = true;
181
- t["Elephant"] = true;
182
- t["Excelsior"] = true;
183
- t["Fairfield"] = true;
178
+ t.Corona = true;
179
+ t.Ecotype = true;
180
+ t.Egyptienne = true;
181
+ t.Elephant = true;
182
+ t.Excelsior = true;
183
+ t.Fairfield = true;
184
184
  t["FF Scala"] = true;
185
- t["Folkard"] = true;
186
- t["Footlight"] = true;
187
- t["FreeSerif"] = true;
185
+ t.Folkard = true;
186
+ t.Footlight = true;
187
+ t.FreeSerif = true;
188
188
  t["Friz Quadrata"] = true;
189
- t["Garamond"] = true;
190
- t["Gentium"] = true;
191
- t["Georgia"] = true;
192
- t["Gloucester"] = true;
189
+ t.Garamond = true;
190
+ t.Gentium = true;
191
+ t.Georgia = true;
192
+ t.Gloucester = true;
193
193
  t["Goudy Old Style"] = true;
194
194
  t["Goudy Schoolbook"] = true;
195
195
  t["Goudy Pro Font"] = true;
196
- t["Granjon"] = true;
196
+ t.Granjon = true;
197
197
  t["Guardian Egyptian"] = true;
198
- t["Heather"] = true;
199
- t["Hercules"] = true;
198
+ t.Heather = true;
199
+ t.Hercules = true;
200
200
  t["High Tower Text"] = true;
201
- t["Hiroshige"] = true;
201
+ t.Hiroshige = true;
202
202
  t["Hoefler Text"] = true;
203
203
  t["Humana Serif"] = true;
204
- t["Imprint"] = true;
204
+ t.Imprint = true;
205
205
  t["Ionic No. 5"] = true;
206
- t["Janson"] = true;
207
- t["Joanna"] = true;
208
- t["Korinna"] = true;
209
- t["Lexicon"] = true;
206
+ t.Janson = true;
207
+ t.Joanna = true;
208
+ t.Korinna = true;
209
+ t.Lexicon = true;
210
210
  t["Liberation Serif"] = true;
211
211
  t["Linux Libertine"] = true;
212
- t["Literaturnaya"] = true;
213
- t["Lucida"] = true;
212
+ t.Literaturnaya = true;
213
+ t.Lucida = true;
214
214
  t["Lucida Bright"] = true;
215
- t["Melior"] = true;
216
- t["Memphis"] = true;
217
- t["Miller"] = true;
218
- t["Minion"] = true;
219
- t["Modern"] = true;
215
+ t.Melior = true;
216
+ t.Memphis = true;
217
+ t.Miller = true;
218
+ t.Minion = true;
219
+ t.Modern = true;
220
220
  t["Mona Lisa"] = true;
221
221
  t["Mrs Eaves"] = true;
222
222
  t["MS Serif"] = true;
@@ -224,48 +224,48 @@ const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
224
224
  t["New York"] = true;
225
225
  t["Nimbus Roman"] = true;
226
226
  t["NPS Rawlinson Roadway"] = true;
227
- t["NuptialScript"] = true;
228
- t["Palatino"] = true;
229
- t["Perpetua"] = true;
230
- t["Plantin"] = true;
227
+ t.NuptialScript = true;
228
+ t.Palatino = true;
229
+ t.Perpetua = true;
230
+ t.Plantin = true;
231
231
  t["Plantin Schoolbook"] = true;
232
- t["Playbill"] = true;
232
+ t.Playbill = true;
233
233
  t["Poor Richard"] = true;
234
234
  t["Rawlinson Roadway"] = true;
235
- t["Renault"] = true;
236
- t["Requiem"] = true;
237
- t["Rockwell"] = true;
238
- t["Roman"] = true;
235
+ t.Renault = true;
236
+ t.Requiem = true;
237
+ t.Rockwell = true;
238
+ t.Roman = true;
239
239
  t["Rotis Serif"] = true;
240
- t["Sabon"] = true;
241
- t["Scala"] = true;
242
- t["Seagull"] = true;
243
- t["Sistina"] = true;
244
- t["Souvenir"] = true;
245
- t["STIX"] = true;
240
+ t.Sabon = true;
241
+ t.Scala = true;
242
+ t.Seagull = true;
243
+ t.Sistina = true;
244
+ t.Souvenir = true;
245
+ t.STIX = true;
246
246
  t["Stone Informal"] = true;
247
247
  t["Stone Serif"] = true;
248
- t["Sylfaen"] = true;
249
- t["Times"] = true;
250
- t["Trajan"] = true;
248
+ t.Sylfaen = true;
249
+ t.Times = true;
250
+ t.Trajan = true;
251
251
  t["Trinité"] = true;
252
252
  t["Trump Mediaeval"] = true;
253
- t["Utopia"] = true;
253
+ t.Utopia = true;
254
254
  t["Vale Type"] = true;
255
255
  t["Bitstream Vera"] = true;
256
256
  t["Vera Serif"] = true;
257
- t["Versailles"] = true;
258
- t["Wanted"] = true;
259
- t["Weiss"] = true;
257
+ t.Versailles = true;
258
+ t.Wanted = true;
259
+ t.Weiss = true;
260
260
  t["Wide Latin"] = true;
261
- t["Windsor"] = true;
262
- t["XITS"] = true;
261
+ t.Windsor = true;
262
+ t.XITS = true;
263
263
  });
264
264
  exports.getSerifFonts = getSerifFonts;
265
265
  const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
266
- t["Dingbats"] = true;
267
- t["Symbol"] = true;
268
- t["ZapfDingbats"] = true;
266
+ t.Dingbats = true;
267
+ t.Symbol = true;
268
+ t.ZapfDingbats = true;
269
269
  });
270
270
  exports.getSymbolsFonts = getSymbolsFonts;
271
271
  const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
@@ -406,7 +406,7 @@ var Type1Parser = function Type1ParserClosure() {
406
406
  }
407
407
  }
408
408
 
409
- return Array.prototype.slice.call(decrypted, discardNumber, j);
409
+ return decrypted.slice(discardNumber, j);
410
410
  }
411
411
 
412
412
  function isSpecial(c) {
@@ -416,7 +416,7 @@ var Type1Parser = function Type1ParserClosure() {
416
416
  function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
417
417
  if (encrypted) {
418
418
  var data = stream.getBytes();
419
- var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
419
+ var isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
420
420
  stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
421
421
  }
422
422
 
@@ -505,7 +505,7 @@ var Type1Parser = function Type1ParserClosure() {
505
505
  var subrs = [],
506
506
  charstrings = [];
507
507
  var privateData = Object.create(null);
508
- privateData["lenIV"] = 4;
508
+ privateData.lenIV = 4;
509
509
  var program = {
510
510
  subrs: [],
511
511
  charstrings: [],
@@ -544,7 +544,7 @@ var Type1Parser = function Type1ParserClosure() {
544
544
  length = this.readInt();
545
545
  this.getToken();
546
546
  data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
547
- lenIV = program.properties.privateData["lenIV"];
547
+ lenIV = program.properties.privateData.lenIV;
548
548
  encoded = this.readCharStrings(data, lenIV);
549
549
  this.nextChar();
550
550
  token = this.getToken();
@@ -566,11 +566,11 @@ var Type1Parser = function Type1ParserClosure() {
566
566
  this.getToken();
567
567
 
568
568
  while (this.getToken() === "dup") {
569
- var index = this.readInt();
569
+ const index = this.readInt();
570
570
  length = this.readInt();
571
571
  this.getToken();
572
572
  data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
573
- lenIV = program.properties.privateData["lenIV"];
573
+ lenIV = program.properties.privateData.lenIV;
574
574
  encoded = this.readCharStrings(data, lenIV);
575
575
  this.nextChar();
576
576
  token = this.getToken();
@@ -107,7 +107,7 @@ var WorkerMessageHandler = {
107
107
  var WorkerTasks = [];
108
108
  const verbosity = (0, _util.getVerbosityLevel)();
109
109
  const apiVersion = docParams.apiVersion;
110
- const workerVersion = '2.4.456';
110
+ const workerVersion = '2.5.207';
111
111
 
112
112
  if (apiVersion !== workerVersion) {
113
113
  throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@@ -123,6 +123,10 @@ var WorkerMessageHandler = {
123
123
  throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
124
124
  }
125
125
 
126
+ if (typeof ReadableStream === "undefined" || typeof Promise.allSettled === "undefined") {
127
+ throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. " + "`ReadableStream` and/or `Promise.allSettled`); " + "please use an ES5-compatible build instead.");
128
+ }
129
+
126
130
  var docId = docParams.docId;
127
131
  var docBaseUrl = docParams.docBaseUrl;
128
132
  var workerHandlerName = docParams.docId + "_worker";
@@ -163,13 +167,13 @@ var WorkerMessageHandler = {
163
167
 
164
168
  function getPdfManager(data, evaluatorOptions) {
165
169
  var pdfManagerCapability = (0, _util.createPromiseCapability)();
166
- var pdfManager;
170
+ let newPdfManager;
167
171
  var source = data.source;
168
172
 
169
173
  if (source.data) {
170
174
  try {
171
- pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
172
- pdfManagerCapability.resolve(pdfManager);
175
+ newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
176
+ pdfManagerCapability.resolve(newPdfManager);
173
177
  } catch (ex) {
174
178
  pdfManagerCapability.reject(ex);
175
179
  }
@@ -194,7 +198,7 @@ var WorkerMessageHandler = {
194
198
  }
195
199
 
196
200
  var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
197
- pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
201
+ newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
198
202
  msgHandler: handler,
199
203
  password: source.password,
200
204
  length: fullRequest.contentLength,
@@ -203,11 +207,11 @@ var WorkerMessageHandler = {
203
207
  }, evaluatorOptions, docBaseUrl);
204
208
 
205
209
  for (let i = 0; i < cachedChunks.length; i++) {
206
- pdfManager.sendProgressiveData(cachedChunks[i]);
210
+ newPdfManager.sendProgressiveData(cachedChunks[i]);
207
211
  }
208
212
 
209
213
  cachedChunks = [];
210
- pdfManagerCapability.resolve(pdfManager);
214
+ pdfManagerCapability.resolve(newPdfManager);
211
215
  cancelXHRs = null;
212
216
  }).catch(function (reason) {
213
217
  pdfManagerCapability.reject(reason);
@@ -223,8 +227,8 @@ var WorkerMessageHandler = {
223
227
  }
224
228
 
225
229
  try {
226
- pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
227
- pdfManagerCapability.resolve(pdfManager);
230
+ newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
231
+ pdfManagerCapability.resolve(newPdfManager);
228
232
  } catch (ex) {
229
233
  pdfManagerCapability.reject(ex);
230
234
  }
@@ -233,12 +237,15 @@ var WorkerMessageHandler = {
233
237
  };
234
238
 
235
239
  var readPromise = new Promise(function (resolve, reject) {
236
- var readChunk = function (chunk) {
240
+ var readChunk = function ({
241
+ value,
242
+ done
243
+ }) {
237
244
  try {
238
245
  ensureNotTerminated();
239
246
 
240
- if (chunk.done) {
241
- if (!pdfManager) {
247
+ if (done) {
248
+ if (!newPdfManager) {
242
249
  flushChunks();
243
250
  }
244
251
 
@@ -246,8 +253,7 @@ var WorkerMessageHandler = {
246
253
  return;
247
254
  }
248
255
 
249
- var data = chunk.value;
250
- loaded += (0, _util.arrayByteLength)(data);
256
+ loaded += (0, _util.arrayByteLength)(value);
251
257
 
252
258
  if (!fullRequest.isStreamingSupported) {
253
259
  handler.send("DocProgress", {
@@ -256,10 +262,10 @@ var WorkerMessageHandler = {
256
262
  });
257
263
  }
258
264
 
259
- if (pdfManager) {
260
- pdfManager.sendProgressiveData(data);
265
+ if (newPdfManager) {
266
+ newPdfManager.sendProgressiveData(value);
261
267
  } else {
262
- cachedChunks.push(data);
268
+ cachedChunks.push(value);
263
269
  }
264
270
 
265
271
  fullRequest.read().then(readChunk, reject);
@@ -296,9 +302,11 @@ var WorkerMessageHandler = {
296
302
  if (ex instanceof _util.PasswordException) {
297
303
  var task = new WorkerTask(`PasswordException: response ${ex.code}`);
298
304
  startWorkerTask(task);
299
- handler.sendWithPromise("PasswordRequest", ex).then(function (data) {
305
+ handler.sendWithPromise("PasswordRequest", ex).then(function ({
306
+ password
307
+ }) {
300
308
  finishWorkerTask(task);
301
- pdfManager.updatePassword(data.password);
309
+ pdfManager.updatePassword(password);
302
310
  pdfManagerReady();
303
311
  }).catch(function () {
304
312
  finishWorkerTask(task);
@@ -331,12 +339,11 @@ var WorkerMessageHandler = {
331
339
 
332
340
  ensureNotTerminated();
333
341
  var evaluatorOptions = {
334
- forceDataSchema: data.disableCreateObjectURL,
335
342
  maxImageSize: data.maxImageSize,
336
343
  disableFontFace: data.disableFontFace,
337
- nativeImageDecoderSupport: data.nativeImageDecoderSupport,
338
344
  ignoreErrors: data.ignoreErrors,
339
- isEvalSupported: data.isEvalSupported
345
+ isEvalSupported: data.isEvalSupported,
346
+ fontExtraProperties: data.fontExtraProperties
340
347
  };
341
348
  getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
342
349
  if (terminated) {
@@ -452,7 +459,7 @@ var WorkerMessageHandler = {
452
459
  }
453
460
 
454
461
  handler.send("UnsupportedFeature", {
455
- featureId: _util.UNSUPPORTED_FEATURES.unknown
462
+ featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
456
463
  });
457
464
  sink.error(reason);
458
465
  });
@@ -498,7 +505,7 @@ var WorkerMessageHandler = {
498
505
  return pdfManager.fontFallback(data.id, handler);
499
506
  });
500
507
  handler.on("Cleanup", function wphCleanup(data) {
501
- return pdfManager.cleanup();
508
+ return pdfManager.cleanup(true);
502
509
  });
503
510
  handler.on("Terminate", function wphTerminate(data) {
504
511
  terminated = true;