foliojs/pdfkit

Generate PDFs in Node and the browser

What

A PDF generation library for Node and the browser: text, vector graphics, images, fonts, links.

How to use

bash
npm i pdfkit
javascript
import PDFDocument from 'pdfkit';
import fs from 'node:fs';

const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('out.pdf'));
doc.fontSize(20).text('Hello PDF');
doc.end();

Reach for it when

building invoices or reports in JS without a headless browser.