Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.92 to 0.1.93

56

index.js

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

let lastPositionX = 0;
this.positionY = 0;
let rowBottomY = 0;

@@ -190,3 +190,3 @@ //------------ experimental fast variables

startY = this.page.margins.top;
this.positionY = 0;
rowBottomY = 0;
// lockAddPage || this.addPage(this.options);

@@ -339,3 +339,3 @@ lockAddPage || this.addPage({

let result = isHeader ? 0 : options.minRowHeight;
let result = isHeader ? 0 : (options.minRowHeight || 0);
let cellp;

@@ -349,6 +349,6 @@

// define row with properties header
row = cells;
row = cells;
}
row.forEach((cell, i) => {
row.forEach((cell,i) => {

@@ -371,2 +371,4 @@ let text = cell;

cellp = prepareCellPadding(options.padding || 0);
// - (cellp.left + cellp.right + (columnSpacing * 2))
// console.log(cellp);

@@ -379,3 +381,3 @@ // calc height size of string

result = Math.max(result, cellHeight);
result = Math.max(result, cellHeight);
});

@@ -389,3 +391,3 @@

return result + columnSpacing;
return result + (columnSpacing);
};

@@ -637,7 +639,7 @@

// Refresh the y coordinate of the bottom of the headers row
this.positionY = Math.max(startY + computeRowHeight(table.headers, true), this.positionY);
rowBottomY = Math.max(startY + computeRowHeight(table.headers, true), rowBottomY);
// Separation line between headers and rows
separationsRow('header', startX, this.positionY);
separationsRow('header', startX, rowBottomY);
} else {
this.positionY = startY;
rowBottomY = startY;
}

@@ -654,7 +656,7 @@

const rowHeight = computeRowHeight(row, false);
this.logg(rowHeight, '<<<<');
this.logg(rowHeight);
// Switch to next page if we cannot go any further because the space is over.
// For safety, consider 3 rows margin instead of just one
// if (startY + 2 * rowHeight < maxY) startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows
// if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
// else this.emitter.emit('addPage'); //this.addPage();

@@ -664,3 +666,3 @@ if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();

// calc position
startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows

@@ -779,12 +781,12 @@ // unlock add page function

// Refresh the y coordinate of the bottom of this row
this.positionY = Math.max(startY + rowHeight, this.positionY);
rowBottomY = Math.max(startY + rowHeight, rowBottomY);
// console.log(this.page.height, this.positionY, this.y);
// console.log(this.page.height, rowBottomY, this.y);
// text is so big as page (crazy!)
if(this.positionY > this.page.height) {
this.positionY = this.y + columnSpacing + (rowDistance * 2);
if(rowBottomY > this.page.height) {
rowBottomY = this.y + columnSpacing + (rowDistance * 2);
}
// Separation line between rows
separationsRow('horizontal', startX, this.positionY);
separationsRow('horizontal', startX, rowBottomY);

@@ -795,3 +797,3 @@ // review this code

// Separation line between rows
separationsRow('horizontal',startX, this.positionY, 1, 1);
separationsRow('horizontal',startX, rowBottomY, 1, 1);
}

@@ -811,3 +813,3 @@ }

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

@@ -817,3 +819,3 @@ if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();

// calc position
startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows

@@ -891,12 +893,12 @@ // unlock add page function

// Refresh the y coordinate of the bottom of this row
this.positionY = Math.max(startY + rowHeight, this.positionY);
rowBottomY = Math.max(startY + rowHeight, rowBottomY);
// console.log(this.page.height, this.positionY, this.y);
// console.log(this.page.height, rowBottomY, this.y);
// text is so big as page (crazy!)
if(this.positionY > this.page.height) {
this.positionY = this.y + columnSpacing + (rowDistance * 2);
if(rowBottomY > this.page.height) {
rowBottomY = this.y + columnSpacing + (rowDistance * 2);
}
// Separation line between rows
separationsRow('horizontal', startX, this.positionY);
separationsRow('horizontal', startX, rowBottomY);

@@ -908,3 +910,3 @@ });

this.x = startX;
this.y = this.positionY; // position y final;
this.y = rowBottomY; // position y final;
this.moveDown(); // break

@@ -911,0 +913,0 @@

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

@@ -446,2 +446,10 @@ <p align="center">

```
Another alternative to alter height, inside renderer:
```js
// ...headers
renderer: (value, indexColumn, indexRow, row, rectRow, rectCell) => {
doc.positionY += 50; // rectRow.height
// your code or image
}
```

@@ -448,0 +456,0 @@ ### 0.1.89

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