pdfkit-table
Advanced tools
Comparing version 0.1.96 to 0.1.97
@@ -40,3 +40,3 @@ declare module 'pdfkit-table' | ||
interface Data { | ||
[key: string]: string | { label: string; options: DataOptions }; | ||
[key: string]: string | { label: string; options?: DataOptions }; | ||
} | ||
@@ -78,3 +78,3 @@ | ||
prepareRow?: ( | ||
row: number, | ||
row?: any, | ||
indexColumn?: number, | ||
@@ -81,0 +81,0 @@ indexRow?: number, |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.96", | ||
"version": "0.1.97", | ||
"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", |
@@ -46,3 +46,3 @@ <p align="center"> | ||
;(async function(){ | ||
;(async function createTable(){ | ||
// table | ||
@@ -77,4 +77,4 @@ const table = { | ||
// router - Node + Express.js | ||
app.get('/create-pdf', (req, res) => { | ||
// ...table code | ||
app.get('/create-pdf', async (req, res) => { | ||
// ...await table code | ||
// if your run express.js server | ||
@@ -224,6 +224,6 @@ // to show PDF on navigator | ||
Array.isArray(json) ? | ||
// any tables | ||
await doc.tables(table, table.options || {})) : | ||
// one table | ||
await doc.table(json, json.options || {}) ; | ||
// any tables - array | ||
await doc.tables(json) : | ||
// one table - string | ||
await doc.table(json) ; | ||
// done! | ||
@@ -234,25 +234,2 @@ doc.end(); | ||
### Example 5 - Promise async/await | ||
```js | ||
// async | ||
;(async function(){ | ||
// table | ||
const table = { | ||
title: "Title", | ||
subtitle: "Subtitle", | ||
headers: ["Name", "Age"], | ||
rows: [ | ||
["Jack", "20"], | ||
["Johnson", "30"], | ||
], | ||
}; | ||
// await | ||
await doc.table(table) ; | ||
// done! | ||
doc.end(); | ||
})(); | ||
``` | ||
## Table | ||
@@ -340,4 +317,4 @@ | ||
| **width** | <code>Number</code> | undefined | width of table | | ||
| **x** | <code>Number</code> | undefined / doc.x | position x (left) | | ||
| **y** | <code>Number</code> | undefined / doc.y | position y (top) | | ||
| **x** | <code>Number</code> | undefined | position x (left). To reset x position set "x: null" | | ||
| **y** | <code>Number</code> | undefined | position y (top) | | ||
| **divider** | <code>Object</code> | undefined | define divider lines | | ||
@@ -361,4 +338,4 @@ | **columnsSize** | <code>Array</code> | undefined | define sizes | | ||
width: 500, // {Number} default: undefined // A4 595.28 x 841.89 (portrait) (about width sizes) | ||
x: 0, // {Number} default: undefined | doc.x | ||
y: 0, // {Number} default: undefined | doc.y | ||
x: 0, // {Number} default: undefined | To reset x position set "x: null" | ||
y: 0, // {Number} default: undefined | | ||
divider: { | ||
@@ -365,0 +342,0 @@ header: { disabled: false, width: 2, opacity: 1 }, |
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
55705
682