0.0.14 • Published 2 years ago

pdfkit-table-ts v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

pdfkit-table-ts

TypeScript - Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin)

const fs = require("fs");
const { PDFDocument } = require("pdfkit-table-ts");

const let = new PDFDocument({
  margin: 30, 
});

;(async function(){
 
  // to save on server
  doc.pipe(fs.createWriteStream("./docment.pdf"));

  // -----------------------------------------------------------------------------------------------------
  // Simple Table with Array
  // -----------------------------------------------------------------------------------------------------
  const table = {
    headers: ["Country Country Country", "Conversion rate", "Trend"],
    rows: [
      ["Switzerland", "12%", "+1.12%"],
      ["France", "67%", "-0.98%"],
      ["England", "33%", "+4.44%"],
    ],
  };

  const options = {
    width: 300,
    x: 150,
    y: 100,
    padding: {
      top: 1, bottom: 1, left: 5, right: 5, 
    },
  };

  await doc.table(table, options);
  doc.end();
 
})();

License

The MIT License.

Author

Thank you

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago