pdfmake 0.3.3 → 0.3.4

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -21
  3. package/README.md +75 -78
  4. package/build/fonts/Roboto/Roboto-Italic.ttf +0 -0
  5. package/build/fonts/Roboto/Roboto-Medium.ttf +0 -0
  6. package/build/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  7. package/build/fonts/Roboto/Roboto-Regular.ttf +0 -0
  8. package/build/fonts/Roboto.js +27 -0
  9. package/build/pdfmake.js +64552 -64404
  10. package/build/pdfmake.js.map +1 -1
  11. package/build/pdfmake.min.js +2 -2
  12. package/build/pdfmake.min.js.map +1 -1
  13. package/build/standard-fonts/Courier.js +27 -27
  14. package/build/standard-fonts/Helvetica.js +27 -27
  15. package/build/standard-fonts/Symbol.js +21 -21
  16. package/build/standard-fonts/Times.js +27 -27
  17. package/build/standard-fonts/ZapfDingbats.js +21 -21
  18. package/build/vfs_fonts.js +5 -5
  19. package/build-vfs.js +44 -44
  20. package/fonts/Roboto.js +8 -8
  21. package/js/DocMeasure.js +6 -6
  22. package/js/DocumentContext.js +8 -3
  23. package/js/ElementWriter.js +42 -16
  24. package/js/LayoutBuilder.js +141 -78
  25. package/js/Line.js +16 -16
  26. package/js/OutputDocument.js +10 -10
  27. package/js/OutputDocumentServer.js +3 -3
  28. package/js/PDFDocument.js +3 -3
  29. package/js/PageElementWriter.js +15 -9
  30. package/js/Printer.js +28 -28
  31. package/js/Renderer.js +40 -8
  32. package/js/SVGMeasure.js +10 -10
  33. package/js/StyleContextStack.js +48 -48
  34. package/js/TableProcessor.js +14 -0
  35. package/js/TextBreaker.js +17 -17
  36. package/js/TextInlines.js +33 -33
  37. package/js/base.js +4 -4
  38. package/js/browser-extensions/OutputDocumentBrowser.js +24 -24
  39. package/js/columnCalculator.js +2 -2
  40. package/js/helpers/node.js +14 -15
  41. package/js/helpers/variableType.js +18 -18
  42. package/js/qrEnc.js +38 -38
  43. package/js/virtual-fs.js +11 -11
  44. package/package.json +8 -8
  45. package/src/3rd-party/svg-to-pdfkit/LICENSE +9 -9
  46. package/src/3rd-party/svg-to-pdfkit/source.js +2745 -2745
  47. package/src/3rd-party/svg-to-pdfkit.js +3 -3
  48. package/src/DocMeasure.js +745 -745
  49. package/src/DocPreprocessor.js +283 -283
  50. package/src/DocumentContext.js +345 -338
  51. package/src/ElementWriter.js +441 -417
  52. package/src/LayoutBuilder.js +1336 -1262
  53. package/src/Line.js +114 -114
  54. package/src/OutputDocument.js +64 -64
  55. package/src/OutputDocumentServer.js +32 -32
  56. package/src/PDFDocument.js +174 -174
  57. package/src/PageElementWriter.js +187 -179
  58. package/src/PageSize.js +53 -53
  59. package/src/Printer.js +306 -306
  60. package/src/Renderer.js +445 -409
  61. package/src/SVGMeasure.js +109 -109
  62. package/src/StyleContextStack.js +208 -208
  63. package/src/TableProcessor.js +620 -602
  64. package/src/TextBreaker.js +168 -168
  65. package/src/TextDecorator.js +175 -175
  66. package/src/TextInlines.js +224 -224
  67. package/src/URLResolver.js +43 -43
  68. package/src/base.js +70 -70
  69. package/src/browser-extensions/OutputDocumentBrowser.js +80 -80
  70. package/src/browser-extensions/fonts/Roboto.js +27 -27
  71. package/src/browser-extensions/index.js +55 -55
  72. package/src/browser-extensions/pdfMake.js +1 -1
  73. package/src/browser-extensions/standard-fonts/Courier.js +27 -27
  74. package/src/browser-extensions/standard-fonts/Helvetica.js +27 -27
  75. package/src/browser-extensions/standard-fonts/Symbol.js +21 -21
  76. package/src/browser-extensions/standard-fonts/Times.js +27 -27
  77. package/src/browser-extensions/standard-fonts/ZapfDingbats.js +21 -21
  78. package/src/browser-extensions/virtual-fs-cjs.js +1 -1
  79. package/src/columnCalculator.js +154 -154
  80. package/src/helpers/node.js +134 -136
  81. package/src/helpers/tools.js +44 -44
  82. package/src/helpers/variableType.js +50 -50
  83. package/src/index.js +16 -16
  84. package/src/qrEnc.js +796 -796
  85. package/src/standardPageSizes.js +52 -52
  86. package/src/tableLayouts.js +100 -100
  87. package/src/virtual-fs.js +66 -66
  88. package/standard-fonts/Courier.js +8 -8
  89. package/standard-fonts/Helvetica.js +8 -8
  90. package/standard-fonts/Symbol.js +5 -5
  91. package/standard-fonts/Times.js +8 -8
  92. package/standard-fonts/ZapfDingbats.js +5 -5
@@ -3,8 +3,8 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
  class OutputDocument {
6
- /**
7
- * @param {Promise<object>} pdfDocumentPromise
6
+ /**
7
+ * @param {Promise<object>} pdfDocumentPromise
8
8
  */
9
9
  constructor(pdfDocumentPromise) {
10
10
  this.bufferSize = 1073741824;
@@ -12,15 +12,15 @@ class OutputDocument {
12
12
  this.bufferPromise = null;
13
13
  }
14
14
 
15
- /**
16
- * @returns {Promise<object>}
15
+ /**
16
+ * @returns {Promise<object>}
17
17
  */
18
18
  getStream() {
19
19
  return this.pdfDocumentPromise;
20
20
  }
21
21
 
22
- /**
23
- * @returns {Promise<Buffer>}
22
+ /**
23
+ * @returns {Promise<Buffer>}
24
24
  */
25
25
  getBuffer() {
26
26
  const getBufferInternal = async () => {
@@ -45,16 +45,16 @@ class OutputDocument {
45
45
  return this.bufferPromise;
46
46
  }
47
47
 
48
- /**
49
- * @returns {Promise<string>}
48
+ /**
49
+ * @returns {Promise<string>}
50
50
  */
51
51
  async getBase64() {
52
52
  const buffer = await this.getBuffer();
53
53
  return buffer.toString('base64');
54
54
  }
55
55
 
56
- /**
57
- * @returns {Promise<string>}
56
+ /**
57
+ * @returns {Promise<string>}
58
58
  */
59
59
  async getDataUrl() {
60
60
  const data = await this.getBase64();
@@ -6,9 +6,9 @@ var _OutputDocument = _interopRequireDefault(require("./OutputDocument"));
6
6
  var _fs = _interopRequireDefault(require("fs"));
7
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
8
  class OutputDocumentServer extends _OutputDocument.default {
9
- /**
10
- * @param {string} filename
11
- * @returns {Promise}
9
+ /**
10
+ * @param {string} filename
11
+ * @returns {Promise}
12
12
  */
13
13
  async write(filename) {
14
14
  const stream = await this.getStream();
package/js/PDFDocument.js CHANGED
@@ -102,9 +102,9 @@ class PDFDocument extends _pdfkit.default {
102
102
  return image;
103
103
  }
104
104
 
105
- /**
106
- * @param {Array} color pdfmake format: [<pattern name>, <color>]
107
- * @returns {Array} pdfkit format: [<pattern object>, <color>]
105
+ /**
106
+ * @param {Array} color pdfmake format: [<pattern name>, <color>]
107
+ * @returns {Array} pdfkit format: [<pattern object>, <color>]
108
108
  */
109
109
  providePattern(color) {
110
110
  if (Array.isArray(color) && color.length === 2) {
@@ -6,17 +6,17 @@ var _ElementWriter = _interopRequireDefault(require("./ElementWriter"));
6
6
  var _PageSize = require("./PageSize");
7
7
  var _DocumentContext = _interopRequireDefault(require("./DocumentContext"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * An extended ElementWriter which can handle:
11
- * - page-breaks (it adds new pages when there's not enough space left),
12
- * - repeatable fragments (like table-headers, which are repeated everytime
13
- * a page-break occurs)
14
- * - transactions (used for unbreakable-blocks when we want to make sure
15
- * whole block will be rendered on the same page)
9
+ /**
10
+ * An extended ElementWriter which can handle:
11
+ * - page-breaks (it adds new pages when there's not enough space left),
12
+ * - repeatable fragments (like table-headers, which are repeated everytime
13
+ * a page-break occurs)
14
+ * - transactions (used for unbreakable-blocks when we want to make sure
15
+ * whole block will be rendered on the same page)
16
16
  */
17
17
  class PageElementWriter extends _ElementWriter.default {
18
- /**
19
- * @param {DocumentContext} context
18
+ /**
19
+ * @param {DocumentContext} context
20
20
  */
21
21
  constructor(context) {
22
22
  super(context);
@@ -50,6 +50,12 @@ class PageElementWriter extends _ElementWriter.default {
50
50
  endClip() {
51
51
  return super.endClip();
52
52
  }
53
+ beginVerticalAlignment(verticalAlignment) {
54
+ return super.beginVerticalAlignment(verticalAlignment);
55
+ }
56
+ endVerticalAlignment(verticalAlignment) {
57
+ return super.endVerticalAlignment(verticalAlignment);
58
+ }
53
59
  addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition) {
54
60
  return this._fitOnPage(() => super.addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition));
55
61
  }
package/js/Printer.js CHANGED
@@ -11,26 +11,26 @@ var _Renderer = _interopRequireDefault(require("./Renderer"));
11
11
  var _variableType = require("./helpers/variableType");
12
12
  var _tools = require("./helpers/tools");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- /**
15
- * Printer which turns document definition into a pdf
16
- *
17
- * @example
18
- * var fontDescriptors = {
19
- * Roboto: {
20
- * normal: 'fonts/Roboto-Regular.ttf',
21
- * bold: 'fonts/Roboto-Medium.ttf',
22
- * italics: 'fonts/Roboto-Italic.ttf',
23
- * bolditalics: 'fonts/Roboto-MediumItalic.ttf'
24
- * }
25
- * };
26
- *
27
- * var printer = new PdfPrinter(fontDescriptors);
14
+ /**
15
+ * Printer which turns document definition into a pdf
16
+ *
17
+ * @example
18
+ * var fontDescriptors = {
19
+ * Roboto: {
20
+ * normal: 'fonts/Roboto-Regular.ttf',
21
+ * bold: 'fonts/Roboto-Medium.ttf',
22
+ * italics: 'fonts/Roboto-Italic.ttf',
23
+ * bolditalics: 'fonts/Roboto-MediumItalic.ttf'
24
+ * }
25
+ * };
26
+ *
27
+ * var printer = new PdfPrinter(fontDescriptors);
28
28
  */
29
29
  class PdfPrinter {
30
- /**
31
- * @param {object} fontDescriptors font definition dictionary
32
- * @param {object} virtualfs
33
- * @param {object} urlResolver
30
+ /**
31
+ * @param {object} fontDescriptors font definition dictionary
32
+ * @param {object} virtualfs
33
+ * @param {object} urlResolver
34
34
  */
35
35
  constructor(fontDescriptors, virtualfs = null, urlResolver = null) {
36
36
  this.fontDescriptors = fontDescriptors;
@@ -38,13 +38,13 @@ class PdfPrinter {
38
38
  this.urlResolver = urlResolver;
39
39
  }
40
40
 
41
- /**
42
- * Executes layout engine for the specified document and renders it into a pdfkit document
43
- * ready to be saved.
44
- *
45
- * @param {object} docDefinition
46
- * @param {object} options
47
- * @returns {Promise<PDFDocument>} resolved promise return a pdfkit document
41
+ /**
42
+ * Executes layout engine for the specified document and renders it into a pdfkit document
43
+ * ready to be saved.
44
+ *
45
+ * @param {object} docDefinition
46
+ * @param {object} options
47
+ * @returns {Promise<PDFDocument>} resolved promise return a pdfkit document
48
48
  */
49
49
  async createPdfKitDocument(docDefinition, options = {}) {
50
50
  await this.resolveUrls(docDefinition);
@@ -109,9 +109,9 @@ class PdfPrinter {
109
109
  return this.pdfKitDoc;
110
110
  }
111
111
 
112
- /**
113
- * @param {object} docDefinition
114
- * @returns {Promise}
112
+ /**
113
+ * @param {object} docDefinition
114
+ * @returns {Promise}
115
115
  */
116
116
  async resolveUrls(docDefinition) {
117
117
  const getExtendedUrl = url => {
package/js/Renderer.js CHANGED
@@ -19,14 +19,14 @@ const findFont = (fonts, requiredFonts, defaultFont) => {
19
19
  return defaultFont;
20
20
  };
21
21
 
22
- /**
23
- * Shift the "y" height of the text baseline up or down (superscript or subscript,
24
- * respectively). The exact shift can / should be changed according to standard
25
- * conventions.
26
- *
27
- * @param {number} y
28
- * @param {object} inline
29
- * @returns {number}
22
+ /**
23
+ * Shift the "y" height of the text baseline up or down (superscript or subscript,
24
+ * respectively). The exact shift can / should be changed according to standard
25
+ * conventions.
26
+ *
27
+ * @param {number} y
28
+ * @param {object} inline
29
+ * @returns {number}
30
30
  */
31
31
  const offsetText = (y, inline) => {
32
32
  let newY = y;
@@ -82,6 +82,12 @@ class Renderer {
82
82
  case 'endClip':
83
83
  this.endClip();
84
84
  break;
85
+ case 'beginVerticalAlignment':
86
+ this.beginVerticalAlignment(item.item);
87
+ break;
88
+ case 'endVerticalAlignment':
89
+ this.endVerticalAlignment(item.item);
90
+ break;
85
91
  }
86
92
  renderedItems++;
87
93
  if (this.progressCallback) {
@@ -364,6 +370,32 @@ class Renderer {
364
370
  endClip() {
365
371
  this.pdfDocument.restore();
366
372
  }
373
+ beginVerticalAlignment(item) {
374
+ if (item.isCellContentMultiPage) {
375
+ return;
376
+ }
377
+ switch (item.verticalAlignment) {
378
+ case 'middle':
379
+ this.pdfDocument.save();
380
+ this.pdfDocument.translate(0, -(item.getNodeHeight() - item.getViewHeight()) / 2);
381
+ break;
382
+ case 'bottom':
383
+ this.pdfDocument.save();
384
+ this.pdfDocument.translate(0, -(item.getNodeHeight() - item.getViewHeight()));
385
+ break;
386
+ }
387
+ }
388
+ endVerticalAlignment(item) {
389
+ if (item.isCellContentMultiPage) {
390
+ return;
391
+ }
392
+ switch (item.verticalAlignment) {
393
+ case 'middle':
394
+ case 'bottom':
395
+ this.pdfDocument.restore();
396
+ break;
397
+ }
398
+ }
367
399
  renderWatermark(page) {
368
400
  let watermark = page.watermark;
369
401
  this.pdfDocument.fill(watermark.color);
package/js/SVGMeasure.js CHANGED
@@ -4,11 +4,11 @@ exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
  var _xmldoc = require("xmldoc");
6
6
  var _variableType = require("./helpers/variableType");
7
- /**
8
- * Strip unit postfix, parse number, but return undefined instead of NaN for bad input
9
- *
10
- * @param {string} textVal
11
- * @returns {?number}
7
+ /**
8
+ * Strip unit postfix, parse number, but return undefined instead of NaN for bad input
9
+ *
10
+ * @param {string} textVal
11
+ * @returns {?number}
12
12
  */
13
13
  const stripUnits = textVal => {
14
14
  let n = parseFloat(textVal);
@@ -18,11 +18,11 @@ const stripUnits = textVal => {
18
18
  return n;
19
19
  };
20
20
 
21
- /**
22
- * Make sure it's valid XML and the root tag is <svg/>, returns xmldoc DOM
23
- *
24
- * @param {string} svgString
25
- * @returns {object}
21
+ /**
22
+ * Make sure it's valid XML and the root tag is <svg/>, returns xmldoc DOM
23
+ *
24
+ * @param {string} svgString
25
+ * @returns {object}
26
26
  */
27
27
  const parseSVG = svgString => {
28
28
  let doc;
@@ -3,13 +3,13 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
  var _variableType = require("./helpers/variableType");
6
- /**
7
- * Used for style inheritance and style overrides
6
+ /**
7
+ * Used for style inheritance and style overrides
8
8
  */
9
9
  class StyleContextStack {
10
- /**
11
- * @param {object} styleDictionary named styles dictionary
12
- * @param {object} defaultStyle optional default style definition
10
+ /**
11
+ * @param {object} styleDictionary named styles dictionary
12
+ * @param {object} defaultStyle optional default style definition
13
13
  */
14
14
  constructor(styleDictionary, defaultStyle = {}) {
15
15
  this.styleDictionary = styleDictionary;
@@ -17,10 +17,10 @@ class StyleContextStack {
17
17
  this.styleOverrides = [];
18
18
  }
19
19
 
20
- /**
21
- * Creates cloned version of current stack
22
- *
23
- * @returns {StyleContextStack} current stack snapshot
20
+ /**
21
+ * Creates cloned version of current stack
22
+ *
23
+ * @returns {StyleContextStack} current stack snapshot
24
24
  */
25
25
  clone() {
26
26
  let stack = new StyleContextStack(this.styleDictionary, this.defaultStyle);
@@ -30,21 +30,21 @@ class StyleContextStack {
30
30
  return stack;
31
31
  }
32
32
 
33
- /**
34
- * Pushes style-name or style-overrides-object onto the stack for future evaluation
35
- *
36
- * @param {string|object} styleNameOrOverride style-name (referring to styleDictionary) or
37
- * a new dictionary defining overriding properties
33
+ /**
34
+ * Pushes style-name or style-overrides-object onto the stack for future evaluation
35
+ *
36
+ * @param {string|object} styleNameOrOverride style-name (referring to styleDictionary) or
37
+ * a new dictionary defining overriding properties
38
38
  */
39
39
  push(styleNameOrOverride) {
40
40
  this.styleOverrides.push(styleNameOrOverride);
41
41
  }
42
42
 
43
- /**
44
- * Removes last style-name or style-overrides-object from the stack
45
- *
46
- * @param {number} howMany optional number of elements to be popped (if not specified,
47
- * one element will be removed from the stack)
43
+ /**
44
+ * Removes last style-name or style-overrides-object from the stack
45
+ *
46
+ * @param {number} howMany optional number of elements to be popped (if not specified,
47
+ * one element will be removed from the stack)
48
48
  */
49
49
  pop(howMany = 1) {
50
50
  while (howMany-- > 0) {
@@ -52,13 +52,13 @@ class StyleContextStack {
52
52
  }
53
53
  }
54
54
 
55
- /**
56
- * Creates a set of named styles or/and a style-overrides-object based on the item,
57
- * pushes those elements onto the stack for future evaluation and returns the number
58
- * of elements pushed, so they can be easily popped then.
59
- *
60
- * @param {object} item - an object with optional style property and/or style overrides
61
- * @returns {number} the number of items pushed onto the stack
55
+ /**
56
+ * Creates a set of named styles or/and a style-overrides-object based on the item,
57
+ * pushes those elements onto the stack for future evaluation and returns the number
58
+ * of elements pushed, so they can be easily popped then.
59
+ *
60
+ * @param {object} item - an object with optional style property and/or style overrides
61
+ * @returns {number} the number of items pushed onto the stack
62
62
  */
63
63
  autopush(item) {
64
64
  if ((0, _variableType.isString)(item)) {
@@ -85,13 +85,13 @@ class StyleContextStack {
85
85
  return styleNames.length + 1;
86
86
  }
87
87
 
88
- /**
89
- * Automatically pushes elements onto the stack, using autopush based on item,
90
- * executes callback and then pops elements back. Returns value returned by callback
91
- *
92
- * @param {object} item - an object with optional style property and/or style overrides
93
- * @param {Function} callback to be called between autopush and pop
94
- * @returns {object} value returned by callback
88
+ /**
89
+ * Automatically pushes elements onto the stack, using autopush based on item,
90
+ * executes callback and then pops elements back. Returns value returned by callback
91
+ *
92
+ * @param {object} item - an object with optional style property and/or style overrides
93
+ * @param {Function} callback to be called between autopush and pop
94
+ * @returns {object} value returned by callback
95
95
  */
96
96
  auto(item, callback) {
97
97
  let pushedItems = this.autopush(item);
@@ -102,11 +102,11 @@ class StyleContextStack {
102
102
  return result;
103
103
  }
104
104
 
105
- /**
106
- * Evaluates stack and returns value of a named property
107
- *
108
- * @param {string} property - property name
109
- * @returns {?any} property value or null if not found
105
+ /**
106
+ * Evaluates stack and returns value of a named property
107
+ *
108
+ * @param {string} property - property name
109
+ * @returns {?any} property value or null if not found
110
110
  */
111
111
  getProperty(property) {
112
112
  const getStylePropertyFromStyle = (styleName, property, visited = new Set()) => {
@@ -150,12 +150,12 @@ class StyleContextStack {
150
150
  return this.defaultStyle && this.defaultStyle[property];
151
151
  }
152
152
 
153
- /**
154
- * @param {object} item
155
- * @param {StyleContextStack} styleContextStack
156
- * @param {string} property
157
- * @param {any} defaultValue
158
- * @returns {any}
153
+ /**
154
+ * @param {object} item
155
+ * @param {StyleContextStack} styleContextStack
156
+ * @param {string} property
157
+ * @param {any} defaultValue
158
+ * @returns {any}
159
159
  */
160
160
  static getStyleProperty(item, styleContextStack, property, defaultValue) {
161
161
  let value;
@@ -172,10 +172,10 @@ class StyleContextStack {
172
172
  return (0, _variableType.isValue)(value) ? value : defaultValue;
173
173
  }
174
174
 
175
- /**
176
- * @param {object} source
177
- * @param {object} destination
178
- * @returns {object}
175
+ /**
176
+ * @param {object} source
177
+ * @param {object} destination
178
+ * @returns {object}
179
179
  */
180
180
  static copyStyle(source = {}, destination = {}) {
181
181
  // TODO: default style to source
@@ -145,6 +145,7 @@ class TableProcessor {
145
145
  this._tableTopBorderY = writer.context().y;
146
146
  writer.context().moveDown(this.topLineWidth);
147
147
  }
148
+ this.rowTopPageY = writer.context().y + this.rowPaddingTop;
148
149
  if (this.dontBreakRows && rowIndex > 0) {
149
150
  writer.beginUnbreakableBlock();
150
151
  }
@@ -441,6 +442,19 @@ class TableProcessor {
441
442
  this.drawVerticalLine(xs[i].x, y1 - hzLineOffset, y2 + this.bottomLineWidth, xs[i].index, writer, rowIndex, xs[i - 1] ? xs[i - 1].index : null);
442
443
  }
443
444
  if (i < l - 1) {
445
+ body[rowIndex][colIndex]._willBreak = body[rowIndex][colIndex]._willBreak ?? willBreak;
446
+ if (body[rowIndex][colIndex]._bottomY === undefined) {
447
+ let bottomY = this.dontBreakRows ? y2 + this.bottomLineWidth : y2 + this.bottomLineWidth / 2;
448
+ if (willBreak || this.dontBreakRows) {
449
+ bottomY = bottomY - this.rowPaddingBottom;
450
+ }
451
+ body[rowIndex][colIndex]._bottomY = bottomY - this.reservedAtBottom;
452
+ }
453
+ body[rowIndex][colIndex]._rowTopPageY = this.rowTopPageY;
454
+ if (this.dontBreakRows) {
455
+ body[rowIndex][colIndex]._rowTopPageYPadding = this.rowPaddingTop;
456
+ }
457
+ body[rowIndex][colIndex]._lastPageNumber = ys[yi].page + 1;
444
458
  let fillColor = body[rowIndex][colIndex].fillColor;
445
459
  let fillOpacity = body[rowIndex][colIndex].fillOpacity;
446
460
  if (!fillColor) {
package/js/TextBreaker.js CHANGED
@@ -6,11 +6,11 @@ var _linebreak = _interopRequireDefault(require("linebreak"));
6
6
  var _variableType = require("./helpers/variableType");
7
7
  var _StyleContextStack = _interopRequireDefault(require("./StyleContextStack"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * @param {string} text
11
- * @param {boolean} noWrap
12
- * @param {boolean} breakAll
13
- * @returns {Array}
9
+ /**
10
+ * @param {string} text
11
+ * @param {boolean} noWrap
12
+ * @param {boolean} breakAll
13
+ * @returns {Array}
14
14
  */
15
15
  const splitWords = (text, noWrap, breakAll = false) => {
16
16
  let words = [];
@@ -67,10 +67,10 @@ const splitWords = (text, noWrap, breakAll = false) => {
67
67
  return words;
68
68
  };
69
69
 
70
- /**
71
- * @param {Array} words
72
- * @param {boolean} noWrap
73
- * @returns {?string}
70
+ /**
71
+ * @param {Array} words
72
+ * @param {boolean} noWrap
73
+ * @returns {?string}
74
74
  */
75
75
  const getFirstWord = (words, noWrap) => {
76
76
  let word = words[0];
@@ -88,10 +88,10 @@ const getFirstWord = (words, noWrap) => {
88
88
  return word.text;
89
89
  };
90
90
 
91
- /**
92
- * @param {Array} words
93
- * @param {boolean} noWrap
94
- * @returns {?string}
91
+ /**
92
+ * @param {Array} words
93
+ * @param {boolean} noWrap
94
+ * @returns {?string}
95
95
  */
96
96
  const getLastWord = (words, noWrap) => {
97
97
  let word = words[words.length - 1];
@@ -112,10 +112,10 @@ const getLastWord = (words, noWrap) => {
112
112
  return word.text;
113
113
  };
114
114
  class TextBreaker {
115
- /**
116
- * @param {string|Array} texts
117
- * @param {StyleContextStack} styleContextStack
118
- * @returns {Array}
115
+ /**
116
+ * @param {string|Array} texts
117
+ * @param {StyleContextStack} styleContextStack
118
+ * @returns {Array}
119
119
  */
120
120
  getBreaks(texts, styleContextStack) {
121
121
  let results = [];
package/js/TextInlines.js CHANGED
@@ -8,9 +8,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
8
8
  const LEADING = /^(\s)+/g;
9
9
  const TRAILING = /(\s)+$/g;
10
10
 
11
- /**
12
- * @param {Array} array
13
- * @returns {Array}
11
+ /**
12
+ * @param {Array} array
13
+ * @returns {Array}
14
14
  */
15
15
  const flattenTextArray = array => {
16
16
  function flatten(array) {
@@ -30,24 +30,24 @@ const flattenTextArray = array => {
30
30
  return array;
31
31
  };
32
32
 
33
- /**
34
- * Text measurement utility
33
+ /**
34
+ * Text measurement utility
35
35
  */
36
36
  class TextInlines {
37
- /**
38
- * @param {object} pdfDocument object is instance of PDFDocument
37
+ /**
38
+ * @param {object} pdfDocument object is instance of PDFDocument
39
39
  */
40
40
  constructor(pdfDocument) {
41
41
  this.pdfDocument = pdfDocument;
42
42
  }
43
43
 
44
- /**
45
- * Converts an array of strings (or inline-definition-objects) into a collection
46
- * of inlines and calculated minWidth/maxWidth and their min/max widths
47
- *
48
- * @param {Array|object} textArray an array of inline-definition-objects (or strings)
49
- * @param {StyleContextStack} styleContextStack current style stack
50
- * @returns {object} collection of inlines, minWidth, maxWidth
44
+ /**
45
+ * Converts an array of strings (or inline-definition-objects) into a collection
46
+ * of inlines and calculated minWidth/maxWidth and their min/max widths
47
+ *
48
+ * @param {Array|object} textArray an array of inline-definition-objects (or strings)
49
+ * @param {StyleContextStack} styleContextStack current style stack
50
+ * @returns {object} collection of inlines, minWidth, maxWidth
51
51
  */
52
52
  buildInlines(textArray, styleContextStack) {
53
53
  const getTrimmedWidth = item => {
@@ -144,23 +144,23 @@ class TextInlines {
144
144
  return array;
145
145
  }
146
146
 
147
- /**
148
- * Width of text
149
- *
150
- * @param {string} text
151
- * @param {object} inline
152
- * @returns {number}
147
+ /**
148
+ * Width of text
149
+ *
150
+ * @param {string} text
151
+ * @param {object} inline
152
+ * @returns {number}
153
153
  */
154
154
  widthOfText(text, inline) {
155
155
  return inline.font.widthOfString(text, inline.fontSize, inline.fontFeatures) + (inline.characterSpacing || 0) * (text.length - 1);
156
156
  }
157
157
 
158
- /**
159
- * Returns size of the specified string (without breaking it) using the current style
160
- *
161
- * @param {string} text text to be measured
162
- * @param {object} styleContextStack current style stack
163
- * @returns {object} size of the specified string
158
+ /**
159
+ * Returns size of the specified string (without breaking it) using the current style
160
+ *
161
+ * @param {string} text text to be measured
162
+ * @param {object} styleContextStack current style stack
163
+ * @returns {object} size of the specified string
164
164
  */
165
165
  sizeOfText(text, styleContextStack) {
166
166
  //TODO: refactor - extract from measure
@@ -187,13 +187,13 @@ class TextInlines {
187
187
  };
188
188
  }
189
189
 
190
- /**
191
- * Returns size of the specified rotated string (without breaking it) using the current style
192
- *
193
- * @param {string} text text to be measured
194
- * @param {number} angle
195
- * @param {object} styleContextStack current style stack
196
- * @returns {object} size of the specified string
190
+ /**
191
+ * Returns size of the specified rotated string (without breaking it) using the current style
192
+ *
193
+ * @param {string} text text to be measured
194
+ * @param {number} angle
195
+ * @param {object} styleContextStack current style stack
196
+ * @returns {object} size of the specified string
197
197
  */
198
198
  sizeOfRotatedText(text, angle, styleContextStack) {
199
199
  let angleRad = angle * Math.PI / -180;
package/js/base.js CHANGED
@@ -13,10 +13,10 @@ class pdfmake {
13
13
  this.urlResolver = null;
14
14
  }
15
15
 
16
- /**
17
- * @param {object} docDefinition
18
- * @param {?object} options
19
- * @returns {object}
16
+ /**
17
+ * @param {object} docDefinition
18
+ * @param {?object} options
19
+ * @returns {object}
20
20
  */
21
21
  createPdf(docDefinition, options = {}) {
22
22
  if (!(0, _variableType.isObject)(docDefinition)) {