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

The right React PDF library depends on where the PDF is created and what the file must preserve. Use react-to-print when a user should review browser print settings and save selected component content. Use html2pdf.js for a client-side download of an element when an image-based PDF is acceptable. Use Puppeteer or Playwright when a server or automated job must render HTML and produce a repeatable PDF with print CSS. These approaches solve different problems; none is universally best.

First decide whether you are printing or generating a file

A React component is ultimately rendered HTML and CSS. “Convert it to PDF” can mean two different operations:

  • Printing: prepare a component, open the browser’s native print flow, and let the user choose a printer or “Save as PDF.”
  • Programmatic generation: create a PDF file in code, download it, attach it to an email, or store it on a server without showing a print dialog.

That distinction determines the library. Browser printing generally preserves selectable text and uses the browser’s print implementation, but the user controls dialog settings. Canvas-based client export is easy to trigger from a button, yet its output is image-based. Headless browsers provide automation and repeatability, at the cost of running a browser runtime.

Quick comparison

Requirement Best starting point Important trade-off
User prints selected React UI and chooses “Save as PDF” react-to-print The native print dialog owns settings; the package does not directly download a PDF by itself.
Download an element in the user’s browser html2pdf.js Browser-only, with image-based output that may not keep text selectable or searchable.
Generate PDFs automatically from rendered HTML Puppeteer or Playwright Requires a headless-browser environment and renders with print CSS media by default.

Option 1: print a React component with react-to-print

react-to-print copies the selected component into a print context and invokes the browser print flow. It is a good fit for invoices, reports, receipts, and preview screens where a person should inspect the result before saving it. The library itself does not download a PDF without opening print preview. A custom print function can hand the prepared content to another generator if your application needs that.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
  • Convert your PDF files into Word, Excel & Co. the easy way
  • Convert scanned documents thanks to our new 2022 OCR technology
  • Adjustable conversion settings
  • No subscription! Lifetime license!
  • Compatible with Windows 11, 10, 8.1, 7 - Internet connection required

Install and create a printable component

npm install react-to-print

With current React usage, keep a ref on the exact node to print and pass a function that returns it:

import React, { useRef } from 'react';
import { useReactToPrint } from 'react-to-print';

export default function InvoicePage({ invoice }) {
  const printRef = useRef(null);

  const printInvoice = useReactToPrint({
    contentRef: printRef,
    documentTitle: `invoice-${invoice.number}`,
  });

  return (
    <>
      <button type="button" onClick={printInvoice}>Print or save PDF</button>
      <section ref={printRef} className="invoice">
        <h1>Invoice {invoice.number}</h1>
        <p>Due {invoice.dueDate}</p>
        <ul>
          {invoice.items.map((item) => (
            <li key={item.id}>{item.description}: {item.total}</li>
          ))}
        </ul>
        <strong>Total: {invoice.total}</strong>
      </section>
    </>
  );
}

In the print dialog, the user selects “Save as PDF” (wording varies by browser and operating system). documentTitle supplies a useful suggested filename where the browser honors it.

Print-specific CSS

@media print {
  body { margin: 0; }
  .screenOnly, button { display: none !important; }
  .invoice { color: #000; background: #fff; }
  .invoice h1 { break-after: avoid; }
  .invoice li { break-inside: avoid; }
}

@page {
  size: A4;
  margin: 14mm;
}

Put print rules on nodes that are actually copied into the print DOM. Styles that depend on ancestors outside that DOM can disappear. The browser’s print settings cannot be controlled through window.print; margins, headers, backgrounds, and scale remain user or browser choices.

Printing caveats

The project reports that most modern browsers work, while mobile WebViews and Firefox for Android have limitations. Test the exact browser, embedded WebView, and device combinations your users rely on. Fonts and images must be loaded before printing; for data fetched asynchronously, render a loading state and enable the print button only after the final content is present.

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

Option 2: download an element with html2pdf.js

html2pdf.js runs in the browser and combines html2canvas with jsPDF. It converts a webpage or selected element into a downloadable PDF without opening print preview. This is convenient for offline or client-only exports, but the rendered page is rasterized. Text may not remain selectable or searchable, and files can become large for long documents or high-resolution images. The project does not run in Node.js.

Install and export a ref

npm install html2pdf.js
import { useRef } from 'react';
import html2pdf from 'html2pdf.js';

export default function DownloadCard() {
  const targetRef = useRef(null);

  const downloadPdf = async () => {
    const element = targetRef.current;
    if (!element) return;

    await html2pdf().set({
      margin: 10,
      filename: 'report.pdf',
      image: { type: 'jpeg', quality: 0.95 },
      html2canvas: { scale: 2, useCORS: true },
      jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
      pagebreak: { mode: ['css', 'legacy'] },
    }).from(element).save();
  };

  return (
    <>
      <button type="button" onClick={downloadPdf}>Download PDF</button>
      <article ref={targetRef}>Your report content</article>
    </>
  );
}

Make canvas export more predictable

  • Wait for web fonts and images before calling save(). An image with a different origin needs suitable CORS headers; otherwise the canvas can be tainted or the image omitted.
  • Keep very large pages manageable. A high scale improves sharpness but increases memory use and output size.
  • Use CSS page-break rules such as break-inside: avoid on cards and rows, then verify the actual PDF because complex flex and grid layouts can paginate unexpectedly.
  • Do not assume text extraction will work: this route captures pixels rather than constructing text objects.

Option 3: generate PDFs with Puppeteer

Puppeteer controls a Chromium browser and exposes page.pdf(). It is suited to server-side invoices, scheduled reports, and API endpoints where no user dialog should appear. PDF generation uses print CSS media. If your design is written for screen media, call page.emulateMediaType('screen') before creating the PDF.

Rank #2
Tengchi RCA to HDMI Converter, AV to HDMI Adapter
  • RCA Female to HDMI Video Converters Adapter : The cable is used to convert analog composite input to HDMI 1080p output, displayed on a 1080p HD TV/TV/monitor.
  • Input ports: 1xRCA Female (Yellow, White, Red), Output ports: 1xHDMI 1.3 1080p. NOT support 3D and 4K, NOT support HDMI Converts to AV
  • AV to HDMI Converter: Plug and Play, Easy to Install and Operate, Powered by External USB Cable. Note: Please hook up the USB power cable (included) to 5V 1Apower source during use (not included power supply ).
  • Support PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV formats input. For PS2,PS3,Xbox,N64,STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
  • You Will Get : 1x RCA Female TO HDMI Converter, 1xHDMI cable, 1xUSB cable, 1xUser Manual. ONE YEAR WARRANTY - if you are not satisfied for any reason whatsoever, do not hesitate to contact us .

Minimal Node.js service

npm install puppeteer express
import express from 'express';
import puppeteer from 'puppeteer';

const app = express();
app.get('/reports/:id.pdf', async (req, res) => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.goto(`https://app.example.com/reports/${encodeURIComponent(req.params.id)}`, {
      waitUntil: 'networkidle0',
    });
    await page.emulateMediaType('print');
    const pdf = await page.pdf({
      format: 'A4',
      printBackground: true,
      margin: { top: '14mm', right: '14mm', bottom: '14mm', left: '14mm' },
      preferCSSPageSize: true,
    });
    res.type('application/pdf').send(pdf);
  } finally {
    await browser.close();
  }
});

app.listen(3000);

For production, authenticate the page request, validate the identifier, and set a navigation timeout. If the page requires a login, establish a browser context or session before navigation. Wait for a specific application-ready selector when network idle is unreliable, for example a chart that loads after an API call.

Option 4: generate PDFs with Playwright

Playwright offers Chromium, Firefox, and WebKit automation and a similar PDF API. PDF generation is available through Chromium. Like Puppeteer, it uses print media unless you emulate screen media.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npm install playwright
import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://app.example.com/report/123', { waitUntil: 'networkidle' });
await page.emulateMedia({ media: 'print' });
await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true,
});
await browser.close();

Choose Playwright when its multi-browser automation model or locator and context APIs fit the rest of your test and rendering stack. Choose Puppeteer when a Chromium-focused implementation is simpler for your deployment. The available documentation establishes the APIs and media behavior, not a universal speed or fidelity winner.

How to choose

Choose by deployment location

  • Only the user’s browser: react-to-print or html2pdf.js. No server browser is required.
  • Server, queue, or scheduled job: Puppeteer or Playwright.
  • Hybrid: let users print interactively, while a server endpoint creates archival PDFs.

Choose by output requirements

  • Need selectable, searchable text and print CSS? Prefer browser printing or headless-browser PDF.
  • Need a one-click client download and can accept image-based output? html2pdf.js is the straightforward option.
  • Need deterministic filenames, authentication, and background generation? Use a server-side browser.

Choose by CSS fidelity

All three browser-oriented approaches render the page rather than asking you to redraw every field. Print styles are an advantage for react-to-print, Puppeteer, and Playwright; html2pdf.js depends on the canvas renderer and can differ on unsupported CSS, cross-origin assets, and page breaks. Build a print stylesheet deliberately instead of relying on your screen layout.

Troubleshooting common failures

The PDF is blank or missing late data

Cause: capture started before React finished rendering or before images and fonts loaded. Fix: disable the action until data is ready, wait for a stable selector in Puppeteer or Playwright, and verify image/font requests complete.

Styles vanish in react-to-print

Cause: a selector depends on an ancestor that is not included in the print content. Fix: move the needed class and print rules onto the printed subtree, and include the relevant stylesheet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Audio Converter - Edit and convert your sound and music files to other audio formats - easy audio editing software - compatible with Windows 10, 8 and 7
  • AUDIO ALL-ROUNDER – convert your audio or video files into almost any audio format - edit, trim, merge, adjust sample and bit rate, extract audio from videos
  • Supported input formats - MP3, MP2, AAC, AC3, WAV, WMA, M4A, RM, RAM, OGG, AU, AIF, AIFF, PG, MPEG, MPEG 2, MP4, M4V, MJPG, MJPEG, HD TS, HD MTS, HD M2TS, HD MPG, HD MPEG, HD MP4, HD WMV, QuickTime HD MOV and others
  • Supported output formats - AAC, AC3, AIFF, AMR, AU, FLAC, M4A, MKA, MP2, MP3, OGG, WAV, WMA
  • EASY TO INSTALL AND USE - user-friendly and intuitive interface, free tech support whenever you need assistance
  • compatible with Windows 10, 8 and 7 (32 and 64-bit versions) - single user license

Images disappear in html2pdf.js

Cause: cross-origin images without usable CORS headers or a canvas security restriction. Fix: serve assets with appropriate CORS configuration, use same-origin URLs where possible, and set useCORS: true only when the server permits it.

Pages split cards or table rows

Cause: CSS break rules are advisory and complex layouts may not paginate as expected. Fix: add break-inside: avoid to small blocks, simplify nested flex containers in print CSS, and test long and short data sets.

Headless generation fails in deployment

Cause: the runtime lacks Chromium dependencies, has insufficient memory, or blocks navigation. Fix: use a deployment image that supports the chosen browser, launch with the platform’s documented executable settings, close every browser in a finally block, and log navigation and page-console errors without exposing customer data.

The browser opens a dialog when automation should be silent

Cause: using the print flow rather than a headless PDF API. Fix: call page.pdf() in Puppeteer or Playwright; keep react-to-print for an intentionally user-controlled workflow.

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.

Performance, reliability, and operating cost

Client-side rendering shifts work to the user’s device. Large canvases can consume substantial memory, especially at high scale factors, and a mobile browser may terminate the tab. Server-side browsers make output more repeatable but require concurrency limits, browser lifecycle management, timeouts, and cleanup. Reuse a controlled browser process where your hosting model allows it, but isolate pages and contexts so one request cannot read another request’s cookies or DOM.

For either model, test representative documents: short and long tables, missing images, slow API responses, different fonts, right-to-left text if applicable, and URLs behind authentication. Compare the actual PDF for page count, text selection, links, colors, and page breaks. The available project documentation describes broad behavior but does not establish independent benchmarks or a universal fidelity ranking.

Rank #4
3.3 Feet VHS to Digital Converter, Type-C/USB 2.0 Video Cpture Card
  • RCA to USB Converter: This USB Capture Device can convert anolog RCA composite input into high-definition USB output, the maximum output resolution can reach 1920x1080@30Hz, suitable for camcorders, set-top boxes, boxes, DV camcorders, DVD, VHS, VCD, VCR, DVR and other devices. (Note: Only compatible with NTSC/PAL formats)
  • USB2.0 Video Capture: Supports RCA and S-Video input, USB 2.0/Type-C capture, the RCA to USB Capture Card is compatible with most current laptops, ensuring stable video capture and transmission.
  • 3.3ft/1m USB Cable: avedio links USB2.0 capture card is equipped with 3.3 feet USB capture cable, reduce the use of troubles caused by short cables and improve operational flexibility.
  • Wide Compatibility: Compatible with Windows and MacOS operating systems and supporting video capture software such as OBS, Potplayer, etc., this RCA to USB Capture Card is ideal for video production, screen recording and other scenarios.
  • Packing List: RCA&S-Video to USB Capture Card*1, USB A to Type-C converter*1, CD*1, 5ft S-Video Cable*1, RCA Converter*1, User Manual*1.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need an API call rather than maintaining a browser runtime, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one GET request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Every plan includes options such as full-page capture with lazy images loaded, CSS-selector element capture, custom CSS and JavaScript, waits, request blocking, cookies and headers, timezone and geolocation, PDF paper settings, signed links, asynchronous jobs, bulk capture of up to 100 URLs per call, caching with a chosen TTL, and a usage API. Plans are Free (1,000 shots/month, no card), Starter ($5 for 3,000), Growth ($15 for 15,000), Pro ($39 for 60,000), Scale ($99 for 250,000), and Business ($249 for 1,000,000); yearly billing gives two months free.

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

Use the API or documentation when the source page—not a React component already mounted in your user’s tab—is the thing you need rendered:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Start with 1,000 free screenshots per month—no card required.

FAQ

Can react-to-print save directly to a known file path?

No. It opens the browser print flow. A known file path requires a separate generator, such as a server-side browser or a custom print function that hands content to one.

Is html2pdf.js suitable for Node.js?

No. It is a browser-side library built around html2canvas and jsPDF. Use Puppeteer or Playwright for Node-based generation.

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

Do Puppeteer and Playwright use screen styles for PDFs?

They generate with print CSS media by default. Explicitly emulate screen media when that is the intended design.

Best Value
Roxio Easy VHS to DVD 3 Plus | VHS, Hi8, V8 Video to DVD or Digital Converter | Amazon Exclusive 2 Bonus DVDs [Windows Disc]
  • Convert your VHS tapes to DVD or digital to enhance and preserve your home movies
  • Capture analog video directly from your camcorder or VCR and burn to DVD or convert to popular digital formats to share freely across devices
  • Trim video, make quick edits, enhance color, add transitions, reduce noise and stabilize old footage to breathe new life into your old videos
  • Complete your video experience by selecting from creative, customizable DVD menu templates, or creating personalized disc labels
  • Get 2 DVDs for your first projects: An Amazon exclusive extra

Which approach should archive legal or financial reports?

Prefer a controlled server-side browser or a reviewed print workflow when selectable text, repeatability, authentication, and audit handling matter. Validate the resulting PDFs with your own document and compliance requirements.

Frequently Asked Questions

Can react-to-print save directly to a known file path?

No. It opens the browser print flow. A known file path requires a separate generator, such as a server-side browser or a custom print function that hands content to one.

Is html2pdf.js suitable for Node.js?

No. It is a browser-side library built around html2canvas and jsPDF. Use Puppeteer or Playwright for Node-based generation.

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

Do Puppeteer and Playwright use screen styles for PDFs?

They generate with print CSS media by default. Explicitly emulate screen media when that is the intended design.

Which approach should archive legal or financial reports?

Prefer a controlled server-side browser or a reviewed print workflow when selectable text, repeatability, authentication, and audit handling matter. Validate the resulting PDFs with your own document and compliance requirements.

Quick Recap

Bestseller No. 1
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
Convert your PDF files into Word, Excel & Co. the easy way; Convert scanned documents thanks to our new 2022 OCR technology
$29.99
Bestseller No. 3
Bestseller No. 5
Roxio Easy VHS to DVD 3 Plus | VHS, Hi8, V8 Video to DVD or Digital Converter | Amazon Exclusive 2 Bonus DVDs [Windows Disc]
Roxio Easy VHS to DVD 3 Plus | VHS, Hi8, V8 Video to DVD or Digital Converter | Amazon Exclusive 2 Bonus DVDs [Windows Disc]
Convert your VHS tapes to DVD or digital to enhance and preserve your home movies; Get 2 DVDs for your first projects: An Amazon exclusive extra
$51.56

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.