Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pdfkit-table-ts

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdfkit-table-ts

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

  • 0.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
432
increased by24.14%
Maintainers
1
Weekly downloads
 
Created
Source

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 doc = new PDFDocument({
  margin: 30, 
});

;(async function(){
 
  // to save on server
  doc.pipe(fs.createWriteStream("./example-1.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%"],
      ["England of England of England", "33%", "+4.44%"],
      ["Switzerland", "12%", "+1.12%"],
      ["France", "67%", "-0.98%"],
      ["England", "33%", "+4.44%"],
      ["England of England of England", "33%", "+4.44%"],
      ["Switzerland", "12%", "+1.12%"],
      ["France", "67%", "-0.98%"],
      ["England", "33%", "+4.44%"],
      ["England of England of England", "33%", "+4.44%"],
      ["Switzerland", "12%", "+1.12%"],
      ["France", "67%", "-0.98%"],
      ["England", "33%", "+4.44%"],
      ["England of England of England", "33%", "+4.44%"],
      ["Switzerland", "12%", "+1.12%"],
      ["France", "67%", "-0.98%"],
    ],
  };

  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

Natan Cabral
natancabral@hotmail.com
https://github.com/natancabral/

Thank you

Keywords

FAQs

Package last updated on 23 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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