pdfjs-dist 2.0.943 → 2.1.266

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 (159) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +15329 -11095
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +12497 -4184
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/image_decoders/pdf.image_decoders.js +3438 -1209
  9. package/image_decoders/pdf.image_decoders.js.map +1 -1
  10. package/image_decoders/pdf.image_decoders.min.js +1 -1
  11. package/lib/core/annotation.js +335 -109
  12. package/lib/core/arithmetic_decoder.js +274 -244
  13. package/lib/core/bidi.js +64 -5
  14. package/lib/core/ccitt.js +172 -17
  15. package/lib/core/ccitt_stream.js +14 -5
  16. package/lib/core/cff_parser.js +304 -28
  17. package/lib/core/charsets.js +4 -3
  18. package/lib/core/chunked_stream.js +379 -149
  19. package/lib/core/cmap.js +210 -40
  20. package/lib/core/colorspace.js +332 -187
  21. package/lib/core/crypto.js +289 -44
  22. package/lib/core/document.js +508 -249
  23. package/lib/core/encodings.js +18 -9
  24. package/lib/core/evaluator.js +657 -119
  25. package/lib/core/font_renderer.js +217 -34
  26. package/lib/core/fonts.js +632 -41
  27. package/lib/core/function.js +252 -26
  28. package/lib/core/glyphlist.js +2 -1
  29. package/lib/core/image.js +124 -27
  30. package/lib/core/jbig2.js +425 -65
  31. package/lib/core/jbig2_stream.js +18 -7
  32. package/lib/core/jpeg_stream.js +24 -8
  33. package/lib/core/jpg.js +208 -16
  34. package/lib/core/jpx.js +395 -5
  35. package/lib/core/jpx_stream.js +17 -5
  36. package/lib/core/metrics.js +3 -3
  37. package/lib/core/murmurhash3.js +23 -5
  38. package/lib/core/obj.js +625 -132
  39. package/lib/core/operator_list.js +104 -3
  40. package/lib/core/parser.js +262 -25
  41. package/lib/core/pattern.js +144 -12
  42. package/lib/core/pdf_manager.js +104 -70
  43. package/lib/core/primitives.js +74 -21
  44. package/lib/core/ps_parser.js +133 -44
  45. package/lib/core/standard_fonts.js +9 -9
  46. package/lib/core/stream.js +283 -31
  47. package/lib/core/type1_parser.js +138 -6
  48. package/lib/core/unicode.js +28 -1
  49. package/lib/core/worker.js +192 -57
  50. package/lib/display/annotation_layer.js +303 -123
  51. package/lib/display/api.js +1073 -574
  52. package/lib/display/api_compatibility.js +4 -1
  53. package/lib/display/canvas.js +314 -18
  54. package/lib/display/content_disposition.js +70 -23
  55. package/lib/display/dom_utils.js +112 -59
  56. package/lib/display/fetch_stream.js +95 -50
  57. package/lib/display/font_loader.js +250 -132
  58. package/lib/display/metadata.js +37 -15
  59. package/lib/display/network.js +123 -34
  60. package/lib/display/network_utils.js +23 -10
  61. package/lib/display/node_stream.js +162 -65
  62. package/lib/display/pattern_helper.js +57 -6
  63. package/lib/display/svg.js +194 -18
  64. package/lib/display/text_layer.js +128 -14
  65. package/lib/display/transport_stream.js +83 -27
  66. package/lib/display/webgl.js +63 -17
  67. package/lib/display/worker_options.js +4 -3
  68. package/lib/display/xml_parser.js +162 -52
  69. package/lib/examples/node/domstubs.js +56 -3
  70. package/lib/pdf.js +15 -2
  71. package/lib/pdf.worker.js +4 -2
  72. package/lib/shared/compatibility.js +129 -26
  73. package/lib/shared/global_scope.js +1 -1
  74. package/lib/shared/is_node.js +3 -3
  75. package/lib/shared/message_handler.js +103 -45
  76. package/lib/shared/streams_polyfill.js +20 -16
  77. package/lib/shared/url_polyfill.js +8 -2
  78. package/lib/shared/util.js +246 -84
  79. package/lib/test/unit/annotation_spec.js +99 -73
  80. package/lib/test/unit/api_spec.js +347 -113
  81. package/lib/test/unit/bidi_spec.js +6 -6
  82. package/lib/test/unit/cff_parser_spec.js +17 -5
  83. package/lib/test/unit/clitests_helper.js +7 -8
  84. package/lib/test/unit/cmap_spec.js +79 -25
  85. package/lib/test/unit/colorspace_spec.js +65 -18
  86. package/lib/test/unit/crypto_spec.js +16 -4
  87. package/lib/test/unit/custom_spec.js +40 -52
  88. package/lib/test/unit/display_svg_spec.js +32 -16
  89. package/lib/test/unit/document_spec.js +2 -2
  90. package/lib/test/unit/dom_utils_spec.js +8 -8
  91. package/lib/test/unit/encodings_spec.js +24 -44
  92. package/lib/test/unit/evaluator_spec.js +15 -8
  93. package/lib/test/unit/function_spec.js +16 -4
  94. package/lib/test/unit/jasmine-boot.js +29 -16
  95. package/lib/test/unit/message_handler_spec.js +19 -6
  96. package/lib/test/unit/metadata_spec.js +64 -11
  97. package/lib/test/unit/murmurhash3_spec.js +2 -2
  98. package/lib/test/unit/network_spec.js +19 -4
  99. package/lib/test/unit/network_utils_spec.js +6 -4
  100. package/lib/test/unit/node_stream_spec.js +50 -26
  101. package/lib/test/unit/parser_spec.js +13 -29
  102. package/lib/test/unit/pdf_find_controller_spec.js +144 -32
  103. package/lib/test/unit/pdf_find_utils_spec.js +10 -9
  104. package/lib/test/unit/pdf_history_spec.js +20 -8
  105. package/lib/test/unit/primitives_spec.js +23 -3
  106. package/lib/test/unit/stream_spec.js +8 -3
  107. package/lib/test/unit/test_utils.js +89 -26
  108. package/lib/test/unit/testreporter.js +19 -1
  109. package/lib/test/unit/type1_parser_spec.js +7 -5
  110. package/lib/test/unit/ui_utils_spec.js +162 -38
  111. package/lib/test/unit/unicode_spec.js +13 -10
  112. package/lib/test/unit/util_spec.js +89 -9
  113. package/lib/web/annotation_layer_builder.js +38 -21
  114. package/lib/web/app.js +610 -245
  115. package/lib/web/app_options.js +54 -34
  116. package/lib/web/base_viewer.js +359 -162
  117. package/lib/web/chromecom.js +159 -80
  118. package/lib/web/debugger.js +161 -17
  119. package/lib/web/download_manager.js +29 -11
  120. package/lib/web/firefox_print_service.js +16 -8
  121. package/lib/web/firefoxcom.js +127 -91
  122. package/lib/web/genericcom.js +50 -31
  123. package/lib/web/genericl10n.js +46 -34
  124. package/lib/web/grab_to_pan.js +25 -3
  125. package/lib/web/interfaces.js +108 -61
  126. package/lib/web/overlay_manager.js +67 -45
  127. package/lib/web/password_prompt.js +20 -12
  128. package/lib/web/pdf_attachment_viewer.js +37 -17
  129. package/lib/web/pdf_cursor_tools.js +38 -15
  130. package/lib/web/pdf_document_properties.js +65 -24
  131. package/lib/web/pdf_find_bar.js +48 -20
  132. package/lib/web/pdf_find_controller.js +290 -89
  133. package/lib/web/pdf_find_utils.js +19 -3
  134. package/lib/web/pdf_history.js +186 -49
  135. package/lib/web/pdf_link_service.js +127 -52
  136. package/lib/web/pdf_outline_viewer.js +71 -21
  137. package/lib/web/pdf_page_view.js +188 -63
  138. package/lib/web/pdf_presentation_mode.js +98 -33
  139. package/lib/web/pdf_print_service.js +54 -10
  140. package/lib/web/pdf_rendering_queue.js +26 -4
  141. package/lib/web/pdf_sidebar.js +116 -62
  142. package/lib/web/pdf_sidebar_resizer.js +41 -15
  143. package/lib/web/pdf_single_page_viewer.js +65 -68
  144. package/lib/web/pdf_thumbnail_view.js +102 -31
  145. package/lib/web/pdf_thumbnail_viewer.js +62 -22
  146. package/lib/web/pdf_viewer.component.js +111 -31
  147. package/lib/web/pdf_viewer.js +80 -60
  148. package/lib/web/preferences.js +61 -39
  149. package/lib/web/secondary_toolbar.js +101 -82
  150. package/lib/web/text_layer_builder.js +124 -69
  151. package/lib/web/toolbar.js +67 -27
  152. package/lib/web/ui_utils.js +284 -128
  153. package/lib/web/view_history.js +75 -51
  154. package/lib/web/viewer_compatibility.js +2 -1
  155. package/package.json +1 -1
  156. package/web/pdf_viewer.css +1 -1
  157. package/web/pdf_viewer.js +2200 -973
  158. package/web/pdf_viewer.js.map +1 -1
  159. package/lib/web/dom_events.js +0 -140
@@ -19,26 +19,30 @@
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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
24
+ var _annotation = require("../../core/annotation");
25
25
 
26
- var _annotation = require('../../core/annotation');
26
+ var _util = require("../../shared/util");
27
27
 
28
- var _util = require('../../shared/util');
28
+ var _primitives = require("../../core/primitives");
29
29
 
30
- var _primitives = require('../../core/primitives');
30
+ var _parser = require("../../core/parser");
31
31
 
32
- var _parser = require('../../core/parser');
32
+ var _stream = require("../../core/stream");
33
33
 
34
- var _stream = require('../../core/stream');
35
-
36
- var _test_utils = require('./test_utils');
34
+ var _test_utils = require("./test_utils");
37
35
 
38
36
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
37
 
38
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
39
+
40
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
41
+
40
42
  describe('annotation', function () {
41
- var PDFManagerMock = function () {
43
+ var PDFManagerMock =
44
+ /*#__PURE__*/
45
+ function () {
42
46
  function PDFManagerMock(params) {
43
47
  _classCallCheck(this, PDFManagerMock);
44
48
 
@@ -46,10 +50,11 @@ describe('annotation', function () {
46
50
  }
47
51
 
48
52
  _createClass(PDFManagerMock, [{
49
- key: 'ensure',
53
+ key: "ensure",
50
54
  value: function ensure(obj, prop, args) {
51
55
  return new Promise(function (resolve) {
52
56
  var value = obj[prop];
57
+
53
58
  if (typeof value === 'function') {
54
59
  resolve(value.apply(obj, args));
55
60
  } else {
@@ -62,16 +67,20 @@ describe('annotation', function () {
62
67
  return PDFManagerMock;
63
68
  }();
64
69
 
65
- var IdFactoryMock = function () {
70
+ var IdFactoryMock =
71
+ /*#__PURE__*/
72
+ function () {
66
73
  function IdFactoryMock(params) {
67
74
  _classCallCheck(this, IdFactoryMock);
68
75
 
69
76
  this.uniquePrefix = params.prefix || 'p0_';
70
- this.idCounters = { obj: params.startObjId || 0 };
77
+ this.idCounters = {
78
+ obj: params.startObjId || 0
79
+ };
71
80
  }
72
81
 
73
82
  _createClass(IdFactoryMock, [{
74
- key: 'createObjId',
83
+ key: "createObjId",
75
84
  value: function createObjId() {
76
85
  return this.uniquePrefix + ++this.idCounters.obj;
77
86
  }
@@ -80,10 +89,11 @@ describe('annotation', function () {
80
89
  return IdFactoryMock;
81
90
  }();
82
91
 
83
- var pdfManagerMock = void 0,
84
- idFactoryMock = void 0;
92
+ var pdfManagerMock, idFactoryMock;
85
93
  beforeAll(function (done) {
86
- pdfManagerMock = new PDFManagerMock({ docBaseUrl: null });
94
+ pdfManagerMock = new PDFManagerMock({
95
+ docBaseUrl: null
96
+ });
87
97
  idFactoryMock = new IdFactoryMock({});
88
98
  done();
89
99
  });
@@ -101,9 +111,9 @@ describe('annotation', function () {
101
111
  ref: annotationRef,
102
112
  data: annotationDict
103
113
  }]);
114
+
104
115
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref) {
105
116
  var data = _ref.data;
106
-
107
117
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
108
118
  expect(data.id).toEqual('10R');
109
119
  done();
@@ -118,18 +128,19 @@ describe('annotation', function () {
118
128
  prefix: 'p0_',
119
129
  startObjId: 0
120
130
  });
131
+
121
132
  var annotation1 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(function (_ref2) {
122
133
  var data = _ref2.data;
123
-
124
134
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
125
135
  expect(data.id).toEqual('annot_p0_1');
126
136
  });
137
+
127
138
  var annotation2 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory).then(function (_ref3) {
128
139
  var data = _ref3.data;
129
-
130
140
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
131
141
  expect(data.id).toEqual('annot_p0_2');
132
142
  });
143
+
133
144
  Promise.all([annotation1, annotation2]).then(done, done.fail);
134
145
  });
135
146
  it('should handle missing /Subtype', function (done) {
@@ -140,17 +151,16 @@ describe('annotation', function () {
140
151
  ref: annotationRef,
141
152
  data: annotationDict
142
153
  }]);
154
+
143
155
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref4) {
144
156
  var data = _ref4.data;
145
-
146
157
  expect(data.annotationType).toBeUndefined();
147
158
  done();
148
159
  }, done.fail);
149
160
  });
150
161
  });
151
162
  describe('Annotation', function () {
152
- var dict = void 0,
153
- ref = void 0;
163
+ var dict, ref;
154
164
  beforeAll(function (done) {
155
165
  dict = new _primitives.Dict();
156
166
  ref = new _primitives.Ref(1, 0);
@@ -254,6 +264,14 @@ describe('annotation', function () {
254
264
  borderStyle.setWidth('three');
255
265
  expect(borderStyle.width).toEqual(1);
256
266
  });
267
+ it('should set the width to zero, when the input is a `Name` (issue 10385)', function () {
268
+ var borderStyleZero = new _annotation.AnnotationBorderStyle();
269
+ borderStyleZero.setWidth(_primitives.Name.get('0'));
270
+ var borderStyleFive = new _annotation.AnnotationBorderStyle();
271
+ borderStyleFive.setWidth(_primitives.Name.get('5'));
272
+ expect(borderStyleZero.width).toEqual(0);
273
+ expect(borderStyleFive.width).toEqual(0);
274
+ });
257
275
  it('should set and get a valid style', function () {
258
276
  var borderStyle = new _annotation.AnnotationBorderStyle();
259
277
  borderStyle.setStyle(_primitives.Name.get('D'));
@@ -310,9 +328,9 @@ describe('annotation', function () {
310
328
  ref: annotationRef,
311
329
  data: annotationDict
312
330
  }]);
331
+
313
332
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref5) {
314
333
  var data = _ref5.data;
315
-
316
334
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
317
335
  expect(data.url).toEqual('http://www.ctan.org/tex-archive/info/lshort');
318
336
  expect(data.unsafeUrl).toEqual('http://www.ctan.org/tex-archive/info/lshort');
@@ -334,9 +352,9 @@ describe('annotation', function () {
334
352
  ref: annotationRef,
335
353
  data: annotationDict
336
354
  }]);
355
+
337
356
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref6) {
338
357
  var data = _ref6.data;
339
-
340
358
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
341
359
  expect(data.url).toEqual('http://www.hmrc.gov.uk/');
342
360
  expect(data.unsafeUrl).toEqual('http://www.hmrc.gov.uk');
@@ -358,9 +376,9 @@ describe('annotation', function () {
358
376
  ref: annotationRef,
359
377
  data: annotationDict
360
378
  }]);
379
+
361
380
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref7) {
362
381
  var data = _ref7.data;
363
-
364
382
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
365
383
  expect(data.url).toEqual(new URL((0, _util.stringToUTF8String)('http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4')).href);
366
384
  expect(data.unsafeUrl).toEqual((0, _util.stringToUTF8String)('http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4'));
@@ -382,9 +400,9 @@ describe('annotation', function () {
382
400
  ref: annotationRef,
383
401
  data: annotationDict
384
402
  }]);
403
+
385
404
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref8) {
386
405
  var data = _ref8.data;
387
-
388
406
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
389
407
  expect(data.url).toBeUndefined();
390
408
  expect(data.unsafeUrl).toBeUndefined();
@@ -408,9 +426,9 @@ describe('annotation', function () {
408
426
  ref: annotationRef,
409
427
  data: annotationDict
410
428
  }]);
429
+
411
430
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref9) {
412
431
  var data = _ref9.data;
413
-
414
432
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
415
433
  expect(data.url).toBeUndefined();
416
434
  expect(data.unsafeUrl).toEqual('../../0013/001346/134685E.pdf#4.3');
@@ -434,10 +452,12 @@ describe('annotation', function () {
434
452
  ref: annotationRef,
435
453
  data: annotationDict
436
454
  }]);
437
- var pdfManager = new PDFManagerMock({ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf' });
455
+ var pdfManager = new PDFManagerMock({
456
+ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf'
457
+ });
458
+
438
459
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(function (_ref10) {
439
460
  var data = _ref10.data;
440
-
441
461
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
442
462
  expect(data.url).toEqual('http://www.example.com/0013/001346/134685E.pdf#4.3');
443
463
  expect(data.unsafeUrl).toEqual('../../0013/001346/134685E.pdf#4.3');
@@ -460,9 +480,9 @@ describe('annotation', function () {
460
480
  ref: annotationRef,
461
481
  data: annotationDict
462
482
  }]);
483
+
463
484
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref11) {
464
485
  var data = _ref11.data;
465
-
466
486
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
467
487
  expect(data.url).toEqual('http://www.example.com/test.pdf#15');
468
488
  expect(data.unsafeUrl).toEqual('http://www.example.com/test.pdf#15');
@@ -486,9 +506,9 @@ describe('annotation', function () {
486
506
  ref: annotationRef,
487
507
  data: annotationDict
488
508
  }]);
509
+
489
510
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref12) {
490
511
  var data = _ref12.data;
491
-
492
512
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
493
513
  expect(data.url).toEqual(new URL('http://www.example.com/test.pdf#' + '[14,{"name":"XYZ"},null,298.043,null]').href);
494
514
  expect(data.unsafeUrl).toEqual('http://www.example.com/test.pdf#' + '[14,{"name":"XYZ"},null,298.043,null]');
@@ -516,10 +536,12 @@ describe('annotation', function () {
516
536
  ref: annotationRef,
517
537
  data: annotationDict
518
538
  }]);
519
- var pdfManager = new PDFManagerMock({ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf' });
539
+ var pdfManager = new PDFManagerMock({
540
+ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf'
541
+ });
542
+
520
543
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock).then(function (_ref13) {
521
544
  var data = _ref13.data;
522
-
523
545
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
524
546
  expect(data.url).toEqual(new URL('http://www.example.com/test/pdfs/Part II/Part II.pdf').href);
525
547
  expect(data.unsafeUrl).toEqual('Part II/Part II.pdf');
@@ -549,7 +571,6 @@ describe('annotation', function () {
549
571
  }]);
550
572
  return _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref14) {
551
573
  var data = _ref14.data;
552
-
553
574
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
554
575
  expect(data.url).toEqual(expectedUrl);
555
576
  expect(data.unsafeUrl).toEqual(expectedUnsafeUrl);
@@ -557,6 +578,7 @@ describe('annotation', function () {
557
578
  expect(data.newWindow).toEqual(expectedNewWindow);
558
579
  });
559
580
  }
581
+
560
582
  var annotation1 = checkJsAction({
561
583
  jsEntry: 'function someFun() { return "qwerty"; } someFun();',
562
584
  expectedUrl: undefined,
@@ -591,9 +613,9 @@ describe('annotation', function () {
591
613
  ref: annotationRef,
592
614
  data: annotationDict
593
615
  }]);
616
+
594
617
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref15) {
595
618
  var data = _ref15.data;
596
-
597
619
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
598
620
  expect(data.url).toBeUndefined();
599
621
  expect(data.unsafeUrl).toBeUndefined();
@@ -611,9 +633,9 @@ describe('annotation', function () {
611
633
  ref: annotationRef,
612
634
  data: annotationDict
613
635
  }]);
636
+
614
637
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref16) {
615
638
  var data = _ref16.data;
616
-
617
639
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
618
640
  expect(data.url).toBeUndefined();
619
641
  expect(data.unsafeUrl).toBeUndefined();
@@ -631,16 +653,18 @@ describe('annotation', function () {
631
653
  ref: annotationRef,
632
654
  data: annotationDict
633
655
  }]);
656
+
634
657
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref17) {
635
658
  var data = _ref17.data;
636
-
637
659
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
638
660
  expect(data.url).toBeUndefined();
639
661
  expect(data.unsafeUrl).toBeUndefined();
640
662
  expect(data.dest).toEqual([{
641
663
  num: 17,
642
664
  gen: 0
643
- }, { name: 'XYZ' }, 0, 841.89, null]);
665
+ }, {
666
+ name: 'XYZ'
667
+ }, 0, 841.89, null]);
644
668
  done();
645
669
  }, done.fail);
646
670
  });
@@ -658,9 +682,9 @@ describe('annotation', function () {
658
682
  ref: annotationRef,
659
683
  data: annotationDict
660
684
  }]);
685
+
661
686
  _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock).then(function (_ref18) {
662
687
  var data = _ref18.data;
663
-
664
688
  expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
665
689
  expect(data.url).toBeUndefined();
666
690
  expect(data.unsafeUrl).toBeUndefined();
@@ -670,7 +694,7 @@ describe('annotation', function () {
670
694
  });
671
695
  });
672
696
  describe('WidgetAnnotation', function () {
673
- var widgetDict = void 0;
697
+ var widgetDict;
674
698
  beforeEach(function (done) {
675
699
  widgetDict = new _primitives.Dict();
676
700
  widgetDict.set('Type', _primitives.Name.get('Annot'));
@@ -686,9 +710,9 @@ describe('annotation', function () {
686
710
  ref: widgetRef,
687
711
  data: widgetDict
688
712
  }]);
713
+
689
714
  _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref19) {
690
715
  var data = _ref19.data;
691
-
692
716
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
693
717
  expect(data.fieldName).toEqual('');
694
718
  done();
@@ -701,9 +725,9 @@ describe('annotation', function () {
701
725
  ref: widgetRef,
702
726
  data: widgetDict
703
727
  }]);
728
+
704
729
  _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref20) {
705
730
  var data = _ref20.data;
706
-
707
731
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
708
732
  expect(data.fieldName).toEqual('foo');
709
733
  done();
@@ -722,9 +746,9 @@ describe('annotation', function () {
722
746
  ref: widgetRef,
723
747
  data: widgetDict
724
748
  }]);
749
+
725
750
  _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref21) {
726
751
  var data = _ref21.data;
727
-
728
752
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
729
753
  expect(data.fieldName).toEqual('foo.bar.baz');
730
754
  done();
@@ -741,9 +765,9 @@ describe('annotation', function () {
741
765
  ref: widgetRef,
742
766
  data: widgetDict
743
767
  }]);
768
+
744
769
  _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock).then(function (_ref22) {
745
770
  var data = _ref22.data;
746
-
747
771
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
748
772
  expect(data.fieldName).toEqual('foo.bar');
749
773
  done();
@@ -751,7 +775,7 @@ describe('annotation', function () {
751
775
  });
752
776
  });
753
777
  describe('TextWidgetAnnotation', function () {
754
- var textWidgetDict = void 0;
778
+ var textWidgetDict;
755
779
  beforeEach(function (done) {
756
780
  textWidgetDict = new _primitives.Dict();
757
781
  textWidgetDict.set('Type', _primitives.Name.get('Annot'));
@@ -768,9 +792,9 @@ describe('annotation', function () {
768
792
  ref: textWidgetRef,
769
793
  data: textWidgetDict
770
794
  }]);
795
+
771
796
  _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref23) {
772
797
  var data = _ref23.data;
773
-
774
798
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
775
799
  expect(data.textAlignment).toEqual(null);
776
800
  expect(data.maxLen).toEqual(null);
@@ -789,9 +813,9 @@ describe('annotation', function () {
789
813
  ref: textWidgetRef,
790
814
  data: textWidgetDict
791
815
  }]);
816
+
792
817
  _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref24) {
793
818
  var data = _ref24.data;
794
-
795
819
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
796
820
  expect(data.textAlignment).toEqual(null);
797
821
  expect(data.maxLen).toEqual(null);
@@ -810,9 +834,9 @@ describe('annotation', function () {
810
834
  ref: textWidgetRef,
811
835
  data: textWidgetDict
812
836
  }]);
837
+
813
838
  _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref25) {
814
839
  var data = _ref25.data;
815
-
816
840
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
817
841
  expect(data.textAlignment).toEqual(1);
818
842
  expect(data.maxLen).toEqual(20);
@@ -828,9 +852,9 @@ describe('annotation', function () {
828
852
  ref: textWidgetRef,
829
853
  data: textWidgetDict
830
854
  }]);
855
+
831
856
  _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref26) {
832
857
  var data = _ref26.data;
833
-
834
858
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
835
859
  expect(data.comb).toEqual(false);
836
860
  done();
@@ -844,9 +868,9 @@ describe('annotation', function () {
844
868
  ref: textWidgetRef,
845
869
  data: textWidgetDict
846
870
  }]);
871
+
847
872
  _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref27) {
848
873
  var data = _ref27.data;
849
-
850
874
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
851
875
  expect(data.comb).toEqual(true);
852
876
  done();
@@ -856,6 +880,7 @@ describe('annotation', function () {
856
880
  var invalidFieldFlags = [_util.AnnotationFieldFlag.MULTILINE, _util.AnnotationFieldFlag.PASSWORD, _util.AnnotationFieldFlag.FILESELECT];
857
881
  var flags = _util.AnnotationFieldFlag.COMB + _util.AnnotationFieldFlag.MULTILINE + _util.AnnotationFieldFlag.PASSWORD + _util.AnnotationFieldFlag.FILESELECT;
858
882
  var promise = Promise.resolve();
883
+
859
884
  for (var i = 0, ii = invalidFieldFlags.length; i <= ii; i++) {
860
885
  promise = promise.then(function () {
861
886
  textWidgetDict.set('MaxLen', 20);
@@ -867,21 +892,22 @@ describe('annotation', function () {
867
892
  }]);
868
893
  return _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref28) {
869
894
  var data = _ref28.data;
870
-
871
895
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
872
896
  var valid = invalidFieldFlags.length === 0;
873
897
  expect(data.comb).toEqual(valid);
898
+
874
899
  if (!valid) {
875
900
  flags -= invalidFieldFlags.pop();
876
901
  }
877
902
  });
878
903
  });
879
904
  }
905
+
880
906
  promise.then(done, done.fail);
881
907
  });
882
908
  });
883
909
  describe('ButtonWidgetAnnotation', function () {
884
- var buttonWidgetDict = void 0;
910
+ var buttonWidgetDict;
885
911
  beforeEach(function (done) {
886
912
  buttonWidgetDict = new _primitives.Dict();
887
913
  buttonWidgetDict.set('Type', _primitives.Name.get('Annot'));
@@ -905,9 +931,9 @@ describe('annotation', function () {
905
931
  ref: buttonWidgetRef,
906
932
  data: buttonWidgetDict
907
933
  }]);
934
+
908
935
  _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref29) {
909
936
  var data = _ref29.data;
910
-
911
937
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
912
938
  expect(data.checkBox).toEqual(true);
913
939
  expect(data.fieldValue).toEqual('1');
@@ -923,9 +949,9 @@ describe('annotation', function () {
923
949
  ref: buttonWidgetRef,
924
950
  data: buttonWidgetDict
925
951
  }]);
952
+
926
953
  _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref30) {
927
954
  var data = _ref30.data;
928
-
929
955
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
930
956
  expect(data.checkBox).toEqual(true);
931
957
  expect(data.fieldValue).toEqual('1');
@@ -948,9 +974,9 @@ describe('annotation', function () {
948
974
  ref: buttonWidgetRef,
949
975
  data: buttonWidgetDict
950
976
  }]);
977
+
951
978
  _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref31) {
952
979
  var data = _ref31.data;
953
-
954
980
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
955
981
  expect(data.checkBox).toEqual(false);
956
982
  expect(data.radioButton).toEqual(true);
@@ -971,9 +997,9 @@ describe('annotation', function () {
971
997
  ref: buttonWidgetRef,
972
998
  data: buttonWidgetDict
973
999
  }]);
1000
+
974
1001
  _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref32) {
975
1002
  var data = _ref32.data;
976
-
977
1003
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
978
1004
  expect(data.checkBox).toEqual(false);
979
1005
  expect(data.radioButton).toEqual(true);
@@ -984,7 +1010,7 @@ describe('annotation', function () {
984
1010
  });
985
1011
  });
986
1012
  describe('ChoiceWidgetAnnotation', function () {
987
- var choiceWidgetDict = void 0;
1013
+ var choiceWidgetDict;
988
1014
  beforeEach(function (done) {
989
1015
  choiceWidgetDict = new _primitives.Dict();
990
1016
  choiceWidgetDict.set('Type', _primitives.Name.get('Annot'));
@@ -1001,9 +1027,9 @@ describe('annotation', function () {
1001
1027
  ref: choiceWidgetRef,
1002
1028
  data: choiceWidgetDict
1003
1029
  }]);
1030
+
1004
1031
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref33) {
1005
1032
  var data = _ref33.data;
1006
-
1007
1033
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1008
1034
  expect(data.options).toEqual([]);
1009
1035
  done();
@@ -1034,9 +1060,9 @@ describe('annotation', function () {
1034
1060
  ref: optionOneRef,
1035
1061
  data: optionOneArr
1036
1062
  }]);
1063
+
1037
1064
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref34) {
1038
1065
  var data = _ref34.data;
1039
-
1040
1066
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1041
1067
  expect(data.options).toEqual(expected);
1042
1068
  done();
@@ -1062,9 +1088,9 @@ describe('annotation', function () {
1062
1088
  ref: optionBarRef,
1063
1089
  data: optionBarStr
1064
1090
  }]);
1091
+
1065
1092
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref35) {
1066
1093
  var data = _ref35.data;
1067
-
1068
1094
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1069
1095
  expect(data.options).toEqual(expected);
1070
1096
  done();
@@ -1087,9 +1113,9 @@ describe('annotation', function () {
1087
1113
  ref: choiceWidgetRef,
1088
1114
  data: choiceWidgetDict
1089
1115
  }]);
1116
+
1090
1117
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref36) {
1091
1118
  var data = _ref36.data;
1092
-
1093
1119
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1094
1120
  expect(data.options).toEqual(expected);
1095
1121
  done();
@@ -1107,9 +1133,9 @@ describe('annotation', function () {
1107
1133
  ref: choiceWidgetRef,
1108
1134
  data: choiceWidgetDict
1109
1135
  }]);
1136
+
1110
1137
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref37) {
1111
1138
  var data = _ref37.data;
1112
-
1113
1139
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1114
1140
  expect(data.options).toEqual(expected);
1115
1141
  done();
@@ -1123,9 +1149,9 @@ describe('annotation', function () {
1123
1149
  ref: choiceWidgetRef,
1124
1150
  data: choiceWidgetDict
1125
1151
  }]);
1152
+
1126
1153
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref38) {
1127
1154
  var data = _ref38.data;
1128
-
1129
1155
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1130
1156
  expect(data.fieldValue).toEqual(fieldValue);
1131
1157
  done();
@@ -1139,9 +1165,9 @@ describe('annotation', function () {
1139
1165
  ref: choiceWidgetRef,
1140
1166
  data: choiceWidgetDict
1141
1167
  }]);
1168
+
1142
1169
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref39) {
1143
1170
  var data = _ref39.data;
1144
-
1145
1171
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1146
1172
  expect(data.fieldValue).toEqual([fieldValue]);
1147
1173
  done();
@@ -1153,9 +1179,9 @@ describe('annotation', function () {
1153
1179
  ref: choiceWidgetRef,
1154
1180
  data: choiceWidgetDict
1155
1181
  }]);
1182
+
1156
1183
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref40) {
1157
1184
  var data = _ref40.data;
1158
-
1159
1185
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1160
1186
  expect(data.readOnly).toEqual(false);
1161
1187
  expect(data.combo).toEqual(false);
@@ -1170,9 +1196,9 @@ describe('annotation', function () {
1170
1196
  ref: choiceWidgetRef,
1171
1197
  data: choiceWidgetDict
1172
1198
  }]);
1199
+
1173
1200
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref41) {
1174
1201
  var data = _ref41.data;
1175
-
1176
1202
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1177
1203
  expect(data.readOnly).toEqual(false);
1178
1204
  expect(data.combo).toEqual(false);
@@ -1187,9 +1213,9 @@ describe('annotation', function () {
1187
1213
  ref: choiceWidgetRef,
1188
1214
  data: choiceWidgetDict
1189
1215
  }]);
1216
+
1190
1217
  _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock).then(function (_ref42) {
1191
1218
  var data = _ref42.data;
1192
-
1193
1219
  expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
1194
1220
  expect(data.readOnly).toEqual(true);
1195
1221
  expect(data.combo).toEqual(true);
@@ -1209,9 +1235,9 @@ describe('annotation', function () {
1209
1235
  ref: lineRef,
1210
1236
  data: lineDict
1211
1237
  }]);
1238
+
1212
1239
  _annotation.AnnotationFactory.create(xref, lineRef, pdfManagerMock, idFactoryMock).then(function (_ref43) {
1213
1240
  var data = _ref43.data;
1214
-
1215
1241
  expect(data.annotationType).toEqual(_util.AnnotationType.LINE);
1216
1242
  expect(data.lineCoordinates).toEqual([1, 2, 3, 4]);
1217
1243
  done();
@@ -1253,9 +1279,9 @@ describe('annotation', function () {
1253
1279
  embeddedFileDict.assignXref(xref);
1254
1280
  fileSpecDict.assignXref(xref);
1255
1281
  fileAttachmentDict.assignXref(xref);
1282
+
1256
1283
  _annotation.AnnotationFactory.create(xref, fileAttachmentRef, pdfManagerMock, idFactoryMock).then(function (_ref44) {
1257
1284
  var data = _ref44.data;
1258
-
1259
1285
  expect(data.annotationType).toEqual(_util.AnnotationType.FILEATTACHMENT);
1260
1286
  expect(data.file.filename).toEqual('Test.txt');
1261
1287
  expect(data.file.content).toEqual((0, _util.stringToBytes)('Test attachment'));
@@ -1279,10 +1305,10 @@ describe('annotation', function () {
1279
1305
  ref: popupRef,
1280
1306
  data: popupDict
1281
1307
  }]);
1308
+
1282
1309
  _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock).then(function (_ref45) {
1283
1310
  var data = _ref45.data,
1284
1311
  viewable = _ref45.viewable;
1285
-
1286
1312
  expect(data.annotationType).toEqual(_util.AnnotationType.POPUP);
1287
1313
  expect(data.annotationFlags).toEqual(25);
1288
1314
  expect(viewable).toEqual(true);
@@ -1301,9 +1327,9 @@ describe('annotation', function () {
1301
1327
  ref: inkRef,
1302
1328
  data: inkDict
1303
1329
  }]);
1330
+
1304
1331
  _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(function (_ref46) {
1305
1332
  var data = _ref46.data;
1306
-
1307
1333
  expect(data.annotationType).toEqual(_util.AnnotationType.INK);
1308
1334
  expect(data.inkLists.length).toEqual(1);
1309
1335
  expect(data.inkLists[0]).toEqual([{
@@ -1332,9 +1358,9 @@ describe('annotation', function () {
1332
1358
  ref: inkRef,
1333
1359
  data: inkDict
1334
1360
  }]);
1361
+
1335
1362
  _annotation.AnnotationFactory.create(xref, inkRef, pdfManagerMock, idFactoryMock).then(function (_ref47) {
1336
1363
  var data = _ref47.data;
1337
-
1338
1364
  expect(data.annotationType).toEqual(_util.AnnotationType.INK);
1339
1365
  expect(data.inkLists.length).toEqual(2);
1340
1366
  expect(data.inkLists[0]).toEqual([{