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.

Use @react-pdf/renderer to build a PDF from React components and data, then choose whether to preview or download it in the browser or generate a file or stream on a server. Its Document, Page, View and Text components are PDF-specific primitives—not a way to print an arbitrary HTML subtree with ordinary browser CSS.

Install the package and define a PDF document

The official quick start installs the package with npm and builds a React tree rooted at Document. Put changing values in props or data, then create the document tree for the record you want to render.

npm install @react-pdf/renderer --save

Here is a small invoice component. It uses the library’s own elements and styling API; it does not render a normal HTML div or accept arbitrary DOM markup.

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

const styles = StyleSheet.create({
  page: { padding: 36, fontSize: 11 },
  heading: { fontSize: 20, marginBottom: 18 },
  row: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 8 },
});

export function InvoicePdf({ invoice }) {
  return (
    <Document>
      <Page size="A4" style={styles.page}>
        <Text style={styles.heading}>Invoice {invoice.number}</Text>
        <Text>Customer: {invoice.customerName}</Text>
        <View style={[styles.row, { marginTop: 16 }]}>
          <Text>Description</Text>
          <Text>Amount</Text>
        </View>
        {invoice.items.map((item) => (
          <View key={item.id} style={styles.row}>
            <Text>{item.description}</Text>
            <Text>{item.amount}</Text>
          </View>
        ))}
        <Text style={{ marginTop: 16 }}>Total: {invoice.total}</Text>
      </Page>
    </Document>
  );
}

The library provides layout and styling features including Flexbox, but its supported style properties are its own API. Consult the current documentation when translating a web layout: browser CSS rules and arbitrary HTML elements should not be assumed to work unchanged. The official React-pdf documentation is the reference for available primitives and styling.

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 where to render: browser or server

React-pdf documents two rendering environments: web and server. Pick based on where the required data and rendering work belong, whether the user needs a preview, and what your deployment runtime supports. The documentation demonstrates both; it does not prescribe one universally.

Need Approach Consideration
Show an embedded preview Render in the browser with PDFViewer Useful when users should inspect the PDF before saving it.
Offer a direct download Use PDFDownloadLink Rendering happens as part of the browser UI flow.
Control when browser rendering refreshes Use usePDF The hook exposes render state and an update function, so you can avoid recomputing for unrelated state changes.
Generate a document without a browser UI Render on the server to a file or stream Check runtime compatibility and account for the operational work of generating and serving the result.

Generate a browser preview or download

Preview with PDFViewer

For a preview in the application, place the PDF document inside PDFViewer and pass the current data into the document component.

import { PDFViewer } from '@react-pdf/renderer';
import { InvoicePdf } from './InvoicePdf';

export function InvoicePreview({ invoice }) {
  return (
    <PDFViewer width="100%" height="700px">
      <InvoicePdf invoice={invoice} />
    </PDFViewer>
  );
}

Download with PDFDownloadLink

When a user action should download the generated document, use PDFDownloadLink. Supply a filename and display the link’s render state while the PDF is being prepared.

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.
import { PDFDownloadLink } from '@react-pdf/renderer';
import { InvoicePdf } from './InvoicePdf';

export function InvoiceDownload({ invoice }) {
  return (
    <PDFDownloadLink
      document={<InvoicePdf invoice={invoice} />}
      fileName={`invoice-${invoice.number}.pdf`}
    >
      {({ loading, error }) => {
        if (error) return 'Could not create PDF';
        return loading ? 'Preparing PDF…' : 'Download invoice';
      }}
    </PDFDownloadLink>
  );
}

Use a Blob or control recomputation

The v4 on-the-fly guide also documents BlobProvider, pdf(document).toBlob(), and the usePDF hook. Blob-based options fit custom download or upload flows where the application needs the generated bytes rather than a ready-made link.

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

Use usePDF when rendering should happen on a deliberate update rather than after every render. It exposes loading, error, URL and blob state along with an update function. PDF generation can be expensive, so update it when relevant document data changes—not when unrelated UI state changes. See the on-the-fly rendering guide for the current APIs.

Generate a file or stream on the server

Server rendering is useful when a backend owns the data, produces documents as part of a workflow, or needs to return a PDF response. The quick start documents file and stream output; the advanced guide shows an Express response with Content-Type: application/pdf. The following is an Express-style pattern; check the current v4 API and your Node/runtime compatibility before adopting an exact stream snippet.

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.
import express from 'express';
import React from 'react';
import { renderToStream } from '@react-pdf/renderer';
import { InvoicePdf } from './InvoicePdf.js';

const app = express();

app.get('/invoices/:id.pdf', async (req, res, next) => {
  try {
    const invoice = await loadInvoice(req.params.id);
    const stream = await renderToStream(<InvoicePdf invoice={invoice} />);
    res.setHeader('Content-Type', 'application/pdf');
    res.setHeader('Content-Disposition', `attachment; filename="invoice-${invoice.number}.pdf"`);
    stream.pipe(res);
  } catch (error) {
    next(error);
  }
});

loadInvoice represents your application’s data lookup, not a react-pdf function. Validate the requested record and authorization before rendering; do not let a request parameter alone grant access to another user’s document. If you need a saved file rather than an HTTP response, use the documented server-side file output approach in the quick start.

Plan for changing content and pagination

Long or variable-length data means pages can break in places you did not anticipate. The advanced guide documents automatic page wrapping and controls for keeping related content together, forcing a new page, and repeating elements. Its opened pagination page is version 2 documentation, so check the current v4 API before relying on exact legacy snippets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Automatic wrapping: View, Text and Link can wrap across pages. Image is unbreakable by default.
  • Keep a block together: set wrap={false} on an element that should not split between pages. Use this for compact items such as a signature block, not for content that could exceed a page.
  • Start a new page: use the documented break prop when a section must begin on its own page.
  • Repeat headers or footers: mark a fixed element with fixed so it appears on wrapped pages.
  • Add page numbers: a dynamic render callback can use the current page number and total page count.

A text render callback may run twice: once when page layout is calculated and again when the final page count is known. Make it deterministic and free of side effects. Do not trigger network requests, mutate application state or generate new IDs from that callback.

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

Add metadata or PDF/A only when required

The v4 Document reference describes metadata fields, PDF version and a conformance option for PDF/A. Use document metadata when downstream users or systems need title, author or related document information; do not confuse metadata with PDF content shown on the page.

The documentation says PDF/A output includes XMP conformance metadata and an sRGB OutputIntent, and that only b-level visual conformance is supported. PDF/A requires embedded fonts. Register custom fonts when needed; the built-in standard 14 fonts will not fully validate for PDF/A. Treat this as a specific archival requirement, not a default setting for every PDF.

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

Common problems and fixes

  • The output is blank or missing values: verify that the component receives the expected data before rendering and that all visible content uses react-pdf primitives inside Document and Page.
  • Browser CSS or an HTML component does not appear: convert the content to supported PDF primitives and use the library’s styling API rather than passing a DOM subtree.
  • A row or paragraph splits awkwardly: apply wrap={false} to a suitably sized block, or restructure the content so the block can fit on a page. A block taller than the available page space cannot be kept together usefully.
  • The page count or footer text is wrong: use the dynamic render callback for page information, and make it safe to run twice.
  • Repeated state changes make generation sluggish: avoid rebuilding the PDF for unrelated state. Use usePDF where controlled updates suit the interaction.
  • A PDF/A file does not validate: confirm embedded fonts, register custom fonts as needed, and account for the documented b-level visual conformance scope.
  • The server endpoint fails while piping: confirm the installed package’s current server API, that the runtime supports the required rendering path, and that errors are passed to the application’s error handler before response headers are committed.

Or skip the browser setup

If the deliverable you need is a screenshot or page capture rather than a data-driven PDF document, ScreenshotNeo is a separate website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP or PDF; it does not replace react-pdf for composing invoices, reports or other structured documents. See the ScreenshotNeo website and API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Cookie banners, popups and chat widgets are removed before capture. Bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Can @react-pdf/renderer convert an existing React web page directly into a PDF?

No. Build the PDF with react-pdf’s document primitives and styling API; an arbitrary DOM subtree or ordinary browser CSS is not the documented workflow.

Should I generate the PDF in React or on my server?

Use browser rendering for interactions such as an in-app preview or download, and server rendering when the backend should produce a file or stream. The right choice depends on where data and rendering belong, runtime compatibility and the user flow.

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.

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