Erik Aronesty

boxpdf · flow PDF layout for JS runtimes - Flexbox-style PDF layout for Workers, Node, Deno, browsers

by
boxpdf is a tiny PDF layout engine for Node, Cloudflare Workers, Deno, Bun, Supabase Edge, and browsers. boxpdf: a flexbox-style layout DSL on top of pdf-lib for structured programmatic PDF generation. boxpdf-html: pixel-perfect HTML/CSS renderer designed for environments where Chromium or dynamic WASM are impractical. Supports pagination, wrapping, spacing, headers/footers, images, links, tables, reusable templates, and edge-native deployment without headless Chrome.

Add a comment

Replies

Best
Erik Aronesty
Maker
📌
I built boxpdf after repeatedly running into the same problem: generating high-quality PDFs in Cloudflare Workers and other restricted runtimes without Chromium, native binaries, or dynamic WASM. The project eventually split into two pieces: boxpdf: A small flexbox-style layout DSL built on top of pdf-lib. Instead of drawing coordinates manually, you compose nested layout boxes with wrapping, spacing, pagination, alignment, headers, footers, tables, and reusable components. boxpdf-html: A pixel-perfect HTML/CSS renderer tested against Prince output. The goal is predictable server-side rendering in environments where running Chrome is expensive, fragile, or impossible. Both run in Workers, Node, Deno, Bun, Supabase Edge, and browsers. A big motivation was AI-assisted generation. LLMs are bad at coordinate systems but surprisingly good at composing structured layout trees and HTML/CSS. The architecture evolved around making PDF generation deterministic enough for agents to use reliably. Would love feedback from people building invoices, reports, receipts, certificates, tickets, or document pipelines at the edge.