Skip to content
Projects

About

Native-speed PDF engine for TypeScript with a Rust core, React-style components and Tailwind-style classes.

Web & App Development

How these counts are measured

What you can do

  • Three ways to write documents: an own zero-dependency JSX runtime, React 19 components (@rentnerkev/pdf/react with hooks, context, use() and Suspense) or plain factory functions; all render byte-identical PDFs.
  • Tailwind styling: className with Tailwind CSS v4 semantics and print units, your app's design tokens, IntelliSense, clsx and tailwind-merge.
  • Layout for business documents: block, flex and grid; page templates with headers, footers, page numbers and letterheads; keep rules, widows and orphans, and diagnostics that explain every page break.
  • Tables: element tables and data tables for 10,000+ rows with repeated headers, sums, running totals and number formats for amounts in cents.

Measured star growth

in 24h
Collecting history
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

RentnerPDF

RentnerPDF, a React PDF generator

Native speed. TypeScript simplicity.

CI CodeQL OpenSSF Scorecard MIT license

RentnerPDF is a PDF engine for JavaScript and TypeScript with a Rust core. Describe documents with React-style components and Tailwind-style className utilities; the engine lays them out with real pagination and writes standards-ready PDFs – natively on Node.js and Bun, and via WebAssembly on macOS and in browsers.

[!IMPORTANT] RentnerPDF 1.0.0 stabilizes the documented TypeScript API and IR v1 under SemVer. The npm package @rentnerkev/pdf includes six native bindings and WebAssembly. The worker engine, React preview, Vite plugin and renderToStream() are experimental. Development · Install · 1.1.0 milestone

Features

  • Three ways to write documents: an own zero-dependency JSX runtime, React 19 components (@rentnerkev/pdf/react with hooks, context, use() and Suspense) or plain factory functions; all render byte-identical PDFs.
  • Tailwind styling: className with Tailwind CSS v4 semantics and print units, your app's design tokens, IntelliSense, clsx and tailwind-merge.
  • Layout for business documents: block, flex and grid; page templates with headers, footers, page numbers and letterheads; keep rules, widows and orphans, and diagnostics that explain every page break.
  • Tables: element tables and data tables for 10,000+ rows with repeated headers, sums, running totals and number formats for amounts in cents.
  • Typography and languages: bundled Noto Sans, font fallback, color emoji, variable fonts, right-to-left and complex scripts, hyphenation, justification and optimal line breaking.
  • Standards: PDF/A-1 to PDF/A-4, tagged PDF/UA-1, letterheads from existing PDFs, custom XMP metadata and ZUGFeRD/Factur-X attachments, validated with veraPDF and Mustang in CI.
  • Engine: a native addon that renders off the event loop on its own threads, batches with bounded memory, streams, cancellation, fonts added at run time and resource limits for untrusted input; a WebAssembly engine with the same output and a Web Worker preview for browsers.
  • Supply chain: zero runtime dependencies, no install scripts.

Performance

From the benchmark report: GitHub-hosted Linux runners with 4 vCPUs, Node.js 24, 03.12.2026, against React-PDF 4.9.2 and pdfmake 0.3.15. The numbers shown passed the same correctness gate.

Focus area RentnerPDF pdfmake React-PDF
Mass generation: 10,000 invoices on 4 workers 943 docs/s, 203 MiB 75 docs/s, 1.23 GiB 60 docs/s, 7.59 GiB
Event loop while serving invoices: timer drift p99 3.8 ms at 749 PDFs/s 323 ms at 27 PDFs/s 457 ms at 20 PDFs/s
500-page statement, 24,000 rows with running totals 798 ms, 642 MiB not supported not supported
100-page text report 108 ms, 204 MiB 681 ms, 589 MiB 3.04 s, 1.69 GiB

The report also covers the WebAssembly engine, cases where another library wins, and how to reproduce each number.

Requirements

  • Node.js 22.14+ or Bun 1.4+; React 19 only for @rentnerkev/pdf/react.
  • Native engines for Windows and Linux (x64 and arm64; glibc and musl). macOS and browsers use the WebAssembly engine.

What CI checks on which runtime, platform and framework: compatibility.

Quick start

Write a document as components with the own JSX runtime (no React needed) and render it to a Uint8Array:

/** @jsxImportSource @rentnerkev/pdf */
import { writeFile } from 'node:fs/promises'
import { Document, Page, render, Text, View } from '@rentnerkev/pdf'

function Invoice({ number, total }: { number: string; total: string }) {
    return (
        <Document title={`Invoice ${number}`} lang="en">
            <Page size="A4" className="p-page text-sm">
                <View className="mb-8 flex justify-between">
                    <Text role="h1" className="text-2xl font-bold">
                        Invoice {number}
                    </Text>
                    <Text className="text-gray-500">Muster GmbH</Text>
                </View>
                <Text>Total: {total}</Text>
            </Page>
        </Document>
    )
}

const pdf = await render(<Invoice number="2026-001" total="1.234,56 €" />)
await writeFile('invoice.pdf', pdf)
  • JSX setup: the per-file pragma above, or "jsx": "react-jsx" and "jsxImportSource": "@rentnerkev/pdf" in a tsconfig.
  • React projects import the same components from @rentnerkev/pdf/react and render with renderToPdf().
  • Your fonts, theme and limits: create one engine per process with createEngine({ fonts, theme }) and call engine.render().

Documentation

Guide Content
Usage guide Install, engine, components, styling, tables, templates, typography, standards, accessibility, browser preview
Compatibility Runtimes, platforms, frameworks and what CI verifies for each
Limits Resource limits for untrusted input and what is not supported yet
Migrating from React-PDF, pdfmake, PDFKit Concept mappings, side-by-side examples, what has no equivalent
Recipes Node.js, Bun, TanStack Start, Next.js, ZUGFeRD/Factur-X invoices
Tailwind support matrix Every utility and what it does on paper
Benchmarks Every scenario against React-PDF and pdfmake, how to reproduce it; re-measured weekly
IR versioning IR compatibility, validation, and evolution
Local documentation for tools @rentnerkev/pdf/ai: guides and declarations of the installed version for AI agents

The playground is a local JSX editor with a live PDF preview: bun run build:wasm, then bun run playground:dev.

AI and MCP access

AI agents and local tools read the installed version through @rentnerkev/pdf/ai: the README, the usage guide, package metadata and the public TypeScript declarations, without loading an engine or React and without network access. Local documentation for tools shows the five read-only helpers. Keep the entry in Node.js or Bun tooling.

The RentnerPackages website also serves the RentnerPDF documentation through a public read-only MCP server and llms.txt. It needs no account and uses the website's documentation snapshot; prefer the installed /ai entry when the versions differ.

{
    "mcpServers": {
        "rentnerPackages": {
            "url": "https://packages.rentner.dev/mcp"
        }
    }
}

Development

Requirements: Bun 1.4.5 and rustup. The Rust toolchain is pinned in core/rust-toolchain.toml.

bun install --frozen-lockfile
cargo install wasm-bindgen-cli --version 0.2.130 --locked
bun run build:native:debug
bun run build:wasm:debug
bun run test
bun run verify

The WebAssembly tests load the local build from bun run build:wasm (wasm-bindgen must match the version in core/Cargo.lock).

Path Content
web/src TypeScript package source and tests
web/playground Local playground app (React UI, examples): bun run playground:dev, bun run playground:build
core/ Rust workspace: rentnerpdf (engine), rentnerpdf-napi (Node-API), rentnerpdf-wasm (WebAssembly)
.github/ Workflows, automation scripts and their tests
docs Usage guide, migration guides, recipes, Tailwind support matrix, benchmarks

See CONTRIBUTING for the full workflow.

Security and support

License

MIT © RentnerKev

Explore related projects

Loading…