Overview
Create PDF files from React components, in Node, in the browser and in a Web Worker.
@axonpdf/react turns React components into PDF files. You build the document from components
such as Document, Page, View and Text, lay it out with flexbox, and render it to a file, a
stream, a Blob or a viewer. Layout and PDF writing run in a Rust engine, with Yoga for flexbox, compiled to WebAssembly,
which is published on its own as @axonpdf/core.
npm install @axonpdf/react reactimport { Document, Page, Text, renderToFile } from '@axonpdf/react';
await renderToFile(
<Document title="Hello">
<Page size="A4" style={{ padding: 40 }}>
<Text>Hello</Text>
</Page>
</Document>,
'hello.pdf',
);What it does
| Feature | What you get | Page |
|---|---|---|
| Components | Document, Page, View, Text, Link, Image, Canvas, SVG and fillable form fields | Components |
| Styles | Flexbox, borders, transforms, media queries, floats and bidirectional text | Styling |
| Fonts | TrueType, OpenType, WOFF and WOFF2, embedded as subsets, with hyphenation and emoji | Fonts |
| Rendering | Files, buffers and streams in Node; Blobs, a viewer and a download link in the browser | Rendering |
| Streaming | Each page is written to the file or stream as soon as it is laid out | Rendering |
Rows | Rows from an array or an async iterable, rendered and written in batches | Long documents |
PageNumber, PageCount | The page number and count as text | axonpdf extras |
| Tables | Table with a header row that repeats on every page and borders that collapse | axonpdf extras |
| Header and footer bands | header and footer on Page, and the content area shrinks to fit them | axonpdf extras |
| Web Worker | The whole render off the page's main thread | Web Worker |
| Profiler | profile() reports time per phase and per page, and memory | Profiling |
| Security and archiving | Passwords, permissions and PDF/A | Security and archiving |
| Engine | Layout and PDF writing in Rust, with Yoga for flexbox, compiled to WebAssembly | Core engine |
Coming from react-pdf? Its API is compatible, and Migrate from react-pdf shows how to switch with one import.
Performance
In Chrome on an Apple M4, on 2026-11-23, the live benchmark app rendered a shipping ledger built
as one <Page> per section, with each engine in a Web Worker. Each cell is the time to the finished
PDF, then the worker's peak JavaScript heap:
| Pages | axonpdf | react-pdf 4.9.0 |
|---|---|---|
| 100 | 0.90 s, 11.6 MB | 2.8 s, 192.5 MB |
| 500 | 4.1 s, 55.9 MB | 45.8 s, 2230 MB |
| 2000 | 15.9 s, 141.6 MB | no PDF after 10 min, 3158 MB when stopped |
The benchmarks page has the full tables,
including the same report in one flowing <Page>. You can run the live app yourself at
axonpdf-demo.axonpack.dev.
An earlier run, in Node on 2026-11-21, rendered a report in one flowing <Page>. Each cell is the
render time, the peak memory of the whole process, and the size of the PDF:
| Engine | 100 pages | 1000 pages | 5000 pages |
|---|---|---|---|
| axonpdf, rows as an array | 817 ms, 117 MB, 442 KB | 7.8 s, 154 MB, 4.3 MB | 39.2 s, 471 MB, 21.5 MB |
| axonpdf, rows from a generator | 863 ms, 117 MB, 442 KB | 7.8 s, 130 MB, 4.3 MB | 39.2 s, 215 MB, 21.5 MB |
axonpdf, rows in <Rows> | 527 ms, 129 MB, 447 KB | 4.8 s, 147 MB, 4.3 MB | 24.1 s, 259 MB, 21.7 MB |
| react-pdf 4.9.0 | 36.1 s, 1289 MB, 643 KB | stopped at 15 min | not run |
| pdfkit 0.21.0 | 145 ms, 97 MB, 357 KB | 1.1 s, 175 MB, 3.5 MB | 5.3 s, 347 MB, 17.3 MB |
pdfkit draws the same pages by hand with page breaks worked out in advance, so read its row as a lower bound. Benchmarks has the method, the commit and the command that reruns every row.
For AI agents
The axonpack agent skill reads these docs, so your coding agent can set axonpdf up from them.
Agent skill has the command for each package manager.
npx skills add axonpack/skillsPackages
| Package | What it is |
|---|---|
@axonpdf/react | The components, styles, fonts and render functions. Most apps need only this one. |
@axonpdf/core | The engine as WebAssembly, for writing a binding for another framework. See Core engine. |