pdfjs-dist 2.3.200 → 2.4.456

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 (185) hide show
  1. package/README.md +4 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +6499 -17971
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +22 -1
  6. package/build/pdf.worker.entry.js +5 -3
  7. package/build/pdf.worker.js +19303 -29896
  8. package/build/pdf.worker.js.map +1 -1
  9. package/build/pdf.worker.min.js +22 -1
  10. package/es5/build/pdf.js +25473 -0
  11. package/es5/build/pdf.js.map +1 -0
  12. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  13. package/es5/build/pdf.worker.js +57878 -0
  14. package/es5/build/pdf.worker.js.map +1 -0
  15. package/es5/web/images/annotation-check.svg +11 -0
  16. package/es5/web/images/annotation-comment.svg +16 -0
  17. package/es5/web/images/annotation-help.svg +26 -0
  18. package/es5/web/images/annotation-insert.svg +10 -0
  19. package/es5/web/images/annotation-key.svg +11 -0
  20. package/es5/web/images/annotation-newparagraph.svg +11 -0
  21. package/es5/web/images/annotation-noicon.svg +7 -0
  22. package/es5/web/images/annotation-note.svg +42 -0
  23. package/es5/web/images/annotation-paragraph.svg +16 -0
  24. package/es5/web/images/loading-icon.gif +0 -0
  25. package/es5/web/images/shadow.png +0 -0
  26. package/es5/web/images/texture.png +0 -0
  27. package/es5/web/pdf_viewer.css +407 -0
  28. package/es5/web/pdf_viewer.js +7757 -0
  29. package/es5/web/pdf_viewer.js.map +1 -0
  30. package/image_decoders/pdf.image_decoders.js +1333 -4839
  31. package/image_decoders/pdf.image_decoders.js.map +1 -1
  32. package/image_decoders/pdf.image_decoders.min.js +22 -1
  33. package/lib/README.md +7 -0
  34. package/lib/core/annotation.js +683 -1066
  35. package/lib/core/arithmetic_decoder.js +81 -97
  36. package/lib/core/bidi.js +54 -46
  37. package/lib/core/ccitt.js +88 -81
  38. package/lib/core/ccitt_stream.js +15 -14
  39. package/lib/core/cff_parser.js +196 -193
  40. package/lib/core/charsets.js +4 -4
  41. package/lib/core/chunked_stream.js +441 -569
  42. package/lib/core/cmap.js +220 -279
  43. package/lib/core/colorspace.js +699 -863
  44. package/lib/core/core_utils.js +59 -80
  45. package/lib/core/crypto.js +379 -437
  46. package/lib/core/document.js +564 -673
  47. package/lib/core/encodings.js +15 -15
  48. package/lib/core/evaluator.js +983 -889
  49. package/lib/core/font_renderer.js +128 -171
  50. package/lib/core/fonts.js +451 -400
  51. package/lib/core/function.js +289 -285
  52. package/lib/core/glyphlist.js +4527 -4527
  53. package/lib/core/image.js +138 -117
  54. package/lib/core/image_utils.js +46 -63
  55. package/lib/core/jbig2.js +324 -332
  56. package/lib/core/jbig2_stream.js +18 -17
  57. package/lib/core/jpeg_stream.js +133 -24
  58. package/lib/core/jpg.js +238 -210
  59. package/lib/core/jpx.js +158 -157
  60. package/lib/core/jpx_stream.js +28 -28
  61. package/lib/core/metrics.js +2928 -2928
  62. package/lib/core/murmurhash3.js +87 -102
  63. package/lib/core/obj.js +1111 -1302
  64. package/lib/core/operator_list.js +55 -42
  65. package/lib/core/parser.js +956 -987
  66. package/lib/core/pattern.js +69 -69
  67. package/lib/core/pdf_manager.js +149 -316
  68. package/lib/core/primitives.js +45 -77
  69. package/lib/core/ps_parser.js +175 -214
  70. package/lib/core/standard_fonts.js +237 -236
  71. package/lib/core/stream.js +83 -77
  72. package/lib/core/type1_parser.js +78 -68
  73. package/lib/core/unicode.js +1654 -1654
  74. package/lib/core/worker.js +148 -196
  75. package/lib/core/worker_stream.js +101 -210
  76. package/lib/display/annotation_layer.js +733 -1155
  77. package/lib/display/api.js +1539 -1928
  78. package/lib/display/api_compatibility.js +10 -8
  79. package/lib/display/canvas.js +159 -158
  80. package/lib/display/content_disposition.js +36 -55
  81. package/lib/display/display_utils.js +298 -551
  82. package/lib/display/fetch_stream.js +181 -305
  83. package/lib/display/font_loader.js +273 -416
  84. package/lib/display/metadata.js +86 -98
  85. package/lib/display/network.js +376 -511
  86. package/lib/display/network_utils.js +20 -19
  87. package/lib/display/node_stream.js +276 -460
  88. package/lib/display/pattern_helper.js +76 -44
  89. package/lib/display/svg.js +1137 -1405
  90. package/lib/display/text_layer.js +75 -82
  91. package/lib/display/transport_stream.js +236 -374
  92. package/lib/display/webgl.js +70 -83
  93. package/lib/display/worker_options.js +3 -3
  94. package/lib/display/xml_parser.js +303 -392
  95. package/lib/examples/node/domstubs.js +37 -37
  96. package/lib/pdf.js +22 -21
  97. package/lib/pdf.worker.js +5 -5
  98. package/lib/shared/compatibility.js +2 -251
  99. package/lib/shared/is_node.js +7 -6
  100. package/lib/shared/message_handler.js +222 -194
  101. package/lib/shared/util.js +269 -405
  102. package/lib/test/unit/annotation_spec.js +1089 -1014
  103. package/lib/test/unit/api_spec.js +617 -544
  104. package/lib/test/unit/bidi_spec.js +7 -7
  105. package/lib/test/unit/cff_parser_spec.js +63 -62
  106. package/lib/test/unit/clitests_helper.js +7 -9
  107. package/lib/test/unit/cmap_spec.js +84 -86
  108. package/lib/test/unit/colorspace_spec.js +154 -154
  109. package/lib/test/unit/core_utils_spec.js +125 -105
  110. package/lib/test/unit/crypto_spec.js +181 -181
  111. package/lib/test/unit/custom_spec.js +22 -24
  112. package/lib/test/unit/display_svg_spec.js +35 -36
  113. package/lib/test/unit/display_utils_spec.js +139 -149
  114. package/lib/test/unit/document_spec.js +16 -16
  115. package/lib/test/unit/encodings_spec.js +12 -34
  116. package/lib/test/unit/evaluator_spec.js +81 -95
  117. package/lib/test/unit/fetch_stream_spec.js +30 -30
  118. package/lib/test/unit/function_spec.js +206 -204
  119. package/lib/test/unit/jasmine-boot.js +48 -32
  120. package/lib/test/unit/message_handler_spec.js +172 -162
  121. package/lib/test/unit/metadata_spec.js +69 -69
  122. package/lib/test/unit/murmurhash3_spec.js +12 -12
  123. package/lib/test/unit/network_spec.js +12 -12
  124. package/lib/test/unit/network_utils_spec.js +152 -152
  125. package/lib/test/unit/node_stream_spec.js +74 -90
  126. package/lib/test/unit/parser_spec.js +107 -113
  127. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  128. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  129. package/lib/test/unit/pdf_history_spec.js +32 -32
  130. package/lib/test/unit/primitives_spec.js +117 -115
  131. package/lib/test/unit/stream_spec.js +16 -14
  132. package/lib/test/unit/test_utils.js +119 -285
  133. package/lib/test/unit/testreporter.js +19 -19
  134. package/lib/test/unit/type1_parser_spec.js +41 -41
  135. package/lib/test/unit/ui_utils_spec.js +318 -426
  136. package/lib/test/unit/unicode_spec.js +42 -42
  137. package/lib/test/unit/util_spec.js +122 -143
  138. package/lib/web/annotation_layer_builder.js +66 -103
  139. package/lib/web/app.js +1166 -1196
  140. package/lib/web/app_options.js +61 -77
  141. package/lib/web/base_viewer.js +804 -850
  142. package/lib/web/chromecom.js +164 -249
  143. package/lib/web/debugger.js +149 -205
  144. package/lib/web/download_manager.js +38 -57
  145. package/lib/web/firefox_print_service.js +35 -30
  146. package/lib/web/firefoxcom.js +175 -374
  147. package/lib/web/genericcom.js +26 -108
  148. package/lib/web/genericl10n.js +24 -153
  149. package/lib/web/grab_to_pan.js +30 -30
  150. package/lib/web/interfaces.js +80 -258
  151. package/lib/web/overlay_manager.js +70 -246
  152. package/lib/web/password_prompt.js +38 -64
  153. package/lib/web/pdf_attachment_viewer.js +105 -130
  154. package/lib/web/pdf_cursor_tools.js +75 -102
  155. package/lib/web/pdf_document_properties.js +227 -376
  156. package/lib/web/pdf_find_bar.js +137 -171
  157. package/lib/web/pdf_find_controller.js +492 -549
  158. package/lib/web/pdf_find_utils.js +13 -13
  159. package/lib/web/pdf_history.js +395 -406
  160. package/lib/web/pdf_link_service.js +302 -349
  161. package/lib/web/pdf_outline_viewer.js +148 -209
  162. package/lib/web/pdf_page_view.js +449 -507
  163. package/lib/web/pdf_presentation_mode.js +304 -357
  164. package/lib/web/pdf_print_service.js +90 -104
  165. package/lib/web/pdf_rendering_queue.js +87 -108
  166. package/lib/web/pdf_sidebar.js +264 -304
  167. package/lib/web/pdf_sidebar_resizer.js +92 -119
  168. package/lib/web/pdf_single_page_viewer.js +77 -126
  169. package/lib/web/pdf_thumbnail_view.js +276 -297
  170. package/lib/web/pdf_thumbnail_viewer.js +186 -206
  171. package/lib/web/pdf_viewer.component.js +20 -21
  172. package/lib/web/pdf_viewer.js +55 -115
  173. package/lib/web/preferences.js +66 -273
  174. package/lib/web/secondary_toolbar.js +164 -196
  175. package/lib/web/text_layer_builder.js +284 -317
  176. package/lib/web/toolbar.js +216 -211
  177. package/lib/web/ui_utils.js +303 -404
  178. package/lib/web/view_history.js +49 -222
  179. package/lib/web/viewer_compatibility.js +7 -5
  180. package/package.json +2 -9
  181. package/web/pdf_viewer.css +25 -18
  182. package/web/pdf_viewer.js +3481 -4764
  183. package/web/pdf_viewer.js.map +1 -1
  184. package/webpack.js +14 -5
  185. package/lib/shared/streams_polyfill.js +0 -43
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2019 Mozilla Foundation
5
+ * Copyright 2020 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -21,26 +21,26 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
- var _primitives = require("../../core/primitives");
24
+ var _primitives = require("../../core/primitives.js");
25
25
 
26
- var _stream = require("../../core/stream");
26
+ var _stream = require("../../core/stream.js");
27
27
 
28
- var _colorspace = require("../../core/colorspace");
28
+ var _colorspace = require("../../core/colorspace.js");
29
29
 
30
- var _function = require("../../core/function");
30
+ var _function = require("../../core/function.js");
31
31
 
32
- var _test_utils = require("./test_utils");
32
+ var _test_utils = require("./test_utils.js");
33
33
 
34
- describe('colorspace', function () {
35
- describe('ColorSpace', function () {
36
- it('should be true if decode is not an array', function () {
37
- expect(_colorspace.ColorSpace.isDefaultDecode('string', 0)).toBeTruthy();
34
+ describe("colorspace", function () {
35
+ describe("ColorSpace", function () {
36
+ it("should be true if decode is not an array", function () {
37
+ expect(_colorspace.ColorSpace.isDefaultDecode("string", 0)).toBeTruthy();
38
38
  });
39
- it('should be true if length of decode array is not correct', function () {
39
+ it("should be true if length of decode array is not correct", function () {
40
40
  expect(_colorspace.ColorSpace.isDefaultDecode([0], 1)).toBeTruthy();
41
41
  expect(_colorspace.ColorSpace.isDefaultDecode([0, 1, 0], 1)).toBeTruthy();
42
42
  });
43
- it('should be true if decode map matches the default decode map', function () {
43
+ it("should be true if decode map matches the default decode map", function () {
44
44
  expect(_colorspace.ColorSpace.isDefaultDecode([], 0)).toBeTruthy();
45
45
  expect(_colorspace.ColorSpace.isDefaultDecode([0, 0], 1)).toBeFalsy();
46
46
  expect(_colorspace.ColorSpace.isDefaultDecode([0, 1], 1)).toBeTruthy();
@@ -50,47 +50,47 @@ describe('colorspace', function () {
50
50
  expect(_colorspace.ColorSpace.isDefaultDecode([1, 0, 0, 1, 0, 1, 0, 1], 4)).toBeFalsy();
51
51
  });
52
52
  });
53
- describe('DeviceGrayCS', function () {
54
- it('should handle the case when cs is a Name object', function () {
55
- var cs = _primitives.Name.get('DeviceGray');
53
+ describe("DeviceGrayCS", function () {
54
+ it("should handle the case when cs is a Name object", function () {
55
+ const cs = _primitives.Name.get("DeviceGray");
56
56
 
57
- var xref = new _test_utils.XRefMock([{
57
+ const xref = new _test_utils.XRefMock([{
58
58
  ref: _primitives.Ref.get(10, 0),
59
59
  data: new _primitives.Dict()
60
60
  }]);
61
- var res = new _primitives.Dict();
62
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
63
- xref: xref
61
+ const res = new _primitives.Dict();
62
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
63
+ xref
64
64
  });
65
65
 
66
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
66
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
67
67
 
68
- var testSrc = new Uint8Array([27, 125, 250, 131]);
69
- var testDest = new Uint8ClampedArray(4 * 4 * 3);
70
- var expectedDest = new Uint8ClampedArray([27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131]);
68
+ const testSrc = new Uint8Array([27, 125, 250, 131]);
69
+ const testDest = new Uint8ClampedArray(4 * 4 * 3);
70
+ const expectedDest = new Uint8ClampedArray([27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131, 250, 250, 250, 250, 250, 250, 131, 131, 131, 131, 131, 131]);
71
71
  colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
72
72
  expect(colorSpace.getRgb(new Float32Array([0.1]), 0)).toEqual(new Uint8ClampedArray([26, 26, 26]));
73
73
  expect(colorSpace.getOutputLength(2, 0)).toEqual(6);
74
74
  expect(colorSpace.isPassthrough(8)).toBeFalsy();
75
75
  expect(testDest).toEqual(expectedDest);
76
76
  });
77
- it('should handle the case when cs is an indirect object', function () {
78
- var cs = _primitives.Ref.get(10, 0);
77
+ it("should handle the case when cs is an indirect object", function () {
78
+ const cs = _primitives.Ref.get(10, 0);
79
79
 
80
- var xref = new _test_utils.XRefMock([{
80
+ const xref = new _test_utils.XRefMock([{
81
81
  ref: cs,
82
- data: _primitives.Name.get('DeviceGray')
82
+ data: _primitives.Name.get("DeviceGray")
83
83
  }]);
84
- var res = new _primitives.Dict();
85
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
86
- xref: xref
84
+ const res = new _primitives.Dict();
85
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
86
+ xref
87
87
  });
88
88
 
89
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
89
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
90
90
 
91
- var testSrc = new Uint8Array([27, 125, 250, 131]);
92
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
93
- var expectedDest = new Uint8ClampedArray([27, 27, 27, 27, 27, 27, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131]);
91
+ const testSrc = new Uint8Array([27, 125, 250, 131]);
92
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
93
+ const expectedDest = new Uint8ClampedArray([27, 27, 27, 27, 27, 27, 125, 125, 125, 27, 27, 27, 27, 27, 27, 125, 125, 125, 250, 250, 250, 250, 250, 250, 131, 131, 131]);
94
94
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
95
95
  expect(colorSpace.getRgb(new Float32Array([0.2]), 0)).toEqual(new Uint8ClampedArray([51, 51, 51]));
96
96
  expect(colorSpace.getOutputLength(3, 1)).toEqual(12);
@@ -98,47 +98,47 @@ describe('colorspace', function () {
98
98
  expect(testDest).toEqual(expectedDest);
99
99
  });
100
100
  });
101
- describe('DeviceRgbCS', function () {
102
- it('should handle the case when cs is a Name object', function () {
103
- var cs = _primitives.Name.get('DeviceRGB');
101
+ describe("DeviceRgbCS", function () {
102
+ it("should handle the case when cs is a Name object", function () {
103
+ const cs = _primitives.Name.get("DeviceRGB");
104
104
 
105
- var xref = new _test_utils.XRefMock([{
105
+ const xref = new _test_utils.XRefMock([{
106
106
  ref: _primitives.Ref.get(10, 0),
107
107
  data: new _primitives.Dict()
108
108
  }]);
109
- var res = new _primitives.Dict();
110
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
111
- xref: xref
109
+ const res = new _primitives.Dict();
110
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
111
+ xref
112
112
  });
113
113
 
114
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
114
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
115
115
 
116
- var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
117
- var testDest = new Uint8ClampedArray(4 * 4 * 3);
118
- var expectedDest = new Uint8ClampedArray([27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255]);
116
+ const testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
117
+ const testDest = new Uint8ClampedArray(4 * 4 * 3);
118
+ const expectedDest = new Uint8ClampedArray([27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255, 111, 25, 198, 111, 25, 198, 21, 147, 255, 21, 147, 255]);
119
119
  colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
120
120
  expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8ClampedArray([26, 51, 77]));
121
121
  expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
122
122
  expect(colorSpace.isPassthrough(8)).toBeTruthy();
123
123
  expect(testDest).toEqual(expectedDest);
124
124
  });
125
- it('should handle the case when cs is an indirect object', function () {
126
- var cs = _primitives.Ref.get(10, 0);
125
+ it("should handle the case when cs is an indirect object", function () {
126
+ const cs = _primitives.Ref.get(10, 0);
127
127
 
128
- var xref = new _test_utils.XRefMock([{
128
+ const xref = new _test_utils.XRefMock([{
129
129
  ref: cs,
130
- data: _primitives.Name.get('DeviceRGB')
130
+ data: _primitives.Name.get("DeviceRGB")
131
131
  }]);
132
- var res = new _primitives.Dict();
133
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
134
- xref: xref
132
+ const res = new _primitives.Dict();
133
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
134
+ xref
135
135
  });
136
136
 
137
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
137
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
138
138
 
139
- var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
140
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
141
- var expectedDest = new Uint8ClampedArray([27, 125, 250, 27, 125, 250, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255]);
139
+ const testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
140
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
141
+ const expectedDest = new Uint8ClampedArray([27, 125, 250, 27, 125, 250, 131, 139, 140, 27, 125, 250, 27, 125, 250, 131, 139, 140, 111, 25, 198, 111, 25, 198, 21, 147, 255]);
142
142
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
143
143
  expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8ClampedArray([26, 51, 77]));
144
144
  expect(colorSpace.getOutputLength(4, 1)).toEqual(5);
@@ -146,47 +146,47 @@ describe('colorspace', function () {
146
146
  expect(testDest).toEqual(expectedDest);
147
147
  });
148
148
  });
149
- describe('DeviceCmykCS', function () {
150
- it('should handle the case when cs is a Name object', function () {
151
- var cs = _primitives.Name.get('DeviceCMYK');
149
+ describe("DeviceCmykCS", function () {
150
+ it("should handle the case when cs is a Name object", function () {
151
+ const cs = _primitives.Name.get("DeviceCMYK");
152
152
 
153
- var xref = new _test_utils.XRefMock([{
153
+ const xref = new _test_utils.XRefMock([{
154
154
  ref: _primitives.Ref.get(10, 0),
155
155
  data: new _primitives.Dict()
156
156
  }]);
157
- var res = new _primitives.Dict();
158
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
159
- xref: xref
157
+ const res = new _primitives.Dict();
158
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
159
+ xref
160
160
  });
161
161
 
162
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
162
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
163
163
 
164
- var testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
165
- var testDest = new Uint8ClampedArray(4 * 4 * 3);
166
- var expectedDest = new Uint8ClampedArray([135, 81, 18, 135, 81, 18, 114, 102, 97, 114, 102, 97, 135, 81, 18, 135, 81, 18, 114, 102, 97, 114, 102, 97, 112, 144, 75, 112, 144, 75, 188, 98, 27, 188, 98, 27, 112, 144, 75, 112, 144, 75, 188, 98, 27, 188, 98, 27]);
164
+ const testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
165
+ const testDest = new Uint8ClampedArray(4 * 4 * 3);
166
+ const expectedDest = new Uint8ClampedArray([135, 81, 18, 135, 81, 18, 114, 102, 97, 114, 102, 97, 135, 81, 18, 135, 81, 18, 114, 102, 97, 114, 102, 97, 112, 144, 75, 112, 144, 75, 188, 98, 27, 188, 98, 27, 112, 144, 75, 112, 144, 75, 188, 98, 27, 188, 98, 27]);
167
167
  colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
168
168
  expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3, 1]), 0)).toEqual(new Uint8ClampedArray([32, 28, 21]));
169
169
  expect(colorSpace.getOutputLength(4, 0)).toEqual(3);
170
170
  expect(colorSpace.isPassthrough(8)).toBeFalsy();
171
171
  expect(testDest).toEqual(expectedDest);
172
172
  });
173
- it('should handle the case when cs is an indirect object', function () {
174
- var cs = _primitives.Ref.get(10, 0);
173
+ it("should handle the case when cs is an indirect object", function () {
174
+ const cs = _primitives.Ref.get(10, 0);
175
175
 
176
- var xref = new _test_utils.XRefMock([{
176
+ const xref = new _test_utils.XRefMock([{
177
177
  ref: cs,
178
- data: _primitives.Name.get('DeviceCMYK')
178
+ data: _primitives.Name.get("DeviceCMYK")
179
179
  }]);
180
- var res = new _primitives.Dict();
181
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
182
- xref: xref
180
+ const res = new _primitives.Dict();
181
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
182
+ xref
183
183
  });
184
184
 
185
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
185
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
186
186
 
187
- var testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
188
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
189
- var expectedDest = new Uint8ClampedArray([135, 81, 18, 135, 81, 18, 114, 102, 97, 135, 81, 18, 135, 81, 18, 114, 102, 97, 112, 144, 75, 112, 144, 75, 188, 98, 27]);
187
+ const testSrc = new Uint8Array([27, 125, 250, 128, 131, 139, 140, 45, 111, 25, 198, 78, 21, 147, 255, 69]);
188
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
189
+ const expectedDest = new Uint8ClampedArray([135, 81, 18, 135, 81, 18, 114, 102, 97, 135, 81, 18, 135, 81, 18, 114, 102, 97, 112, 144, 75, 112, 144, 75, 188, 98, 27]);
190
190
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
191
191
  expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3, 1]), 0)).toEqual(new Uint8ClampedArray([32, 28, 21]));
192
192
  expect(colorSpace.getOutputLength(4, 1)).toEqual(4);
@@ -194,27 +194,27 @@ describe('colorspace', function () {
194
194
  expect(testDest).toEqual(expectedDest);
195
195
  });
196
196
  });
197
- describe('CalGrayCS', function () {
198
- it('should handle the case when cs is an array', function () {
199
- var params = new _primitives.Dict();
200
- params.set('WhitePoint', [1, 1, 1]);
201
- params.set('BlackPoint', [0, 0, 0]);
202
- params.set('Gamma', 2.0);
203
- var cs = [_primitives.Name.get('CalGray'), params];
204
- var xref = new _test_utils.XRefMock([{
197
+ describe("CalGrayCS", function () {
198
+ it("should handle the case when cs is an array", function () {
199
+ const params = new _primitives.Dict();
200
+ params.set("WhitePoint", [1, 1, 1]);
201
+ params.set("BlackPoint", [0, 0, 0]);
202
+ params.set("Gamma", 2.0);
203
+ const cs = [_primitives.Name.get("CalGray"), params];
204
+ const xref = new _test_utils.XRefMock([{
205
205
  ref: _primitives.Ref.get(10, 0),
206
206
  data: new _primitives.Dict()
207
207
  }]);
208
- var res = new _primitives.Dict();
209
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
210
- xref: xref
208
+ const res = new _primitives.Dict();
209
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
210
+ xref
211
211
  });
212
212
 
213
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
213
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
214
214
 
215
- var testSrc = new Uint8Array([27, 125, 250, 131]);
216
- var testDest = new Uint8ClampedArray(4 * 4 * 3);
217
- var expectedDest = new Uint8ClampedArray([25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 251, 251, 251, 251, 251, 251, 149, 149, 149, 149, 149, 149, 251, 251, 251, 251, 251, 251, 149, 149, 149, 149, 149, 149]);
215
+ const testSrc = new Uint8Array([27, 125, 250, 131]);
216
+ const testDest = new Uint8ClampedArray(4 * 4 * 3);
217
+ const expectedDest = new Uint8ClampedArray([25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 25, 25, 25, 25, 25, 25, 143, 143, 143, 143, 143, 143, 251, 251, 251, 251, 251, 251, 149, 149, 149, 149, 149, 149, 251, 251, 251, 251, 251, 251, 149, 149, 149, 149, 149, 149]);
218
218
  colorSpace.fillRgb(testDest, 2, 2, 4, 4, 4, 8, testSrc, 0);
219
219
  expect(colorSpace.getRgb(new Float32Array([1.0]), 0)).toEqual(new Uint8ClampedArray([255, 255, 255]));
220
220
  expect(colorSpace.getOutputLength(4, 0)).toEqual(12);
@@ -222,28 +222,28 @@ describe('colorspace', function () {
222
222
  expect(testDest).toEqual(expectedDest);
223
223
  });
224
224
  });
225
- describe('CalRGBCS', function () {
226
- it('should handle the case when cs is an array', function () {
227
- var params = new _primitives.Dict();
228
- params.set('WhitePoint', [1, 1, 1]);
229
- params.set('BlackPoint', [0, 0, 0]);
230
- params.set('Gamma', [1, 1, 1]);
231
- params.set('Matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
232
- var cs = [_primitives.Name.get('CalRGB'), params];
233
- var xref = new _test_utils.XRefMock([{
225
+ describe("CalRGBCS", function () {
226
+ it("should handle the case when cs is an array", function () {
227
+ const params = new _primitives.Dict();
228
+ params.set("WhitePoint", [1, 1, 1]);
229
+ params.set("BlackPoint", [0, 0, 0]);
230
+ params.set("Gamma", [1, 1, 1]);
231
+ params.set("Matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
232
+ const cs = [_primitives.Name.get("CalRGB"), params];
233
+ const xref = new _test_utils.XRefMock([{
234
234
  ref: _primitives.Ref.get(10, 0),
235
235
  data: new _primitives.Dict()
236
236
  }]);
237
- var res = new _primitives.Dict();
238
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
239
- xref: xref
237
+ const res = new _primitives.Dict();
238
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
239
+ xref
240
240
  });
241
241
 
242
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
242
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
243
243
 
244
- var testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
245
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
246
- var expectedDest = new Uint8ClampedArray([0, 238, 255, 0, 238, 255, 185, 196, 195, 0, 238, 255, 0, 238, 255, 185, 196, 195, 235, 0, 243, 235, 0, 243, 0, 255, 255]);
244
+ const testSrc = new Uint8Array([27, 125, 250, 131, 139, 140, 111, 25, 198, 21, 147, 255]);
245
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
246
+ const expectedDest = new Uint8ClampedArray([0, 238, 255, 0, 238, 255, 185, 196, 195, 0, 238, 255, 0, 238, 255, 185, 196, 195, 235, 0, 243, 235, 0, 243, 0, 255, 255]);
247
247
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
248
248
  expect(colorSpace.getRgb(new Float32Array([0.1, 0.2, 0.3]), 0)).toEqual(new Uint8ClampedArray([0, 147, 151]));
249
249
  expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
@@ -251,27 +251,27 @@ describe('colorspace', function () {
251
251
  expect(testDest).toEqual(expectedDest);
252
252
  });
253
253
  });
254
- describe('LabCS', function () {
255
- it('should handle the case when cs is an array', function () {
256
- var params = new _primitives.Dict();
257
- params.set('WhitePoint', [1, 1, 1]);
258
- params.set('BlackPoint', [0, 0, 0]);
259
- params.set('Range', [-100, 100, -100, 100]);
260
- var cs = [_primitives.Name.get('Lab'), params];
261
- var xref = new _test_utils.XRefMock([{
254
+ describe("LabCS", function () {
255
+ it("should handle the case when cs is an array", function () {
256
+ const params = new _primitives.Dict();
257
+ params.set("WhitePoint", [1, 1, 1]);
258
+ params.set("BlackPoint", [0, 0, 0]);
259
+ params.set("Range", [-100, 100, -100, 100]);
260
+ const cs = [_primitives.Name.get("Lab"), params];
261
+ const xref = new _test_utils.XRefMock([{
262
262
  ref: _primitives.Ref.get(10, 0),
263
263
  data: new _primitives.Dict()
264
264
  }]);
265
- var res = new _primitives.Dict();
266
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
267
- xref: xref
265
+ const res = new _primitives.Dict();
266
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
267
+ xref
268
268
  });
269
269
 
270
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
270
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
271
271
 
272
- var testSrc = new Uint8Array([27, 25, 50, 31, 19, 40, 11, 25, 98, 21, 47, 55]);
273
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
274
- var expectedDest = new Uint8ClampedArray([0, 49, 101, 0, 49, 101, 0, 53, 117, 0, 49, 101, 0, 49, 101, 0, 53, 117, 0, 41, 40, 0, 41, 40, 0, 43, 90]);
272
+ const testSrc = new Uint8Array([27, 25, 50, 31, 19, 40, 11, 25, 98, 21, 47, 55]);
273
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
274
+ const expectedDest = new Uint8ClampedArray([0, 49, 101, 0, 49, 101, 0, 53, 117, 0, 49, 101, 0, 49, 101, 0, 53, 117, 0, 41, 40, 0, 41, 40, 0, 43, 90]);
275
275
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
276
276
  expect(colorSpace.getRgb([55, 25, 35], 0)).toEqual(new Uint8ClampedArray([188, 100, 61]));
277
277
  expect(colorSpace.getOutputLength(4, 0)).toEqual(4);
@@ -280,24 +280,24 @@ describe('colorspace', function () {
280
280
  expect(testDest).toEqual(expectedDest);
281
281
  });
282
282
  });
283
- describe('IndexedCS', function () {
284
- it('should handle the case when cs is an array', function () {
285
- var lookup = new Uint8Array([23, 155, 35, 147, 69, 93, 255, 109, 70]);
286
- var cs = [_primitives.Name.get('Indexed'), _primitives.Name.get('DeviceRGB'), 2, lookup];
287
- var xref = new _test_utils.XRefMock([{
283
+ describe("IndexedCS", function () {
284
+ it("should handle the case when cs is an array", function () {
285
+ const lookup = new Uint8Array([23, 155, 35, 147, 69, 93, 255, 109, 70]);
286
+ const cs = [_primitives.Name.get("Indexed"), _primitives.Name.get("DeviceRGB"), 2, lookup];
287
+ const xref = new _test_utils.XRefMock([{
288
288
  ref: _primitives.Ref.get(10, 0),
289
289
  data: new _primitives.Dict()
290
290
  }]);
291
- var res = new _primitives.Dict();
292
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
293
- xref: xref
291
+ const res = new _primitives.Dict();
292
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
293
+ xref
294
294
  });
295
295
 
296
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
296
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
297
297
 
298
- var testSrc = new Uint8Array([2, 2, 0, 1]);
299
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
300
- var expectedDest = new Uint8ClampedArray([255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 23, 155, 35, 23, 155, 35, 147, 69, 93]);
298
+ const testSrc = new Uint8Array([2, 2, 0, 1]);
299
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
300
+ const expectedDest = new Uint8ClampedArray([255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 255, 109, 70, 23, 155, 35, 23, 155, 35, 147, 69, 93]);
301
301
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
302
302
  expect(colorSpace.getRgb([2], 0)).toEqual(new Uint8ClampedArray([255, 109, 70]));
303
303
  expect(colorSpace.isPassthrough(8)).toBeFalsy();
@@ -305,33 +305,33 @@ describe('colorspace', function () {
305
305
  expect(testDest).toEqual(expectedDest);
306
306
  });
307
307
  });
308
- describe('AlternateCS', function () {
309
- it('should handle the case when cs is an array', function () {
310
- var fnDict = new _primitives.Dict();
311
- fnDict.set('FunctionType', 4);
312
- fnDict.set('Domain', [0.0, 1.0]);
313
- fnDict.set('Range', [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]);
314
- fnDict.set('Length', 58);
315
- var fn = new _stream.StringStream('{ dup 0.84 mul ' + 'exch 0.00 exch ' + 'dup 0.44 mul ' + 'exch 0.21 mul }');
308
+ describe("AlternateCS", function () {
309
+ it("should handle the case when cs is an array", function () {
310
+ const fnDict = new _primitives.Dict();
311
+ fnDict.set("FunctionType", 4);
312
+ fnDict.set("Domain", [0.0, 1.0]);
313
+ fnDict.set("Range", [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]);
314
+ fnDict.set("Length", 58);
315
+ let fn = new _stream.StringStream("{ dup 0.84 mul " + "exch 0.00 exch " + "dup 0.44 mul " + "exch 0.21 mul }");
316
316
  fn = new _stream.Stream(fn.bytes, 0, 58, fnDict);
317
317
 
318
- var fnRef = _primitives.Ref.get(10, 0);
318
+ const fnRef = _primitives.Ref.get(10, 0);
319
319
 
320
- var cs = [_primitives.Name.get('Separation'), _primitives.Name.get('LogoGreen'), _primitives.Name.get('DeviceCMYK'), fnRef];
321
- var xref = new _test_utils.XRefMock([{
320
+ const cs = [_primitives.Name.get("Separation"), _primitives.Name.get("LogoGreen"), _primitives.Name.get("DeviceCMYK"), fnRef];
321
+ const xref = new _test_utils.XRefMock([{
322
322
  ref: fnRef,
323
323
  data: fn
324
324
  }]);
325
- var res = new _primitives.Dict();
326
- var pdfFunctionFactory = new _function.PDFFunctionFactory({
327
- xref: xref
325
+ const res = new _primitives.Dict();
326
+ const pdfFunctionFactory = new _function.PDFFunctionFactory({
327
+ xref
328
328
  });
329
329
 
330
- var colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
330
+ const colorSpace = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
331
331
 
332
- var testSrc = new Uint8Array([27, 25, 50, 31]);
333
- var testDest = new Uint8ClampedArray(3 * 3 * 3);
334
- var expectedDest = new Uint8ClampedArray([226, 242, 241, 226, 242, 241, 229, 244, 242, 226, 242, 241, 226, 242, 241, 229, 244, 242, 203, 232, 229, 203, 232, 229, 222, 241, 238]);
332
+ const testSrc = new Uint8Array([27, 25, 50, 31]);
333
+ const testDest = new Uint8ClampedArray(3 * 3 * 3);
334
+ const expectedDest = new Uint8ClampedArray([226, 242, 241, 226, 242, 241, 229, 244, 242, 226, 242, 241, 226, 242, 241, 229, 244, 242, 203, 232, 229, 203, 232, 229, 222, 241, 238]);
335
335
  colorSpace.fillRgb(testDest, 2, 2, 3, 3, 3, 8, testSrc, 0);
336
336
  expect(colorSpace.getRgb([0.1], 0)).toEqual(new Uint8ClampedArray([228, 243, 242]));
337
337
  expect(colorSpace.isPassthrough(8)).toBeFalsy();