pdfmake 0.3.0-beta.3 → 0.3.0-beta.5

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 (49) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/build/pdfmake.js +2213 -8630
  3. package/build/pdfmake.js.map +1 -1
  4. package/build/pdfmake.min.js +2 -2
  5. package/build/pdfmake.min.js.map +1 -1
  6. package/build/vfs_fonts.js +6 -5
  7. package/js/3rd-party/svg-to-pdfkit/source.js +247 -920
  8. package/js/3rd-party/svg-to-pdfkit.js +0 -3
  9. package/js/DocMeasure.js +6 -139
  10. package/js/DocPreprocessor.js +2 -54
  11. package/js/DocumentContext.js +0 -40
  12. package/js/ElementWriter.js +2 -70
  13. package/js/LayoutBuilder.js +20 -165
  14. package/js/Line.js +6 -25
  15. package/js/OutputDocument.js +15 -24
  16. package/js/OutputDocumentServer.js +0 -6
  17. package/js/PDFDocument.js +1 -46
  18. package/js/PageElementWriter.js +7 -31
  19. package/js/PageSize.js +2 -16
  20. package/js/Printer.js +5 -46
  21. package/js/Renderer.js +11 -98
  22. package/js/SVGMeasure.js +1 -20
  23. package/js/StyleContextStack.js +12 -36
  24. package/js/TableProcessor.js +36 -117
  25. package/js/TextBreaker.js +2 -44
  26. package/js/TextDecorator.js +1 -38
  27. package/js/TextInlines.js +8 -49
  28. package/js/URLResolver.js +0 -13
  29. package/js/base.js +1 -17
  30. package/js/browser-extensions/OutputDocumentBrowser.js +5 -17
  31. package/js/browser-extensions/URLBrowserResolver.js +0 -17
  32. package/js/browser-extensions/fonts/Roboto.js +0 -4
  33. package/js/browser-extensions/index.js +0 -16
  34. package/js/browser-extensions/pdfMake.js +2 -4
  35. package/js/browser-extensions/standard-fonts/Courier.js +0 -4
  36. package/js/browser-extensions/standard-fonts/Helvetica.js +0 -4
  37. package/js/browser-extensions/standard-fonts/Symbol.js +0 -4
  38. package/js/browser-extensions/standard-fonts/Times.js +0 -4
  39. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +0 -4
  40. package/js/columnCalculator.js +6 -18
  41. package/js/helpers/node.js +3 -27
  42. package/js/helpers/tools.js +0 -8
  43. package/js/helpers/variableType.js +4 -9
  44. package/js/index.js +0 -6
  45. package/js/qrEnc.js +126 -215
  46. package/js/tableLayouts.js +1 -28
  47. package/js/virtual-fs.js +3 -19
  48. package/package.json +2 -2
  49. package/src/OutputDocument.js +78 -78
package/js/Line.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
-
6
5
  class Line {
7
6
  /**
8
7
  * @param {number} maxWidth Maximum width this line can have
@@ -14,30 +13,26 @@ class Line {
14
13
  this.inlineWidths = 0;
15
14
  this.inlines = [];
16
15
  }
16
+
17
17
  /**
18
18
  * @param {object} inline
19
19
  */
20
-
21
-
22
20
  addInline(inline) {
23
21
  if (this.inlines.length === 0) {
24
22
  this.leadingCut = inline.leadingCut || 0;
25
23
  }
26
-
27
24
  this.trailingCut = inline.trailingCut || 0;
28
25
  inline.x = this.inlineWidths - this.leadingCut;
29
26
  this.inlines.push(inline);
30
27
  this.inlineWidths += inline.width;
31
-
32
28
  if (inline.lineEnd) {
33
29
  this.newLineForced = true;
34
30
  }
35
31
  }
32
+
36
33
  /**
37
34
  * @returns {number}
38
35
  */
39
-
40
-
41
36
  getHeight() {
42
37
  let max = 0;
43
38
  this.inlines.forEach(item => {
@@ -45,11 +40,10 @@ class Line {
45
40
  });
46
41
  return max;
47
42
  }
43
+
48
44
  /**
49
45
  * @returns {number}
50
46
  */
51
-
52
-
53
47
  getAscenderHeight() {
54
48
  let y = 0;
55
49
  this.inlines.forEach(inline => {
@@ -57,69 +51,56 @@ class Line {
57
51
  });
58
52
  return y;
59
53
  }
54
+
60
55
  /**
61
56
  * @returns {number}
62
57
  */
63
-
64
-
65
58
  getWidth() {
66
59
  return this.inlineWidths - this.leadingCut - this.trailingCut;
67
60
  }
61
+
68
62
  /**
69
63
  * @returns {number}
70
64
  */
71
-
72
-
73
65
  getAvailableWidth() {
74
66
  return this.maxWidth - this.getWidth();
75
67
  }
68
+
76
69
  /**
77
70
  * @param {object} inline
78
71
  * @param {Array} nextInlines
79
72
  * @returns {boolean}
80
73
  */
81
-
82
-
83
74
  hasEnoughSpaceForInline(inline, nextInlines = []) {
84
75
  if (this.inlines.length === 0) {
85
76
  return true;
86
77
  }
87
-
88
78
  if (this.newLineForced) {
89
79
  return false;
90
80
  }
91
-
92
81
  let inlineWidth = inline.width;
93
82
  let inlineTrailingCut = inline.trailingCut || 0;
94
-
95
83
  if (inline.noNewLine) {
96
84
  for (let i = 0, l = nextInlines.length; i < l; i++) {
97
85
  let nextInline = nextInlines[i];
98
86
  inlineWidth += nextInline.width;
99
87
  inlineTrailingCut += nextInline.trailingCut || 0;
100
-
101
88
  if (!nextInline.noNewLine) {
102
89
  break;
103
90
  }
104
91
  }
105
92
  }
106
-
107
93
  return this.inlineWidths + inlineWidth - this.leadingCut - inlineTrailingCut <= this.maxWidth;
108
94
  }
109
-
110
95
  clone() {
111
96
  let result = new Line(this.maxWidth);
112
-
113
97
  for (let key in this) {
114
98
  if (this.hasOwnProperty(key)) {
115
99
  result[key] = this[key];
116
100
  }
117
101
  }
118
-
119
102
  return result;
120
103
  }
121
-
122
104
  }
123
-
124
105
  var _default = Line;
125
106
  exports.default = _default;
@@ -2,29 +2,26 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
-
6
5
  class OutputDocument {
7
- /**
8
- * @param {Promise<object>} pdfDocumentPromise
6
+ /**
7
+ * @param {Promise<object>} pdfDocumentPromise
9
8
  */
10
9
  constructor(pdfDocumentPromise) {
11
- this.bufferSize = 9007199254740991;
10
+ this.bufferSize = 1073741824;
12
11
  this.pdfDocumentPromise = pdfDocumentPromise;
13
12
  this.bufferPromise = null;
14
13
  }
15
- /**
16
- * @returns {Promise<object>}
17
- */
18
-
19
14
 
15
+ /**
16
+ * @returns {Promise<object>}
17
+ */
20
18
  getStream() {
21
19
  return this.pdfDocumentPromise;
22
20
  }
23
- /**
24
- * @returns {Promise<Buffer>}
25
- */
26
-
27
21
 
22
+ /**
23
+ * @returns {Promise<Buffer>}
24
+ */
28
25
  getBuffer() {
29
26
  if (this.bufferPromise === null) {
30
27
  this.bufferPromise = new Promise((resolve, reject) => {
@@ -33,7 +30,6 @@ class OutputDocument {
33
30
  let result;
34
31
  stream.on('readable', () => {
35
32
  let chunk;
36
-
37
33
  while ((chunk = stream.read(this.bufferSize)) !== null) {
38
34
  chunks.push(chunk);
39
35
  }
@@ -48,14 +44,12 @@ class OutputDocument {
48
44
  });
49
45
  });
50
46
  }
51
-
52
47
  return this.bufferPromise;
53
48
  }
54
- /**
55
- * @returns {Promise<string>}
56
- */
57
-
58
49
 
50
+ /**
51
+ * @returns {Promise<string>}
52
+ */
59
53
  getBase64() {
60
54
  return new Promise((resolve, reject) => {
61
55
  this.getBuffer().then(buffer => {
@@ -65,11 +59,10 @@ class OutputDocument {
65
59
  });
66
60
  });
67
61
  }
68
- /**
69
- * @returns {Promise<string>}
70
- */
71
-
72
62
 
63
+ /**
64
+ * @returns {Promise<string>}
65
+ */
73
66
  getDataUrl() {
74
67
  return new Promise((resolve, reject) => {
75
68
  this.getBase64().then(data => {
@@ -79,8 +72,6 @@ class OutputDocument {
79
72
  });
80
73
  });
81
74
  }
82
-
83
75
  }
84
-
85
76
  var _default = OutputDocument;
86
77
  exports.default = _default;
@@ -2,13 +2,9 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
-
6
5
  var _OutputDocument = _interopRequireDefault(require("./OutputDocument"));
7
-
8
6
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
8
  class OutputDocumentServer extends _OutputDocument.default {
13
9
  /**
14
10
  * @param {string} filename
@@ -27,8 +23,6 @@ class OutputDocumentServer extends _OutputDocument.default {
27
23
  });
28
24
  });
29
25
  }
30
-
31
26
  }
32
-
33
27
  var _default = OutputDocumentServer;
34
28
  exports.default = _default;
package/js/PDFDocument.js CHANGED
@@ -2,14 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
-
6
5
  var _pdfkit = _interopRequireDefault(require("@foliojs-fork/pdfkit"));
7
-
8
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
-
10
7
  const typeName = (bold, italics) => {
11
8
  let type = 'normal';
12
-
13
9
  if (bold && italics) {
14
10
  type = 'bolditalics';
15
11
  } else if (bold) {
@@ -17,16 +13,13 @@ const typeName = (bold, italics) => {
17
13
  } else if (italics) {
18
14
  type = 'italics';
19
15
  }
20
-
21
16
  return type;
22
17
  };
23
-
24
18
  class PDFDocument extends _pdfkit.default {
25
19
  constructor(fonts = {}, images = {}, patterns = {}, attachments = {}, options = {}, virtualfs = null) {
26
20
  super(options);
27
21
  this.fonts = {};
28
22
  this.fontCache = {};
29
-
30
23
  for (let font in fonts) {
31
24
  if (fonts.hasOwnProperty(font)) {
32
25
  let fontDef = fonts[font];
@@ -38,142 +31,106 @@ class PDFDocument extends _pdfkit.default {
38
31
  };
39
32
  }
40
33
  }
41
-
42
34
  this.patterns = {};
43
-
44
35
  for (let pattern in patterns) {
45
36
  if (patterns.hasOwnProperty(pattern)) {
46
37
  let patternDef = patterns[pattern];
47
38
  this.patterns[pattern] = this.pattern(patternDef.boundingBox, patternDef.xStep, patternDef.yStep, patternDef.pattern, patternDef.colored);
48
39
  }
49
40
  }
50
-
51
41
  this.images = images;
52
42
  this.attachments = attachments;
53
43
  this.virtualfs = virtualfs;
54
44
  }
55
-
56
45
  getFontType(bold, italics) {
57
46
  return typeName(bold, italics);
58
47
  }
59
-
60
48
  getFontFile(familyName, bold, italics) {
61
49
  let type = this.getFontType(bold, italics);
62
-
63
50
  if (!this.fonts[familyName] || !this.fonts[familyName][type]) {
64
51
  return null;
65
52
  }
66
-
67
53
  return this.fonts[familyName][type];
68
54
  }
69
-
70
55
  provideFont(familyName, bold, italics) {
71
56
  let type = this.getFontType(bold, italics);
72
-
73
57
  if (this.getFontFile(familyName, bold, italics) === null) {
74
58
  throw new Error(`Font '${familyName}' in style '${type}' is not defined in the font section of the document definition.`);
75
59
  }
76
-
77
60
  this.fontCache[familyName] = this.fontCache[familyName] || {};
78
-
79
61
  if (!this.fontCache[familyName][type]) {
80
62
  let def = this.fonts[familyName][type];
81
-
82
63
  if (!Array.isArray(def)) {
83
64
  def = [def];
84
65
  }
85
-
86
66
  if (this.virtualfs && this.virtualfs.existsSync(def[0])) {
87
67
  def[0] = this.virtualfs.readFileSync(def[0]);
88
68
  }
89
-
90
69
  this.fontCache[familyName][type] = this.font(...def)._font;
91
70
  }
92
-
93
71
  return this.fontCache[familyName][type];
94
72
  }
95
-
96
73
  provideImage(src) {
97
74
  const realImageSrc = src => {
98
75
  let image = this.images[src];
99
-
100
76
  if (!image) {
101
77
  return src;
102
78
  }
103
-
104
79
  if (this.virtualfs && this.virtualfs.existsSync(image)) {
105
80
  return this.virtualfs.readFileSync(image);
106
81
  }
107
-
108
82
  let index = image.indexOf('base64,');
109
-
110
83
  if (index < 0) {
111
84
  return this.images[src];
112
85
  }
113
-
114
86
  return Buffer.from(image.substring(index + 7), 'base64');
115
87
  };
116
-
117
88
  if (this._imageRegistry[src]) {
118
89
  return this._imageRegistry[src];
119
90
  }
120
-
121
91
  let image;
122
-
123
92
  try {
124
93
  image = this.openImage(realImageSrc(src));
125
-
126
94
  if (!image) {
127
95
  throw new Error('No image');
128
96
  }
129
97
  } catch (error) {
130
98
  throw new Error(`Invalid image: ${error.toString()}\nImages dictionary should contain dataURL entries (or local file paths in node.js)`);
131
99
  }
132
-
133
100
  image.embed(this);
134
101
  this._imageRegistry[src] = image;
135
102
  return image;
136
103
  }
104
+
137
105
  /**
138
106
  * @param {Array} color pdfmake format: [<pattern name>, <color>]
139
107
  * @returns {Array} pdfkit format: [<pattern object>, <color>]
140
108
  */
141
-
142
-
143
109
  providePattern(color) {
144
110
  if (Array.isArray(color) && color.length === 2) {
145
111
  return [this.patterns[color[0]], color[1]];
146
112
  }
147
-
148
113
  return null;
149
114
  }
150
-
151
115
  provideAttachment(src) {
152
116
  const checkRequired = obj => {
153
117
  if (!obj) {
154
118
  throw new Error('No attachment');
155
119
  }
156
-
157
120
  if (!obj.src) {
158
121
  throw new Error('The "src" key is required for attachments');
159
122
  }
160
-
161
123
  return obj;
162
124
  };
163
-
164
125
  if (typeof src === 'object') {
165
126
  return checkRequired(src);
166
127
  }
167
-
168
128
  let attachment = checkRequired(this.attachments[src]);
169
-
170
129
  if (this.virtualfs && this.virtualfs.existsSync(attachment.src)) {
171
130
  return this.virtualfs.readFileSync(attachment.src);
172
131
  }
173
-
174
132
  return attachment;
175
133
  }
176
-
177
134
  setOpenActionAsPrint() {
178
135
  let printActionRef = this.ref({
179
136
  Type: 'Action',
@@ -183,8 +140,6 @@ class PDFDocument extends _pdfkit.default {
183
140
  this._root.data.OpenAction = printActionRef;
184
141
  printActionRef.end();
185
142
  }
186
-
187
143
  }
188
-
189
144
  var _default = PDFDocument;
190
145
  exports.default = _default;
@@ -2,11 +2,8 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
-
6
5
  var _ElementWriter = _interopRequireDefault(require("./ElementWriter"));
7
-
8
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
-
10
7
  /**
11
8
  * An extended ElementWriter which can handle:
12
9
  * - page-breaks (it adds new pages when there's not enough space left),
@@ -21,52 +18,42 @@ class PageElementWriter extends _ElementWriter.default {
21
18
  this.transactionLevel = 0;
22
19
  this.repeatables = [];
23
20
  }
24
-
25
21
  addLine(line, dontUpdateContextPosition, index) {
26
22
  return this._fitOnPage(() => super.addLine(line, dontUpdateContextPosition, index));
27
23
  }
28
-
29
24
  addImage(image, index) {
30
25
  return this._fitOnPage(() => super.addImage(image, index));
31
26
  }
32
-
33
27
  addCanvas(image, index) {
34
28
  return this._fitOnPage(() => super.addCanvas(image, index));
35
29
  }
36
-
37
30
  addSVG(image, index) {
38
31
  return this._fitOnPage(() => super.addSVG(image, index));
39
32
  }
40
-
41
33
  addQr(qr, index) {
42
34
  return this._fitOnPage(() => super.addQr(qr, index));
43
35
  }
44
-
45
36
  addAttachment(attachment, index) {
46
37
  return this._fitOnPage(() => super.addAttachment(attachment, index));
47
38
  }
48
-
49
39
  addVector(vector, ignoreContextX, ignoreContextY, index) {
50
40
  return super.addVector(vector, ignoreContextX, ignoreContextY, index);
51
41
  }
52
-
53
42
  beginClip(width, height) {
54
43
  return super.beginClip(width, height);
55
44
  }
56
-
57
45
  endClip() {
58
46
  return super.endClip();
59
47
  }
60
-
61
48
  addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition) {
62
49
  return this._fitOnPage(() => super.addFragment(fragment, useBlockXOffset, useBlockYOffset, dontUpdateContextPosition));
63
50
  }
64
-
65
51
  moveToNextPage(pageOrientation) {
66
- let nextPage = this.context().moveToNextPage(pageOrientation); // moveToNextPage is called multiple times for table, because is called for each column
52
+ let nextPage = this.context().moveToNextPage(pageOrientation);
53
+
54
+ // moveToNextPage is called multiple times for table, because is called for each column
67
55
  // and repeatables are inserted only in the first time. If columns are used, is needed
68
56
  // call for table in first column and then for table in the second column (is other repeatables).
69
-
70
57
  this.repeatables.forEach(function (rep) {
71
58
  if (rep.insertedOnPages[this.context().page] === undefined) {
72
59
  rep.insertedOnPages[this.context().page] = true;
@@ -81,33 +68,30 @@ class PageElementWriter extends _ElementWriter.default {
81
68
  y: this.context().y
82
69
  });
83
70
  }
84
-
85
71
  beginUnbreakableBlock(width, height) {
86
72
  if (this.transactionLevel++ === 0) {
87
73
  this.originalX = this.context().x;
88
74
  this.pushContext(width, height);
89
75
  }
90
76
  }
91
-
92
77
  commitUnbreakableBlock(forcedX, forcedY) {
93
78
  if (--this.transactionLevel === 0) {
94
79
  let unbreakableContext = this.context();
95
80
  this.popContext();
96
81
  let nbPages = unbreakableContext.pages.length;
97
-
98
82
  if (nbPages > 0) {
99
83
  // no support for multi-page unbreakableBlocks
100
84
  let fragment = unbreakableContext.pages[0];
101
85
  fragment.xOffset = forcedX;
102
- fragment.yOffset = forcedY; //TODO: vectors can influence height in some situations
86
+ fragment.yOffset = forcedY;
103
87
 
88
+ //TODO: vectors can influence height in some situations
104
89
  if (nbPages > 1) {
105
90
  // on out-of-context blocs (headers, footers, background) height should be the whole DocumentContext height
106
91
  if (forcedX !== undefined || forcedY !== undefined) {
107
92
  fragment.height = unbreakableContext.getCurrentPage().pageSize.height - unbreakableContext.pageMargins.top - unbreakableContext.pageMargins.bottom;
108
93
  } else {
109
94
  fragment.height = this.context().getCurrentPage().pageSize.height - this.context().pageMargins.top - this.context().pageMargins.bottom;
110
-
111
95
  for (let i = 0, l = this.repeatables.length; i < l; i++) {
112
96
  fragment.height -= this.repeatables[i].height;
113
97
  }
@@ -115,7 +99,6 @@ class PageElementWriter extends _ElementWriter.default {
115
99
  } else {
116
100
  fragment.height = unbreakableContext.y;
117
101
  }
118
-
119
102
  if (forcedX !== undefined || forcedY !== undefined) {
120
103
  super.addFragment(fragment, true, true, true);
121
104
  } else {
@@ -124,7 +107,6 @@ class PageElementWriter extends _ElementWriter.default {
124
107
  }
125
108
  }
126
109
  }
127
-
128
110
  currentBlockToRepeatable() {
129
111
  let unbreakableContext = this.context();
130
112
  let rep = {
@@ -133,33 +115,27 @@ class PageElementWriter extends _ElementWriter.default {
133
115
  unbreakableContext.pages[0].items.forEach(item => {
134
116
  rep.items.push(item);
135
117
  });
136
- rep.xOffset = this.originalX; //TODO: vectors can influence height in some situations
118
+ rep.xOffset = this.originalX;
137
119
 
120
+ //TODO: vectors can influence height in some situations
138
121
  rep.height = unbreakableContext.y;
139
122
  rep.insertedOnPages = [];
140
123
  return rep;
141
124
  }
142
-
143
125
  pushToRepeatables(rep) {
144
126
  this.repeatables.push(rep);
145
127
  }
146
-
147
128
  popFromRepeatables() {
148
129
  this.repeatables.pop();
149
130
  }
150
-
151
131
  _fitOnPage(addFct) {
152
132
  let position = addFct();
153
-
154
133
  if (!position) {
155
134
  this.moveToNextPage();
156
135
  position = addFct();
157
136
  }
158
-
159
137
  return position;
160
138
  }
161
-
162
139
  }
163
-
164
140
  var _default = PageElementWriter;
165
141
  exports.default = _default;
package/js/PageSize.js CHANGED
@@ -3,47 +3,36 @@
3
3
  exports.__esModule = true;
4
4
  exports.normalizePageMargin = normalizePageMargin;
5
5
  exports.normalizePageSize = normalizePageSize;
6
-
7
6
  var _standardPageSizes = _interopRequireDefault(require("./standardPageSizes"));
8
-
9
7
  var _variableType = require("./helpers/variableType");
10
-
11
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
9
  function normalizePageSize(pageSize, pageOrientation) {
14
10
  function isNeedSwapPageSizes(pageOrientation) {
15
11
  if ((0, _variableType.isString)(pageOrientation)) {
16
12
  pageOrientation = pageOrientation.toLowerCase();
17
13
  return pageOrientation === 'portrait' && size.width > size.height || pageOrientation === 'landscape' && size.width < size.height;
18
14
  }
19
-
20
15
  return false;
21
16
  }
22
-
23
17
  function pageSizeToWidthAndHeight(pageSize) {
24
18
  if ((0, _variableType.isString)(pageSize)) {
25
19
  let size = _standardPageSizes.default[pageSize.toUpperCase()];
26
-
27
20
  if (!size) {
28
21
  throw new Error(`Page size ${pageSize} not recognized`);
29
22
  }
30
-
31
23
  return {
32
24
  width: size[0],
33
25
  height: size[1]
34
26
  };
35
27
  }
36
-
37
28
  return pageSize;
38
- } // if pageSize.height is set to auto, set the height to infinity so there are no page breaks.
39
-
29
+ }
40
30
 
31
+ // if pageSize.height is set to auto, set the height to infinity so there are no page breaks.
41
32
  if (pageSize && pageSize.height === 'auto') {
42
33
  pageSize.height = Infinity;
43
34
  }
44
-
45
35
  let size = pageSizeToWidthAndHeight(pageSize || 'A4');
46
-
47
36
  if (isNeedSwapPageSizes(pageOrientation)) {
48
37
  // swap page sizes
49
38
  size = {
@@ -51,11 +40,9 @@ function normalizePageSize(pageSize, pageOrientation) {
51
40
  height: size.width
52
41
  };
53
42
  }
54
-
55
43
  size.orientation = size.width > size.height ? 'landscape' : 'portrait';
56
44
  return size;
57
45
  }
58
-
59
46
  function normalizePageMargin(margin) {
60
47
  if ((0, _variableType.isNumber)(margin)) {
61
48
  margin = {
@@ -83,6 +70,5 @@ function normalizePageMargin(margin) {
83
70
  throw new Error('Invalid pageMargins definition');
84
71
  }
85
72
  }
86
-
87
73
  return margin;
88
74
  }