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.25 to 0.1.26

44

index.js

@@ -19,9 +19,8 @@ "use strict";

let startX = this.page.margins.left,
startY = this.y;
if( !options || typeof options !== 'object' ) options = {};
options.hasOwnProperty('x') && (startX = options.x);
options.hasOwnProperty('y') && (startY = options.y);
table || (table = {})
table.headers || (table.headers = []);
table.datas || (table.datas = [])
table.rows || (table.rows = [])

@@ -31,9 +30,22 @@ const columnCount = table.headers.length;

const columnSizes = options.columnSizes || [];
const columnPositions = []; // 0,10,20,30,100 | | | | |
const columnPositions = []; // 0, 10, 20, 30, 100
const rowSpacing = options.rowSpacing || 3; // 5
const usableWidth = options.width || this.page.width - this.page.margins.left - this.page.margins.right;
const prepareHeader = options.prepareHeader || (() => this.font("Helvetica-Bold").fontSize(8));
const prepareHeader = options.prepareHeader || (() => this.font("Helvetica-Bold").fontSize(8) );
const prepareRow = options.prepareRow || (() => this.font("Helvetica").fontSize(8) );
const columnContainerWidth = usableWidth / columnCount;
const columnWidth = columnContainerWidth - columnSpacing;
const maxY = this.page.height - this.page.margins.bottom;
let startX = options.x || this.page.margins.left;
let startY = options.y || this.y;
let rowBottomY = 0;
this.on("pageAdded", () => {
startY = this.page.margins.top;
rowBottomY = 0;
});
const prepareRowOptions = ( row ) => {

@@ -50,3 +62,3 @@ if( typeof row !== 'object' || !row.hasOwnProperty('options') ) return;

// reconhece se é uma linha object, content with property
// if row is object, content with property and options
if( !Array.isArray(row) && typeof row === 'object' && !row.hasOwnProperty('property') ){

@@ -88,13 +100,2 @@ const cells = [];

const columnContainerWidth = usableWidth / columnCount;
const columnWidth = columnContainerWidth - columnSpacing;
const maxY = this.page.height - this.page.margins.bottom;
let rowBottomY = 0;
this.on("pageAdded", () => {
startY = this.page.margins.top;
rowBottomY = 0;
});
// Allow the user to override style for headers

@@ -177,3 +178,2 @@ prepareHeader();

// ------------------------------------------------------------------------------
table.datas || (table.datas = [])
table.datas.forEach((row, i) => {

@@ -262,3 +262,2 @@ const rowHeight = computeRowHeight(row);

// ------------------------------------------------------------------------------
table.rows || (table.rows = [])
table.rows.forEach((row, i) => {

@@ -295,2 +294,5 @@ const rowHeight = computeRowHeight(row);

});
// ------------------------------------------------------------------------------
// rows -------------------------------------------------------------------------
// ------------------------------------------------------------------------------

@@ -297,0 +299,0 @@ this.x = startX;

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

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