pdfmake 0.2.8 → 0.2.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfmake",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Client/server side PDF printing in pure JavaScript",
5
5
  "main": "src/printer.js",
6
6
  "browser": "build/pdfmake.js",
@@ -34,6 +34,7 @@
34
34
  "rewire": "^5.0.0",
35
35
  "shx": "^0.3.3",
36
36
  "sinon": "^11.1.1",
37
+ "source-map-loader": "^4.0.1",
37
38
  "stream-browserify": "^3.0.0",
38
39
  "string-replace-webpack-plugin": "^0.1.3",
39
40
  "svg-to-pdfkit": "^0.1.8",
package/src/docMeasure.js CHANGED
@@ -164,6 +164,9 @@ DocMeasure.prototype.measureImageWithDimensions = function (node, dimensions) {
164
164
  var factor = (dimensions.width / dimensions.height > node.fit[0] / node.fit[1]) ? node.fit[0] / dimensions.width : node.fit[1] / dimensions.height;
165
165
  node._width = node._minWidth = node._maxWidth = dimensions.width * factor;
166
166
  node._height = dimensions.height * factor;
167
+ } else if (node.cover) {
168
+ node._width = node._minWidth = node._maxWidth = node.cover.width;
169
+ node._height = node._minHeight = node._maxHeight = node.cover.height;
167
170
  } else {
168
171
  node._width = node._minWidth = node._maxWidth = node.width || dimensions.width;
169
172
  node._height = node.height || (dimensions.height * node._width / dimensions.width);
package/src/printer.js CHANGED
@@ -125,6 +125,7 @@ PdfPrinter.prototype.createPdfKitDocument = function (docDefinition, options) {
125
125
  userPassword: docDefinition.userPassword,
126
126
  ownerPassword: docDefinition.ownerPassword,
127
127
  permissions: docDefinition.permissions,
128
+ lang: docDefinition.language,
128
129
  fontLayoutCache: isBoolean(options.fontLayoutCache) ? options.fontLayoutCache : true,
129
130
  bufferPages: options.bufferPages || false,
130
131
  autoFirstPage: false,
package/src/qrEnc.js CHANGED
@@ -743,11 +743,13 @@ function buildCanvas(data, options) {
743
743
  var canvas = [];
744
744
  var background = options.background || '#fff';
745
745
  var foreground = options.foreground || '#000';
746
+ var padding = options.padding || 0;
746
747
  //var margin = options.margin || 4;
747
748
  var matrix = generateFrame(data, options);
748
749
  var n = matrix.length;
749
750
  var modSize = Math.floor(options.fit ? options.fit / n : 5);
750
- var size = n * modSize;
751
+ var size = (n * modSize) + (modSize * padding * 2);
752
+ var paddingXY = modSize * padding;
751
753
 
752
754
  canvas.push({
753
755
  type: 'rect',
@@ -759,8 +761,8 @@ function buildCanvas(data, options) {
759
761
  if (matrix[i][j]) {
760
762
  canvas.push({
761
763
  type: 'rect',
762
- x: modSize * j,
763
- y: modSize * i,
764
+ x: modSize * j + paddingXY,
765
+ y: modSize * i + paddingXY,
764
766
  w: modSize,
765
767
  h: modSize,
766
768
  lineWidth: 0,
@@ -25,6 +25,10 @@ TableProcessor.prototype.beginTable = function (writer) {
25
25
  this.cleanUpRepeatables = false;
26
26
 
27
27
  this.headerRows = tableNode.table.headerRows || 0;
28
+ if (this.headerRows > tableNode.table.body.length) {
29
+ throw new Error(`Too few rows in the table. Property headerRows requires at least ${this.headerRows}, contains only ${tableNode.table.body.length}`);
30
+ }
31
+
28
32
  this.rowsWithoutPageBreak = this.headerRows + (tableNode.table.keepWithHeaderRows || 0);
29
33
  this.dontBreakRows = tableNode.table.dontBreakRows || false;
30
34
 
@@ -78,7 +78,7 @@ function drawDecoration(group, x, y, pdfKitDoc) {
78
78
  y += lineAscent - (ascent * 0.25);
79
79
  break;
80
80
  default:
81
- throw 'Unkown decoration : ' + group.decoration;
81
+ throw 'Unknown decoration : ' + group.decoration;
82
82
  }
83
83
  pdfKitDoc.save();
84
84