pdfkit 0.12.0 → 0.13.0

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.
package/js/pdfkit.js CHANGED
@@ -9,8 +9,8 @@ var events = require('events');
9
9
  var LineBreaker = require('linebreak');
10
10
  var PNG = require('png-js');
11
11
 
12
- /*
13
- PDFAbstractReference - abstract class for PDF reference
12
+ /*
13
+ PDFAbstractReference - abstract class for PDF reference
14
14
  */
15
15
  class PDFAbstractReference {
16
16
  toString() {
@@ -19,8 +19,8 @@ class PDFAbstractReference {
19
19
 
20
20
  }
21
21
 
22
- /*
23
- PDFTree - abstract base class for name and number tree objects
22
+ /*
23
+ PDFTree - abstract base class for name and number tree objects
24
24
  */
25
25
 
26
26
  class PDFTree {
@@ -60,9 +60,7 @@ class PDFTree {
60
60
  return out.join('\n');
61
61
  }
62
62
 
63
- _compareKeys()
64
- /*a, b*/
65
- {
63
+ _compareKeys() {
66
64
  throw new Error('Must be implemented by subclasses');
67
65
  }
68
66
 
@@ -70,17 +68,15 @@ class PDFTree {
70
68
  throw new Error('Must be implemented by subclasses');
71
69
  }
72
70
 
73
- _dataForKey()
74
- /*k*/
75
- {
71
+ _dataForKey() {
76
72
  throw new Error('Must be implemented by subclasses');
77
73
  }
78
74
 
79
75
  }
80
76
 
81
- /*
82
- PDFObject - converts JavaScript types into their corresponding PDF types.
83
- By Devon Govett
77
+ /*
78
+ PDFObject - converts JavaScript types into their corresponding PDF types.
79
+ By Devon Govett
84
80
  */
85
81
 
86
82
  const pad = (str, length) => (Array(length + 1).join('0') + str).slice(-length);
@@ -193,9 +189,9 @@ class PDFObject {
193
189
 
194
190
  }
195
191
 
196
- /*
197
- PDFReference - represents a reference to another object in the PDF object heirarchy
198
- By Devon Govett
192
+ /*
193
+ PDFReference - represents a reference to another object in the PDF object heirarchy
194
+ By Devon Govett
199
195
  */
200
196
 
201
197
  class PDFReference extends PDFAbstractReference {
@@ -280,9 +276,9 @@ class PDFReference extends PDFAbstractReference {
280
276
 
281
277
  }
282
278
 
283
- /*
284
- PDFPage - represents a single page in the PDF document
285
- By Devon Govett
279
+ /*
280
+ PDFPage - represents a single page in the PDF document
281
+ By Devon Govett
286
282
  */
287
283
  const DEFAULT_MARGINS = {
288
284
  top: 72,
@@ -401,6 +397,11 @@ class PDFPage {
401
397
  return data.Pattern != null ? data.Pattern : data.Pattern = {};
402
398
  }
403
399
 
400
+ get colorSpaces() {
401
+ const data = this.resources.data;
402
+ return data.ColorSpace || (data.ColorSpace = {});
403
+ }
404
+
404
405
  get annotations() {
405
406
  const data = this.dictionary.data;
406
407
  return data.Annots != null ? data.Annots : data.Annots = [];
@@ -427,8 +428,8 @@ class PDFPage {
427
428
 
428
429
  }
429
430
 
430
- /*
431
- PDFNameTree - represents a name tree object
431
+ /*
432
+ PDFNameTree - represents a name tree object
432
433
  */
433
434
 
434
435
  class PDFNameTree extends PDFTree {
@@ -446,11 +447,11 @@ class PDFNameTree extends PDFTree {
446
447
 
447
448
  }
448
449
 
449
- /**
450
- * Check if value is in a range group.
451
- * @param {number} value
452
- * @param {number[]} rangeGroup
453
- * @returns {boolean}
450
+ /**
451
+ * Check if value is in a range group.
452
+ * @param {number} value
453
+ * @param {number[]} rangeGroup
454
+ * @returns {boolean}
454
455
  */
455
456
  function inRange(value, rangeGroup) {
456
457
  if (value < rangeGroup[0]) return false;
@@ -478,18 +479,18 @@ function inRange(value, rangeGroup) {
478
479
  return false;
479
480
  }
480
481
 
481
- /**
482
- * A.1 Unassigned code points in Unicode 3.2
483
- * @link https://tools.ietf.org/html/rfc3454#appendix-A.1
482
+ /**
483
+ * A.1 Unassigned code points in Unicode 3.2
484
+ * @link https://tools.ietf.org/html/rfc3454#appendix-A.1
484
485
  */
485
486
 
486
487
  const unassigned_code_points = [0x0221, 0x0221, 0x0234, 0x024f, 0x02ae, 0x02af, 0x02ef, 0x02ff, 0x0350, 0x035f, 0x0370, 0x0373, 0x0376, 0x0379, 0x037b, 0x037d, 0x037f, 0x0383, 0x038b, 0x038b, 0x038d, 0x038d, 0x03a2, 0x03a2, 0x03cf, 0x03cf, 0x03f7, 0x03ff, 0x0487, 0x0487, 0x04cf, 0x04cf, 0x04f6, 0x04f7, 0x04fa, 0x04ff, 0x0510, 0x0530, 0x0557, 0x0558, 0x0560, 0x0560, 0x0588, 0x0588, 0x058b, 0x0590, 0x05a2, 0x05a2, 0x05ba, 0x05ba, 0x05c5, 0x05cf, 0x05eb, 0x05ef, 0x05f5, 0x060b, 0x060d, 0x061a, 0x061c, 0x061e, 0x0620, 0x0620, 0x063b, 0x063f, 0x0656, 0x065f, 0x06ee, 0x06ef, 0x06ff, 0x06ff, 0x070e, 0x070e, 0x072d, 0x072f, 0x074b, 0x077f, 0x07b2, 0x0900, 0x0904, 0x0904, 0x093a, 0x093b, 0x094e, 0x094f, 0x0955, 0x0957, 0x0971, 0x0980, 0x0984, 0x0984, 0x098d, 0x098e, 0x0991, 0x0992, 0x09a9, 0x09a9, 0x09b1, 0x09b1, 0x09b3, 0x09b5, 0x09ba, 0x09bb, 0x09bd, 0x09bd, 0x09c5, 0x09c6, 0x09c9, 0x09ca, 0x09ce, 0x09d6, 0x09d8, 0x09db, 0x09de, 0x09de, 0x09e4, 0x09e5, 0x09fb, 0x0a01, 0x0a03, 0x0a04, 0x0a0b, 0x0a0e, 0x0a11, 0x0a12, 0x0a29, 0x0a29, 0x0a31, 0x0a31, 0x0a34, 0x0a34, 0x0a37, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3d, 0x0a3d, 0x0a43, 0x0a46, 0x0a49, 0x0a4a, 0x0a4e, 0x0a58, 0x0a5d, 0x0a5d, 0x0a5f, 0x0a65, 0x0a75, 0x0a80, 0x0a84, 0x0a84, 0x0a8c, 0x0a8c, 0x0a8e, 0x0a8e, 0x0a92, 0x0a92, 0x0aa9, 0x0aa9, 0x0ab1, 0x0ab1, 0x0ab4, 0x0ab4, 0x0aba, 0x0abb, 0x0ac6, 0x0ac6, 0x0aca, 0x0aca, 0x0ace, 0x0acf, 0x0ad1, 0x0adf, 0x0ae1, 0x0ae5, 0x0af0, 0x0b00, 0x0b04, 0x0b04, 0x0b0d, 0x0b0e, 0x0b11, 0x0b12, 0x0b29, 0x0b29, 0x0b31, 0x0b31, 0x0b34, 0x0b35, 0x0b3a, 0x0b3b, 0x0b44, 0x0b46, 0x0b49, 0x0b4a, 0x0b4e, 0x0b55, 0x0b58, 0x0b5b, 0x0b5e, 0x0b5e, 0x0b62, 0x0b65, 0x0b71, 0x0b81, 0x0b84, 0x0b84, 0x0b8b, 0x0b8d, 0x0b91, 0x0b91, 0x0b96, 0x0b98, 0x0b9b, 0x0b9b, 0x0b9d, 0x0b9d, 0x0ba0, 0x0ba2, 0x0ba5, 0x0ba7, 0x0bab, 0x0bad, 0x0bb6, 0x0bb6, 0x0bba, 0x0bbd, 0x0bc3, 0x0bc5, 0x0bc9, 0x0bc9, 0x0bce, 0x0bd6, 0x0bd8, 0x0be6, 0x0bf3, 0x0c00, 0x0c04, 0x0c04, 0x0c0d, 0x0c0d, 0x0c11, 0x0c11, 0x0c29, 0x0c29, 0x0c34, 0x0c34, 0x0c3a, 0x0c3d, 0x0c45, 0x0c45, 0x0c49, 0x0c49, 0x0c4e, 0x0c54, 0x0c57, 0x0c5f, 0x0c62, 0x0c65, 0x0c70, 0x0c81, 0x0c84, 0x0c84, 0x0c8d, 0x0c8d, 0x0c91, 0x0c91, 0x0ca9, 0x0ca9, 0x0cb4, 0x0cb4, 0x0cba, 0x0cbd, 0x0cc5, 0x0cc5, 0x0cc9, 0x0cc9, 0x0cce, 0x0cd4, 0x0cd7, 0x0cdd, 0x0cdf, 0x0cdf, 0x0ce2, 0x0ce5, 0x0cf0, 0x0d01, 0x0d04, 0x0d04, 0x0d0d, 0x0d0d, 0x0d11, 0x0d11, 0x0d29, 0x0d29, 0x0d3a, 0x0d3d, 0x0d44, 0x0d45, 0x0d49, 0x0d49, 0x0d4e, 0x0d56, 0x0d58, 0x0d5f, 0x0d62, 0x0d65, 0x0d70, 0x0d81, 0x0d84, 0x0d84, 0x0d97, 0x0d99, 0x0db2, 0x0db2, 0x0dbc, 0x0dbc, 0x0dbe, 0x0dbf, 0x0dc7, 0x0dc9, 0x0dcb, 0x0dce, 0x0dd5, 0x0dd5, 0x0dd7, 0x0dd7, 0x0de0, 0x0df1, 0x0df5, 0x0e00, 0x0e3b, 0x0e3e, 0x0e5c, 0x0e80, 0x0e83, 0x0e83, 0x0e85, 0x0e86, 0x0e89, 0x0e89, 0x0e8b, 0x0e8c, 0x0e8e, 0x0e93, 0x0e98, 0x0e98, 0x0ea0, 0x0ea0, 0x0ea4, 0x0ea4, 0x0ea6, 0x0ea6, 0x0ea8, 0x0ea9, 0x0eac, 0x0eac, 0x0eba, 0x0eba, 0x0ebe, 0x0ebf, 0x0ec5, 0x0ec5, 0x0ec7, 0x0ec7, 0x0ece, 0x0ecf, 0x0eda, 0x0edb, 0x0ede, 0x0eff, 0x0f48, 0x0f48, 0x0f6b, 0x0f70, 0x0f8c, 0x0f8f, 0x0f98, 0x0f98, 0x0fbd, 0x0fbd, 0x0fcd, 0x0fce, 0x0fd0, 0x0fff, 0x1022, 0x1022, 0x1028, 0x1028, 0x102b, 0x102b, 0x1033, 0x1035, 0x103a, 0x103f, 0x105a, 0x109f, 0x10c6, 0x10cf, 0x10f9, 0x10fa, 0x10fc, 0x10ff, 0x115a, 0x115e, 0x11a3, 0x11a7, 0x11fa, 0x11ff, 0x1207, 0x1207, 0x1247, 0x1247, 0x1249, 0x1249, 0x124e, 0x124f, 0x1257, 0x1257, 0x1259, 0x1259, 0x125e, 0x125f, 0x1287, 0x1287, 0x1289, 0x1289, 0x128e, 0x128f, 0x12af, 0x12af, 0x12b1, 0x12b1, 0x12b6, 0x12b7, 0x12bf, 0x12bf, 0x12c1, 0x12c1, 0x12c6, 0x12c7, 0x12cf, 0x12cf, 0x12d7, 0x12d7, 0x12ef, 0x12ef, 0x130f, 0x130f, 0x1311, 0x1311, 0x1316, 0x1317, 0x131f, 0x131f, 0x1347, 0x1347, 0x135b, 0x1360, 0x137d, 0x139f, 0x13f5, 0x1400, 0x1677, 0x167f, 0x169d, 0x169f, 0x16f1, 0x16ff, 0x170d, 0x170d, 0x1715, 0x171f, 0x1737, 0x173f, 0x1754, 0x175f, 0x176d, 0x176d, 0x1771, 0x1771, 0x1774, 0x177f, 0x17dd, 0x17df, 0x17ea, 0x17ff, 0x180f, 0x180f, 0x181a, 0x181f, 0x1878, 0x187f, 0x18aa, 0x1dff, 0x1e9c, 0x1e9f, 0x1efa, 0x1eff, 0x1f16, 0x1f17, 0x1f1e, 0x1f1f, 0x1f46, 0x1f47, 0x1f4e, 0x1f4f, 0x1f58, 0x1f58, 0x1f5a, 0x1f5a, 0x1f5c, 0x1f5c, 0x1f5e, 0x1f5e, 0x1f7e, 0x1f7f, 0x1fb5, 0x1fb5, 0x1fc5, 0x1fc5, 0x1fd4, 0x1fd5, 0x1fdc, 0x1fdc, 0x1ff0, 0x1ff1, 0x1ff5, 0x1ff5, 0x1fff, 0x1fff, 0x2053, 0x2056, 0x2058, 0x205e, 0x2064, 0x2069, 0x2072, 0x2073, 0x208f, 0x209f, 0x20b2, 0x20cf, 0x20eb, 0x20ff, 0x213b, 0x213c, 0x214c, 0x2152, 0x2184, 0x218f, 0x23cf, 0x23ff, 0x2427, 0x243f, 0x244b, 0x245f, 0x24ff, 0x24ff, 0x2614, 0x2615, 0x2618, 0x2618, 0x267e, 0x267f, 0x268a, 0x2700, 0x2705, 0x2705, 0x270a, 0x270b, 0x2728, 0x2728, 0x274c, 0x274c, 0x274e, 0x274e, 0x2753, 0x2755, 0x2757, 0x2757, 0x275f, 0x2760, 0x2795, 0x2797, 0x27b0, 0x27b0, 0x27bf, 0x27cf, 0x27ec, 0x27ef, 0x2b00, 0x2e7f, 0x2e9a, 0x2e9a, 0x2ef4, 0x2eff, 0x2fd6, 0x2fef, 0x2ffc, 0x2fff, 0x3040, 0x3040, 0x3097, 0x3098, 0x3100, 0x3104, 0x312d, 0x3130, 0x318f, 0x318f, 0x31b8, 0x31ef, 0x321d, 0x321f, 0x3244, 0x3250, 0x327c, 0x327e, 0x32cc, 0x32cf, 0x32ff, 0x32ff, 0x3377, 0x337a, 0x33de, 0x33df, 0x33ff, 0x33ff, 0x4db6, 0x4dff, 0x9fa6, 0x9fff, 0xa48d, 0xa48f, 0xa4c7, 0xabff, 0xd7a4, 0xd7ff, 0xfa2e, 0xfa2f, 0xfa6b, 0xfaff, 0xfb07, 0xfb12, 0xfb18, 0xfb1c, 0xfb37, 0xfb37, 0xfb3d, 0xfb3d, 0xfb3f, 0xfb3f, 0xfb42, 0xfb42, 0xfb45, 0xfb45, 0xfbb2, 0xfbd2, 0xfd40, 0xfd4f, 0xfd90, 0xfd91, 0xfdc8, 0xfdcf, 0xfdfd, 0xfdff, 0xfe10, 0xfe1f, 0xfe24, 0xfe2f, 0xfe47, 0xfe48, 0xfe53, 0xfe53, 0xfe67, 0xfe67, 0xfe6c, 0xfe6f, 0xfe75, 0xfe75, 0xfefd, 0xfefe, 0xff00, 0xff00, 0xffbf, 0xffc1, 0xffc8, 0xffc9, 0xffd0, 0xffd1, 0xffd8, 0xffd9, 0xffdd, 0xffdf, 0xffe7, 0xffe7, 0xffef, 0xfff8, 0x10000, 0x102ff, 0x1031f, 0x1031f, 0x10324, 0x1032f, 0x1034b, 0x103ff, 0x10426, 0x10427, 0x1044e, 0x1cfff, 0x1d0f6, 0x1d0ff, 0x1d127, 0x1d129, 0x1d1de, 0x1d3ff, 0x1d455, 0x1d455, 0x1d49d, 0x1d49d, 0x1d4a0, 0x1d4a1, 0x1d4a3, 0x1d4a4, 0x1d4a7, 0x1d4a8, 0x1d4ad, 0x1d4ad, 0x1d4ba, 0x1d4ba, 0x1d4bc, 0x1d4bc, 0x1d4c1, 0x1d4c1, 0x1d4c4, 0x1d4c4, 0x1d506, 0x1d506, 0x1d50b, 0x1d50c, 0x1d515, 0x1d515, 0x1d51d, 0x1d51d, 0x1d53a, 0x1d53a, 0x1d53f, 0x1d53f, 0x1d545, 0x1d545, 0x1d547, 0x1d549, 0x1d551, 0x1d551, 0x1d6a4, 0x1d6a7, 0x1d7ca, 0x1d7cd, 0x1d800, 0x1fffd, 0x2a6d7, 0x2f7ff, 0x2fa1e, 0x2fffd, 0x30000, 0x3fffd, 0x40000, 0x4fffd, 0x50000, 0x5fffd, 0x60000, 0x6fffd, 0x70000, 0x7fffd, 0x80000, 0x8fffd, 0x90000, 0x9fffd, 0xa0000, 0xafffd, 0xb0000, 0xbfffd, 0xc0000, 0xcfffd, 0xd0000, 0xdfffd, 0xe0000, 0xe0000, 0xe0002, 0xe001f, 0xe0080, 0xefffd]; // prettier-ignore-end
487
488
 
488
489
  const isUnassignedCodePoint = character => inRange(character, unassigned_code_points); // prettier-ignore-start
489
490
 
490
- /**
491
- * B.1 Commonly mapped to nothing
492
- * @link https://tools.ietf.org/html/rfc3454#appendix-B.1
491
+ /**
492
+ * B.1 Commonly mapped to nothing
493
+ * @link https://tools.ietf.org/html/rfc3454#appendix-B.1
493
494
  */
494
495
 
495
496
 
@@ -497,9 +498,9 @@ const commonly_mapped_to_nothing = [0x00ad, 0x00ad, 0x034f, 0x034f, 0x1806, 0x18
497
498
 
498
499
  const isCommonlyMappedToNothing = character => inRange(character, commonly_mapped_to_nothing); // prettier-ignore-start
499
500
 
500
- /**
501
- * C.1.2 Non-ASCII space characters
502
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
501
+ /**
502
+ * C.1.2 Non-ASCII space characters
503
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.1.2
503
504
  */
504
505
 
505
506
 
@@ -543,9 +544,9 @@ const isNonASCIISpaceCharacter = character => inRange(character, non_ASCII_space
543
544
 
544
545
 
545
546
  const non_ASCII_controls_characters = [
546
- /**
547
- * C.2.2 Non-ASCII control characters
548
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
547
+ /**
548
+ * C.2.2 Non-ASCII control characters
549
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.2
549
550
  */
550
551
  0x0080, 0x009f
551
552
  /* [CONTROL CHARACTERS] */
@@ -581,9 +582,9 @@ const non_ASCII_controls_characters = [
581
582
  /* [MUSICAL CONTROL CHARACTERS] */
582
583
  ];
583
584
  const non_character_codepoints = [
584
- /**
585
- * C.4 Non-character code points
586
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.4
585
+ /**
586
+ * C.4 Non-character code points
587
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.4
587
588
  */
588
589
  0xfdd0, 0xfdef
589
590
  /* [NONCHARACTER CODE POINTS] */
@@ -620,23 +621,23 @@ const non_character_codepoints = [
620
621
  , 0x10fffe, 0x10ffff
621
622
  /* [NONCHARACTER CODE POINTS] */
622
623
  ];
623
- /**
624
- * 2.3. Prohibited Output
624
+ /**
625
+ * 2.3. Prohibited Output
625
626
  */
626
627
 
627
628
  const prohibited_characters = [
628
- /**
629
- * C.2.1 ASCII control characters
630
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
629
+ /**
630
+ * C.2.1 ASCII control characters
631
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.2.1
631
632
  */
632
633
  0, 0x001f
633
634
  /* [CONTROL CHARACTERS] */
634
635
  , 0x007f, 0x007f
635
636
  /* DELETE */
636
637
  ,
637
- /**
638
- * C.8 Change display properties or are deprecated
639
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.8
638
+ /**
639
+ * C.8 Change display properties or are deprecated
640
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.8
640
641
  */
641
642
  0x0340, 0x0340
642
643
  /* COMBINING GRAVE TONE MARK */
@@ -669,28 +670,28 @@ const prohibited_characters = [
669
670
  , 0x206f, 0x206f
670
671
  /* NOMINAL DIGIT SHAPES */
671
672
  ,
672
- /**
673
- * C.7 Inappropriate for canonical representation
674
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.7
673
+ /**
674
+ * C.7 Inappropriate for canonical representation
675
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.7
675
676
  */
676
677
  0x2ff0, 0x2ffb
677
678
  /* [IDEOGRAPHIC DESCRIPTION CHARACTERS] */
678
679
  ,
679
- /**
680
- * C.5 Surrogate codes
681
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.5
680
+ /**
681
+ * C.5 Surrogate codes
682
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.5
682
683
  */
683
684
  0xd800, 0xdfff,
684
- /**
685
- * C.3 Private use
686
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.3
685
+ /**
686
+ * C.3 Private use
687
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.3
687
688
  */
688
689
  0xe000, 0xf8ff
689
690
  /* [PRIVATE USE, PLANE 0] */
690
691
  ,
691
- /**
692
- * C.6 Inappropriate for plain text
693
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.6
692
+ /**
693
+ * C.6 Inappropriate for plain text
694
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.6
694
695
  */
695
696
  0xfff9, 0xfff9
696
697
  /* INTERLINEAR ANNOTATION ANCHOR */
@@ -703,18 +704,18 @@ const prohibited_characters = [
703
704
  , 0xfffd, 0xfffd
704
705
  /* REPLACEMENT CHARACTER */
705
706
  ,
706
- /**
707
- * C.9 Tagging characters
708
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.9
707
+ /**
708
+ * C.9 Tagging characters
709
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.9
709
710
  */
710
711
  0xe0001, 0xe0001
711
712
  /* LANGUAGE TAG */
712
713
  , 0xe0020, 0xe007f
713
714
  /* [TAGGING CHARACTERS] */
714
715
  ,
715
- /**
716
- * C.3 Private use
717
- * @link https://tools.ietf.org/html/rfc3454#appendix-C.3
716
+ /**
717
+ * C.3 Private use
718
+ * @link https://tools.ietf.org/html/rfc3454#appendix-C.3
718
719
  */
719
720
  0xf0000, 0xffffd
720
721
  /* [PRIVATE USE, PLANE 15] */
@@ -724,9 +725,9 @@ const prohibited_characters = [
724
725
 
725
726
  const isProhibitedCharacter = character => inRange(character, non_ASCII_space_characters) || inRange(character, prohibited_characters) || inRange(character, non_ASCII_controls_characters) || inRange(character, non_character_codepoints); // prettier-ignore-start
726
727
 
727
- /**
728
- * D.1 Characters with bidirectional property "R" or "AL"
729
- * @link https://tools.ietf.org/html/rfc3454#appendix-D.1
728
+ /**
729
+ * D.1 Characters with bidirectional property "R" or "AL"
730
+ * @link https://tools.ietf.org/html/rfc3454#appendix-D.1
730
731
  */
731
732
 
732
733
 
@@ -734,9 +735,9 @@ const bidirectional_r_al = [0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05
734
735
 
735
736
  const isBidirectionalRAL = character => inRange(character, bidirectional_r_al); // prettier-ignore-start
736
737
 
737
- /**
738
- * D.2 Characters with bidirectional property "L"
739
- * @link https://tools.ietf.org/html/rfc3454#appendix-D.2
738
+ /**
739
+ * D.2 Characters with bidirectional property "L"
740
+ * @link https://tools.ietf.org/html/rfc3454#appendix-D.2
740
741
  */
741
742
 
742
743
 
@@ -744,15 +745,15 @@ const bidirectional_l = [0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5,
744
745
 
745
746
  const isBidirectionalL = character => inRange(character, bidirectional_l);
746
747
 
747
- /**
748
- * non-ASCII space characters [StringPrep, C.1.2] that can be
749
- * mapped to SPACE (U+0020)
748
+ /**
749
+ * non-ASCII space characters [StringPrep, C.1.2] that can be
750
+ * mapped to SPACE (U+0020)
750
751
  */
751
752
 
752
753
  const mapping2space = isNonASCIISpaceCharacter;
753
- /**
754
- * the "commonly mapped to nothing" characters [StringPrep, B.1]
755
- * that can be mapped to nothing.
754
+ /**
755
+ * the "commonly mapped to nothing" characters [StringPrep, B.1]
756
+ * that can be mapped to nothing.
756
757
  */
757
758
 
758
759
  const mapping2nothing = isCommonlyMappedToNothing; // utils
@@ -762,12 +763,12 @@ const getCodePoint = character => character.codePointAt(0);
762
763
  const first = x => x[0];
763
764
 
764
765
  const last = x => x[x.length - 1];
765
- /**
766
- * Convert provided string into an array of Unicode Code Points.
767
- * Based on https://stackoverflow.com/a/21409165/1556249
768
- * and https://www.npmjs.com/package/code-point-at.
769
- * @param {string} input
770
- * @returns {number[]}
766
+ /**
767
+ * Convert provided string into an array of Unicode Code Points.
768
+ * Based on https://stackoverflow.com/a/21409165/1556249
769
+ * and https://www.npmjs.com/package/code-point-at.
770
+ * @param {string} input
771
+ * @returns {number[]}
771
772
  */
772
773
 
773
774
 
@@ -793,12 +794,12 @@ function toCodePoints(input) {
793
794
 
794
795
  return codepoints;
795
796
  }
796
- /**
797
- * SASLprep.
798
- * @param {string} input
799
- * @param {Object} opts
800
- * @param {boolean} opts.allowUnassigned
801
- * @returns {string}
797
+ /**
798
+ * SASLprep.
799
+ * @param {string} input
800
+ * @param {Object} opts
801
+ * @param {boolean} opts.allowUnassigned
802
+ * @returns {string}
802
803
  */
803
804
 
804
805
 
@@ -842,10 +843,10 @@ function saslprep(input, opts = {}) {
842
843
  if (hasBidiRAL && hasBidiL) {
843
844
  throw new Error('String must not contain RandALCat and LCat at the same time,' + ' see https://tools.ietf.org/html/rfc3454#section-6');
844
845
  }
845
- /**
846
- * 4.2 If a string contains any RandALCat character, a RandALCat
847
- * character MUST be the first character of the string, and a
848
- * RandALCat character MUST be the last character of the string.
846
+ /**
847
+ * 4.2 If a string contains any RandALCat character, a RandALCat
848
+ * character MUST be the first character of the string, and a
849
+ * RandALCat character MUST be the last character of the string.
849
850
  */
850
851
 
851
852
 
@@ -859,9 +860,9 @@ function saslprep(input, opts = {}) {
859
860
  return normalized_input;
860
861
  }
861
862
 
862
- /*
863
- PDFSecurity - represents PDF security settings
864
- By Yang Liu <hi@zesik.com>
863
+ /*
864
+ PDFSecurity - represents PDF security settings
865
+ By Yang Liu <hi@zesik.com>
865
866
  */
866
867
 
867
868
  class PDFSecurity {
@@ -1462,7 +1463,7 @@ class PDFGradient {
1462
1463
  return pattern;
1463
1464
  }
1464
1465
 
1465
- apply(op) {
1466
+ apply(stroke) {
1466
1467
  // apply gradient transform to existing document ctm
1467
1468
  const [m0, m1, m2, m3, m4, m5] = this.doc._ctm;
1468
1469
  const [m11, m12, m21, m22, dx, dy] = this.transform;
@@ -1472,6 +1473,9 @@ class PDFGradient {
1472
1473
  this.embed(m);
1473
1474
  }
1474
1475
 
1476
+ this.doc._setColorSpace('Pattern', stroke);
1477
+
1478
+ const op = stroke ? 'SCN' : 'scn';
1475
1479
  return this.doc.addContent(`/${this.id} ${op}`);
1476
1480
  }
1477
1481
 
@@ -1536,24 +1540,119 @@ var Gradient = {
1536
1540
  PDFRadialGradient
1537
1541
  };
1538
1542
 
1543
+ /*
1544
+ PDF tiling pattern support. Uncolored only.
1545
+ */
1546
+ const underlyingColorSpaces = ['DeviceCMYK', 'DeviceRGB'];
1547
+
1548
+ class PDFTilingPattern {
1549
+ constructor(doc, bBox, xStep, yStep, stream) {
1550
+ this.doc = doc;
1551
+ this.bBox = bBox;
1552
+ this.xStep = xStep;
1553
+ this.yStep = yStep;
1554
+ this.stream = stream;
1555
+ }
1556
+
1557
+ createPattern() {
1558
+ // no resources needed for our current usage
1559
+ // required entry
1560
+ const resources = this.doc.ref();
1561
+ resources.end(); // apply default transform matrix (flipped in the default doc._ctm)
1562
+ // see document.js & gradient.js
1563
+
1564
+ const [m0, m1, m2, m3, m4, m5] = this.doc._ctm;
1565
+ const [m11, m12, m21, m22, dx, dy] = [1, 0, 0, 1, 0, 0];
1566
+ const m = [m0 * m11 + m2 * m12, m1 * m11 + m3 * m12, m0 * m21 + m2 * m22, m1 * m21 + m3 * m22, m0 * dx + m2 * dy + m4, m1 * dx + m3 * dy + m5];
1567
+ const pattern = this.doc.ref({
1568
+ Type: 'Pattern',
1569
+ PatternType: 1,
1570
+ // tiling
1571
+ PaintType: 2,
1572
+ // 1-colored, 2-uncolored
1573
+ TilingType: 2,
1574
+ // 2-no distortion
1575
+ BBox: this.bBox,
1576
+ XStep: this.xStep,
1577
+ YStep: this.yStep,
1578
+ Matrix: m.map(v => +v.toFixed(5)),
1579
+ Resources: resources
1580
+ });
1581
+ pattern.end(this.stream);
1582
+ return pattern;
1583
+ }
1584
+
1585
+ embedPatternColorSpaces() {
1586
+ // map each pattern to an underlying color space
1587
+ // and embed on each page
1588
+ underlyingColorSpaces.forEach(csName => {
1589
+ const csId = this.getPatternColorSpaceId(csName);
1590
+ if (this.doc.page.colorSpaces[csId]) return;
1591
+ const cs = this.doc.ref(['Pattern', csName]);
1592
+ cs.end();
1593
+ this.doc.page.colorSpaces[csId] = cs;
1594
+ });
1595
+ }
1596
+
1597
+ getPatternColorSpaceId(underlyingColorspace) {
1598
+ return `CsP${underlyingColorspace}`;
1599
+ }
1600
+
1601
+ embed() {
1602
+ if (!this.id) {
1603
+ this.doc._patternCount = this.doc._patternCount + 1;
1604
+ this.id = 'P' + this.doc._patternCount;
1605
+ this.pattern = this.createPattern();
1606
+ } // patterns are embedded in each page
1607
+
1608
+
1609
+ if (!this.doc.page.patterns[this.id]) {
1610
+ this.doc.page.patterns[this.id] = this.pattern;
1611
+ }
1612
+ }
1613
+
1614
+ apply(stroke, patternColor) {
1615
+ // do any embedding/creating that might be needed
1616
+ this.embedPatternColorSpaces();
1617
+ this.embed();
1618
+
1619
+ const normalizedColor = this.doc._normalizeColor(patternColor);
1620
+
1621
+ if (!normalizedColor) throw Error(`invalid pattern color. (value: ${patternColor})`); // select one of the pattern color spaces
1622
+
1623
+ const csId = this.getPatternColorSpaceId(this.doc._getColorSpace(normalizedColor));
1624
+
1625
+ this.doc._setColorSpace(csId, stroke); // stroke/fill using the pattern and color (in the above underlying color space)
1626
+
1627
+
1628
+ const op = stroke ? 'SCN' : 'scn';
1629
+ return this.doc.addContent(`${normalizedColor.join(' ')} /${this.id} ${op}`);
1630
+ }
1631
+
1632
+ }
1633
+
1634
+ var pattern = {
1635
+ PDFTilingPattern
1636
+ };
1637
+
1539
1638
  const {
1540
1639
  PDFGradient: PDFGradient$1,
1541
1640
  PDFLinearGradient: PDFLinearGradient$1,
1542
1641
  PDFRadialGradient: PDFRadialGradient$1
1543
1642
  } = Gradient;
1643
+ const {
1644
+ PDFTilingPattern: PDFTilingPattern$1
1645
+ } = pattern;
1544
1646
  var ColorMixin = {
1545
1647
  initColor() {
1546
1648
  // The opacity dictionaries
1547
1649
  this._opacityRegistry = {};
1548
1650
  this._opacityCount = 0;
1651
+ this._patternCount = 0;
1549
1652
  return this._gradCount = 0;
1550
1653
  },
1551
1654
 
1552
1655
  _normalizeColor(color) {
1553
- if (color instanceof PDFGradient$1) {
1554
- return color;
1555
- }
1556
-
1557
1656
  if (typeof color === 'string') {
1558
1657
  if (color.charAt(0) === '#') {
1559
1658
  if (color.length === 4) {
@@ -1582,6 +1681,19 @@ var ColorMixin = {
1582
1681
  },
1583
1682
 
1584
1683
  _setColor(color, stroke) {
1684
+ if (color instanceof PDFGradient$1) {
1685
+ color.apply(stroke);
1686
+ return true; // see if tiling pattern, decode & apply it it
1687
+ } else if (Array.isArray(color) && color[0] instanceof PDFTilingPattern$1) {
1688
+ color[0].apply(stroke, color[1]);
1689
+ return true;
1690
+ } // any other case should be a normal color and not a pattern
1691
+
1692
+
1693
+ return this._setColorCore(color, stroke);
1694
+ },
1695
+
1696
+ _setColorCore(color, stroke) {
1585
1697
  color = this._normalizeColor(color);
1586
1698
 
1587
1699
  if (!color) {
@@ -1590,19 +1702,12 @@ var ColorMixin = {
1590
1702
 
1591
1703
  const op = stroke ? 'SCN' : 'scn';
1592
1704
 
1593
- if (color instanceof PDFGradient$1) {
1594
- this._setColorSpace('Pattern', stroke);
1595
-
1596
- color.apply(op);
1597
- } else {
1598
- const space = color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
1599
-
1600
- this._setColorSpace(space, stroke);
1705
+ const space = this._getColorSpace(color);
1601
1706
 
1602
- color = color.join(' ');
1603
- this.addContent(`${color} ${op}`);
1604
- }
1707
+ this._setColorSpace(space, stroke);
1605
1708
 
1709
+ color = color.join(' ');
1710
+ this.addContent(`${color} ${op}`);
1606
1711
  return true;
1607
1712
  },
1608
1713
 
@@ -1611,6 +1716,10 @@ var ColorMixin = {
1611
1716
  return this.addContent(`/${space} ${op}`);
1612
1717
  },
1613
1718
 
1719
+ _getColorSpace(color) {
1720
+ return color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
1721
+ },
1722
+
1614
1723
  fillColor(color, opacity) {
1615
1724
  const set = this._setColor(color, false);
1616
1725
 
@@ -1701,6 +1810,10 @@ var ColorMixin = {
1701
1810
 
1702
1811
  radialGradient(x1, y1, r1, x2, y2, r2) {
1703
1812
  return new PDFRadialGradient$1(this, x1, y1, r1, x2, y2, r2);
1813
+ },
1814
+
1815
+ pattern(bbox, xStep, yStep, stream) {
1816
+ return new PDFTilingPattern$1(this, bbox, xStep, yStep, stream);
1704
1817
  }
1705
1818
 
1706
1819
  };
@@ -4081,10 +4194,10 @@ var TextMixin = {
4081
4194
 
4082
4195
  if (options.destination != null) {
4083
4196
  this.addNamedDestination(options.destination, 'XYZ', x, y, null);
4084
- } // create underline or strikethrough line
4197
+ } // create underline
4085
4198
 
4086
4199
 
4087
- if (options.underline || options.strike) {
4200
+ if (options.underline) {
4088
4201
  this.save();
4089
4202
 
4090
4203
  if (!options.stroke) {
@@ -4093,13 +4206,24 @@ var TextMixin = {
4093
4206
 
4094
4207
  const lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
4095
4208
  this.lineWidth(lineWidth);
4096
- const d = options.underline ? 1 : 2;
4097
- let lineY = y + this.currentLineHeight() / d;
4209
+ let lineY = y + this.currentLineHeight() - lineWidth;
4210
+ this.moveTo(x, lineY);
4211
+ this.lineTo(x + renderedWidth, lineY);
4212
+ this.stroke();
4213
+ this.restore();
4214
+ } // create strikethrough line
4215
+
4098
4216
 
4099
- if (options.underline) {
4100
- lineY -= lineWidth;
4217
+ if (options.strike) {
4218
+ this.save();
4219
+
4220
+ if (!options.stroke) {
4221
+ this.strokeColor(...(this._fillColor || []));
4101
4222
  }
4102
4223
 
4224
+ const lineWidth = this._fontSize < 10 ? 0.5 : Math.floor(this._fontSize / 10);
4225
+ this.lineWidth(lineWidth);
4226
+ let lineY = y + this.currentLineHeight() / 2;
4103
4227
  this.moveTo(x, lineY);
4104
4228
  this.lineTo(x + renderedWidth, lineY);
4105
4229
  this.stroke();
@@ -4482,9 +4606,9 @@ class PNGImage {
4482
4606
 
4483
4607
  }
4484
4608
 
4485
- /*
4486
- PDFImage - embeds images in PDF documents
4487
- By Devon Govett
4609
+ /*
4610
+ PDFImage - embeds images in PDF documents
4611
+ By Devon Govett
4488
4612
  */
4489
4613
 
4490
4614
  class PDFImage {
@@ -4908,29 +5032,18 @@ var OutlineMixin = {
4908
5032
 
4909
5033
  };
4910
5034
 
4911
- function _defineProperty(obj, key, value) {
4912
- if (key in obj) {
4913
- Object.defineProperty(obj, key, {
4914
- value: value,
4915
- enumerable: true,
4916
- configurable: true,
4917
- writable: true
4918
- });
4919
- } else {
4920
- obj[key] = value;
4921
- }
4922
-
4923
- return obj;
4924
- }
4925
-
4926
5035
  function ownKeys(object, enumerableOnly) {
4927
5036
  var keys = Object.keys(object);
4928
5037
 
4929
5038
  if (Object.getOwnPropertySymbols) {
4930
5039
  var symbols = Object.getOwnPropertySymbols(object);
4931
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
4932
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4933
- });
5040
+
5041
+ if (enumerableOnly) {
5042
+ symbols = symbols.filter(function (sym) {
5043
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
5044
+ });
5045
+ }
5046
+
4934
5047
  keys.push.apply(keys, symbols);
4935
5048
  }
4936
5049
 
@@ -4957,9 +5070,24 @@ function _objectSpread2(target) {
4957
5070
  return target;
4958
5071
  }
4959
5072
 
4960
- /*
4961
- PDFStructureContent - a reference to a marked structure content
4962
- By Ben Schmidt
5073
+ function _defineProperty(obj, key, value) {
5074
+ if (key in obj) {
5075
+ Object.defineProperty(obj, key, {
5076
+ value: value,
5077
+ enumerable: true,
5078
+ configurable: true,
5079
+ writable: true
5080
+ });
5081
+ } else {
5082
+ obj[key] = value;
5083
+ }
5084
+
5085
+ return obj;
5086
+ }
5087
+
5088
+ /*
5089
+ PDFStructureContent - a reference to a marked structure content
5090
+ By Ben Schmidt
4963
5091
  */
4964
5092
  class PDFStructureContent {
4965
5093
  constructor(pageRef, mcid) {
@@ -4975,9 +5103,9 @@ class PDFStructureContent {
4975
5103
 
4976
5104
  }
4977
5105
 
4978
- /*
4979
- PDFStructureElement - represents an element in the PDF logical structure tree
4980
- By Ben Schmidt
5106
+ /*
5107
+ PDFStructureElement - represents an element in the PDF logical structure tree
5108
+ By Ben Schmidt
4981
5109
  */
4982
5110
 
4983
5111
  class PDFStructureElement {
@@ -5191,8 +5319,8 @@ class PDFStructureElement {
5191
5319
 
5192
5320
  }
5193
5321
 
5194
- /*
5195
- PDFNumberTree - represents a number tree object
5322
+ /*
5323
+ PDFNumberTree - represents a number tree object
5196
5324
  */
5197
5325
 
5198
5326
  class PDFNumberTree extends PDFTree {
@@ -5215,7 +5343,8 @@ var MarkingsMixin = {
5215
5343
  this.structChildren = [];
5216
5344
 
5217
5345
  if (options.tagged) {
5218
- this.getMarkingsDictionary().data.Marked = true;
5346
+ this.getMarkInfoDictionary().data.Marked = true;
5347
+ this.getStructTreeRoot();
5219
5348
  }
5220
5349
  },
5221
5350
 
@@ -5343,18 +5472,18 @@ var MarkingsMixin = {
5343
5472
  return pageMarkings;
5344
5473
  },
5345
5474
 
5346
- getMarkingsDictionary() {
5347
- if (!this._root.data.Markings) {
5348
- this._root.data.Markings = this.ref({});
5475
+ getMarkInfoDictionary() {
5476
+ if (!this._root.data.MarkInfo) {
5477
+ this._root.data.MarkInfo = this.ref({});
5349
5478
  }
5350
5479
 
5351
- return this._root.data.Markings;
5480
+ return this._root.data.MarkInfo;
5352
5481
  },
5353
5482
 
5354
5483
  getStructTreeRoot() {
5355
5484
  if (!this._root.data.StructTreeRoot) {
5356
5485
  this._root.data.StructTreeRoot = this.ref({
5357
- Type: "StructTreeRoot",
5486
+ Type: 'StructTreeRoot',
5358
5487
  ParentTree: new PDFNumberTree(),
5359
5488
  ParentTreeNextKey: 0
5360
5489
  });
@@ -5368,8 +5497,8 @@ var MarkingsMixin = {
5368
5497
  },
5369
5498
 
5370
5499
  createStructParentTreeNextKey() {
5371
- // initialise the Markings dictionary
5372
- this.getMarkingsDictionary();
5500
+ // initialise the MarkInfo dictionary
5501
+ this.getMarkInfoDictionary();
5373
5502
  const structTreeRoot = this.getStructTreeRoot();
5374
5503
  const key = structTreeRoot.data.ParentTreeNextKey++;
5375
5504
  structTreeRoot.data.ParentTree.add(key, []);
@@ -5384,8 +5513,8 @@ var MarkingsMixin = {
5384
5513
  this.structChildren.forEach(structElem => structElem.end());
5385
5514
  }
5386
5515
 
5387
- if (this._root.data.Markings) {
5388
- this._root.data.Markings.end();
5516
+ if (this._root.data.MarkInfo) {
5517
+ this._root.data.MarkInfo.end();
5389
5518
  }
5390
5519
  }
5391
5520
 
@@ -5436,9 +5565,9 @@ const FORMAT_DEFAULT = {
5436
5565
  }
5437
5566
  };
5438
5567
  var AcroFormMixin = {
5439
- /**
5440
- * Must call if adding AcroForms to a document. Must also call font() before
5441
- * this method to set the default font.
5568
+ /**
5569
+ * Must call if adding AcroForms to a document. Must also call font() before
5570
+ * this method to set the default font.
5442
5571
  */
5443
5572
  initForm() {
5444
5573
  if (!this._font) {
@@ -5464,8 +5593,8 @@ var AcroFormMixin = {
5464
5593
  return this;
5465
5594
  },
5466
5595
 
5467
- /**
5468
- * Called automatically by document.js
5596
+ /**
5597
+ * Called automatically by document.js
5469
5598
  */
5470
5599
  endAcroForm() {
5471
5600
  if (this._root.data.AcroForm) {
@@ -5499,12 +5628,12 @@ var AcroFormMixin = {
5499
5628
  return this;
5500
5629
  },
5501
5630
 
5502
- /**
5503
- * Creates and adds a form field to the document. Form fields are intermediate
5504
- * nodes in a PDF form that are used to specify form name heirarchy and form
5505
- * value defaults.
5506
- * @param {string} name - field name (T attribute in field dictionary)
5507
- * @param {object} options - other attributes to include in field dictionary
5631
+ /**
5632
+ * Creates and adds a form field to the document. Form fields are intermediate
5633
+ * nodes in a PDF form that are used to specify form name heirarchy and form
5634
+ * value defaults.
5635
+ * @param {string} name - field name (T attribute in field dictionary)
5636
+ * @param {object} options - other attributes to include in field dictionary
5508
5637
  */
5509
5638
  formField(name, options = {}) {
5510
5639
  let fieldDict = this._fieldDict(name, null, options);
@@ -5516,16 +5645,16 @@ var AcroFormMixin = {
5516
5645
  return fieldRef;
5517
5646
  },
5518
5647
 
5519
- /**
5520
- * Creates and adds a Form Annotation to the document. Form annotations are
5521
- * called Widget annotations internally within a PDF file.
5522
- * @param {string} name - form field name (T attribute of widget annotation
5523
- * dictionary)
5524
- * @param {number} x
5525
- * @param {number} y
5526
- * @param {number} w
5527
- * @param {number} h
5528
- * @param {object} options
5648
+ /**
5649
+ * Creates and adds a Form Annotation to the document. Form annotations are
5650
+ * called Widget annotations internally within a PDF file.
5651
+ * @param {string} name - form field name (T attribute of widget annotation
5652
+ * dictionary)
5653
+ * @param {number} x
5654
+ * @param {number} y
5655
+ * @param {number} w
5656
+ * @param {number} h
5657
+ * @param {object} options
5529
5658
  */
5530
5659
  formAnnotation(name, type, x, y, w, h, options = {}) {
5531
5660
  let fieldDict = this._fieldDict(name, type, options);
@@ -5749,9 +5878,11 @@ var AcroFormMixin = {
5749
5878
  if (this._acroform.defaultFont !== this._font.name) {
5750
5879
  options.DR = {
5751
5880
  Font: {}
5752
- };
5881
+ }; // Get the fontSize option. If not set use auto sizing
5882
+
5883
+ const fontSize = options.fontSize || 0;
5753
5884
  options.DR.Font[this._font.id] = this._font.ref();
5754
- options.DA = new String(`/${this._font.id} 0 Tf 0 g`);
5885
+ options.DA = new String(`/${this._font.id} ${fontSize} Tf 0 g`);
5755
5886
  }
5756
5887
 
5757
5888
  return options;
@@ -5811,17 +5942,17 @@ var AcroFormMixin = {
5811
5942
  };
5812
5943
 
5813
5944
  var AttachmentsMixin = {
5814
- /**
5815
- * Embed contents of `src` in PDF
5816
- * @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
5817
- * @param {object} options
5818
- * * options.name: filename to be shown in PDF, will use `src` if none set
5819
- * * options.type: filetype to be shown in PDF
5820
- * * options.description: description to be shown in PDF
5821
- * * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
5822
- * * options.creationDate: override creation date
5823
- * * options.modifiedDate: override modified date
5824
- * @returns filespec reference
5945
+ /**
5946
+ * Embed contents of `src` in PDF
5947
+ * @param {Buffer | ArrayBuffer | string} src input Buffer, ArrayBuffer, base64 encoded string or path to file
5948
+ * @param {object} options
5949
+ * * options.name: filename to be shown in PDF, will use `src` if none set
5950
+ * * options.type: filetype to be shown in PDF
5951
+ * * options.description: description to be shown in PDF
5952
+ * * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
5953
+ * * options.creationDate: override creation date
5954
+ * * options.modifiedDate: override modified date
5955
+ * @returns filespec reference
5825
5956
  */
5826
5957
  file(src, options = {}) {
5827
5958
  options.name = options.name || src;
@@ -5927,16 +6058,12 @@ var AttachmentsMixin = {
5927
6058
  /** check two embedded file metadata objects for equality */
5928
6059
 
5929
6060
  function isEqual(a, b) {
5930
- if (a.Subtype !== b.Subtype || a.Params.CheckSum.toString() !== b.Params.CheckSum.toString() || a.Params.Size !== b.Params.Size || a.Params.CreationDate !== b.Params.CreationDate || a.Params.ModDate !== b.Params.ModDate) {
5931
- return false;
5932
- }
5933
-
5934
- return true;
6061
+ return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate === b.Params.CreationDate && a.Params.ModDate === b.Params.ModDate;
5935
6062
  }
5936
6063
 
5937
- /*
5938
- PDFDocument - represents an entire PDF document
5939
- By Devon Govett
6064
+ /*
6065
+ PDFDocument - represents an entire PDF document
6066
+ By Devon Govett
5940
6067
  */
5941
6068
 
5942
6069
  class PDFDocument extends stream.Readable {