Socket
Socket
Sign inDemoInstall

voilab-pdf-table

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

voilab-pdf-table - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

2

package.json
{
"name": "voilab-pdf-table",
"version": "0.1.4",
"version": "0.1.5",
"description": "PdfKit wrapper that helps to draw informations in simple tables.",

@@ -5,0 +5,0 @@ "main": "voilab-table.js",

@@ -75,3 +75,4 @@ /*jslint node: true, unparam: true, nomen: true */

data = row._renderedContent.data[column.id] || '',
renderer = isHeader ? column.headerRenderer : column.renderer;
renderer = isHeader ? column.headerRenderer : column.renderer,
y = pos.y;

@@ -83,2 +84,3 @@ if (!isHeader && column.padding) {

}
y += padding.top;
// if specified, cache is not used and renderer is called one more time

@@ -88,3 +90,10 @@ if (renderer && column.cache === false) {

}
self.pdf.text(data, pos.x + padding.left, pos.y + padding.top, lodash.assign({
// manage vertical alignement
if (column.valign === 'center') {
y += (row._renderedContent.height - row._renderedContent.dataHeight[column.id]) / 2;
} else if (column.valign === 'bottom') {
y += (row._renderedContent.height - row._renderedContent.dataHeight[column.id]);
}
self.pdf.text(data, pos.x + padding.left, y, lodash.assign({
height: row._renderedContent.height,

@@ -130,19 +139,21 @@ width: width

row._renderedContent = {data: {}};
row._renderedContent = {data: {}, dataHeight: {}};
lodash.forEach(self.getColumns(), function (column) {
var renderer = isHeader ? column.headerRenderer : column.renderer,
content = (renderer && renderer(self, row, false)) || row[column.id],
height = self.pdf.heightOfString(content, lodash.assign(lodash.clone(column), {
content = renderer ? renderer(self, row, false) : row[column.id],
height = !content ? 1 : self.pdf.heightOfString(content, lodash.assign(lodash.clone(column), {
width: column.width - getPaddingValue('horizontal', column.padding)
}));
})),
column_height = isHeader ? column.headerHeight : column.height;
if (height < column_height) {
height = column_height;
}
// backup content so we don't need to call the renderer a second
// time when really rendering the column
row._renderedContent.data[column.id] = content;
row._renderedContent.dataHeight[column.id] = height;
if (height < column.height) {
height = column.height;
}
// check max row height

@@ -447,3 +458,6 @@ max_height = height > max_height ? height : max_height;

* standard linebreak)</li>
* <li><i>String</i> <b>align</b>: text horizontal align</li>
* <li><i>String</i> <b>align</b>: text horizontal align (left, center,
* right)</li>
* <li><i>String</i> <b>valign</b>: text vertical align (top, center,
* bottom)</li>
* <li><i>String</i> <b>border</b>: cell border (LTBR)</li>

@@ -465,2 +479,4 @@ * <li><i>Boolean</i> <b>fill</b>: True to fill the cell with the

* the predefined color (with pdf.fillColor(color))</li>
* <li><i>Number</i> <b>headerHeight</b>: min height for cell (default
* to standard linebreak)</li>
* </ul>

@@ -467,0 +483,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc