pdfkit-table
Advanced tools
Comparing version 0.1.23 to 0.1.24
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"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", |
@@ -16,3 +16,3 @@ # pdfkit-table | ||
## Start | ||
## Install | ||
@@ -29,9 +29,20 @@ ```bash | ||
const doc = new PDFDocument({ margin: 30, size: 'A4' }); | ||
// file name | ||
doc.pipe(fs.createWriteStream("./file-table.pdf")); | ||
// the magic: | ||
// paramns | ||
const table = { | ||
headers: [], | ||
datas: [/* complex data */], | ||
rows: [/* or simple data */], | ||
} | ||
// options | ||
const options = {} | ||
// the magic | ||
doc.table( table, options ); | ||
//... | ||
// done! | ||
doc.end(); | ||
``` | ||
@@ -145,3 +156,8 @@ | ||
## Table | ||
- <code>Array.<object></code> | ||
- headers <code>Array.<object></code> | <code>Array.[]</code> | ||
- datas <code>Array.<object></code> | ||
- rows <code>Array.[]</code> | ||
Example code: | ||
@@ -180,13 +196,13 @@ ```js | ||
### Options Table | ||
### Options | ||
| Properties | description | | ||
-----------------------|-------------------| | ||
| **width** | width of table | | ||
| **x** | position x (left) | | ||
| **y** | position y (top) | | ||
| **columnSpacing** | 5 | | ||
| **rowSpacing** | 3 | | ||
| **prepareHeader** | Function | | ||
| **prepareRow** | Function | | ||
| Properties | Type | Default | Description | | ||
-----------------------|-----------------------|--------------------|-------------------| | ||
| **width** | <code>Number</code> | undefined | width of table | | ||
| **x** | <code>Number</code> | undefined | dox.x | position x (left) | | ||
| **y** | <code>Number</code> | undefined | dox.y | position y (top) | | ||
| **columnSpacing** | <code>Number</code> | 5 | | | ||
| **rowSpacing** | <code>Number</code> | 3 | | | ||
| **prepareHeader** | <code>Function</code> | Function | | | ||
| **prepareRow** | <code>Function</code> | Function | | | ||
@@ -262,2 +278,4 @@ | ||
- renderer function. Like renderer: (value) => { return `$${value}`} | ||
- load json file - require | string | ||
- sample with database | ||
- setFontFamily {String} | ||
@@ -264,0 +282,0 @@ - setBoldFontFamily {String} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18918
315