Socket
Socket
Sign inDemoInstall

pdfkit-table

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdfkit-table - npm Package Compare versions

Comparing version 0.1.43 to 0.1.44

35

index.js

@@ -30,3 +30,3 @@ // jshint esversion: 6

.fillOpacity(fillOpacity)
.rect( x, y + 0.5, width, height )
.rect( x, y, width, height )
//.stroke()

@@ -69,8 +69,9 @@ .fill();

const columnCount = table.headers.length; // TODO if not have header
const columnSpacing = options.columnSpacing || 5; // 15
const columnSpacing = options.columnSpacing || 3; // 15
const columnSizes = options.columnsSize;
const columnPositions = []; // 0, 10, 20, 30, 100
// const rowSpacing = options.rowSpacing || 5; // 5
const usableWidth = String(options.width).replace(/[^0-9]/g,'') || this.page.width - this.page.margins.left - this.page.margins.right;
const rowDistance = 0.5;
const prepareHeader = options.prepareHeader || (() => this.font("Helvetica-Bold").fontSize(8));

@@ -144,3 +145,3 @@ const prepareRow = options.prepareRow || ((row, indexColumn, indexRow, rectRow) => this.font("Helvetica").fontSize(8));

const separationsRow = (pStart, pEnd, strokeWidth, strokeOpacity) => {
// validate

@@ -151,4 +152,4 @@ strokeOpacity || (strokeOpacity = 0.5);

// draw
this.moveTo(pStart.x, pStart.y + strokeWidth)
.lineTo(pEnd.x, pEnd.y)
this.moveTo(pStart.x, pStart.y - (rowDistance * 1.5))
.lineTo(pEnd.x, pEnd.y - (rowDistance * 1.5))
.lineWidth(strokeWidth)

@@ -260,3 +261,3 @@ .opacity(strokeOpacity)

// we have columnSizes[] complete
if( columnIsDefined ){
if(columnIsDefined){

@@ -269,3 +270,3 @@ // sum columns sizes

x: startX,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: columnWidth,

@@ -298,3 +299,3 @@ height: rowHeight + columnSpacing,

x: startX,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: columnWidth * table.headers.length - columnSpacing,

@@ -340,3 +341,3 @@ height: rowHeight + columnSpacing,

x: lastPosition,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: width,

@@ -382,2 +383,3 @@ height: rowHeight + columnSpacing,

table.datas.forEach((row, i) => {
const rowHeight = computeRowHeight(row);

@@ -387,3 +389,3 @@

// For safety, consider 3 rows margin instead of just one
if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing;
if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
else this.addPage();

@@ -393,3 +395,3 @@

x: startX,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: tableWidth - startX,

@@ -409,3 +411,3 @@ height: rowHeight + columnSpacing,

x: posX,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: width,

@@ -497,2 +499,3 @@ height: rowHeight + columnSpacing,

table.rows.forEach((row, i) => {
const rowHeight = computeRowHeight(row);

@@ -502,3 +505,3 @@

// For safety, consider 3 rows margin instead of just one
if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing;
if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
else this.addPage();

@@ -508,3 +511,3 @@

x: startX,
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: tableWidth - startX,

@@ -521,3 +524,3 @@ height: rowHeight + columnSpacing,

x: columnPositions[index],
y: startY - columnSpacing,
y: startY - columnSpacing - (rowDistance * 2),
width: columnSizes[index],

@@ -524,0 +527,0 @@ height: rowHeight + columnSpacing,

{
"name": "pdfkit-table",
"version": "0.1.43",
"version": "0.1.44",
"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",

@@ -264,3 +264,2 @@ # pdfkit-table

| **columnSpacing** | <code>Number</code> | 5 | |
| **rowSpacing** | <code>Number</code> | 3 | |
| **addPage** | <code>Boolean</code> | false | add table on new page |

@@ -281,3 +280,2 @@ | **prepareHeader** | <code>Function</code> | Function | () |

columnSpacing: 5, // {Number} default: 5
rowSpacing: 3, // {Number} default: 3
// functions

@@ -353,2 +351,3 @@ prepareHeader: () => doc.font("Helvetica-Bold").fontSize(8), // {Function}

- [Suggestions / Issues / Fixes](https://github.com/natancabral/pdfkit-table/issues)
- cellPadding {Array} [5,2,5,2];
- striped {Boolean} (corsimcornao)

@@ -375,2 +374,6 @@ - colspan - the colspan attribute defines the number of columns a table cell should span.

### 0.1.44
+ Fix paddings and distances
### 0.1.43

@@ -377,0 +380,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