pdfjs-dist 2.0.943 → 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 (192) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/README.md +4 -0
  3. package/bower.json +1 -1
  4. package/build/pdf.js +8286 -14230
  5. package/build/pdf.js.map +1 -1
  6. package/build/pdf.min.js +22 -1
  7. package/build/pdf.worker.entry.js +5 -3
  8. package/build/pdf.worker.js +25500 -26628
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25473 -0
  12. package/es5/build/pdf.js.map +1 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +57878 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/web/images/annotation-check.svg +11 -0
  17. package/es5/web/images/annotation-comment.svg +16 -0
  18. package/es5/web/images/annotation-help.svg +26 -0
  19. package/es5/web/images/annotation-insert.svg +10 -0
  20. package/es5/web/images/annotation-key.svg +11 -0
  21. package/es5/web/images/annotation-newparagraph.svg +11 -0
  22. package/es5/web/images/annotation-noicon.svg +7 -0
  23. package/es5/web/images/annotation-note.svg +42 -0
  24. package/es5/web/images/annotation-paragraph.svg +16 -0
  25. package/es5/web/images/loading-icon.gif +0 -0
  26. package/es5/web/images/shadow.png +0 -0
  27. package/es5/web/images/texture.png +0 -0
  28. package/es5/web/pdf_viewer.css +407 -0
  29. package/es5/web/pdf_viewer.js +7757 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +2887 -4094
  32. package/image_decoders/pdf.image_decoders.js.map +1 -1
  33. package/image_decoders/pdf.image_decoders.min.js +22 -1
  34. package/lib/README.md +7 -0
  35. package/lib/core/annotation.js +855 -778
  36. package/lib/core/arithmetic_decoder.js +325 -311
  37. package/lib/core/bidi.js +117 -50
  38. package/lib/core/ccitt.js +251 -89
  39. package/lib/core/ccitt_stream.js +26 -16
  40. package/lib/core/cff_parser.js +525 -197
  41. package/lib/core/charsets.js +6 -5
  42. package/lib/core/chunked_stream.js +541 -406
  43. package/lib/core/cmap.js +368 -253
  44. package/lib/core/colorspace.js +781 -800
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +609 -422
  47. package/lib/core/document.js +649 -481
  48. package/lib/core/encodings.js +33 -24
  49. package/lib/core/evaluator.js +1471 -736
  50. package/lib/core/font_renderer.js +289 -149
  51. package/lib/core/fonts.js +1067 -413
  52. package/lib/core/function.js +517 -287
  53. package/lib/core/glyphlist.js +4529 -4527
  54. package/lib/core/image.js +232 -114
  55. package/lib/core/image_utils.js +94 -0
  56. package/lib/core/jbig2.js +711 -342
  57. package/lib/core/jbig2_stream.js +31 -19
  58. package/lib/core/jpeg_stream.js +151 -26
  59. package/lib/core/jpg.js +433 -181
  60. package/lib/core/jpx.js +551 -143
  61. package/lib/core/jpx_stream.js +40 -28
  62. package/lib/core/metrics.js +2931 -2931
  63. package/lib/core/murmurhash3.js +104 -97
  64. package/lib/core/obj.js +1561 -1053
  65. package/lib/core/operator_list.js +192 -64
  66. package/lib/core/parser.js +1162 -864
  67. package/lib/core/pattern.js +224 -75
  68. package/lib/core/pdf_manager.js +154 -285
  69. package/lib/core/primitives.js +145 -69
  70. package/lib/core/ps_parser.js +212 -162
  71. package/lib/core/standard_fonts.js +245 -244
  72. package/lib/core/stream.js +353 -81
  73. package/lib/core/type1_parser.js +218 -68
  74. package/lib/core/unicode.js +1682 -1655
  75. package/lib/core/worker.js +233 -302
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +808 -862
  78. package/lib/display/api.js +1778 -1462
  79. package/lib/display/api_compatibility.js +14 -9
  80. package/lib/display/canvas.js +463 -140
  81. package/lib/display/content_disposition.js +86 -58
  82. package/lib/display/display_utils.js +524 -0
  83. package/lib/display/fetch_stream.js +202 -274
  84. package/lib/display/font_loader.js +311 -333
  85. package/lib/display/metadata.js +98 -88
  86. package/lib/display/network.js +343 -347
  87. package/lib/display/network_utils.js +46 -26
  88. package/lib/display/node_stream.js +326 -404
  89. package/lib/display/pattern_helper.js +168 -69
  90. package/lib/display/svg.js +1296 -885
  91. package/lib/display/text_layer.js +229 -103
  92. package/lib/display/transport_stream.js +290 -250
  93. package/lib/display/webgl.js +116 -83
  94. package/lib/display/worker_options.js +6 -5
  95. package/lib/display/xml_parser.js +358 -337
  96. package/lib/examples/node/domstubs.js +95 -39
  97. package/lib/pdf.js +49 -31
  98. package/lib/pdf.worker.js +7 -5
  99. package/lib/shared/compatibility.js +3 -145
  100. package/lib/shared/is_node.js +8 -7
  101. package/lib/shared/message_handler.js +367 -314
  102. package/lib/shared/util.js +421 -415
  103. package/lib/test/unit/annotation_spec.js +1570 -690
  104. package/lib/test/unit/api_spec.js +855 -493
  105. package/lib/test/unit/bidi_spec.js +12 -12
  106. package/lib/test/unit/cff_parser_spec.js +88 -61
  107. package/lib/test/unit/clitests_helper.js +9 -12
  108. package/lib/test/unit/cmap_spec.js +140 -88
  109. package/lib/test/unit/colorspace_spec.js +204 -152
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +194 -182
  112. package/lib/test/unit/custom_spec.js +50 -64
  113. package/lib/test/unit/display_svg_spec.js +53 -38
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +17 -22
  116. package/lib/test/unit/encodings_spec.js +15 -57
  117. package/lib/test/unit/evaluator_spec.js +90 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +219 -205
  120. package/lib/test/unit/jasmine-boot.js +68 -39
  121. package/lib/test/unit/message_handler_spec.js +187 -160
  122. package/lib/test/unit/metadata_spec.js +87 -34
  123. package/lib/test/unit/murmurhash3_spec.js +13 -13
  124. package/lib/test/unit/network_spec.js +26 -59
  125. package/lib/test/unit/network_utils_spec.js +187 -121
  126. package/lib/test/unit/node_stream_spec.js +98 -90
  127. package/lib/test/unit/parser_spec.js +173 -131
  128. package/lib/test/unit/pdf_find_controller_spec.js +148 -67
  129. package/lib/test/unit/pdf_find_utils_spec.js +35 -34
  130. package/lib/test/unit/pdf_history_spec.js +45 -33
  131. package/lib/test/unit/primitives_spec.js +161 -126
  132. package/lib/test/unit/stream_spec.js +22 -15
  133. package/lib/test/unit/test_utils.js +149 -98
  134. package/lib/test/unit/testreporter.js +36 -18
  135. package/lib/test/unit/type1_parser_spec.js +46 -44
  136. package/lib/test/unit/ui_utils_spec.js +388 -372
  137. package/lib/test/unit/unicode_spec.js +49 -46
  138. package/lib/test/unit/util_spec.js +144 -248
  139. package/lib/web/annotation_layer_builder.js +75 -95
  140. package/lib/web/app.js +1538 -1147
  141. package/lib/web/app_options.js +116 -104
  142. package/lib/web/base_viewer.js +950 -775
  143. package/lib/web/chromecom.js +217 -225
  144. package/lib/web/debugger.js +236 -148
  145. package/lib/web/download_manager.js +50 -50
  146. package/lib/web/firefox_print_service.js +51 -33
  147. package/lib/web/firefoxcom.js +225 -352
  148. package/lib/web/genericcom.js +30 -93
  149. package/lib/web/genericl10n.js +26 -143
  150. package/lib/web/grab_to_pan.js +57 -33
  151. package/lib/web/interfaces.js +105 -232
  152. package/lib/web/overlay_manager.js +73 -227
  153. package/lib/web/password_prompt.js +44 -62
  154. package/lib/web/pdf_attachment_viewer.js +118 -123
  155. package/lib/web/pdf_cursor_tools.js +89 -93
  156. package/lib/web/pdf_document_properties.js +242 -281
  157. package/lib/web/pdf_find_bar.js +157 -163
  158. package/lib/web/pdf_find_controller.js +598 -454
  159. package/lib/web/pdf_find_utils.js +32 -16
  160. package/lib/web/pdf_history.js +481 -355
  161. package/lib/web/pdf_link_service.js +355 -323
  162. package/lib/web/pdf_outline_viewer.js +167 -152
  163. package/lib/web/pdf_page_view.js +511 -457
  164. package/lib/web/pdf_presentation_mode.js +347 -335
  165. package/lib/web/pdf_print_service.js +133 -103
  166. package/lib/web/pdf_rendering_queue.js +98 -100
  167. package/lib/web/pdf_sidebar.js +323 -299
  168. package/lib/web/pdf_sidebar_resizer.js +107 -108
  169. package/lib/web/pdf_single_page_viewer.js +94 -146
  170. package/lib/web/pdf_thumbnail_view.js +319 -269
  171. package/lib/web/pdf_thumbnail_viewer.js +219 -199
  172. package/lib/web/pdf_viewer.component.js +111 -32
  173. package/lib/web/pdf_viewer.js +61 -101
  174. package/lib/web/preferences.js +87 -272
  175. package/lib/web/secondary_toolbar.js +207 -220
  176. package/lib/web/text_layer_builder.js +322 -322
  177. package/lib/web/toolbar.js +227 -180
  178. package/lib/web/ui_utils.js +476 -421
  179. package/lib/web/view_history.js +59 -208
  180. package/lib/web/viewer_compatibility.js +9 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +36 -22
  183. package/web/pdf_viewer.js +4407 -4516
  184. package/web/pdf_viewer.js.map +1 -1
  185. package/webpack.js +14 -5
  186. package/external/streams/streams-lib.js +0 -3962
  187. package/external/url/url-lib.js +0 -627
  188. package/lib/display/dom_utils.js +0 -441
  189. package/lib/shared/streams_polyfill.js +0 -39
  190. package/lib/shared/url_polyfill.js +0 -50
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
  192. package/lib/web/dom_events.js +0 -140
@@ -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 2018 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.
@@ -19,56 +19,61 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _cmap = require('../../core/cmap');
24
+ var _cmap = require("../../core/cmap.js");
25
25
 
26
- var _dom_utils = require('../../display/dom_utils');
26
+ var _display_utils = require("../../display/display_utils.js");
27
27
 
28
- var _is_node = require('../../shared/is_node');
28
+ var _is_node = require("../../shared/is_node.js");
29
29
 
30
- var _is_node2 = _interopRequireDefault(_is_node);
30
+ var _primitives = require("../../core/primitives.js");
31
31
 
32
- var _primitives = require('../../core/primitives');
32
+ var _test_utils = require("./test_utils.js");
33
33
 
34
- var _test_utils = require('./test_utils');
35
-
36
- var _stream = require('../../core/stream');
37
-
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
+ var _stream = require("../../core/stream.js");
39
35
 
40
36
  var cMapUrl = {
41
- dom: '../../external/bcmaps/',
42
- node: './external/bcmaps/'
37
+ dom: "../../external/bcmaps/",
38
+ node: "./external/bcmaps/"
43
39
  };
44
40
  var cMapPacked = true;
45
- describe('cmap', function () {
41
+ describe("cmap", function () {
46
42
  var fetchBuiltInCMap;
47
43
  beforeAll(function (done) {
48
44
  var CMapReaderFactory;
49
- if ((0, _is_node2.default)()) {
45
+
46
+ if (_is_node.isNodeJS) {
50
47
  CMapReaderFactory = new _test_utils.NodeCMapReaderFactory({
51
48
  baseUrl: cMapUrl.node,
52
49
  isCompressed: cMapPacked
53
50
  });
54
51
  } else {
55
- CMapReaderFactory = new _dom_utils.DOMCMapReaderFactory({
52
+ CMapReaderFactory = new _display_utils.DOMCMapReaderFactory({
56
53
  baseUrl: cMapUrl.dom,
57
54
  isCompressed: cMapPacked
58
55
  });
59
56
  }
60
- fetchBuiltInCMap = function fetchBuiltInCMap(name) {
61
- return CMapReaderFactory.fetch({ name: name });
57
+
58
+ fetchBuiltInCMap = function (name) {
59
+ return CMapReaderFactory.fetch({
60
+ name
61
+ });
62
62
  };
63
+
63
64
  done();
64
65
  });
65
66
  afterAll(function () {
66
67
  fetchBuiltInCMap = null;
67
68
  });
68
- it('parses beginbfchar', function (done) {
69
- var str = '2 beginbfchar\n' + '<03> <00>\n' + '<04> <01>\n' + 'endbfchar\n';
69
+ it("parses beginbfchar", function (done) {
70
+ var str = "2 beginbfchar\n" + "<03> <00>\n" + "<04> <01>\n" + "endbfchar\n";
70
71
  var stream = new _stream.StringStream(str);
71
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
72
+
73
+ var cmapPromise = _cmap.CMapFactory.create({
74
+ encoding: stream
75
+ });
76
+
72
77
  cmapPromise.then(function (cmap) {
73
78
  expect(cmap.lookup(0x03)).toEqual(String.fromCharCode(0x00));
74
79
  expect(cmap.lookup(0x04)).toEqual(String.fromCharCode(0x01));
@@ -78,27 +83,35 @@ describe('cmap', function () {
78
83
  done.fail(reason);
79
84
  });
80
85
  });
81
- it('parses beginbfrange with range', function (done) {
82
- var str = '1 beginbfrange\n' + '<06> <0B> 0\n' + 'endbfrange\n';
86
+ it("parses beginbfrange with range", function (done) {
87
+ var str = "1 beginbfrange\n" + "<06> <0B> 0\n" + "endbfrange\n";
83
88
  var stream = new _stream.StringStream(str);
84
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
89
+
90
+ var cmapPromise = _cmap.CMapFactory.create({
91
+ encoding: stream
92
+ });
93
+
85
94
  cmapPromise.then(function (cmap) {
86
95
  expect(cmap.lookup(0x05)).toBeUndefined();
87
96
  expect(cmap.lookup(0x06)).toEqual(String.fromCharCode(0x00));
88
- expect(cmap.lookup(0x0B)).toEqual(String.fromCharCode(0x05));
89
- expect(cmap.lookup(0x0C)).toBeUndefined();
97
+ expect(cmap.lookup(0x0b)).toEqual(String.fromCharCode(0x05));
98
+ expect(cmap.lookup(0x0c)).toBeUndefined();
90
99
  done();
91
100
  }).catch(function (reason) {
92
101
  done.fail(reason);
93
102
  });
94
103
  });
95
- it('parses beginbfrange with array', function (done) {
96
- var str = '1 beginbfrange\n' + '<0D> <12> [ 0 1 2 3 4 5 ]\n' + 'endbfrange\n';
104
+ it("parses beginbfrange with array", function (done) {
105
+ var str = "1 beginbfrange\n" + "<0D> <12> [ 0 1 2 3 4 5 ]\n" + "endbfrange\n";
97
106
  var stream = new _stream.StringStream(str);
98
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
107
+
108
+ var cmapPromise = _cmap.CMapFactory.create({
109
+ encoding: stream
110
+ });
111
+
99
112
  cmapPromise.then(function (cmap) {
100
- expect(cmap.lookup(0x0C)).toBeUndefined();
101
- expect(cmap.lookup(0x0D)).toEqual(0x00);
113
+ expect(cmap.lookup(0x0c)).toBeUndefined();
114
+ expect(cmap.lookup(0x0d)).toEqual(0x00);
102
115
  expect(cmap.lookup(0x12)).toEqual(0x05);
103
116
  expect(cmap.lookup(0x13)).toBeUndefined();
104
117
  done();
@@ -106,10 +119,14 @@ describe('cmap', function () {
106
119
  done.fail(reason);
107
120
  });
108
121
  });
109
- it('parses begincidchar', function (done) {
110
- var str = '1 begincidchar\n' + '<14> 0\n' + 'endcidchar\n';
122
+ it("parses begincidchar", function (done) {
123
+ var str = "1 begincidchar\n" + "<14> 0\n" + "endcidchar\n";
111
124
  var stream = new _stream.StringStream(str);
112
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
125
+
126
+ var cmapPromise = _cmap.CMapFactory.create({
127
+ encoding: stream
128
+ });
129
+
113
130
  cmapPromise.then(function (cmap) {
114
131
  expect(cmap.lookup(0x14)).toEqual(0x00);
115
132
  expect(cmap.lookup(0x15)).toBeUndefined();
@@ -118,24 +135,32 @@ describe('cmap', function () {
118
135
  done.fail(reason);
119
136
  });
120
137
  });
121
- it('parses begincidrange', function (done) {
122
- var str = '1 begincidrange\n' + '<0016> <001B> 0\n' + 'endcidrange\n';
138
+ it("parses begincidrange", function (done) {
139
+ var str = "1 begincidrange\n" + "<0016> <001B> 0\n" + "endcidrange\n";
123
140
  var stream = new _stream.StringStream(str);
124
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
141
+
142
+ var cmapPromise = _cmap.CMapFactory.create({
143
+ encoding: stream
144
+ });
145
+
125
146
  cmapPromise.then(function (cmap) {
126
147
  expect(cmap.lookup(0x15)).toBeUndefined();
127
148
  expect(cmap.lookup(0x16)).toEqual(0x00);
128
- expect(cmap.lookup(0x1B)).toEqual(0x05);
129
- expect(cmap.lookup(0x1C)).toBeUndefined();
149
+ expect(cmap.lookup(0x1b)).toEqual(0x05);
150
+ expect(cmap.lookup(0x1c)).toBeUndefined();
130
151
  done();
131
152
  }).catch(function (reason) {
132
153
  done.fail(reason);
133
154
  });
134
155
  });
135
- it('decodes codespace ranges', function (done) {
136
- var str = '1 begincodespacerange\n' + '<01> <02>\n' + '<00000003> <00000004>\n' + 'endcodespacerange\n';
156
+ it("decodes codespace ranges", function (done) {
157
+ var str = "1 begincodespacerange\n" + "<01> <02>\n" + "<00000003> <00000004>\n" + "endcodespacerange\n";
137
158
  var stream = new _stream.StringStream(str);
138
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
159
+
160
+ var cmapPromise = _cmap.CMapFactory.create({
161
+ encoding: stream
162
+ });
163
+
139
164
  cmapPromise.then(function (cmap) {
140
165
  var c = {};
141
166
  cmap.readCharCode(String.fromCharCode(1), 0, c);
@@ -149,54 +174,68 @@ describe('cmap', function () {
149
174
  done.fail(reason);
150
175
  });
151
176
  });
152
- it('decodes 4 byte codespace ranges', function (done) {
153
- var str = '1 begincodespacerange\n' + '<8EA1A1A1> <8EA1FEFE>\n' + 'endcodespacerange\n';
177
+ it("decodes 4 byte codespace ranges", function (done) {
178
+ var str = "1 begincodespacerange\n" + "<8EA1A1A1> <8EA1FEFE>\n" + "endcodespacerange\n";
154
179
  var stream = new _stream.StringStream(str);
155
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
180
+
181
+ var cmapPromise = _cmap.CMapFactory.create({
182
+ encoding: stream
183
+ });
184
+
156
185
  cmapPromise.then(function (cmap) {
157
186
  var c = {};
158
- cmap.readCharCode(String.fromCharCode(0x8E, 0xA1, 0xA1, 0xA1), 0, c);
159
- expect(c.charcode).toEqual(0x8EA1A1A1);
187
+ cmap.readCharCode(String.fromCharCode(0x8e, 0xa1, 0xa1, 0xa1), 0, c);
188
+ expect(c.charcode).toEqual(0x8ea1a1a1);
160
189
  expect(c.length).toEqual(4);
161
190
  done();
162
191
  }).catch(function (reason) {
163
192
  done.fail(reason);
164
193
  });
165
194
  });
166
- it('read usecmap', function (done) {
167
- var str = '/Adobe-Japan1-1 usecmap\n';
195
+ it("read usecmap", function (done) {
196
+ var str = "/Adobe-Japan1-1 usecmap\n";
168
197
  var stream = new _stream.StringStream(str);
198
+
169
199
  var cmapPromise = _cmap.CMapFactory.create({
170
200
  encoding: stream,
171
- fetchBuiltInCMap: fetchBuiltInCMap,
201
+ fetchBuiltInCMap,
172
202
  useCMap: null
173
203
  });
204
+
174
205
  cmapPromise.then(function (cmap) {
175
206
  expect(cmap instanceof _cmap.CMap).toEqual(true);
176
207
  expect(cmap.useCMap).not.toBeNull();
177
208
  expect(cmap.builtInCMap).toBeFalsy();
178
- expect(cmap.length).toEqual(0x20A7);
209
+ expect(cmap.length).toEqual(0x20a7);
179
210
  expect(cmap.isIdentityCMap).toEqual(false);
180
211
  done();
181
212
  }).catch(function (reason) {
182
213
  done.fail(reason);
183
214
  });
184
215
  });
185
- it('parses cmapname', function (done) {
186
- var str = '/CMapName /Identity-H def\n';
216
+ it("parses cmapname", function (done) {
217
+ var str = "/CMapName /Identity-H def\n";
187
218
  var stream = new _stream.StringStream(str);
188
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
219
+
220
+ var cmapPromise = _cmap.CMapFactory.create({
221
+ encoding: stream
222
+ });
223
+
189
224
  cmapPromise.then(function (cmap) {
190
- expect(cmap.name).toEqual('Identity-H');
225
+ expect(cmap.name).toEqual("Identity-H");
191
226
  done();
192
227
  }).catch(function (reason) {
193
228
  done.fail(reason);
194
229
  });
195
230
  });
196
- it('parses wmode', function (done) {
197
- var str = '/WMode 1 def\n';
231
+ it("parses wmode", function (done) {
232
+ var str = "/WMode 1 def\n";
198
233
  var stream = new _stream.StringStream(str);
199
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
234
+
235
+ var cmapPromise = _cmap.CMapFactory.create({
236
+ encoding: stream
237
+ });
238
+
200
239
  cmapPromise.then(function (cmap) {
201
240
  expect(cmap.vertical).toEqual(true);
202
241
  done();
@@ -204,101 +243,114 @@ describe('cmap', function () {
204
243
  done.fail(reason);
205
244
  });
206
245
  });
207
- it('loads built in cmap', function (done) {
246
+ it("loads built in cmap", function (done) {
208
247
  var cmapPromise = _cmap.CMapFactory.create({
209
- encoding: _primitives.Name.get('Adobe-Japan1-1'),
210
- fetchBuiltInCMap: fetchBuiltInCMap,
248
+ encoding: _primitives.Name.get("Adobe-Japan1-1"),
249
+ fetchBuiltInCMap,
211
250
  useCMap: null
212
251
  });
252
+
213
253
  cmapPromise.then(function (cmap) {
214
254
  expect(cmap instanceof _cmap.CMap).toEqual(true);
215
255
  expect(cmap.useCMap).toBeNull();
216
256
  expect(cmap.builtInCMap).toBeTruthy();
217
- expect(cmap.length).toEqual(0x20A7);
257
+ expect(cmap.length).toEqual(0x20a7);
218
258
  expect(cmap.isIdentityCMap).toEqual(false);
219
259
  done();
220
260
  }).catch(function (reason) {
221
261
  done.fail(reason);
222
262
  });
223
263
  });
224
- it('loads built in identity cmap', function (done) {
264
+ it("loads built in identity cmap", function (done) {
225
265
  var cmapPromise = _cmap.CMapFactory.create({
226
- encoding: _primitives.Name.get('Identity-H'),
227
- fetchBuiltInCMap: fetchBuiltInCMap,
266
+ encoding: _primitives.Name.get("Identity-H"),
267
+ fetchBuiltInCMap,
228
268
  useCMap: null
229
269
  });
270
+
230
271
  cmapPromise.then(function (cmap) {
231
272
  expect(cmap instanceof _cmap.IdentityCMap).toEqual(true);
232
273
  expect(cmap.vertical).toEqual(false);
233
274
  expect(cmap.length).toEqual(0x10000);
234
275
  expect(function () {
235
276
  return cmap.isIdentityCMap;
236
- }).toThrow(new Error('should not access .isIdentityCMap'));
277
+ }).toThrow(new Error("should not access .isIdentityCMap"));
237
278
  done();
238
279
  }).catch(function (reason) {
239
280
  done.fail(reason);
240
281
  });
241
282
  });
242
- it('attempts to load a non-existent built-in CMap', function (done) {
283
+ it("attempts to load a non-existent built-in CMap", function (done) {
243
284
  var cmapPromise = _cmap.CMapFactory.create({
244
- encoding: _primitives.Name.get('null'),
245
- fetchBuiltInCMap: fetchBuiltInCMap,
285
+ encoding: _primitives.Name.get("null"),
286
+ fetchBuiltInCMap,
246
287
  useCMap: null
247
288
  });
289
+
248
290
  cmapPromise.then(function () {
249
- done.fail('No CMap should be loaded');
291
+ done.fail("No CMap should be loaded");
250
292
  }, function (reason) {
251
293
  expect(reason instanceof Error).toEqual(true);
252
- expect(reason.message).toEqual('Unknown CMap name: null');
294
+ expect(reason.message).toEqual("Unknown CMap name: null");
253
295
  done();
254
296
  });
255
297
  });
256
- it('attempts to load a built-in CMap without the necessary API parameters', function (done) {
298
+ it("attempts to load a built-in CMap without the necessary API parameters", function (done) {
257
299
  function tmpFetchBuiltInCMap(name) {
258
- var CMapReaderFactory = (0, _is_node2.default)() ? new _test_utils.NodeCMapReaderFactory({}) : new _dom_utils.DOMCMapReaderFactory({});
259
- return CMapReaderFactory.fetch({ name: name });
300
+ var CMapReaderFactory = _is_node.isNodeJS ? new _test_utils.NodeCMapReaderFactory({}) : new _display_utils.DOMCMapReaderFactory({});
301
+ return CMapReaderFactory.fetch({
302
+ name
303
+ });
260
304
  }
305
+
261
306
  var cmapPromise = _cmap.CMapFactory.create({
262
- encoding: _primitives.Name.get('Adobe-Japan1-1'),
307
+ encoding: _primitives.Name.get("Adobe-Japan1-1"),
263
308
  fetchBuiltInCMap: tmpFetchBuiltInCMap,
264
309
  useCMap: null
265
310
  });
311
+
266
312
  cmapPromise.then(function () {
267
- done.fail('No CMap should be loaded');
313
+ done.fail("No CMap should be loaded");
268
314
  }, function (reason) {
269
315
  expect(reason instanceof Error).toEqual(true);
270
316
  expect(reason.message).toEqual('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.');
271
317
  done();
272
318
  });
273
319
  });
274
- it('attempts to load a built-in CMap with inconsistent API parameters', function (done) {
320
+ it("attempts to load a built-in CMap with inconsistent API parameters", function (done) {
275
321
  function tmpFetchBuiltInCMap(name) {
276
- var CMapReaderFactory = void 0;
277
- if ((0, _is_node2.default)()) {
322
+ let CMapReaderFactory;
323
+
324
+ if (_is_node.isNodeJS) {
278
325
  CMapReaderFactory = new _test_utils.NodeCMapReaderFactory({
279
326
  baseUrl: cMapUrl.node,
280
327
  isCompressed: false
281
328
  });
282
329
  } else {
283
- CMapReaderFactory = new _dom_utils.DOMCMapReaderFactory({
330
+ CMapReaderFactory = new _display_utils.DOMCMapReaderFactory({
284
331
  baseUrl: cMapUrl.dom,
285
332
  isCompressed: false
286
333
  });
287
334
  }
288
- return CMapReaderFactory.fetch({ name: name });
335
+
336
+ return CMapReaderFactory.fetch({
337
+ name
338
+ });
289
339
  }
290
- var cmapPromise = _cmap.CMapFactory.create({
291
- encoding: _primitives.Name.get('Adobe-Japan1-1'),
340
+
341
+ const cmapPromise = _cmap.CMapFactory.create({
342
+ encoding: _primitives.Name.get("Adobe-Japan1-1"),
292
343
  fetchBuiltInCMap: tmpFetchBuiltInCMap,
293
344
  useCMap: null
294
345
  });
346
+
295
347
  cmapPromise.then(function () {
296
- done.fail('No CMap should be loaded');
348
+ done.fail("No CMap should be loaded");
297
349
  }, function (reason) {
298
350
  expect(reason instanceof Error).toEqual(true);
299
- var message = reason.message;
300
- expect(message.startsWith('Unable to load CMap at: ')).toEqual(true);
301
- expect(message.endsWith('/external/bcmaps/Adobe-Japan1-1')).toEqual(true);
351
+ const message = reason.message;
352
+ expect(message.startsWith("Unable to load CMap at: ")).toEqual(true);
353
+ expect(message.endsWith("/external/bcmaps/Adobe-Japan1-1")).toEqual(true);
302
354
  done();
303
355
  });
304
356
  });