pdfmake 0.2.17 → 0.2.18

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/build/pdfmake.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! pdfmake v0.2.17, @license MIT, @link http://pdfmake.org */
1
+ /*! pdfmake v0.2.18, @license MIT, @link http://pdfmake.org */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -16191,7 +16191,7 @@ module.exports = LayoutBuilder;
16191
16191
 
16192
16192
  /***/ }),
16193
16193
 
16194
- /***/ 82383:
16194
+ /***/ 30357:
16195
16195
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
16196
16196
 
16197
16197
  "use strict";
@@ -16205,7 +16205,6 @@ __webpack_require__(11765);
16205
16205
  __webpack_require__(7585);
16206
16206
  __webpack_require__(7283);
16207
16207
  __webpack_require__(58281);
16208
- __webpack_require__(94712);
16209
16208
  Object.defineProperty(exports, "__esModule", ({
16210
16209
  value: true
16211
16210
  }));
@@ -16228,6 +16227,7 @@ __webpack_require__(10849);
16228
16227
  __webpack_require__(18756);
16229
16228
  __webpack_require__(37309);
16230
16229
  __webpack_require__(14032);
16230
+ __webpack_require__(59883);
16231
16231
  __webpack_require__(68067);
16232
16232
  __webpack_require__(61726);
16233
16233
  __webpack_require__(57114);
@@ -16264,7 +16264,9 @@ __webpack_require__(84538);
16264
16264
  __webpack_require__(64793);
16265
16265
  __webpack_require__(74202);
16266
16266
  __webpack_require__(52529);
16267
+ __webpack_require__(64654);
16267
16268
  __webpack_require__(42437);
16269
+ __webpack_require__(94712);
16268
16270
  var _stream = _interopRequireDefault(__webpack_require__(9760));
16269
16271
  var _zlib = _interopRequireDefault(__webpack_require__(6729));
16270
16272
  var _cryptoJs = _interopRequireDefault(__webpack_require__(94119));
@@ -16347,6 +16349,29 @@ var PDFTree = /*#__PURE__*/function () {
16347
16349
  };
16348
16350
  return PDFTree;
16349
16351
  }();
16352
+ var SpotColor = /*#__PURE__*/function () {
16353
+ function SpotColor(doc, name, C, M, Y, K) {
16354
+ this.id = 'CS' + Object.keys(doc.spotColors).length;
16355
+ this.name = name;
16356
+ this.values = [C, M, Y, K];
16357
+ this.ref = doc.ref(['Separation', this.name, 'DeviceCMYK', {
16358
+ Range: [0, 1, 0, 1, 0, 1, 0, 1],
16359
+ C0: [0, 0, 0, 0],
16360
+ C1: this.values.map(function (value) {
16361
+ return value / 100;
16362
+ }),
16363
+ FunctionType: 2,
16364
+ Domain: [0, 1],
16365
+ N: 1
16366
+ }]);
16367
+ this.ref.end();
16368
+ }
16369
+ var _proto3 = SpotColor.prototype;
16370
+ _proto3.toString = function toString() {
16371
+ return this.ref.id + " 0 R";
16372
+ };
16373
+ return SpotColor;
16374
+ }();
16350
16375
  /*
16351
16376
  PDFObject - converts JavaScript types into their corresponding PDF types.
16352
16377
  By Devon Govett
@@ -16424,7 +16449,7 @@ var PDFObject = /*#__PURE__*/function () {
16424
16449
  // Buffers are converted to PDF hex strings
16425
16450
  } else if (Buffer.isBuffer(object)) {
16426
16451
  return "<" + object.toString('hex') + ">";
16427
- } else if (object instanceof PDFAbstractReference || object instanceof PDFTree) {
16452
+ } else if (object instanceof PDFAbstractReference || object instanceof PDFTree || object instanceof SpotColor) {
16428
16453
  return object.toString();
16429
16454
  } else if (object instanceof Date) {
16430
16455
  var _string = "D:" + pad(object.getUTCFullYear(), 4) + pad(object.getUTCMonth() + 1, 2) + pad(object.getUTCDate(), 2) + pad(object.getUTCHours(), 2) + pad(object.getUTCMinutes(), 2) + pad(object.getUTCSeconds(), 2) + 'Z';
@@ -16485,8 +16510,8 @@ var PDFReference = /*#__PURE__*/function (_PDFAbstractReference) {
16485
16510
  return _this2;
16486
16511
  }
16487
16512
  _inheritsLoose(PDFReference, _PDFAbstractReference);
16488
- var _proto3 = PDFReference.prototype;
16489
- _proto3.write = function write(chunk) {
16513
+ var _proto4 = PDFReference.prototype;
16514
+ _proto4.write = function write(chunk) {
16490
16515
  if (!Buffer.isBuffer(chunk)) {
16491
16516
  chunk = Buffer.from(chunk + '\n', 'binary');
16492
16517
  }
@@ -16500,13 +16525,13 @@ var PDFReference = /*#__PURE__*/function (_PDFAbstractReference) {
16500
16525
  return this.data.Filter = 'FlateDecode';
16501
16526
  }
16502
16527
  };
16503
- _proto3.end = function end(chunk) {
16528
+ _proto4.end = function end(chunk) {
16504
16529
  if (chunk) {
16505
16530
  this.write(chunk);
16506
16531
  }
16507
16532
  return this.finalize();
16508
16533
  };
16509
- _proto3.finalize = function finalize() {
16534
+ _proto4.finalize = function finalize() {
16510
16535
  this.offset = this.document._offset;
16511
16536
  var encryptFn = this.document._security ? this.document._security.getEncryptFn(this.id, this.gen) : null;
16512
16537
  if (this.buffer.length) {
@@ -16530,7 +16555,7 @@ var PDFReference = /*#__PURE__*/function (_PDFAbstractReference) {
16530
16555
  this.document._write('endobj');
16531
16556
  this.document._refEnd(this);
16532
16557
  };
16533
- _proto3.toString = function toString() {
16558
+ _proto4.toString = function toString() {
16534
16559
  return this.id + " " + this.gen + " R";
16535
16560
  };
16536
16561
  return PDFReference;
@@ -16641,15 +16666,29 @@ var PDFPage = /*#__PURE__*/function () {
16641
16666
  }
16642
16667
 
16643
16668
  // Lazily create these objects
16644
- var _proto4 = PDFPage.prototype;
16645
- _proto4.maxY = function maxY() {
16669
+ var _proto5 = PDFPage.prototype;
16670
+ _proto5.maxY = function maxY() {
16646
16671
  return this.height - this.margins.bottom;
16647
16672
  };
16648
- _proto4.write = function write(chunk) {
16673
+ _proto5.write = function write(chunk) {
16649
16674
  return this.content.write(chunk);
16675
+ }
16676
+
16677
+ // Set tab order if document is tagged for accessibility.
16678
+ ;
16679
+ _proto5._setTabOrder = function _setTabOrder() {
16680
+ if (!this.dictionary.Tabs && this.document.hasMarkInfoDictionary()) {
16681
+ this.dictionary.data.Tabs = 'S';
16682
+ }
16650
16683
  };
16651
- _proto4.end = function end() {
16684
+ _proto5.end = function end() {
16685
+ this._setTabOrder();
16652
16686
  this.dictionary.end();
16687
+ this.resources.data.ColorSpace = this.resources.data.ColorSpace || {};
16688
+ for (var _i = 0, _Object$values = Object.values(this.document.spotColors); _i < _Object$values.length; _i++) {
16689
+ var color = _Object$values[_i];
16690
+ this.resources.data.ColorSpace[color.id] = color;
16691
+ }
16653
16692
  this.resources.end();
16654
16693
  return this.content.end();
16655
16694
  };
@@ -16705,14 +16744,14 @@ var PDFNameTree = /*#__PURE__*/function (_PDFTree) {
16705
16744
  return _PDFTree.apply(this, arguments) || this;
16706
16745
  }
16707
16746
  _inheritsLoose(PDFNameTree, _PDFTree);
16708
- var _proto5 = PDFNameTree.prototype;
16709
- _proto5._compareKeys = function _compareKeys(a, b) {
16747
+ var _proto6 = PDFNameTree.prototype;
16748
+ _proto6._compareKeys = function _compareKeys(a, b) {
16710
16749
  return a.localeCompare(b);
16711
16750
  };
16712
- _proto5._keysName = function _keysName() {
16751
+ _proto6._keysName = function _keysName() {
16713
16752
  return "Names";
16714
16753
  };
16715
- _proto5._dataForKey = function _dataForKey(k) {
16754
+ _proto6._dataForKey = function _dataForKey(k) {
16716
16755
  return new String(k);
16717
16756
  };
16718
16757
  return PDFNameTree;
@@ -17028,8 +17067,8 @@ var PDFSecurity = /*#__PURE__*/function () {
17028
17067
  }
17029
17068
  return new PDFSecurity(document, options);
17030
17069
  };
17031
- var _proto6 = PDFSecurity.prototype;
17032
- _proto6._setupEncryption = function _setupEncryption(options) {
17070
+ var _proto7 = PDFSecurity.prototype;
17071
+ _proto7._setupEncryption = function _setupEncryption(options) {
17033
17072
  switch (options.pdfVersion) {
17034
17073
  case '1.4':
17035
17074
  case '1.5':
@@ -17061,7 +17100,7 @@ var PDFSecurity = /*#__PURE__*/function () {
17061
17100
  }
17062
17101
  this.dictionary = this.document.ref(encDict);
17063
17102
  };
17064
- _proto6._setupEncryptionV1V2V4 = function _setupEncryptionV1V2V4(v, encDict, options) {
17103
+ _proto7._setupEncryptionV1V2V4 = function _setupEncryptionV1V2V4(v, encDict, options) {
17065
17104
  var r, permissions;
17066
17105
  switch (v) {
17067
17106
  case 1:
@@ -17110,7 +17149,7 @@ var PDFSecurity = /*#__PURE__*/function () {
17110
17149
  encDict.U = wordArrayToBuffer(userPasswordEntry);
17111
17150
  encDict.P = permissions;
17112
17151
  };
17113
- _proto6._setupEncryptionV5 = function _setupEncryptionV5(encDict, options) {
17152
+ _proto7._setupEncryptionV5 = function _setupEncryptionV5(encDict, options) {
17114
17153
  this.keyBits = 256;
17115
17154
  var permissions = getPermissionsR3(options.permissions);
17116
17155
  var processedUserPassword = processPasswordR5(options.userPassword);
@@ -17142,7 +17181,7 @@ var PDFSecurity = /*#__PURE__*/function () {
17142
17181
  encDict.P = permissions;
17143
17182
  encDict.Perms = wordArrayToBuffer(permsEntry);
17144
17183
  };
17145
- _proto6.getEncryptFn = function getEncryptFn(obj, gen) {
17184
+ _proto7.getEncryptFn = function getEncryptFn(obj, gen) {
17146
17185
  var digest;
17147
17186
  if (this.version < 5) {
17148
17187
  digest = this.encryptionKey.clone().concat(_cryptoJs.default.lib.WordArray.create([(obj & 0xff) << 24 | (obj & 0xff00) << 8 | obj >> 8 & 0xff00 | gen & 0xff, (gen & 0xff00) << 16], 5));
@@ -17170,7 +17209,7 @@ var PDFSecurity = /*#__PURE__*/function () {
17170
17209
  return wordArrayToBuffer(iv.clone().concat(_cryptoJs.default.AES.encrypt(_cryptoJs.default.lib.WordArray.create(buffer), key, options).ciphertext));
17171
17210
  };
17172
17211
  };
17173
- _proto6.end = function end() {
17212
+ _proto7.end = function end() {
17174
17213
  this.dictionary.end();
17175
17214
  };
17176
17215
  return PDFSecurity;
@@ -17246,10 +17285,10 @@ function getOwnerPasswordR2R3R4(r, keyBits, paddedUserPassword, paddedOwnerPassw
17246
17285
  key.sigBytes = keyBits / 8;
17247
17286
  var cipher = paddedUserPassword;
17248
17287
  round = r >= 3 ? 20 : 1;
17249
- for (var _i = 0; _i < round; _i++) {
17288
+ for (var _i2 = 0; _i2 < round; _i2++) {
17250
17289
  var xorRound = Math.ceil(key.sigBytes / 4);
17251
17290
  for (var j = 0; j < xorRound; j++) {
17252
- key.words[j] = digest.words[j] ^ (_i | _i << 8 | _i << 16 | _i << 24);
17291
+ key.words[j] = digest.words[j] ^ (_i2 | _i2 << 8 | _i2 << 16 | _i2 << 24);
17253
17292
  }
17254
17293
  cipher = _cryptoJs.default.RC4.encrypt(cipher, key).ciphertext;
17255
17294
  }
@@ -17351,8 +17390,8 @@ var PDFGradient = /*#__PURE__*/function () {
17351
17390
  this.embedded = false;
17352
17391
  this.transform = [1, 0, 0, 1, 0, 0];
17353
17392
  }
17354
- var _proto7 = PDFGradient.prototype;
17355
- _proto7.stop = function stop(pos, color, opacity) {
17393
+ var _proto8 = PDFGradient.prototype;
17394
+ _proto8.stop = function stop(pos, color, opacity) {
17356
17395
  if (opacity == null) {
17357
17396
  opacity = 1;
17358
17397
  }
@@ -17374,11 +17413,11 @@ var PDFGradient = /*#__PURE__*/function () {
17374
17413
  this.stops.push([pos, color, opacity]);
17375
17414
  return this;
17376
17415
  };
17377
- _proto7.setTransform = function setTransform(m11, m12, m21, m22, dx, dy) {
17416
+ _proto8.setTransform = function setTransform(m11, m12, m21, m22, dx, dy) {
17378
17417
  this.transform = [m11, m12, m21, m22, dx, dy];
17379
17418
  return this;
17380
17419
  };
17381
- _proto7.embed = function embed(m) {
17420
+ _proto8.embed = function embed(m) {
17382
17421
  var fn;
17383
17422
  var stopsLength = this.stops.length;
17384
17423
  if (stopsLength === 0) {
@@ -17500,7 +17539,7 @@ var PDFGradient = /*#__PURE__*/function () {
17500
17539
  }
17501
17540
  return pattern;
17502
17541
  };
17503
- _proto7.apply = function apply(stroke) {
17542
+ _proto8.apply = function apply(stroke) {
17504
17543
  // apply gradient transform to existing document ctm
17505
17544
  var _this$doc$_ctm = this.doc._ctm,
17506
17545
  m0 = _this$doc$_ctm[0],
@@ -17537,8 +17576,8 @@ var PDFLinearGradient = /*#__PURE__*/function (_PDFGradient) {
17537
17576
  return _this3;
17538
17577
  }
17539
17578
  _inheritsLoose(PDFLinearGradient, _PDFGradient);
17540
- var _proto8 = PDFLinearGradient.prototype;
17541
- _proto8.shader = function shader(fn) {
17579
+ var _proto9 = PDFLinearGradient.prototype;
17580
+ _proto9.shader = function shader(fn) {
17542
17581
  return this.doc.ref({
17543
17582
  ShadingType: 2,
17544
17583
  ColorSpace: this._colorSpace,
@@ -17547,7 +17586,7 @@ var PDFLinearGradient = /*#__PURE__*/function (_PDFGradient) {
17547
17586
  Extend: [true, true]
17548
17587
  });
17549
17588
  };
17550
- _proto8.opacityGradient = function opacityGradient() {
17589
+ _proto9.opacityGradient = function opacityGradient() {
17551
17590
  return new PDFLinearGradient(this.doc, this.x1, this.y1, this.x2, this.y2);
17552
17591
  };
17553
17592
  return PDFLinearGradient;
@@ -17566,8 +17605,8 @@ var PDFRadialGradient = /*#__PURE__*/function (_PDFGradient2) {
17566
17605
  return _this4;
17567
17606
  }
17568
17607
  _inheritsLoose(PDFRadialGradient, _PDFGradient2);
17569
- var _proto9 = PDFRadialGradient.prototype;
17570
- _proto9.shader = function shader(fn) {
17608
+ var _proto10 = PDFRadialGradient.prototype;
17609
+ _proto10.shader = function shader(fn) {
17571
17610
  return this.doc.ref({
17572
17611
  ShadingType: 3,
17573
17612
  ColorSpace: this._colorSpace,
@@ -17576,7 +17615,7 @@ var PDFRadialGradient = /*#__PURE__*/function (_PDFGradient2) {
17576
17615
  Extend: [true, true]
17577
17616
  });
17578
17617
  };
17579
- _proto9.opacityGradient = function opacityGradient() {
17618
+ _proto10.opacityGradient = function opacityGradient() {
17580
17619
  return new PDFRadialGradient(this.doc, this.x1, this.y1, this.r1, this.x2, this.y2, this.r2);
17581
17620
  };
17582
17621
  return PDFRadialGradient;
@@ -17600,8 +17639,8 @@ var PDFTilingPattern = /*#__PURE__*/function () {
17600
17639
  this.yStep = yStep;
17601
17640
  this.stream = stream;
17602
17641
  }
17603
- var _proto10 = PDFTilingPattern.prototype;
17604
- _proto10.createPattern = function createPattern() {
17642
+ var _proto11 = PDFTilingPattern.prototype;
17643
+ _proto11.createPattern = function createPattern() {
17605
17644
  // no resources needed for our current usage
17606
17645
  // required entry
17607
17646
  var resources = this.doc.ref();
@@ -17641,7 +17680,7 @@ var PDFTilingPattern = /*#__PURE__*/function () {
17641
17680
  pattern.end(this.stream);
17642
17681
  return pattern;
17643
17682
  };
17644
- _proto10.embedPatternColorSpaces = function embedPatternColorSpaces() {
17683
+ _proto11.embedPatternColorSpaces = function embedPatternColorSpaces() {
17645
17684
  var _this5 = this;
17646
17685
  // map each pattern to an underlying color space
17647
17686
  // and embed on each page
@@ -17653,10 +17692,10 @@ var PDFTilingPattern = /*#__PURE__*/function () {
17653
17692
  _this5.doc.page.colorSpaces[csId] = cs;
17654
17693
  });
17655
17694
  };
17656
- _proto10.getPatternColorSpaceId = function getPatternColorSpaceId(underlyingColorspace) {
17695
+ _proto11.getPatternColorSpaceId = function getPatternColorSpaceId(underlyingColorspace) {
17657
17696
  return "CsP" + underlyingColorspace;
17658
17697
  };
17659
- _proto10.embed = function embed() {
17698
+ _proto11.embed = function embed() {
17660
17699
  if (!this.id) {
17661
17700
  this.doc._patternCount = this.doc._patternCount + 1;
17662
17701
  this.id = 'P' + this.doc._patternCount;
@@ -17668,7 +17707,7 @@ var PDFTilingPattern = /*#__PURE__*/function () {
17668
17707
  this.doc.page.patterns[this.id] = this.pattern;
17669
17708
  }
17670
17709
  };
17671
- _proto10.apply = function apply(stroke, patternColor) {
17710
+ _proto11.apply = function apply(stroke, patternColor) {
17672
17711
  // do any embedding/creating that might be needed
17673
17712
  this.embedPatternColorSpaces();
17674
17713
  this.embed();
@@ -17694,6 +17733,7 @@ var PDFGradient$1 = Gradient.PDFGradient,
17694
17733
  var PDFTilingPattern$1 = pattern.PDFTilingPattern;
17695
17734
  var ColorMixin = {
17696
17735
  initColor: function initColor() {
17736
+ this.spotColors = {};
17697
17737
  // The opacity dictionaries
17698
17738
  this._opacityRegistry = {};
17699
17739
  this._opacityCount = 0;
@@ -17710,6 +17750,8 @@ var ColorMixin = {
17710
17750
  color = [hex >> 16, hex >> 8 & 0xff, hex & 0xff];
17711
17751
  } else if (namedColors[color]) {
17712
17752
  color = namedColors[color];
17753
+ } else if (this.spotColors[color]) {
17754
+ return this.spotColors[color];
17713
17755
  }
17714
17756
  }
17715
17757
  if (Array.isArray(color)) {
@@ -17748,8 +17790,12 @@ var ColorMixin = {
17748
17790
  var op = stroke ? 'SCN' : 'scn';
17749
17791
  var space = this._getColorSpace(color);
17750
17792
  this._setColorSpace(space, stroke);
17751
- color = color.join(' ');
17752
- this.addContent(color + " " + op);
17793
+ if (color instanceof SpotColor) {
17794
+ this.page.colorSpaces[color.id] = color.ref;
17795
+ this.addContent("1 " + op);
17796
+ } else {
17797
+ this.addContent(color.join(' ') + " " + op);
17798
+ }
17753
17799
  return true;
17754
17800
  },
17755
17801
  _setColorSpace: function _setColorSpace(space, stroke) {
@@ -17757,6 +17803,9 @@ var ColorMixin = {
17757
17803
  return this.addContent("/" + space + " " + op);
17758
17804
  },
17759
17805
  _getColorSpace: function _getColorSpace(color) {
17806
+ if (color instanceof SpotColor) {
17807
+ return color.id;
17808
+ }
17760
17809
  return color.length === 4 ? 'DeviceCMYK' : 'DeviceRGB';
17761
17810
  },
17762
17811
  fillColor: function fillColor(color, opacity) {
@@ -17832,6 +17881,11 @@ var ColorMixin = {
17832
17881
  },
17833
17882
  pattern: function pattern(bbox, xStep, yStep, stream) {
17834
17883
  return new PDFTilingPattern$1(this, bbox, xStep, yStep, stream);
17884
+ },
17885
+ addSpotColor: function addSpotColor(name, C, M, Y, K) {
17886
+ var color = new SpotColor(this, name, C, M, Y, K);
17887
+ this.spotColors[name] = color;
17888
+ return this;
17835
17889
  }
17836
17890
  };
17837
17891
  var namedColors = {
@@ -18528,8 +18582,8 @@ var VectorMixin = {
18528
18582
  points[_key] = arguments[_key];
18529
18583
  }
18530
18584
  this.moveTo.apply(this, points.shift() || []);
18531
- for (var _i2 = 0, _points = points; _i2 < _points.length; _i2++) {
18532
- var point = _points[_i2];
18585
+ for (var _i3 = 0, _points = points; _i3 < _points.length; _i3++) {
18586
+ var point = _points[_i3];
18533
18587
  this.lineTo.apply(this, point || []);
18534
18588
  }
18535
18589
  return this.closePath();
@@ -18703,8 +18757,8 @@ var AFMFont = /*#__PURE__*/function () {
18703
18757
  AFMFont.open = function open(filename) {
18704
18758
  return new AFMFont(fs.readFileSync(filename, 'utf8'));
18705
18759
  };
18706
- var _proto11 = AFMFont.prototype;
18707
- _proto11.parse = function parse() {
18760
+ var _proto12 = AFMFont.prototype;
18761
+ _proto12.parse = function parse() {
18708
18762
  var section = '';
18709
18763
  for (var _iterator5 = _createForOfIteratorHelperLoose(this.contents.split('\n')), _step5; !(_step5 = _iterator5()).done;) {
18710
18764
  var line = _step5.value;
@@ -18747,7 +18801,7 @@ var AFMFont = /*#__PURE__*/function () {
18747
18801
  }
18748
18802
  }
18749
18803
  };
18750
- _proto11.encodeText = function encodeText(text) {
18804
+ _proto12.encodeText = function encodeText(text) {
18751
18805
  var res = [];
18752
18806
  for (var i = 0, len = text.length; i < len; i++) {
18753
18807
  var char = text.charCodeAt(i);
@@ -18756,7 +18810,7 @@ var AFMFont = /*#__PURE__*/function () {
18756
18810
  }
18757
18811
  return res;
18758
18812
  };
18759
- _proto11.glyphsForString = function glyphsForString(string) {
18813
+ _proto12.glyphsForString = function glyphsForString(string) {
18760
18814
  var glyphs = [];
18761
18815
  for (var i = 0, len = string.length; i < len; i++) {
18762
18816
  var charCode = string.charCodeAt(i);
@@ -18764,16 +18818,16 @@ var AFMFont = /*#__PURE__*/function () {
18764
18818
  }
18765
18819
  return glyphs;
18766
18820
  };
18767
- _proto11.characterToGlyph = function characterToGlyph(character) {
18821
+ _proto12.characterToGlyph = function characterToGlyph(character) {
18768
18822
  return characters[WIN_ANSI_MAP[character] || character] || '.notdef';
18769
18823
  };
18770
- _proto11.widthOfGlyph = function widthOfGlyph(glyph) {
18824
+ _proto12.widthOfGlyph = function widthOfGlyph(glyph) {
18771
18825
  return this.glyphWidths[glyph] || 0;
18772
18826
  };
18773
- _proto11.getKernPair = function getKernPair(left, right) {
18827
+ _proto12.getKernPair = function getKernPair(left, right) {
18774
18828
  return this.kernPairs[left + '\0' + right] || 0;
18775
18829
  };
18776
- _proto11.advancesForGlyphs = function advancesForGlyphs(glyphs) {
18830
+ _proto12.advancesForGlyphs = function advancesForGlyphs(glyphs) {
18777
18831
  var advances = [];
18778
18832
  for (var index = 0; index < glyphs.length; index++) {
18779
18833
  var left = glyphs[index];
@@ -18786,27 +18840,27 @@ var AFMFont = /*#__PURE__*/function () {
18786
18840
  }();
18787
18841
  var PDFFont = /*#__PURE__*/function () {
18788
18842
  function PDFFont() {}
18789
- var _proto12 = PDFFont.prototype;
18790
- _proto12.encode = function encode() {
18843
+ var _proto13 = PDFFont.prototype;
18844
+ _proto13.encode = function encode() {
18791
18845
  throw new Error('Must be implemented by subclasses');
18792
18846
  };
18793
- _proto12.widthOfString = function widthOfString() {
18847
+ _proto13.widthOfString = function widthOfString() {
18794
18848
  throw new Error('Must be implemented by subclasses');
18795
18849
  };
18796
- _proto12.ref = function ref() {
18850
+ _proto13.ref = function ref() {
18797
18851
  return this.dictionary != null ? this.dictionary : this.dictionary = this.document.ref();
18798
18852
  };
18799
- _proto12.finalize = function finalize() {
18853
+ _proto13.finalize = function finalize() {
18800
18854
  if (this.embedded || this.dictionary == null) {
18801
18855
  return;
18802
18856
  }
18803
18857
  this.embed();
18804
18858
  return this.embedded = true;
18805
18859
  };
18806
- _proto12.embed = function embed() {
18860
+ _proto13.embed = function embed() {
18807
18861
  throw new Error('Must be implemented by subclasses');
18808
18862
  };
18809
- _proto12.lineHeight = function lineHeight(size, includeGap) {
18863
+ _proto13.lineHeight = function lineHeight(size, includeGap) {
18810
18864
  if (includeGap == null) {
18811
18865
  includeGap = false;
18812
18866
  }
@@ -18877,8 +18931,8 @@ var StandardFont = /*#__PURE__*/function (_PDFFont) {
18877
18931
  return _this6;
18878
18932
  }
18879
18933
  _inheritsLoose(StandardFont, _PDFFont);
18880
- var _proto13 = StandardFont.prototype;
18881
- _proto13.embed = function embed() {
18934
+ var _proto14 = StandardFont.prototype;
18935
+ _proto14.embed = function embed() {
18882
18936
  this.dictionary.data = {
18883
18937
  Type: 'Font',
18884
18938
  BaseFont: this.name,
@@ -18887,7 +18941,7 @@ var StandardFont = /*#__PURE__*/function (_PDFFont) {
18887
18941
  };
18888
18942
  return this.dictionary.end();
18889
18943
  };
18890
- _proto13.encode = function encode(text) {
18944
+ _proto14.encode = function encode(text) {
18891
18945
  var encoded = this.font.encodeText(text);
18892
18946
  var glyphs = this.font.glyphsForString("" + text);
18893
18947
  var advances = this.font.advancesForGlyphs(glyphs);
@@ -18904,7 +18958,7 @@ var StandardFont = /*#__PURE__*/function (_PDFFont) {
18904
18958
  }
18905
18959
  return [encoded, positions];
18906
18960
  };
18907
- _proto13.widthOfString = function widthOfString(string, size) {
18961
+ _proto14.widthOfString = function widthOfString(string, size) {
18908
18962
  var glyphs = this.font.glyphsForString("" + string);
18909
18963
  var advances = this.font.advancesForGlyphs(glyphs);
18910
18964
  var width = 0;
@@ -18947,8 +19001,8 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
18947
19001
  return _this7;
18948
19002
  }
18949
19003
  _inheritsLoose(EmbeddedFont, _PDFFont2);
18950
- var _proto14 = EmbeddedFont.prototype;
18951
- _proto14.layoutRun = function layoutRun(text, features) {
19004
+ var _proto15 = EmbeddedFont.prototype;
19005
+ _proto15.layoutRun = function layoutRun(text, features) {
18952
19006
  var run = this.font.layout(text, features);
18953
19007
 
18954
19008
  // Normalize position values
@@ -18961,7 +19015,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
18961
19015
  }
18962
19016
  return run;
18963
19017
  };
18964
- _proto14.layoutCached = function layoutCached(text) {
19018
+ _proto15.layoutCached = function layoutCached(text) {
18965
19019
  if (!this.layoutCache) {
18966
19020
  return this.layoutRun(text);
18967
19021
  }
@@ -18973,7 +19027,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
18973
19027
  this.layoutCache[text] = run;
18974
19028
  return run;
18975
19029
  };
18976
- _proto14.layout = function layout(text, features, onlyWidth) {
19030
+ _proto15.layout = function layout(text, features, onlyWidth) {
18977
19031
  // Skip the cache if any user defined features are applied
18978
19032
  if (features) {
18979
19033
  return this.layoutRun(text, features);
@@ -19006,7 +19060,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
19006
19060
  advanceWidth: advanceWidth
19007
19061
  };
19008
19062
  };
19009
- _proto14.encode = function encode(text, features) {
19063
+ _proto15.encode = function encode(text, features) {
19010
19064
  var _this$layout = this.layout(text, features),
19011
19065
  glyphs = _this$layout.glyphs,
19012
19066
  positions = _this$layout.positions;
@@ -19024,12 +19078,12 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
19024
19078
  }
19025
19079
  return [res, positions];
19026
19080
  };
19027
- _proto14.widthOfString = function widthOfString(string, size, features) {
19081
+ _proto15.widthOfString = function widthOfString(string, size, features) {
19028
19082
  var width = this.layout(string, features, true).advanceWidth;
19029
19083
  var scale = size / 1000;
19030
19084
  return width * scale;
19031
19085
  };
19032
- _proto14.embed = function embed() {
19086
+ _proto15.embed = function embed() {
19033
19087
  var _this8 = this;
19034
19088
  var isCFF = this.subset.cff != null;
19035
19089
  var fontFile = this.document.ref();
@@ -19061,7 +19115,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
19061
19115
  var tag = [1, 2, 3, 4, 5, 6].map(function (i) {
19062
19116
  return String.fromCharCode((_this8.id.charCodeAt(i) || 73) + 17);
19063
19117
  }).join('');
19064
- var name = tag + '+' + this.font.postscriptName;
19118
+ var name = tag + '+' + this.font.postscriptName.replaceAll(' ', '_');
19065
19119
  var bbox = this.font.bbox;
19066
19120
  var descriptor = this.document.ref({
19067
19121
  Type: 'FontDescriptor',
@@ -19122,7 +19176,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
19122
19176
  // Because of ligature substitutions and the like, there may be one or more
19123
19177
  // unicode characters represented by each glyph.
19124
19178
  ;
19125
- _proto14.toUnicodeCmap = function toUnicodeCmap() {
19179
+ _proto15.toUnicodeCmap = function toUnicodeCmap() {
19126
19180
  var cmap = this.document.ref();
19127
19181
  var entries = [];
19128
19182
  for (var _iterator7 = _createForOfIteratorHelperLoose(this.unicode), _step7; !(_step7 = _iterator7()).done;) {
@@ -19178,6 +19232,19 @@ var PDFFontFactory = /*#__PURE__*/function () {
19178
19232
  };
19179
19233
  return PDFFontFactory;
19180
19234
  }();
19235
+ var isEqualFont = function isEqualFont(font1, font2) {
19236
+ var _font1$font$_tables, _font2$font$_tables, _font1$font$_tables2, _font2$font$_tables2;
19237
+ // compare font checksum
19238
+ if (((_font1$font$_tables = font1.font._tables) == null || (_font1$font$_tables = _font1$font$_tables.head) == null ? void 0 : _font1$font$_tables.checkSumAdjustment) !== ((_font2$font$_tables = font2.font._tables) == null || (_font2$font$_tables = _font2$font$_tables.head) == null ? void 0 : _font2$font$_tables.checkSumAdjustment)) {
19239
+ return false;
19240
+ }
19241
+
19242
+ // compare font name table
19243
+ if (JSON.stringify((_font1$font$_tables2 = font1.font._tables) == null || (_font1$font$_tables2 = _font1$font$_tables2.name) == null ? void 0 : _font1$font$_tables2.records) !== JSON.stringify((_font2$font$_tables2 = font2.font._tables) == null || (_font2$font$_tables2 = _font2$font$_tables2.name) == null ? void 0 : _font2$font$_tables2.records)) {
19244
+ return false;
19245
+ }
19246
+ return true;
19247
+ };
19181
19248
  var FontsMixin = {
19182
19249
  initFonts: function initFonts() {
19183
19250
  var defaultFont = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Helvetica';
@@ -19230,7 +19297,7 @@ var FontsMixin = {
19230
19297
 
19231
19298
  // check for existing font familes with the same name already in the PDF
19232
19299
  // useful if the font was passed as a buffer
19233
- if (font = this._fontFamilies[this._font.name]) {
19300
+ if ((font = this._fontFamilies[this._font.name]) && isEqualFont(this._font, font)) {
19234
19301
  this._font = font;
19235
19302
  return this;
19236
19303
  }
@@ -19269,12 +19336,13 @@ var LineWrapper = /*#__PURE__*/function (_EventEmitter) {
19269
19336
  var _this9;
19270
19337
  _this9 = _EventEmitter.call(this) || this;
19271
19338
  _this9.document = document;
19272
- _this9.indent = options.indent || 0;
19273
- _this9.characterSpacing = options.characterSpacing || 0;
19274
- _this9.wordSpacing = options.wordSpacing === 0;
19339
+ _this9.horizontalScaling = options.horizontalScaling || 100;
19340
+ _this9.indent = (options.indent || 0) * _this9.horizontalScaling / 100;
19341
+ _this9.characterSpacing = (options.characterSpacing || 0) * _this9.horizontalScaling / 100;
19342
+ _this9.wordSpacing = (options.wordSpacing === 0) * _this9.horizontalScaling / 100;
19275
19343
  _this9.columns = options.columns || 1;
19276
- _this9.columnGap = options.columnGap != null ? options.columnGap : 18; // 1/4 inch
19277
- _this9.lineWidth = (options.width - _this9.columnGap * (_this9.columns - 1)) / _this9.columns;
19344
+ _this9.columnGap = (options.columnGap != null ? options.columnGap : 18) * _this9.horizontalScaling / 100; // 1/4 inch
19345
+ _this9.lineWidth = (options.width * _this9.horizontalScaling / 100 - _this9.columnGap * (_this9.columns - 1)) / _this9.columns;
19278
19346
  _this9.spaceLeft = _this9.lineWidth;
19279
19347
  _this9.startX = _this9.document.x;
19280
19348
  _this9.startY = _this9.document.y;
@@ -19299,6 +19367,14 @@ var LineWrapper = /*#__PURE__*/function (_EventEmitter) {
19299
19367
  var indent = _this9.continuedX || _this9.indent;
19300
19368
  _this9.document.x += indent;
19301
19369
  _this9.lineWidth -= indent;
19370
+
19371
+ // if indentAllLines is set to true
19372
+ // we're not resetting the indentation for this paragraph after the first line
19373
+ if (options.indentAllLines) {
19374
+ return;
19375
+ }
19376
+
19377
+ // otherwise we start the next line without indent
19302
19378
  return _this9.once('line', function () {
19303
19379
  _this9.document.x -= indent;
19304
19380
  _this9.lineWidth += indent;
@@ -19327,17 +19403,17 @@ var LineWrapper = /*#__PURE__*/function (_EventEmitter) {
19327
19403
  return _this9;
19328
19404
  }
19329
19405
  _inheritsLoose(LineWrapper, _EventEmitter);
19330
- var _proto15 = LineWrapper.prototype;
19331
- _proto15.wordWidth = function wordWidth(word) {
19406
+ var _proto16 = LineWrapper.prototype;
19407
+ _proto16.wordWidth = function wordWidth(word) {
19332
19408
  return this.document.widthOfString(word, this) + this.characterSpacing + this.wordSpacing;
19333
19409
  };
19334
- _proto15.canFit = function canFit(word, w) {
19410
+ _proto16.canFit = function canFit(word, w) {
19335
19411
  if (word[word.length - 1] != SOFT_HYPHEN) {
19336
19412
  return w <= this.spaceLeft;
19337
19413
  }
19338
19414
  return w + this.wordWidth(HYPHEN) <= this.spaceLeft;
19339
19415
  };
19340
- _proto15.eachWord = function eachWord(text, fn) {
19416
+ _proto16.eachWord = function eachWord(text, fn) {
19341
19417
  // setup a unicode line breaker
19342
19418
  var bk;
19343
19419
  var breaker = new _linebreak.default(text);
@@ -19408,17 +19484,18 @@ var LineWrapper = /*#__PURE__*/function (_EventEmitter) {
19408
19484
  last = bk;
19409
19485
  }
19410
19486
  };
19411
- _proto15.wrap = function wrap(text, options) {
19487
+ _proto16.wrap = function wrap(text, options) {
19412
19488
  var _this10 = this;
19413
19489
  // override options from previous continued fragments
19490
+ this.horizontalScaling = options.horizontalScaling || 100;
19414
19491
  if (options.indent != null) {
19415
- this.indent = options.indent;
19492
+ this.indent = options.indent * this.horizontalScaling / 100;
19416
19493
  }
19417
19494
  if (options.characterSpacing != null) {
19418
- this.characterSpacing = options.characterSpacing;
19495
+ this.characterSpacing = options.characterSpacing * this.horizontalScaling / 100;
19419
19496
  }
19420
19497
  if (options.wordSpacing != null) {
19421
- this.wordSpacing = options.wordSpacing;
19498
+ this.wordSpacing = options.wordSpacing * this.horizontalScaling / 100;
19422
19499
  }
19423
19500
  if (options.ellipsis != null) {
19424
19501
  this.ellipsis = options.ellipsis;
@@ -19544,7 +19621,7 @@ var LineWrapper = /*#__PURE__*/function (_EventEmitter) {
19544
19621
  return this.document.x = this.startX;
19545
19622
  }
19546
19623
  };
19547
- _proto15.nextSection = function nextSection(options) {
19624
+ _proto16.nextSection = function nextSection(options) {
19548
19625
  this.emit('sectionEnd', options, this);
19549
19626
  if (++this.column > this.columns) {
19550
19627
  // if a max height was specified by the user, we're done.
@@ -19643,7 +19720,8 @@ var TextMixin = {
19643
19720
  },
19644
19721
  widthOfString: function widthOfString(string) {
19645
19722
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19646
- return this._font.widthOfString(string, this._fontSize, options.features) + (options.characterSpacing || 0) * (string.length - 1);
19723
+ var horizontalScaling = options.horizontalScaling || 100;
19724
+ return (this._font.widthOfString(string, this._fontSize, options.features) + (options.characterSpacing || 0) * (string.length - 1)) * horizontalScaling / 100;
19647
19725
  },
19648
19726
  heightOfString: function heightOfString(text, options) {
19649
19727
  var _this12 = this;
@@ -19826,7 +19904,7 @@ var TextMixin = {
19826
19904
  this._fragment(text, this.x, this.y, options);
19827
19905
  var lineGap = options.lineGap || this._lineGap || 0;
19828
19906
  if (!wrapper) {
19829
- return this.x += this.widthOfString(text);
19907
+ return this.x += this.widthOfString(text, options);
19830
19908
  } else {
19831
19909
  return this.y += this.currentLineHeight(true) + lineGap;
19832
19910
  }
@@ -19843,6 +19921,7 @@ var TextMixin = {
19843
19921
  var align = options.align || 'left';
19844
19922
  var wordSpacing = options.wordSpacing || 0;
19845
19923
  var characterSpacing = options.characterSpacing || 0;
19924
+ var horizontalScaling = options.horizontalScaling || 100;
19846
19925
 
19847
19926
  // text alignments
19848
19927
  if (options.width) {
@@ -19985,6 +20064,11 @@ var TextMixin = {
19985
20064
  this.addContent(number$2(characterSpacing) + " Tc");
19986
20065
  }
19987
20066
 
20067
+ // Horizontal scaling
20068
+ if (horizontalScaling !== 100) {
20069
+ this.addContent(horizontalScaling + " Tz");
20070
+ }
20071
+
19988
20072
  // Add the actual text
19989
20073
  // If we have a word spacing value, we need to encode each word separately
19990
20074
  // since the normal Tw operator only works on character code 32, which isn't
@@ -20118,8 +20202,8 @@ var JPEG = /*#__PURE__*/function () {
20118
20202
  this.colorSpace = COLOR_SPACE_MAP[channels];
20119
20203
  this.obj = null;
20120
20204
  }
20121
- var _proto16 = JPEG.prototype;
20122
- _proto16.embed = function embed(document) {
20205
+ var _proto17 = JPEG.prototype;
20206
+ _proto17.embed = function embed(document) {
20123
20207
  if (this.obj) {
20124
20208
  return;
20125
20209
  }
@@ -20155,8 +20239,8 @@ var PNGImage = /*#__PURE__*/function () {
20155
20239
  this.imgData = this.image.imgData;
20156
20240
  this.obj = null;
20157
20241
  }
20158
- var _proto17 = PNGImage.prototype;
20159
- _proto17.embed = function embed(document) {
20242
+ var _proto18 = PNGImage.prototype;
20243
+ _proto18.embed = function embed(document) {
20160
20244
  var dataDecoded = false;
20161
20245
  this.document = document;
20162
20246
  if (this.obj) {
@@ -20227,7 +20311,7 @@ var PNGImage = /*#__PURE__*/function () {
20227
20311
  }
20228
20312
  this.finalize();
20229
20313
  };
20230
- _proto17.finalize = function finalize() {
20314
+ _proto18.finalize = function finalize() {
20231
20315
  if (this.alphaChannel) {
20232
20316
  var sMask = this.document.ref({
20233
20317
  Type: 'XObject',
@@ -20250,7 +20334,7 @@ var PNGImage = /*#__PURE__*/function () {
20250
20334
  this.image = null;
20251
20335
  return this.imgData = null;
20252
20336
  };
20253
- _proto17.splitAlphaChannel = function splitAlphaChannel() {
20337
+ _proto18.splitAlphaChannel = function splitAlphaChannel() {
20254
20338
  var _this15 = this;
20255
20339
  return this.image.decodePixels(function (pixels) {
20256
20340
  var a, p;
@@ -20275,7 +20359,7 @@ var PNGImage = /*#__PURE__*/function () {
20275
20359
  return _this15.finalize();
20276
20360
  });
20277
20361
  };
20278
- _proto17.loadIndexedAlphaChannel = function loadIndexedAlphaChannel() {
20362
+ _proto18.loadIndexedAlphaChannel = function loadIndexedAlphaChannel() {
20279
20363
  var _this16 = this;
20280
20364
  var transparency = this.image.transparency.indexed;
20281
20365
  return this.image.decodePixels(function (pixels) {
@@ -20288,7 +20372,7 @@ var PNGImage = /*#__PURE__*/function () {
20288
20372
  return _this16.finalize();
20289
20373
  });
20290
20374
  };
20291
- _proto17.decodeData = function decodeData() {
20375
+ _proto18.decodeData = function decodeData() {
20292
20376
  var _this17 = this;
20293
20377
  this.image.decodePixels(function (pixels) {
20294
20378
  _this17.imgData = _zlib.default.deflateSync(pixels);
@@ -20578,7 +20662,9 @@ var AnnotationsMixin = {
20578
20662
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
20579
20663
  options.Subtype = 'Text';
20580
20664
  options.Contents = new String(contents);
20581
- options.Name = 'Comment';
20665
+ if (options.Name == null) {
20666
+ options.Name = 'Comment';
20667
+ }
20582
20668
  if (options.color == null) {
20583
20669
  options.color = [243, 223, 92];
20584
20670
  }
@@ -20735,8 +20821,8 @@ var PDFOutline = /*#__PURE__*/function () {
20735
20821
  this.dictionary = this.document.ref(this.outlineData);
20736
20822
  this.children = [];
20737
20823
  }
20738
- var _proto18 = PDFOutline.prototype;
20739
- _proto18.addItem = function addItem(title) {
20824
+ var _proto19 = PDFOutline.prototype;
20825
+ _proto19.addItem = function addItem(title) {
20740
20826
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
20741
20827
  expanded: false
20742
20828
  };
@@ -20744,7 +20830,7 @@ var PDFOutline = /*#__PURE__*/function () {
20744
20830
  this.children.push(result);
20745
20831
  return result;
20746
20832
  };
20747
- _proto18.endOutline = function endOutline() {
20833
+ _proto19.endOutline = function endOutline() {
20748
20834
  if (this.children.length > 0) {
20749
20835
  if (this.options.expanded) {
20750
20836
  this.outlineData.Count = this.children.length;
@@ -20792,8 +20878,8 @@ var PDFStructureContent = /*#__PURE__*/function () {
20792
20878
  mcid: mcid
20793
20879
  }];
20794
20880
  }
20795
- var _proto19 = PDFStructureContent.prototype;
20796
- _proto19.push = function push(structContent) {
20881
+ var _proto20 = PDFStructureContent.prototype;
20882
+ _proto20.push = function push(structContent) {
20797
20883
  var _this18 = this;
20798
20884
  structContent.refs.forEach(function (ref) {
20799
20885
  return _this18.refs.push(ref);
@@ -20849,8 +20935,8 @@ var PDFStructureElement = /*#__PURE__*/function () {
20849
20935
  this.end();
20850
20936
  }
20851
20937
  }
20852
- var _proto20 = PDFStructureElement.prototype;
20853
- _proto20.add = function add(child) {
20938
+ var _proto21 = PDFStructureElement.prototype;
20939
+ _proto21.add = function add(child) {
20854
20940
  if (this._ended) {
20855
20941
  throw new Error("Cannot add child to already-ended structure element");
20856
20942
  }
@@ -20873,7 +20959,7 @@ var PDFStructureElement = /*#__PURE__*/function () {
20873
20959
  this._children.push(child);
20874
20960
  return this;
20875
20961
  };
20876
- _proto20._addContentToParentTree = function _addContentToParentTree(content) {
20962
+ _proto21._addContentToParentTree = function _addContentToParentTree(content) {
20877
20963
  var _this20 = this;
20878
20964
  content.refs.forEach(function (_ref) {
20879
20965
  var pageRef = _ref.pageRef,
@@ -20882,14 +20968,14 @@ var PDFStructureElement = /*#__PURE__*/function () {
20882
20968
  pageStructParents[mcid] = _this20.dictionary;
20883
20969
  });
20884
20970
  };
20885
- _proto20.setParent = function setParent(parentRef) {
20971
+ _proto21.setParent = function setParent(parentRef) {
20886
20972
  if (this.dictionary.data.P) {
20887
20973
  throw new Error("Structure element added to more than one parent");
20888
20974
  }
20889
20975
  this.dictionary.data.P = parentRef;
20890
20976
  this._flush();
20891
20977
  };
20892
- _proto20.setAttached = function setAttached() {
20978
+ _proto21.setAttached = function setAttached() {
20893
20979
  var _this21 = this;
20894
20980
  if (this._attached) {
20895
20981
  return;
@@ -20905,7 +20991,7 @@ var PDFStructureElement = /*#__PURE__*/function () {
20905
20991
  this._attached = true;
20906
20992
  this._flush();
20907
20993
  };
20908
- _proto20.end = function end() {
20994
+ _proto21.end = function end() {
20909
20995
  if (this._ended) {
20910
20996
  return;
20911
20997
  }
@@ -20917,17 +21003,17 @@ var PDFStructureElement = /*#__PURE__*/function () {
20917
21003
  this._ended = true;
20918
21004
  this._flush();
20919
21005
  };
20920
- _proto20._isValidChild = function _isValidChild(child) {
21006
+ _proto21._isValidChild = function _isValidChild(child) {
20921
21007
  return child instanceof PDFStructureElement || child instanceof PDFStructureContent || typeof child === 'function';
20922
21008
  };
20923
- _proto20._contentForClosure = function _contentForClosure(closure) {
21009
+ _proto21._contentForClosure = function _contentForClosure(closure) {
20924
21010
  var content = this.document.markStructureContent(this.dictionary.data.S);
20925
21011
  closure();
20926
21012
  this.document.endMarkedContent();
20927
21013
  this._addContentToParentTree(content);
20928
21014
  return content;
20929
21015
  };
20930
- _proto20._isFlushable = function _isFlushable() {
21016
+ _proto21._isFlushable = function _isFlushable() {
20931
21017
  if (!this.dictionary.data.P || !this._ended) {
20932
21018
  return false;
20933
21019
  }
@@ -20941,7 +21027,7 @@ var PDFStructureElement = /*#__PURE__*/function () {
20941
21027
  return true;
20942
21028
  });
20943
21029
  };
20944
- _proto20._flush = function _flush() {
21030
+ _proto21._flush = function _flush() {
20945
21031
  var _this22 = this;
20946
21032
  if (this._flushed || !this._isFlushable()) {
20947
21033
  return;
@@ -20959,7 +21045,7 @@ var PDFStructureElement = /*#__PURE__*/function () {
20959
21045
  this.dictionary.data.K = null;
20960
21046
  this._flushed = true;
20961
21047
  };
20962
- _proto20._flushChild = function _flushChild(child) {
21048
+ _proto21._flushChild = function _flushChild(child) {
20963
21049
  var _this23 = this;
20964
21050
  if (child instanceof PDFStructureElement) {
20965
21051
  this.dictionary.data.K.push(child.dictionary);
@@ -20993,14 +21079,14 @@ var PDFNumberTree = /*#__PURE__*/function (_PDFTree2) {
20993
21079
  return _PDFTree2.apply(this, arguments) || this;
20994
21080
  }
20995
21081
  _inheritsLoose(PDFNumberTree, _PDFTree2);
20996
- var _proto21 = PDFNumberTree.prototype;
20997
- _proto21._compareKeys = function _compareKeys(a, b) {
21082
+ var _proto22 = PDFNumberTree.prototype;
21083
+ _proto22._compareKeys = function _compareKeys(a, b) {
20998
21084
  return parseInt(a) - parseInt(b);
20999
21085
  };
21000
- _proto21._keysName = function _keysName() {
21086
+ _proto22._keysName = function _keysName() {
21001
21087
  return "Nums";
21002
21088
  };
21003
- _proto21._dataForKey = function _dataForKey(k) {
21089
+ _proto22._dataForKey = function _dataForKey(k) {
21004
21090
  return parseInt(k);
21005
21091
  };
21006
21092
  return PDFNumberTree;
@@ -21135,6 +21221,9 @@ var MarkingsMixin = {
21135
21221
  }
21136
21222
  return this._root.data.MarkInfo;
21137
21223
  },
21224
+ hasMarkInfoDictionary: function hasMarkInfoDictionary() {
21225
+ return !!this._root.data.MarkInfo;
21226
+ },
21138
21227
  getStructTreeRoot: function getStructTreeRoot() {
21139
21228
  if (!this._root.data.StructTreeRoot) {
21140
21229
  this._root.data.StructTreeRoot = this.ref({
@@ -21737,22 +21826,22 @@ var PDFMetadata = /*#__PURE__*/function () {
21737
21826
  function PDFMetadata() {
21738
21827
  this._metadata = "\n <?xpacket begin=\"\uFEFF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n <x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n ";
21739
21828
  }
21740
- var _proto22 = PDFMetadata.prototype;
21741
- _proto22._closeTags = function _closeTags() {
21829
+ var _proto23 = PDFMetadata.prototype;
21830
+ _proto23._closeTags = function _closeTags() {
21742
21831
  this._metadata = this._metadata.concat("\n </rdf:RDF>\n </x:xmpmeta>\n <?xpacket end=\"w\"?>\n ");
21743
21832
  };
21744
- _proto22.append = function append(xml) {
21833
+ _proto23.append = function append(xml) {
21745
21834
  var newline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
21746
21835
  this._metadata = this._metadata.concat(xml);
21747
21836
  if (newline) this._metadata = this._metadata.concat('\n');
21748
21837
  };
21749
- _proto22.getXML = function getXML() {
21838
+ _proto23.getXML = function getXML() {
21750
21839
  return this._metadata;
21751
21840
  };
21752
- _proto22.getLength = function getLength() {
21841
+ _proto23.getLength = function getLength() {
21753
21842
  return this._metadata.length;
21754
21843
  };
21755
- _proto22.end = function end() {
21844
+ _proto23.end = function end() {
21756
21845
  this._closeTags();
21757
21846
  this._metadata = this._metadata.trim();
21758
21847
  };
@@ -21919,8 +22008,8 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
21919
22008
  return _this27;
21920
22009
  }
21921
22010
  _inheritsLoose(PDFDocument, _stream$Readable);
21922
- var _proto23 = PDFDocument.prototype;
21923
- _proto23.addPage = function addPage(options) {
22011
+ var _proto24 = PDFDocument.prototype;
22012
+ _proto24.addPage = function addPage(options) {
21924
22013
  if (options == null) {
21925
22014
  options = this.options;
21926
22015
  }
@@ -21950,26 +22039,26 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
21950
22039
  this.emit('pageAdded');
21951
22040
  return this;
21952
22041
  };
21953
- _proto23.continueOnNewPage = function continueOnNewPage(options) {
22042
+ _proto24.continueOnNewPage = function continueOnNewPage(options) {
21954
22043
  var pageMarkings = this.endPageMarkings(this.page);
21955
22044
  this.addPage(options);
21956
22045
  this.initPageMarkings(pageMarkings);
21957
22046
  return this;
21958
22047
  };
21959
- _proto23.bufferedPageRange = function bufferedPageRange() {
22048
+ _proto24.bufferedPageRange = function bufferedPageRange() {
21960
22049
  return {
21961
22050
  start: this._pageBufferStart,
21962
22051
  count: this._pageBuffer.length
21963
22052
  };
21964
22053
  };
21965
- _proto23.switchToPage = function switchToPage(n) {
22054
+ _proto24.switchToPage = function switchToPage(n) {
21966
22055
  var page;
21967
22056
  if (!(page = this._pageBuffer[n - this._pageBufferStart])) {
21968
22057
  throw new Error("switchToPage(" + n + ") out of bounds, current buffer covers pages " + this._pageBufferStart + " to " + (this._pageBufferStart + this._pageBuffer.length - 1));
21969
22058
  }
21970
22059
  return this.page = page;
21971
22060
  };
21972
- _proto23.flushPages = function flushPages() {
22061
+ _proto24.flushPages = function flushPages() {
21973
22062
  // this local variable exists so we're future-proof against
21974
22063
  // reentrant calls to flushPages.
21975
22064
  var pages = this._pageBuffer;
@@ -21981,7 +22070,7 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
21981
22070
  page.end();
21982
22071
  }
21983
22072
  };
21984
- _proto23.addNamedDestination = function addNamedDestination(name) {
22073
+ _proto24.addNamedDestination = function addNamedDestination(name) {
21985
22074
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
21986
22075
  args[_key - 1] = arguments[_key];
21987
22076
  }
@@ -21994,7 +22083,7 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
21994
22083
  args.unshift(this.page.dictionary);
21995
22084
  this._root.data.Names.data.Dests.add(name, args);
21996
22085
  };
21997
- _proto23.addNamedEmbeddedFile = function addNamedEmbeddedFile(name, ref) {
22086
+ _proto24.addNamedEmbeddedFile = function addNamedEmbeddedFile(name, ref) {
21998
22087
  if (!this._root.data.Names.data.EmbeddedFiles) {
21999
22088
  // disabling /Limits for this tree fixes attachments not showing in Adobe Reader
22000
22089
  this._root.data.Names.data.EmbeddedFiles = new PDFNameTree({
@@ -22005,7 +22094,7 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
22005
22094
  // add filespec to EmbeddedFiles
22006
22095
  this._root.data.Names.data.EmbeddedFiles.add(name, ref);
22007
22096
  };
22008
- _proto23.addNamedJavaScript = function addNamedJavaScript(name, js) {
22097
+ _proto24.addNamedJavaScript = function addNamedJavaScript(name, js) {
22009
22098
  if (!this._root.data.Names.data.JavaScript) {
22010
22099
  this._root.data.Names.data.JavaScript = new PDFNameTree();
22011
22100
  }
@@ -22015,34 +22104,34 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
22015
22104
  };
22016
22105
  this._root.data.Names.data.JavaScript.add(name, data);
22017
22106
  };
22018
- _proto23.ref = function ref(data) {
22107
+ _proto24.ref = function ref(data) {
22019
22108
  var ref = new PDFReference(this, this._offsets.length + 1, data);
22020
22109
  this._offsets.push(null); // placeholder for this object's offset once it is finalized
22021
22110
  this._waiting++;
22022
22111
  return ref;
22023
22112
  };
22024
- _proto23._read = function _read() {}
22113
+ _proto24._read = function _read() {}
22025
22114
  // do nothing, but this method is required by node
22026
22115
  ;
22027
- _proto23._write = function _write(data) {
22116
+ _proto24._write = function _write(data) {
22028
22117
  if (!Buffer.isBuffer(data)) {
22029
22118
  data = Buffer.from(data + '\n', 'binary');
22030
22119
  }
22031
22120
  this.push(data);
22032
22121
  return this._offset += data.length;
22033
22122
  };
22034
- _proto23.addContent = function addContent(data) {
22123
+ _proto24.addContent = function addContent(data) {
22035
22124
  this.page.write(data);
22036
22125
  return this;
22037
22126
  };
22038
- _proto23._refEnd = function _refEnd(ref) {
22127
+ _proto24._refEnd = function _refEnd(ref) {
22039
22128
  this._offsets[ref.id - 1] = ref.offset;
22040
22129
  if (--this._waiting === 0 && this._ended) {
22041
22130
  this._finalize();
22042
22131
  return this._ended = false;
22043
22132
  }
22044
22133
  };
22045
- _proto23.end = function end() {
22134
+ _proto24.end = function end() {
22046
22135
  this.flushPages();
22047
22136
  this._info = this.ref();
22048
22137
  for (var key in this.info) {
@@ -22081,7 +22170,7 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
22081
22170
  return this._ended = true;
22082
22171
  }
22083
22172
  };
22084
- _proto23._finalize = function _finalize() {
22173
+ _proto24._finalize = function _finalize() {
22085
22174
  // generate xref
22086
22175
  var xRefOffset = this._offset;
22087
22176
  this._write('xref');
@@ -22112,7 +22201,7 @@ var PDFDocument = /*#__PURE__*/function (_stream$Readable) {
22112
22201
  // end the stream
22113
22202
  return this.push(null);
22114
22203
  };
22115
- _proto23.toString = function toString() {
22204
+ _proto24.toString = function toString() {
22116
22205
  return '[object PDFDocument]';
22117
22206
  };
22118
22207
  return PDFDocument;
@@ -34711,6 +34800,90 @@ $({ target: 'String', proto: true }, {
34711
34800
  });
34712
34801
 
34713
34802
 
34803
+ /***/ }),
34804
+
34805
+ /***/ 1593:
34806
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
34807
+
34808
+ "use strict";
34809
+
34810
+ var $ = __webpack_require__(56475);
34811
+ var global = __webpack_require__(32010);
34812
+ var call = __webpack_require__(2834);
34813
+ var uncurryThis = __webpack_require__(38347);
34814
+ var requireObjectCoercible = __webpack_require__(83943);
34815
+ var isCallable = __webpack_require__(94578);
34816
+ var isRegExp = __webpack_require__(28831);
34817
+ var toString = __webpack_require__(25096);
34818
+ var getMethod = __webpack_require__(51839);
34819
+ var regExpFlags = __webpack_require__(21182);
34820
+ var getSubstitution = __webpack_require__(29519);
34821
+ var wellKnownSymbol = __webpack_require__(38688);
34822
+ var IS_PURE = __webpack_require__(63432);
34823
+
34824
+ var REPLACE = wellKnownSymbol('replace');
34825
+ var RegExpPrototype = RegExp.prototype;
34826
+ var TypeError = global.TypeError;
34827
+ var getFlags = uncurryThis(regExpFlags);
34828
+ var indexOf = uncurryThis(''.indexOf);
34829
+ var replace = uncurryThis(''.replace);
34830
+ var stringSlice = uncurryThis(''.slice);
34831
+ var max = Math.max;
34832
+
34833
+ var stringIndexOf = function (string, searchValue, fromIndex) {
34834
+ if (fromIndex > string.length) return -1;
34835
+ if (searchValue === '') return fromIndex;
34836
+ return indexOf(string, searchValue, fromIndex);
34837
+ };
34838
+
34839
+ // `String.prototype.replaceAll` method
34840
+ // https://tc39.es/ecma262/#sec-string.prototype.replaceall
34841
+ $({ target: 'String', proto: true }, {
34842
+ replaceAll: function replaceAll(searchValue, replaceValue) {
34843
+ var O = requireObjectCoercible(this);
34844
+ var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement;
34845
+ var position = 0;
34846
+ var endOfLastMatch = 0;
34847
+ var result = '';
34848
+ if (searchValue != null) {
34849
+ IS_REG_EXP = isRegExp(searchValue);
34850
+ if (IS_REG_EXP) {
34851
+ flags = toString(requireObjectCoercible('flags' in RegExpPrototype
34852
+ ? searchValue.flags
34853
+ : getFlags(searchValue)
34854
+ ));
34855
+ if (!~indexOf(flags, 'g')) throw TypeError('`.replaceAll` does not allow non-global regexes');
34856
+ }
34857
+ replacer = getMethod(searchValue, REPLACE);
34858
+ if (replacer) {
34859
+ return call(replacer, searchValue, O, replaceValue);
34860
+ } else if (IS_PURE && IS_REG_EXP) {
34861
+ return replace(toString(O), searchValue, replaceValue);
34862
+ }
34863
+ }
34864
+ string = toString(O);
34865
+ searchString = toString(searchValue);
34866
+ functionalReplace = isCallable(replaceValue);
34867
+ if (!functionalReplace) replaceValue = toString(replaceValue);
34868
+ searchLength = searchString.length;
34869
+ advanceBy = max(1, searchLength);
34870
+ position = stringIndexOf(string, searchString, 0);
34871
+ while (position !== -1) {
34872
+ replacement = functionalReplace
34873
+ ? toString(replaceValue(searchString, position, string))
34874
+ : getSubstitution(searchString, string, position, [], undefined, replaceValue);
34875
+ result += stringSlice(string, endOfLastMatch, position) + replacement;
34876
+ endOfLastMatch = position + searchLength;
34877
+ position = stringIndexOf(string, searchString, position + advanceBy);
34878
+ }
34879
+ if (endOfLastMatch < string.length) {
34880
+ result += stringSlice(string, endOfLastMatch);
34881
+ }
34882
+ return result;
34883
+ }
34884
+ });
34885
+
34886
+
34714
34887
  /***/ }),
34715
34888
 
34716
34889
  /***/ 46467:
@@ -36378,6 +36551,15 @@ $({ target: 'Promise', stat: true }, {
36378
36551
  __webpack_require__(71768);
36379
36552
 
36380
36553
 
36554
+ /***/ }),
36555
+
36556
+ /***/ 64654:
36557
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
36558
+
36559
+ // TODO: Remove from `core-js@4`
36560
+ __webpack_require__(1593);
36561
+
36562
+
36381
36563
  /***/ }),
36382
36564
 
36383
36565
  /***/ 42437:
@@ -55719,7 +55901,7 @@ var isFunction = (__webpack_require__(91867).isFunction);
55719
55901
  var isUndefined = (__webpack_require__(91867).isUndefined);
55720
55902
  //var isNull = require('../helpers').isNull;
55721
55903
  var pack = (__webpack_require__(91867).pack);
55722
- var FileSaver = __webpack_require__(8161);
55904
+ var FileSaver = __webpack_require__(3502);
55723
55905
  var saveAs = FileSaver.saveAs;
55724
55906
 
55725
55907
  var defaultClientFonts = {
@@ -58333,11 +58515,9 @@ ImageMeasure.prototype.measureImage = function (src) {
58333
58515
 
58334
58516
  var imageSize = { width: image.width, height: image.height };
58335
58517
 
58336
- if (typeof image === 'object' && image.constructor.name === 'JPEG') {
58337
- // If EXIF orientation calls for it, swap width and height
58338
- if (image.orientation > 4) {
58339
- imageSize = { width: image.height, height: image.width };
58340
- }
58518
+ // If EXIF orientation calls for it, swap width and height
58519
+ if (image.orientation > 4) {
58520
+ imageSize = { width: image.height, height: image.width };
58341
58521
  }
58342
58522
 
58343
58523
  return imageSize;
@@ -58662,7 +58842,7 @@ function _interopDefault(ex) {
58662
58842
  return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
58663
58843
  }
58664
58844
 
58665
- var PdfKit = _interopDefault(__webpack_require__(82383));
58845
+ var PdfKit = _interopDefault(__webpack_require__(30357));
58666
58846
 
58667
58847
  function getEngineInstance() {
58668
58848
  return PdfKit;
@@ -61715,7 +61895,7 @@ module.exports = TraversalTracker;
61715
61895
 
61716
61896
  /***/ }),
61717
61897
 
61718
- /***/ 8161:
61898
+ /***/ 3502:
61719
61899
  /***/ (function(module, exports, __webpack_require__) {
61720
61900
 
61721
61901
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(a,b){if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (b),