pdfkit-table
Advanced tools
Comparing version 0.1.69 to 0.1.70
27
index.js
@@ -73,3 +73,3 @@ // jshint esversion: 6 | ||
table.rows || (table.rows = []); | ||
table.options && (options = table.options); | ||
table.options && (options = {...options, ...table.options}); | ||
@@ -79,2 +79,3 @@ options.padding || (options.padding = 0); | ||
options.addPage || (options.addPage = false); | ||
options.absolutePosition || (options.absolutePosition = false); | ||
@@ -96,9 +97,11 @@ const title = table.title ? table.title : ( options.title || '' ) ; | ||
let tableWidth = 0; | ||
const maxY = this.page.height - (this.page.margins.top + this.page.margins.bottom); | ||
let startX = options.x || this.x || this.page.margins.left; | ||
let startY = options.y || this.y; | ||
let startY = options.y || this.y || this.page.margins.top; | ||
let lastPositionX = 0; | ||
let rowBottomY = 0; | ||
let tableWidth = 0; | ||
// reset position to margins.left | ||
@@ -386,4 +389,12 @@ if( options.x === null || options.x === -1 ){ | ||
let rowHeight = computeRowHeight(table.headers); | ||
let lastPositionX = startX; // x position head | ||
// lastPositionX = startX; // x position head | ||
// this options is trial | ||
if(options.absolutePosition === true){ | ||
lastPositionX = options.x || startX || this.x; // x position head | ||
startY = options.y || startY || this.y; // x position head | ||
} else { | ||
lastPositionX = startX; // x position head | ||
} | ||
// Check to have enough room for header and first rows. default 3 | ||
@@ -496,5 +507,3 @@ // if (startY + 2 * rowHeight > maxY) this.addPage(); | ||
addHeader(); | ||
let lastPositionX; | ||
// Datas | ||
@@ -501,0 +510,0 @@ table.datas.forEach((row, i) => { |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.69", | ||
"version": "0.1.70", | ||
"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", |
@@ -393,5 +393,10 @@ <p align="center"> | ||
### 0.1.70 | ||
+ fix ***y*** position. | ||
- Thanks Nabil Tahmidul Karim ***@nabiltkarim*** | ||
### 0.1.68 | ||
+ added ***Promise***. table is a Promise(); | ||
+ Added ***Promise***. table is a Promise(); | ||
- Async/Await function | ||
@@ -413,3 +418,3 @@ ```js | ||
+ added ***callback***. | ||
+ Added ***callback***. | ||
```js | ||
@@ -421,4 +426,4 @@ doc.table(table, options, callback); | ||
+ added ***valign*** on headers options. (ex: valign:"center") | ||
+ added ***headerAlign***, alignment only to header. | ||
+ Added ***valign*** on headers options. (ex: valign:"center") | ||
+ Added ***headerAlign***, alignment only to header. | ||
```js | ||
@@ -433,4 +438,4 @@ headers: [ | ||
+ add callbak on addBackground function, add .save() and .restore() style. | ||
+ header font color | ||
+ Add callbak on addBackground function, add .save() and .restore() style. | ||
+ Header font color | ||
- Thanks ***@dev-fema*** | ||
@@ -437,0 +442,0 @@ |
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
42667
589
593