gitwtfhub

wtf is pdfmake?

bpampuch/pdfmake — explained in plain English

Analysis updated 2026-06-24

12,275JavaScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TL;DR

A JavaScript library that generates PDF documents from a structured definition object, running in both web browsers and Node.js with support for tables, images, fonts, and page layouts.

Mindmap

mindmap
  root((pdfmake))
    Where it runs
      Web browser
      Node.js server
    Document Elements
      Paragraphs and text
      Tables and columns
      Images and lists
      Headers and footers
    Layout Options
      Page size and margins
      Portrait and landscape
      Multi-column flow
    Features
      Custom fonts
      Table of contents
      Page number references

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Generate a downloadable PDF invoice or report directly in the browser without any server round-trip

REASON 2

Build a Node.js service that creates formatted PDF documents like receipts, letters, or certificates

REASON 3

Add a print-to-PDF button to a web app that produces documents with tables, custom fonts, and page numbers

What's in the stack?

JavaScriptNode.jspdfkit

How it stacks up

bpampuch/pdfmakeatomiks/tippyjsbrowsersync/browser-sync
Stars12,27512,27712,288
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min
MIT license, use freely for any purpose, including commercial, as long as you keep the copyright notice.

Wtf does this do

pdfmake is a JavaScript library that generates PDF documents. It works in two environments: inside a web browser, where it can create a PDF directly on the user's device, and on a server running Node.js, where it can generate PDFs as part of a back-end process. The library is driven by a document definition object. Instead of drawing on a page pixel by pixel, developers describe what a document should contain, including paragraphs, tables, images, lists, headers, and footers, and pdfmake handles all the layout calculations. It supports text alignment (left, right, centered, or justified), numbered and bulleted lists, tables with configurable column widths, column and row spans, automatically repeated table headers across page breaks, and a newspaper-style column layout where content flows from one column to the next. Other capabilities include embedded fonts, custom margins and page sizes, portrait or landscape orientation, a table of contents, multi-level nested structures, and document-level metadata such as author and subject fields. Page headers and footers can show static text or dynamic content that references the current page number and total page count. The library also provides helper functions to open a generated PDF in a new browser tab, print it directly, or trigger a file download. pdfmake is built on top of another library called pdfkit, which handles the lower-level PDF construction. An interactive playground is available online where developers can test document definitions in real time without installing anything. The library is released under the MIT license.

Yoink these prompts

Prompt 1
Using pdfmake in my Node.js app, write me a document definition that creates an invoice with a header, an itemized table, a footer showing page numbers, and a total row
Prompt 2
Show me how to use pdfmake in the browser to generate a multi-page PDF with a table of contents and justified text columns
Prompt 3
How do I embed a custom font in a pdfmake document so all text uses it instead of the default font?
Prompt 4
Write a pdfmake document definition for a two-column newspaper-style layout with a title, body text, and a watermark

Frequently asked questions

wtf is pdfmake?

A JavaScript library that generates PDF documents from a structured definition object, running in both web browsers and Node.js with support for tables, images, fonts, and page layouts.

What language is pdfmake written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js, pdfkit.

What license does pdfmake use?

MIT license, use freely for any purpose, including commercial, as long as you keep the copyright notice.

How hard is pdfmake to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is pdfmake for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.