Illustration of a PDF table

The King of PDF Table Generation

I created this library because generating PDF tables is hard. Anything beyond the most basic example is usually unsupported. This library aims to solve that.

Easy to use

Install the library, import the create table function, then print!

import { createPDFTables } from 'pdf-lib-table';
//TABLE SETTINGS
const pdfSettings = {
     tableStartingX: 50,
     tableStartingY: 50,
     headerFont: timesRomanBold,
     cellFont: timesRoman,
};
const document = await createPDFTables(
     data,
     page,
     pdfDoc,
     columns,
     StandardFonts,
     rgb,
     pdfSettings,
);
document.drawVerticalTables();

Handle Page Breaks with Ease

Pages can start with or without headers, and table dimensions are returned, facilitating dynamic footers to fill space.

A table continuing onto the next page

Lightweight & Performant

pdf-lib-table has no dependencies beyond pdf-lib and can print hundreds of pages with ease.

Illustration of a rocket

Over 50 parameters

Easy to get going, but enough customization to grow with your project

Illustration of configuration options

Install Now!

1. Install pdf-lib-table as a Node package:
npm i pdf-lib-table
2. Import pdf-lib-table in your project files:
import { createPDFTables } from 'pdf-lib-table';