pdfkit-table
Advanced tools
Comparing version 0.1.70 to 0.1.71
32
index.js
@@ -79,2 +79,8 @@ // jshint esversion: 6 | ||
options.absolutePosition || (options.absolutePosition = false); | ||
// divider lines | ||
options.divider || (options.divider = {}); | ||
options.divider.header || (options.divider.header = {disabled: false, width: undefined, opacity: undefined}); | ||
options.divider.horizontal || (options.divider.horizontal = {disabled: false, width: undefined, opacity: undefined}); | ||
options.divider.vertical || (options.divider.vertical = {disabled: false, width: undefined, opacity: undefined}); | ||
@@ -164,8 +170,12 @@ const title = table.title ? table.title : ( options.title || '' ) ; | ||
const separationsRow = (x, y, strokeWidth, strokeOpacity) => { | ||
const separationsRow = (type, x, y, width, opacity) => { | ||
type || (type = 'horizontal'); // header | horizontal | vertical | ||
// disabled | ||
if(options.divider[type].disabled === true) return; | ||
// validate | ||
strokeOpacity || (strokeOpacity = 0.5); | ||
strokeWidth || (strokeWidth = 0.5); | ||
opacity = opacity || options.divider[type].opacity || 0.5; | ||
width = width || options.divider[type].width || 0.5; | ||
// distance | ||
@@ -180,4 +190,4 @@ const d = rowDistance * 1.5; | ||
.lineTo(x + tableWidth - m, y - d) | ||
.lineWidth(strokeWidth) | ||
.opacity(strokeOpacity) | ||
.lineWidth(width) | ||
.opacity(opacity) | ||
.stroke() | ||
@@ -500,3 +510,3 @@ // Reset opacity after drawing the line | ||
// Separation line between headers and rows | ||
separationsRow(startX, rowBottomY); | ||
separationsRow('header', startX, rowBottomY); | ||
@@ -631,3 +641,3 @@ }; | ||
// Separation line between rows | ||
separationsRow(startX, rowBottomY); | ||
separationsRow('horizontal', startX, rowBottomY); | ||
@@ -638,3 +648,3 @@ // review this code | ||
// Separation line between rows | ||
separationsRow(startX, rowBottomY, 1, 1); | ||
separationsRow('horizontal',startX, rowBottomY, 1, 1); | ||
} | ||
@@ -729,3 +739,3 @@ } | ||
// Separation line between rows | ||
separationsRow(startX, rowBottomY); | ||
separationsRow('horizontal', startX, rowBottomY); | ||
@@ -732,0 +742,0 @@ }); |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.70", | ||
"version": "0.1.71", | ||
"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", |
@@ -435,3 +435,3 @@ <p align="center"> | ||
+ Add callbak on addBackground function, add .save() and .restore() style. | ||
+ Add callback on addBackground function, add .save() and .restore() style. | ||
+ Header font color | ||
@@ -438,0 +438,0 @@ - Thanks ***@dev-fema*** |
43355
597