Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To convert React to PDF, choose whether you need a PDF-native document or a printout of an existing React page. Use @react-pdf/renderer for invoices, reports, and other documents designed specifically for PDF. Use Chromium with Puppeteer—or the browser’s print dialog—to preserve an existing page’s HTML and CSS. The right choice depends on how closely the output must match the web page, how much control you need over pagination, and whether export runs interactively or on a server.

Choose a conversion method

Method Best for What it renders Main trade-off
@react-pdf/renderer Invoices, reports, certificates, forms A PDF-specific React component tree You design the document with PDF primitives rather than reusing arbitrary DOM and CSS.
Puppeteer and Chromium Server-generated printouts of an existing React route The rendered HTML page, styled for print by default Requires a browser runtime and reliable handling of page readiness and CSS pagination.
Browser print dialog A user-triggered export with minimal infrastructure The page as handled by the user’s browser and print settings Less predictable for unattended or batch output.

These approaches solve different problems. A React component does not automatically become a PDF: either build a document using PDF-oriented components, or render the normal web page in a browser and print it.

Use @react-pdf/renderer for a PDF-native document

The official v4 quick start installs the package with npm install @react-pdf/renderer --save. It provides components such as Document, Page, View, and Text, styled with JavaScript style objects and a flexbox-like layout model. It is not a renderer for ordinary DOM elements or arbitrary web CSS; create a separate component tree for the PDF.

Install and create a document

npm install @react-pdf/renderer --save
import { Document, Page, Text, View, StyleSheet } from '@react-pdf/renderer';

const styles = StyleSheet.create({
  page: { padding: 36, fontSize: 12 },
  title: { fontSize: 20, marginBottom: 16 },
  row: { marginBottom: 8 },
});

export default function Invoice() {
  return (
    <Document>
      <Page size="A4" style={styles.page}>
        <Text style={styles.title}>Invoice</Text>
        <View style={styles.row}>
          <Text>Invoice number: INV-1042</Text>
        </View>
        <View style={styles.row}>
          <Text>Amount due: $240.00</Text>
        </View>
      </Page>
    </Document>
  );
}

In a client-side React app, render the document with the library’s PDFViewer to preview it, or use the browser download workflow provided by the library. On a Node server, the library supports ReactPDF.render() and ReactPDF.renderToStream(). Consult the react-pdf documentation for the current API and the correct browser or server entry point for your app.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose this method when you control the content and want explicit PDF-oriented layout. It is a poor fit if the requirement is to capture a complex existing page unchanged: translating the page into Document, Page, View, and Text is a separate implementation.

Print an existing React page with Puppeteer

Puppeteer drives Chromium and calls page.pdf() to create a PDF. Its official API generates the PDF using the print CSS media type by default; call page.emulateMediaType('screen') first if you specifically want screen styles. page.pdf() returns a Promise<Uint8Array>. The guide’s basic sequence is to launch a browser, open a page, navigate, generate a PDF, and close the browser.

Runnable Node.js example

This example assumes the React app is already running at the URL you provide. Install Puppeteer, save the script as an ES module such as print-page.mjs, and replace the example URL with a route that displays the page to export.

npm install puppeteer
import puppeteer from 'puppeteer';

const url = process.env.REACT_PAGE_URL ?? 'http://localhost:3000/invoice/1042';
const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  await page.goto(url, { waitUntil: 'networkidle2' });

  // Optional: use screen CSS instead of the default print CSS.
  // await page.emulateMediaType('screen');

  await page.pdf({
    path: 'output.pdf',
    format: 'A4',
    printBackground: true,
    margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
  });
} finally {
  await browser.close();
}

Run it with REACT_PAGE_URL=http://localhost:3000/invoice/1042 node print-page.mjs. The navigation wait is not a substitute for application-specific readiness: a route may still be fetching data, loading images, or rendering after navigation completes. Add a selector wait or an app-provided ready signal when needed, and confirm the page’s content is complete before creating the PDF. Puppeteer’s Page.pdf API states that it waits for fonts to load by default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the page for printing

Use a dedicated print route or print-specific CSS so the exported document is intentional rather than a raw screenshot of the interactive app. For example:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
@page {
  size: A4;
  margin: 12mm;
}

@media print {
  .site-nav,
  .export-button,
  .interactive-controls {
    display: none !important;
  }

  .report-section {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

Set page size and margins explicitly, decide whether backgrounds and colors matter, hide navigation or controls, and use page-break rules for sections, tables, and headings. Print CSS is subject to browser pagination behavior, so inspect the resulting pages rather than assuming a web layout will divide cleanly.

Let a user save a React page as PDF

For a user-triggered export, expose a print-friendly view and call window.print() from a button or other user action:

function PrintButton() {
  return (
    <button type="button" onClick={() => window.print()}>
      Print or save as PDF
    </button>
  );
}

The browser opens its print interface; the user chooses the available Save as PDF destination. Define @media print rules for hidden controls, margins, and page breaks. This avoids adding a PDF-generation library, but output can vary with browser behavior and the user’s print settings. It is not the best option for unattended batch generation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wait for the right content before capture

PDF generation can faithfully print an incomplete page if the application has not finished loading. Before calling page.pdf(), account for data, images, and fonts. Puppeteer waits for fonts by default, but your app’s API requests and image rendering still need appropriate readiness handling. A route-specific selector can serve as a simple gate:

await page.goto(url, { waitUntil: 'networkidle2' });
await page.waitForSelector('[data-pdf-ready="true"]');
await page.pdf({ path: 'output.pdf', format: 'A4', printBackground: true });

Set data-pdf-ready="true" only after the data and page elements required for the document are present. For highly dynamic routes, a deliberate application readiness condition is more reliable than treating a navigation event as proof that all meaningful content has settled.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Large documents, performance, and reliability

The react-pdf advanced documentation warns that rendering documents with 30 pages or more directly in the browser can occupy the browser’s main thread for a long time, and recommends rendering large documents inside a web worker so the UI remains responsive. This is guidance, not a benchmark or a guarantee about every document. Measure generation time and memory use with representative content.

For large exports or batch work, consider server-side generation, a background job, or a worker-based browser implementation instead of blocking the user’s active page. With Puppeteer, also control the browser/runtime and make page readiness deterministic: the same route should load the same data, fonts, and assets before capture. A worker can keep the UI responsive, but it does not eliminate the need to test resource use or output quality.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the PDF before shipping it

Inspect multiple pages, including the first and last, and test realistic long content. Check for:

  • Text or images clipped at page boundaries, unexpected blank pages, and awkward page breaks.
  • Tables split across pages in ways that obscure headers or totals.
  • Missing backgrounds, altered colors, or content hidden by print styles.
  • Font substitution, missing glyphs, and text that is not selectable as expected.
  • Working links, sensible reading order, and appropriate metadata or accessibility characteristics for your chosen renderer.

Generated PDFs are static artifacts. Do not assume that a visually correct preview also guarantees usable links, selectable text, reading order, or accessibility metadata; verify those properties in the actual output.

Or skip the browser setup

If your requirement is a screenshot of a React page rather than a paginated PDF, ScreenshotNeo offers a website screenshot API and MCP server. One GET request returns an image or PDF. For example, request a PDF of a deployed page:

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com/report 
  -d format=pdf 
  -o report.pdf

See the ScreenshotNeo documentation for authentication and supported options. Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ScreenshotNeo captures a page; it is not a replacement for a custom PDF document built from React components, or for tuning print pagination in your own app. Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common React-to-PDF problems

The PDF is blank or missing route content

Check that the app is reachable from the environment running Chromium and that navigation reaches the intended route. If the page loads data after navigation, wait for a route-specific ready selector before printing. Confirm that the data required for the PDF is available to that session.

Fonts or images are missing

Verify the browser can load the asset URLs and that they are not blocked by authentication, network policy, or an incorrect base path. Wait for application content and image loading before printing. Puppeteer’s PDF API waits for fonts by default, but check that the intended font files actually loaded.

Screen styling appears wrong

page.pdf() uses print media by default. Add @media print styles for the desired output, or call page.emulateMediaType('screen') before generating the PDF if the screen stylesheet is the intended design. Screen styles may still paginate differently when printed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Content is cut off or pages break badly

Set page format and margins explicitly, review @page rules, and add print-specific break behavior to the sections that need it. Check long tables and images at several content lengths; a layout that works for a short example may fail on a full report.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

The browser appears frozen during a large export

For react-pdf documents of 30 pages or more, the project warns that direct browser rendering can occupy the main thread for a long time. Consider a web worker, server-side rendering, or a background job, and test memory and generation time using the real document size.

Implementation checklist

  1. Decide whether the output is a printout of an existing page or a separately designed PDF document.
  2. For a printout, create a print route or stylesheet; for a document, build with the PDF renderer’s Document and Page components.
  3. Wait for API data, images, and fonts before generation, using a specific ready condition where needed.
  4. Set page format, margins, headers or footers, colors, and break rules deliberately.
  5. Use browser generation for small interactive exports; consider Node, a worker, or background processing for large and batch jobs.
  6. Inspect the finished PDF for clipping, blank pages, broken tables, fonts, links, text selection, reading order, and accessibility needs.

Frequently Asked Questions

Can I use regular HTML elements directly with @react-pdf/renderer?

No. It uses its own PDF-oriented primitives such as Document, Page, View, and Text; it is not a renderer for arbitrary DOM elements and CSS.

Does Puppeteer use print CSS or screen CSS for PDFs?

Print CSS is used by default. Call page.emulateMediaType(‘screen’) before page.pdf() if you want screen media styles.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is browser print suitable for automated batch PDF generation?

It is best suited to user-triggered exports because the browser and user print settings affect the result; unattended work is better handled by a controlled server or worker workflow.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.