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.34 to 0.1.35

46

index.js

@@ -31,2 +31,5 @@ "use strict";

const title = table.title ? table.title : ( options.title ? options.title : '' ) ;
const subtitle = table.subtitle ? table.subtitle : ( options.subtitle ? options.subtitle : '' ) ;
let columnIsDefined = options.columnsSize.length ? true : false ;

@@ -48,7 +51,46 @@ const columnsCountSize = options.columnsSize.length; // pre-defined coluns size

const startX = options.x || this.page.margins.left;
let startY = options.y || this.y;
let startX = options.x || this.x || this.page.margins.left ;
let startY = options.y || this.y ;
let rowBottomY = 0;
let tableWidth = 0;
// if options.x === null
// reset position to margins.left
if( options.x === null || options.x === -1 ){
startX = this.page.margins.left;
}
const createTitle = ( data, size, opacity ) => {
// Title
if( !data ) return;
// get height line
let cellHeight = 0;
// if string
if(typeof data === 'string' ){
// font size
this.fontSize( size ).opacity( opacity );
// get height line
cellHeight = this.heightOfString( data, {
width: usableWidth,
align: "left",
});
// write
this.text( data, startX, startY ).opacity( 1 ); // moveDown( 0.5 )
// startY += cellHeight;
startY = this.y + 2;
// else object
} else if(typeof data === 'object' ){
// title object
data.label && this.fontSize( data.fontSize || size ).text( data.label, startX, startY );
}
}
createTitle( title, 12, 1 );
createTitle( subtitle, 9, 0.7 );
if( title || subtitle ){
startY += 3;
}
this.on("pageAdded", () => {

@@ -55,0 +97,0 @@ startY = this.page.margins.top;

2

package.json
{
"name": "pdfkit-table",
"version": "0.1.34",
"version": "0.1.35",
"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",

@@ -354,2 +354,11 @@ # pdfkit-table

### 0.1.35
+ add **title** <code>{String}</code>
- const table = { title: "", };
- const options = { title: "", };
+ add **subtitle** <code>{String}</code>
- const table = { subtitle: "", };
- const options = { subtitle: "", };
### 0.1.34

@@ -356,0 +365,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