Free @react-pdf/renderer PDF Templates & Visual Builder

Compiles layouts to @react-pdf/renderer TSX components powered by a custom React reconciler and Meta’s Yoga Flexbox engine (no browser or DOM). Produces the #2 smallest multi-page PDF overall (126.8 KB across 18 pages in 1.06s; 12 ms single-page) and is best run on Node.js servers (including Next.js Route Handlers via renderToBuffer()) or client-only React SPAs.

Install: npm install @react-pdf/renderer@^4.3.0 | Runtime: Node.js (TypeScript / TSX) | Version: 4.3.0 | Popularity: 1.8M/mo installs

Works with: React 18 & 19, Next.js (Route Handlers), Vite / React SPA, Node.js

How @react-pdf/renderer Templates Work in CodePDF

@react-pdf/renderer uses Yoga Flexbox primitives (<Document>, <Page>, <View>, <Text>, <Image>) styled with StyleSheet.create() rather than HTML DOM tags. CodePDF compiles visual layouts, repeating arrays, headers/footers, and data tables into idiomatic Flexbox TSX components with Font.register() support.

  • Converts visual tables into proportional Flexbox <View> rows without hand-calculating column widths and borders
  • Exports standalone TSX components with typed data props ready for renderToBuffer()/renderToStream() on Node.js or <PDFViewer>/<PDFDownloadLink> in client-only React SPAs
  • Includes Font.register() custom font snippets and PNG data-URI QR/barcodes compatible with <Image>

Quick Start: Generate PDFs with React-PDF

Install @react-pdf/renderer (TypeScript / TSX), then run the code CodePDF exports for any template:

npm install @react-pdf/renderer@^4.3.0

  1. Save the generated file as MyDocument.tsx inside your React project.
  2. Render it in the browser with <PDFViewer><MyDocument /></PDFViewer>.
  3. On the server, use renderToFile(<MyDocument />, 'out.pdf') from @react-pdf/renderer.
  4. Register custom fonts with Font.register({ family, src }) before rendering.

Example React-PDF Output (Standard B2B Commercial Invoice)

Compiled directly from the Standard B2B Commercial Invoice template (TypeScript / TSX):

import React from 'react';
import { Document, Page, View, Text, Image, Svg, Rect, Path, StyleSheet, Font } from '@react-pdf/renderer';

// This code is generated using codepdf.dev

Font.registerHyphenationCallback((word) => [word]);

// Document-wide defaults configured in the editor.
export const DOCUMENT_DEFAULTS = {
  "fontFamily": "Helvetica",
  "fontSize": 12,
  "textColor": "#000000",
  "locale": "en-US",
  "currency": "USD",
  "currencyDisplay": "symbol",
  "timeZone": "GMT",
  "dateFormat": "DD/MM/YYYY",
  "timeFormat": "HH:mm",
  "showPageNumbers": false,
  "pageNumberFormat": "{{page}} / {{total}}",
  "pageNumberPosition": "center",
  "compress": true
};

export interface DocumentData {
  vendorCompany: string;
  invoiceNumber: string;
  vendorAddress: string;
  invoiceDate: string;
  paymentDueDate: string;
// … (439 more lines in full generated file)

Custom Fonts in React-PDF

Register TTF, OTF, or WOFF font sources globally with Font.register() before rendering <Document />.

  1. Host font files publicly via HTTPS or place .ttf/.woff assets in ./fonts/ for server builds.
  2. Call Font.register({ family, fonts: [{ src, fontWeight }] }) at module startup.
  3. Reference the exact registered family name in StyleSheet fontFamily properties.

Official documentation: React-PDF docs

React-PDF Benchmark Results

Measured on CodePDF’s 26-component, 18-page All-Components Dynamic Multi-Page Flow Stress Test (same document across all 22 libraries).

@react-pdf/renderer stress-test results and rank out of 22 PDF libraries
MetricReact-PDFRank (of 22)
Wall-clock time1.06 s19th fastest
CPU time2.79 s20th lowest
Peak RAM237.3 MB21st lowest
PDF file size126.8 KB2nd smallest
Engine type
Custom Layout Engine
Under the hood
Custom React reconciler + Meta Yoga Flexbox + PDFKit stream writer (no browser/DOM)
Runs in
Node.js (incl. Next.js Route Handlers), React SPAs (Vite)
Verdict
#2 smallest multi-page PDF overall (126.8 KB across 18p; 12 ms single-page, 1.06s stress) with Yoga Flexbox; run server-side in Next.js.

Under the Hood & Benchmark Highlights

  • Uses a custom React reconciler + Meta Yoga Flexbox (the same layout engine behind React Native) instead of HTML/DOM, emitting vector streams directly via PDFKit.
  • Ranked #3 smallest PDF in our 26-component multi-page stress test (82.2 KB across 10 pages, ~1.98s, ~201 MB RAM) — roughly 3.6× smaller than Playwright and 5.5× smaller than Puppeteer.
  • Pairs declarative JSX components with true multi-page Flexbox flow, without launching a headless browser.

Good to Know (React-PDF Caveats)

  • Next.js App Router: Avoid using @react-pdf/renderer on the client side in Next.js — SSR and Turbopack frequently break PDFViewer/PDFDownloadLink. Render PDFs server-side inside a Route Handler with renderToBuffer() and add serverExternalPackages: ['@react-pdf/renderer'] to next.config.
  • Not HTML/CSS: Standard tags (<div>, <table>, <span>) and CSS Grid are unsupported; layouts must use Yoga Flexbox primitives.
  • Built-in fonts are limited to PDF Standard-14 (Helvetica, Times, Courier); register static .ttf/.otf/.woff files via Font.register() for custom typefaces or non-Latin text.

Popular React-PDF PDF Templates

All 100 CodePDF templates export to @react-pdf/renderer. Browse them by category: Career (5) · Business (6) · Education (7) · Marketing (6) · Human Resources (8) · Finance (7) · Legal (8) · Healthcare (10) · Logistics (6) · Real Estate (6) · Hospitality (4) · Operations (5) · Technology (5) · Banking (9) · Non-Profit (4) · Personal (3) · Compliance & Enterprise (1), or see the full template gallery.

React-PDF Template FAQs

How do you build tables in @react-pdf/renderer templates?

Because @react-pdf/renderer has no native HTML <table> tag, tables are built with Flexbox <View style={{ flexDirection: 'row' }}> containers and proportional column widths. CodePDF's visual Table component compiles directly into responsive Flexbox rows and repeating array mappings.

Can I use these @react-pdf/renderer templates in Next.js App Router?

Yes, on the server. Next.js App Router does not reliably support @react-pdf/renderer on the client side due to SSR and bundler incompatibilities. Render the exported TSX component inside a Next.js Route Handler using renderToBuffer() or renderToStream(), and add serverExternalPackages: ['@react-pdf/renderer'] to next.config.

How are custom fonts and QR codes handled in exported React-PDF code?

CodePDF emits Font.register() setup snippets for Google Fonts or local TTF/WOFF files and encodes QR codes and Code-128 barcodes as crisp data URIs compatible with React-PDF's <Image> primitive.

React-PDF vs Other Node.js PDF Libraries

  • pdf-lib — 334 ms, 209.7 MB RAM, 203.8 KB PDF. Runs in browsers & Edge Workers and edits/merges existing PDFs (5.3 ms single-page; 334 ms / 203.8 KB across 20p).
  • jsPDF — 120 ms, 98.3 MB RAM, 157.4 KB PDF. Fastest Node.js/browser JS engine in stress test (120 ms for 22p, 3.5 ms single-page, 98.3 MB RAM); custom TTFs require base64 VFS.
  • pdfmake — 189 ms, 183.7 MB RAM, 165.5 KB PDF. Declarative JSON tables & automatic pagination in 189 ms (27p, 165.5 KB; 4.4 ms single-page); VFS fonts add weight to browser bundles.
  • PDFKit (Node.js) — 140 ms, 125.5 MB RAM, 162.6 KB PDF. Fastest server-only Node.js stream writer on single-page invoices (2.8 ms / 2.6 KB; 140 ms / 125.5 MB RAM across 22p).
  • Puppeteer — 1.35 s, 263.2 MB RAM, 841.2 KB PDF. Full Chrome CSS fidelity, but 841.2 KB PDF (#2 largest), 263.2 MB RAM (highest), 1.35s warm render (+ cold Chrome launch & ~350 MB binary).
  • Playwright — 883 ms, 203.8 MB RAM, 452.2 KB PDF. Beat Puppeteer on pure PDF render speed (883 ms vs 1.35s), RAM (204 vs 263 MB), and PDF size (452 vs 841 KB); Chromium-only.
  • HTML5 & CSS Paged Media — 818 ms, 196.3 MB RAM, 453.6 KB PDF. Renderer-agnostic HTML5 + @page CSS; warm Chromium print finishes 19 pages in 818 ms (453.6 KB; 581 ms single-page).

See the full 22-library benchmark rankings · Compare all supported PDF libraries