whatisgithub

What is boxpdf?

earonesty/boxpdf — explained in plain English

Analysis updated 2026-05-18

2TypeScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

A TypeScript library for generating PDF documents using a flexbox-style layout system, so you describe nested boxes instead of calculating exact positions yourself.

Mindmap

mindmap
  root((boxpdf))
    What it does
      Flexbox-style layout
      Word wrapping
      Multi-page flow
    Tech stack
      TypeScript
      pdf-lib
      Node and Workers
    Use cases
      Receipts and invoices
      Resumes
      Tables with headers
    Audience
      Backend developers
      Serverless apps

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

What do people build with it?

USE CASE 1

Generate PDF receipts, invoices, or boarding passes from server-side code

USE CASE 2

Build resumes or certificates using one of the four built-in themes

USE CASE 3

Render multi-page tables with repeating header rows

USE CASE 4

Generate PDFs from a Cloudflare Worker with no native dependencies

What is it built with?

TypeScriptpdf-libNode.jsCloudflare WorkersDeno

How does it compare?

earonesty/boxpdfarashthr/hugo-flowargeneau12e/kairos-tx
Stars222
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatehard
Complexity2/53/54/5
Audiencedeveloperdeveloperdeveloper

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

How do you get it running?

Difficulty · easy Time to first run · 30min

So what is it?

boxpdf is a TypeScript library for generating PDF documents using a layout system similar to how flexbox works in web design. Instead of calculating exact positions yourself, you describe the document as nested boxes, vertical stacks, horizontal stacks, text blocks, images, lines, and tables, and the library figures out where everything goes, including word wrapping and multi-page flow. It is built on top of pdf-lib and runs in Node 18+, Cloudflare Workers, Deno, and browsers, with no native dependencies, no WASM, and no headless browser required. This makes it practical for server-side PDF generation in environments that restrict what code they can run. The layout primitives accept style options familiar to anyone who has used CSS: padding, margin, gap, flex grow and shrink weights, justify and align options, borders, background colors, and corner radii. The text node handles word wrapping automatically when given a width, and truncates with an ellipsis when you set a maximum line count. A table primitive supports fixed, auto, and fractional column widths, repeating header rows across pages, and per-cell styling. Multi-page documents can include per-page headers and footers, and streaming generation keeps memory bounded regardless of page count. Four built-in themes, cleanTheme, stripeTheme, editorialTheme, and brutalistTheme, provide pre-made color, spacing, and font settings. A CLI lets you scaffold single-file templates for receipts, boarding passes, resumes, order confirmations, and certificates. The core is approximately 7 KB minified, and the library ships a resource-only MCP server for use with AI agents. The project is written in TypeScript.

Copy-paste prompts

Prompt 1
Show me how to generate a PDF invoice using boxpdf's box layout system
Prompt 2
Write a boxpdf template for a two-column resume with a header and footer
Prompt 3
How do I use boxpdf's table primitive to render a multi-page report with repeating headers?
Prompt 4
Set up boxpdf in a Cloudflare Worker to generate PDFs on demand

Frequently asked questions

What is boxpdf?

A TypeScript library for generating PDF documents using a flexbox-style layout system, so you describe nested boxes instead of calculating exact positions yourself.

What language is boxpdf written in?

Mainly TypeScript. The stack also includes TypeScript, pdf-lib, Node.js.

How hard is boxpdf to set up?

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

Who is boxpdf for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.