pdfjs-dist 2.6.347 → 2.7.570

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 (158) hide show
  1. package/README.md +3 -3
  2. package/bower.json +1 -1
  3. package/build/pdf.js +2050 -1087
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +18219 -10436
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/es5/build/pdf.d.ts +1 -0
  10. package/es5/build/pdf.js +6623 -6654
  11. package/es5/build/pdf.js.map +1 -1
  12. package/es5/build/pdf.min.js +1 -1
  13. package/es5/build/pdf.worker.js +20815 -13888
  14. package/es5/build/pdf.worker.js.map +1 -1
  15. package/es5/build/pdf.worker.min.js +1 -1
  16. package/es5/image_decoders/pdf.image_decoders.js +3817 -4946
  17. package/es5/image_decoders/pdf.image_decoders.js.map +1 -1
  18. package/es5/image_decoders/pdf.image_decoders.min.js +1 -1
  19. package/es5/web/pdf_viewer.css +18 -15
  20. package/es5/web/pdf_viewer.js +1094 -514
  21. package/es5/web/pdf_viewer.js.map +1 -1
  22. package/image_decoders/pdf.image_decoders.js +774 -168
  23. package/image_decoders/pdf.image_decoders.js.map +1 -1
  24. package/image_decoders/pdf.image_decoders.min.js +1 -1
  25. package/lib/core/annotation.js +556 -108
  26. package/lib/core/cff_parser.js +7 -1
  27. package/lib/core/charsets.js +1 -1
  28. package/lib/core/cmap.js +20 -1
  29. package/lib/core/core_utils.js +162 -3
  30. package/lib/core/crypto.js +1 -1
  31. package/lib/core/default_appearance.js +132 -0
  32. package/lib/core/document.js +115 -9
  33. package/lib/core/encodings.js +1 -1
  34. package/lib/core/evaluator.js +168 -74
  35. package/lib/core/fonts.js +97 -11
  36. package/lib/core/function.js +5 -10
  37. package/lib/core/glyphlist.js +11 -4529
  38. package/lib/core/image_utils.js +30 -1
  39. package/lib/core/jpg.js +1 -1
  40. package/lib/core/jpx.js +5 -5
  41. package/lib/core/murmurhash3.js +1 -1
  42. package/lib/core/obj.js +123 -39
  43. package/lib/core/pattern.js +4 -4
  44. package/lib/core/primitives.js +24 -5
  45. package/lib/core/standard_fonts.js +1 -1
  46. package/lib/core/stream.js +5 -1
  47. package/lib/core/unicode.js +15 -1387
  48. package/lib/core/worker.js +58 -17
  49. package/lib/core/writer.js +68 -4
  50. package/lib/display/annotation_layer.js +712 -119
  51. package/lib/display/annotation_storage.js +21 -4
  52. package/lib/display/api.js +88 -18
  53. package/lib/display/canvas.js +414 -375
  54. package/lib/display/display_utils.js +11 -4
  55. package/lib/display/fetch_stream.js +3 -3
  56. package/lib/display/font_loader.js +2 -3
  57. package/lib/display/metadata.js +54 -20
  58. package/lib/display/node_stream.js +1 -1
  59. package/lib/display/optional_content_config.js +1 -1
  60. package/lib/display/pattern_helper.js +109 -113
  61. package/lib/display/svg.js +5 -5
  62. package/lib/display/text_layer.js +54 -54
  63. package/lib/display/transport_stream.js +4 -4
  64. package/lib/display/webgl.js +65 -68
  65. package/lib/examples/node/domstubs.js +9 -4
  66. package/lib/pdf.js +2 -2
  67. package/lib/pdf.sandbox.js +311 -0
  68. package/lib/pdf.worker.js +2 -2
  69. package/lib/shared/scripting_utils.js +84 -0
  70. package/lib/shared/util.js +129 -14
  71. package/lib/{display → shared}/xml_parser.js +112 -4
  72. package/lib/test/unit/annotation_spec.js +831 -109
  73. package/lib/test/unit/annotation_storage_spec.js +28 -10
  74. package/lib/test/unit/api_spec.js +190 -160
  75. package/lib/test/unit/bidi_spec.js +6 -6
  76. package/lib/test/unit/cff_parser_spec.js +73 -73
  77. package/lib/test/unit/clitests_helper.js +2 -0
  78. package/lib/test/unit/cmap_spec.js +48 -74
  79. package/lib/test/unit/core_utils_spec.js +34 -0
  80. package/lib/test/unit/crypto_spec.js +162 -199
  81. package/lib/test/unit/custom_spec.js +7 -18
  82. package/lib/test/unit/default_appearance_spec.js +54 -0
  83. package/lib/test/unit/display_svg_spec.js +24 -19
  84. package/lib/test/unit/display_utils_spec.js +1 -1
  85. package/lib/test/unit/document_spec.js +187 -20
  86. package/lib/test/unit/evaluator_spec.js +30 -30
  87. package/lib/test/unit/function_spec.js +165 -165
  88. package/lib/test/unit/jasmine-boot.js +52 -53
  89. package/lib/test/unit/metadata_spec.js +2 -2
  90. package/lib/test/unit/murmurhash3_spec.js +29 -16
  91. package/lib/test/unit/network_spec.js +21 -21
  92. package/lib/test/unit/pdf_find_controller_spec.js +131 -69
  93. package/lib/test/unit/pdf_find_utils_spec.js +10 -10
  94. package/lib/test/unit/scripting_spec.js +1104 -0
  95. package/lib/test/unit/stream_spec.js +8 -8
  96. package/lib/test/unit/test_utils.js +16 -19
  97. package/lib/test/unit/testreporter.js +11 -4
  98. package/lib/test/unit/type1_parser_spec.js +23 -23
  99. package/lib/test/unit/ui_utils_spec.js +78 -35
  100. package/lib/test/unit/unicode_spec.js +7 -7
  101. package/lib/test/unit/util_spec.js +26 -3
  102. package/lib/test/unit/writer_spec.js +16 -1
  103. package/lib/test/unit/xml_spec.js +117 -0
  104. package/lib/web/annotation_layer_builder.js +18 -6
  105. package/lib/web/app.js +579 -161
  106. package/lib/web/app_options.js +14 -0
  107. package/lib/web/base_tree_viewer.js +50 -0
  108. package/lib/web/base_viewer.js +350 -14
  109. package/lib/web/chromecom.js +9 -1
  110. package/lib/web/debugger.js +1 -2
  111. package/lib/web/download_manager.js +0 -15
  112. package/lib/web/firefox_print_service.js +6 -4
  113. package/lib/web/firefoxcom.js +84 -69
  114. package/lib/web/generic_scripting.js +55 -0
  115. package/lib/web/genericcom.js +9 -1
  116. package/lib/web/grab_to_pan.js +1 -1
  117. package/lib/web/interfaces.js +9 -3
  118. package/lib/web/pdf_attachment_viewer.js +1 -3
  119. package/lib/web/pdf_cursor_tools.js +20 -13
  120. package/lib/web/pdf_document_properties.js +48 -61
  121. package/lib/web/pdf_find_bar.js +1 -3
  122. package/lib/web/pdf_find_controller.js +58 -12
  123. package/lib/web/pdf_history.js +43 -21
  124. package/lib/web/pdf_layer_viewer.js +1 -9
  125. package/lib/web/pdf_link_service.js +108 -78
  126. package/lib/web/pdf_outline_viewer.js +166 -10
  127. package/lib/web/pdf_page_view.js +14 -14
  128. package/lib/web/pdf_presentation_mode.js +21 -31
  129. package/lib/web/pdf_rendering_queue.js +8 -1
  130. package/lib/web/pdf_sidebar.js +62 -107
  131. package/lib/web/pdf_sidebar_resizer.js +11 -21
  132. package/lib/web/pdf_single_page_viewer.js +8 -0
  133. package/lib/web/pdf_thumbnail_view.js +26 -26
  134. package/lib/web/pdf_thumbnail_viewer.js +13 -2
  135. package/lib/web/pdf_viewer.component.js +2 -2
  136. package/lib/web/pdf_viewer.js +3 -1
  137. package/lib/web/preferences.js +33 -44
  138. package/lib/web/text_layer_builder.js +2 -9
  139. package/lib/web/ui_utils.js +78 -46
  140. package/lib/web/viewer_compatibility.js +1 -2
  141. package/package.json +4 -1
  142. package/types/display/annotation_layer.d.ts +18 -3
  143. package/types/display/api.d.ts +110 -54
  144. package/types/display/canvas.d.ts +1 -1
  145. package/types/display/display_utils.d.ts +96 -95
  146. package/types/display/fetch_stream.d.ts +2 -2
  147. package/types/display/metadata.d.ts +4 -0
  148. package/types/display/pattern_helper.d.ts +1 -1
  149. package/types/display/text_layer.d.ts +7 -7
  150. package/types/display/transport_stream.d.ts +1 -1
  151. package/types/shared/scripting_utils.d.ts +12 -0
  152. package/types/shared/util.d.ts +281 -250
  153. package/types/shared/xml_parser.d.ts +64 -0
  154. package/web/pdf_viewer.css +18 -15
  155. package/web/pdf_viewer.js +809 -408
  156. package/web/pdf_viewer.js.map +1 -1
  157. package/webpack.js +1 -1
  158. package/types/display/xml_parser.d.ts +0 -35
@@ -24,7 +24,7 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.GlobalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.LocalImageCache = void 0;
27
+ exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
28
28
 
29
29
  var _util = require("../shared/util.js");
30
30
 
@@ -180,6 +180,35 @@ class LocalGStateCache extends BaseLocalCache {
180
180
 
181
181
  exports.LocalGStateCache = LocalGStateCache;
182
182
 
183
+ class LocalTilingPatternCache extends BaseLocalCache {
184
+ set(name, ref = null, data) {
185
+ if (!name) {
186
+ throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
187
+ }
188
+
189
+ if (ref) {
190
+ if (this._imageCache.has(ref)) {
191
+ return;
192
+ }
193
+
194
+ this._nameRefMap.set(name, ref);
195
+
196
+ this._imageCache.put(ref, data);
197
+
198
+ return;
199
+ }
200
+
201
+ if (this._imageMap.has(name)) {
202
+ return;
203
+ }
204
+
205
+ this._imageMap.set(name, data);
206
+ }
207
+
208
+ }
209
+
210
+ exports.LocalTilingPatternCache = LocalTilingPatternCache;
211
+
183
212
  class GlobalImageCache {
184
213
  static get NUM_PAGES_THRESHOLD() {
185
214
  return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
package/lib/core/jpg.js CHANGED
@@ -1029,7 +1029,7 @@ var JpegImage = function JpegImageClosure() {
1029
1029
  break;
1030
1030
  }
1031
1031
 
1032
- if (offset >= data.length - 1) {
1032
+ if (!nextFileMarker || offset >= data.length - 1) {
1033
1033
  (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
1034
1034
  break markerLoop;
1035
1035
  }
package/lib/core/jpx.js CHANGED
@@ -413,7 +413,7 @@ var JpxImage = function JpxImageClosure() {
413
413
 
414
414
  if (unsupported.length > 0) {
415
415
  doNotRecover = true;
416
- throw new Error("Unsupported COD options (" + unsupported.join(", ") + ")");
416
+ (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
417
417
  }
418
418
 
419
419
  if (context.mainHeader) {
@@ -457,6 +457,9 @@ var JpxImage = function JpxImageClosure() {
457
457
  parseTilePackets(context, data, position, length);
458
458
  break;
459
459
 
460
+ case 0xff53:
461
+ (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
462
+
460
463
  case 0xff55:
461
464
  case 0xff57:
462
465
  case 0xff58:
@@ -464,9 +467,6 @@ var JpxImage = function JpxImageClosure() {
464
467
  length = (0, _core_utils.readUint16)(data, position);
465
468
  break;
466
469
 
467
- case 0xff53:
468
- throw new Error("Codestream code 0xFF53 (COC) is not implemented");
469
-
470
470
  default:
471
471
  throw new Error("Unknown codestream code: " + code.toString(16));
472
472
  }
@@ -477,7 +477,7 @@ var JpxImage = function JpxImageClosure() {
477
477
  if (doNotRecover || this.failOnCorruptedImage) {
478
478
  throw new JpxError(e.message);
479
479
  } else {
480
- (0, _util.warn)("JPX: Trying to recover from: " + e.message);
480
+ (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
481
481
  }
482
482
  }
483
483
 
@@ -56,7 +56,7 @@ class MurmurHash3_64 {
56
56
  }
57
57
  }
58
58
  } else if ((0, _util.isArrayBuffer)(input)) {
59
- data = input;
59
+ data = input.slice();
60
60
  length = data.byteLength;
61
61
  } else {
62
62
  throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
package/lib/core/obj.js CHANGED
@@ -24,16 +24,16 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;
27
+ exports.XRef = exports.ObjectLoader = exports.FileSpec = exports.Catalog = void 0;
28
28
 
29
29
  var _util = require("../shared/util.js");
30
30
 
31
31
  var _primitives = require("./primitives.js");
32
32
 
33
- var _parser = require("./parser.js");
34
-
35
33
  var _core_utils = require("./core_utils.js");
36
34
 
35
+ var _parser = require("./parser.js");
36
+
37
37
  var _crypto = require("./crypto.js");
38
38
 
39
39
  var _colorspace = require("./colorspace.js");
@@ -58,6 +58,7 @@ class Catalog {
58
58
  this.builtInCMapCache = new Map();
59
59
  this.globalImageCache = new _image_utils.GlobalImageCache();
60
60
  this.pageKidsCountCache = new _primitives.RefSetCache();
61
+ this.nonBlendModesSet = new _primitives.RefSet();
61
62
  }
62
63
 
63
64
  get version() {
@@ -141,6 +142,52 @@ class Catalog {
141
142
  return (0, _util.shadow)(this, "metadata", metadata);
142
143
  }
143
144
 
145
+ get markInfo() {
146
+ let markInfo = null;
147
+
148
+ try {
149
+ markInfo = this._readMarkInfo();
150
+ } catch (ex) {
151
+ if (ex instanceof _core_utils.MissingDataException) {
152
+ throw ex;
153
+ }
154
+
155
+ (0, _util.warn)("Unable to read mark info.");
156
+ }
157
+
158
+ return (0, _util.shadow)(this, "markInfo", markInfo);
159
+ }
160
+
161
+ _readMarkInfo() {
162
+ const obj = this._catDict.get("MarkInfo");
163
+
164
+ if (!(0, _primitives.isDict)(obj)) {
165
+ return null;
166
+ }
167
+
168
+ const markInfo = Object.assign(Object.create(null), {
169
+ Marked: false,
170
+ UserProperties: false,
171
+ Suspects: false
172
+ });
173
+
174
+ for (const key in markInfo) {
175
+ if (!obj.has(key)) {
176
+ continue;
177
+ }
178
+
179
+ const value = obj.get(key);
180
+
181
+ if (!(0, _util.isBool)(value)) {
182
+ continue;
183
+ }
184
+
185
+ markInfo[key] = value;
186
+ }
187
+
188
+ return markInfo;
189
+ }
190
+
144
191
  get toplevelPagesDict() {
145
192
  const pagesObj = this._catDict.get("Pages");
146
193
 
@@ -843,7 +890,7 @@ class Catalog {
843
890
  get openAction() {
844
891
  const obj = this._catDict.get("OpenAction");
845
892
 
846
- let openAction = null;
893
+ const openAction = Object.create(null);
847
894
 
848
895
  if ((0, _primitives.isDict)(obj)) {
849
896
  const destDict = new _primitives.Dict(this.xref);
@@ -859,27 +906,15 @@ class Catalog {
859
906
  });
860
907
 
861
908
  if (Array.isArray(resultObj.dest)) {
862
- if (!openAction) {
863
- openAction = Object.create(null);
864
- }
865
-
866
909
  openAction.dest = resultObj.dest;
867
910
  } else if (resultObj.action) {
868
- if (!openAction) {
869
- openAction = Object.create(null);
870
- }
871
-
872
911
  openAction.action = resultObj.action;
873
912
  }
874
913
  } else if (Array.isArray(obj)) {
875
- if (!openAction) {
876
- openAction = Object.create(null);
877
- }
878
-
879
914
  openAction.dest = obj;
880
915
  }
881
916
 
882
- return (0, _util.shadow)(this, "openAction", openAction);
917
+ return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
883
918
  }
884
919
 
885
920
  get attachments() {
@@ -905,12 +940,12 @@ class Catalog {
905
940
  return (0, _util.shadow)(this, "attachments", attachments);
906
941
  }
907
942
 
908
- get javaScript() {
943
+ _collectJavaScript() {
909
944
  const obj = this._catDict.get("Names");
910
945
 
911
946
  let javaScript = null;
912
947
 
913
- function appendIfJavaScriptDict(jsDict) {
948
+ function appendIfJavaScriptDict(name, jsDict) {
914
949
  const type = jsDict.get("S");
915
950
 
916
951
  if (!(0, _primitives.isName)(type, "JavaScript")) {
@@ -925,11 +960,11 @@ class Catalog {
925
960
  return;
926
961
  }
927
962
 
928
- if (!javaScript) {
929
- javaScript = [];
963
+ if (javaScript === null) {
964
+ javaScript = Object.create(null);
930
965
  }
931
966
 
932
- javaScript.push((0, _util.stringToPDFString)(js));
967
+ javaScript[name] = (0, _util.stringToPDFString)(js);
933
968
  }
934
969
 
935
970
  if (obj && obj.has("JavaScript")) {
@@ -940,7 +975,7 @@ class Catalog {
940
975
  const jsDict = names[name];
941
976
 
942
977
  if ((0, _primitives.isDict)(jsDict)) {
943
- appendIfJavaScriptDict(jsDict);
978
+ appendIfJavaScriptDict(name, jsDict);
944
979
  }
945
980
  }
946
981
  }
@@ -948,10 +983,38 @@ class Catalog {
948
983
  const openAction = this._catDict.get("OpenAction");
949
984
 
950
985
  if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
951
- appendIfJavaScriptDict(openAction);
986
+ appendIfJavaScriptDict("OpenAction", openAction);
952
987
  }
953
988
 
954
- return (0, _util.shadow)(this, "javaScript", javaScript);
989
+ return javaScript;
990
+ }
991
+
992
+ get javaScript() {
993
+ const javaScript = this._collectJavaScript();
994
+
995
+ return (0, _util.shadow)(this, "javaScript", javaScript ? Object.values(javaScript) : null);
996
+ }
997
+
998
+ get jsActions() {
999
+ const js = this._collectJavaScript();
1000
+
1001
+ let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
1002
+
1003
+ if (!actions && js) {
1004
+ actions = Object.create(null);
1005
+ }
1006
+
1007
+ if (actions && js) {
1008
+ for (const [key, val] of Object.entries(js)) {
1009
+ if (key in actions) {
1010
+ actions[key].push(val);
1011
+ } else {
1012
+ actions[key] = [val];
1013
+ }
1014
+ }
1015
+ }
1016
+
1017
+ return (0, _util.shadow)(this, "jsActions", actions);
955
1018
  }
956
1019
 
957
1020
  fontFallback(id, handler) {
@@ -973,6 +1036,7 @@ class Catalog {
973
1036
  (0, _primitives.clearPrimitiveCaches)();
974
1037
  this.globalImageCache.clear(manuallyTriggered);
975
1038
  this.pageKidsCountCache.clear();
1039
+ this.nonBlendModesSet.clear();
976
1040
  const promises = [];
977
1041
  this.fontCache.forEach(function (promise) {
978
1042
  promises.push(promise);
@@ -981,7 +1045,7 @@ class Catalog {
981
1045
  for (const {
982
1046
  dict
983
1047
  } of translatedFonts) {
984
- delete dict.translated;
1048
+ delete dict.cacheKey;
985
1049
  }
986
1050
 
987
1051
  this.fontCache.clear();
@@ -1210,8 +1274,20 @@ class Catalog {
1210
1274
  url,
1211
1275
  dest;
1212
1276
 
1213
- if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) {
1214
- action = destDict.get("Dest");
1277
+ if (!(0, _primitives.isDict)(action)) {
1278
+ if (destDict.has("Dest")) {
1279
+ action = destDict.get("Dest");
1280
+ } else {
1281
+ action = destDict.get("AA");
1282
+
1283
+ if ((0, _primitives.isDict)(action)) {
1284
+ if (action.has("D")) {
1285
+ action = action.get("D");
1286
+ } else if (action.has("U")) {
1287
+ action = action.get("U");
1288
+ }
1289
+ }
1290
+ }
1215
1291
  }
1216
1292
 
1217
1293
  if ((0, _primitives.isDict)(action)) {
@@ -1772,16 +1848,14 @@ var XRef = function XRefClosure() {
1772
1848
  }
1773
1849
  }
1774
1850
 
1775
- var i, ii;
1776
-
1777
- for (i = 0, ii = xrefStms.length; i < ii; ++i) {
1851
+ for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
1778
1852
  this.startXRefQueue.push(xrefStms[i]);
1779
1853
  this.readXRef(true);
1780
1854
  }
1781
1855
 
1782
1856
  let trailerDict;
1783
1857
 
1784
- for (i = 0, ii = trailers.length; i < ii; ++i) {
1858
+ for (let i = 0, ii = trailers.length; i < ii; ++i) {
1785
1859
  stream.pos = trailers[i];
1786
1860
  const parser = new _parser.Parser({
1787
1861
  lexer: new _parser.Lexer(stream),
@@ -1801,10 +1875,24 @@ var XRef = function XRefClosure() {
1801
1875
  continue;
1802
1876
  }
1803
1877
 
1804
- let rootDict;
1805
-
1806
1878
  try {
1807
- rootDict = dict.get("Root");
1879
+ const rootDict = dict.get("Root");
1880
+
1881
+ if (!(rootDict instanceof _primitives.Dict)) {
1882
+ continue;
1883
+ }
1884
+
1885
+ const pagesDict = rootDict.get("Pages");
1886
+
1887
+ if (!(pagesDict instanceof _primitives.Dict)) {
1888
+ continue;
1889
+ }
1890
+
1891
+ const pagesCount = pagesDict.get("Count");
1892
+
1893
+ if (!Number.isInteger(pagesCount)) {
1894
+ continue;
1895
+ }
1808
1896
  } catch (ex) {
1809
1897
  if (ex instanceof _core_utils.MissingDataException) {
1810
1898
  throw ex;
@@ -1813,10 +1901,6 @@ var XRef = function XRefClosure() {
1813
1901
  continue;
1814
1902
  }
1815
1903
 
1816
- if (!(0, _primitives.isDict)(rootDict) || !rootDict.has("Pages")) {
1817
- continue;
1818
- }
1819
-
1820
1904
  if (dict.has("ID")) {
1821
1905
  return dict;
1822
1906
  }
@@ -173,7 +173,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
173
173
  fn(ratio, 0, color, 0);
174
174
  rgbColor = cs.getRgb(color, 0);
175
175
 
176
- var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
176
+ var cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
177
177
 
178
178
  colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
179
179
  }
@@ -182,7 +182,7 @@ Shadings.RadialAxial = function RadialAxialClosure() {
182
182
 
183
183
  if (dict.has("Background")) {
184
184
  rgbColor = cs.getRgb(dict.get("Background"), 0);
185
- background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
185
+ background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
186
186
  }
187
187
 
188
188
  if (!extendStart) {
@@ -949,7 +949,7 @@ Shadings.Dummy = function DummyClosure() {
949
949
  return Dummy;
950
950
  }();
951
951
 
952
- function getTilingPatternIR(operatorList, dict, args) {
952
+ function getTilingPatternIR(operatorList, dict, color) {
953
953
  const matrix = dict.getArray("Matrix");
954
954
 
955
955
  const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
@@ -963,5 +963,5 @@ function getTilingPatternIR(operatorList, dict, args) {
963
963
  throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
964
964
  }
965
965
 
966
- return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
966
+ return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
967
967
  }
@@ -25,14 +25,14 @@ Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
27
  exports.clearPrimitiveCaches = clearPrimitiveCaches;
28
- exports.isEOF = isEOF;
29
28
  exports.isCmd = isCmd;
30
29
  exports.isDict = isDict;
30
+ exports.isEOF = isEOF;
31
31
  exports.isName = isName;
32
32
  exports.isRef = isRef;
33
33
  exports.isRefsEqual = isRefsEqual;
34
34
  exports.isStream = isStream;
35
- exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;
35
+ exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
36
36
 
37
37
  var _util = require("../shared/util.js");
38
38
 
@@ -184,7 +184,16 @@ var Dict = function DictClosure() {
184
184
  }
185
185
  }
186
186
  };
187
- Dict.empty = new Dict(null);
187
+
188
+ Dict.empty = function () {
189
+ const emptyDict = new Dict(null);
190
+
191
+ emptyDict.set = (key, value) => {
192
+ (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
193
+ };
194
+
195
+ return emptyDict;
196
+ }();
188
197
 
189
198
  Dict.merge = function ({
190
199
  xref,
@@ -296,8 +305,8 @@ var Ref = function RefClosure() {
296
305
  exports.Ref = Ref;
297
306
 
298
307
  class RefSet {
299
- constructor() {
300
- this._set = new Set();
308
+ constructor(parent = null) {
309
+ this._set = new Set(parent && parent._set);
301
310
  }
302
311
 
303
312
  has(ref) {
@@ -312,6 +321,16 @@ class RefSet {
312
321
  this._set.delete(ref.toString());
313
322
  }
314
323
 
324
+ forEach(callback) {
325
+ for (const ref of this._set.values()) {
326
+ callback(ref);
327
+ }
328
+ }
329
+
330
+ clear() {
331
+ this._set.clear();
332
+ }
333
+
315
334
  }
316
335
 
317
336
  exports.RefSet = RefSet;
@@ -24,7 +24,7 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0;
27
+ exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = void 0;
28
28
 
29
29
  var _core_utils = require("./core_utils.js");
30
30
 
@@ -24,7 +24,7 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
27
+ exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.LZWStream = exports.FlateStream = exports.DecryptStream = exports.DecodeStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
28
28
 
29
29
  var _util = require("../shared/util.js");
30
30
 
@@ -177,6 +177,10 @@ var DecodeStream = function DecodeStreamClosure() {
177
177
  }
178
178
 
179
179
  DecodeStream.prototype = {
180
+ get length() {
181
+ (0, _util.unreachable)("Should not access DecodeStream.length");
182
+ },
183
+
180
184
  get isEmpty() {
181
185
  while (!this.eof && this.bufferLength === 0) {
182
186
  this.readBlock();