pdfkit-table
Advanced tools
Comparing version 0.1.52 to 0.1.53
25
index.js
@@ -255,3 +255,3 @@ // jshint esversion: 6 | ||
const calcColumnsSizes = () => { | ||
const calcColumnSizes = () => { | ||
@@ -262,16 +262,19 @@ let h = []; // header width | ||
// 1o - Max size table | ||
// (table width) 1o - Max size table | ||
w = this.page.width - this.page.margins.right - ( options.x || this.page.margins.left ); | ||
// 2o - Size defined | ||
options.width && ( w = String(options.width).replace(/[^0-9]/g,'') ); | ||
// (table width) 2o - Size defined | ||
options.width && ( w = String(options.width).replace(/[^0-9]/g,'') >> 0 ); | ||
// 1o | ||
// (table width) if table is percent of page | ||
// ... | ||
// (size columns) 1o | ||
table.headers.forEach( el => { | ||
el.width && h.push(el.width); // - columnSpacing | ||
}); | ||
// 2o | ||
// (size columns) 2o | ||
if(h.length === 0) { | ||
h = options.columnsSize; | ||
} | ||
// 3o | ||
// (size columns) 3o | ||
if(h.length === 0) { | ||
@@ -288,10 +291,10 @@ columnWidth = ( w / table.headers.length ); // - columnSpacing // define column width | ||
// Set columnSizes | ||
// !Set columnSizes | ||
h.length && (columnSizes = h); | ||
p.length && (columnPositions = p); | ||
// 3o - Sum last position + lest header width | ||
// (table width) 3o - Sum last position + lest header width | ||
w = p[p.length-1] + h[h.length-1]; | ||
// Set tableWidth | ||
// !Set tableWidth | ||
w && ( tableWidth = w ); | ||
@@ -307,3 +310,3 @@ | ||
calcColumnsSizes(); | ||
calcColumnSizes(); | ||
@@ -310,0 +313,0 @@ // Header |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.52", | ||
"version": "0.1.53", | ||
"description": "PdfKit Table. Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin) ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -349,21 +349,10 @@ # pdfkit-table | ||
- [Suggestions / Issues / Fixes](https://github.com/natancabral/pdfkit-table/issues) | ||
- cellPadding {Array} [5,2,5,2]; | ||
- striped {Boolean} (corsimcornao) | ||
- colspan - the colspan attribute defines the number of columns a table cell should span. | ||
- renderer function on cell. Like renderer: (value) => { return `$${value}`} | ||
- sample with database | ||
- alignment | ||
- setFontFamily {String} | ||
- setBoldFontFamily {String} | ||
- verticalLines {Boolean} | ||
- verticalLinesWidth {Number} | ||
- verticalLinesColor {String} | ||
- horizontalLines {Boolean} | ||
- horizontalLinesWidth {Number} | ||
- horizontalLinesColor {String} | ||
- tableLine {Boolean} | ||
- tableLineWidth {Number} | ||
- tableLineColor {String} | ||
- margin: marginBottom before, marginTop after | ||
- add line bottom or line top | ||
@@ -374,3 +363,3 @@ ## Changelogs | ||
+ Max size age | ||
+ Max size page | ||
@@ -377,0 +366,0 @@ ### 0.1.48 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464
31576
490