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.89 to 0.1.90

30

index.js

@@ -77,3 +77,2 @@ // jshint esversion: 6

table.options && (options = {...options, ...table.options});

@@ -85,2 +84,3 @@ options.hideHeader || (options.hideHeader = false);

options.absolutePosition || (options.absolutePosition = false);
options.minRowHeight || (options.minRowHeight = 0);

@@ -337,5 +337,5 @@ // divider lines

const computeRowHeight = (row) => {
const computeRowHeight = (row, isHeader) => {
let result = 0;
let result = isHeader ? 0 : options.minRowHeight;
let cellp;

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

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

@@ -369,3 +369,4 @@ let text = cell;

// cell padding
cellp = prepareCellPadding(table.headers[i].padding || options.padding || 0);
// cellp = prepareCellPadding(table.headers[i].padding || options.padding || 0);
cellp = prepareCellPadding(options.padding || 0);

@@ -379,5 +380,6 @@ // calc height size of string

result = Math.max(result, cellHeight);
});
// isHeader && (result = Math.max(result, options.minRowHeight));
// if(result + columnSpacing === 0) {

@@ -455,3 +457,3 @@ // computeRowHeight(row);

if(headerHeight === 0){
headerHeight = computeRowHeight(table.headers);
headerHeight = computeRowHeight(table.headers, true);
this.logg(headerHeight, 'headers');

@@ -463,7 +465,7 @@ }

if(table.datas.length > 0){
firstLineHeight = computeRowHeight(table.datas[0]);
firstLineHeight = computeRowHeight(table.datas[0], true);
this.logg(firstLineHeight, 'datas');
}
else if(table.rows.length > 0){
firstLineHeight = computeRowHeight(table.rows[0]);
firstLineHeight = computeRowHeight(table.rows[0], true);
this.logg(firstLineHeight, 'rows');

@@ -636,3 +638,3 @@ }

// Refresh the y coordinate of the bottom of the headers row
rowBottomY = Math.max(startY + computeRowHeight(table.headers), rowBottomY);
rowBottomY = Math.max(startY + computeRowHeight(table.headers, true), rowBottomY);
// Separation line between headers and rows

@@ -652,4 +654,4 @@ separationsRow('header', startX, rowBottomY);

const rowHeight = computeRowHeight(row);
this.logg(rowHeight);
const rowHeight = computeRowHeight(row, false);
this.logg(rowHeight, '<<<<');

@@ -802,3 +804,3 @@ // Switch to next page if we cannot go any further because the space is over.

const rowHeight = computeRowHeight(row);
const rowHeight = computeRowHeight(row, false);
this.logg(rowHeight);

@@ -805,0 +807,0 @@

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

@@ -39,7 +39,8 @@ <p align="center">

const fs = require("fs");
const PDFDocument = require("pdfkit-table");
const PDFDocument = require("pdfkit-table");
// create document
// init document
let doc = new PDFDocument({ margin: 30, size: 'A4' });
// file name
// save document
doc.pipe(fs.createWriteStream("./document.pdf"));

@@ -54,6 +55,11 @@

}
// the magic
// magic
doc.table(table, { /* options */ }, () => { /* callback */ } );
// doc.table() is a Promise to async/await function
// or async/await
// await doc.table(table);
// or Promise
// doc.table(table).then(() => { /* done */ }).catch((err) => { /* err */ })
// server/response
// if your run express.js server

@@ -86,3 +92,3 @@ // to show PDF on navigator

```js
// requires
// table
const table = {

@@ -114,4 +120,3 @@ title: "Title",

```js
// require
// A4 595.28 x 841.89 (portrait) (about width sizes)
// table
const table = {

@@ -213,2 +218,3 @@ title: "Title",

```js
// json file
const json = require('./table.json');

@@ -245,3 +251,2 @@ // if json file is array

doc.end();
})();

@@ -339,2 +344,3 @@ ```

| **hideHeader** | <code>Boolean</code> | false | hide header |
| **minRowHeight** | <code>Number</code> | undefined | min height |
| **prepareHeader** | <code>Function</code> | Function | () |

@@ -448,2 +454,17 @@ | **prepareRow** | <code>Function</code> | Function | (row, indexColumn, indexRow, rectRow, rectCell) => {} |

### 0.1.90
- Add options minRowHeight
- Thanks LouiseEH ***@LouiseEH***
```js
options: {
minRowHeight: 30, // pixel
}
```
### 0.1.88
- Fix height first line
- Thanks José Luis Francisco ***@JoseLuis21***
### 0.1.87

@@ -450,0 +471,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