Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Use a DOM-to-canvas pipeline, increase the canvas scale deliberately, and calculate PDF dimensions from the canvas aspect ratio. For most React components, the practical workflow is: capture a referenced element with html2canvas, place the resulting image in jsPDF, and paginate tall content explicitly. Wait for fonts and images first, enable CORS for images you control, and test memory usage before selecting a very large scale.
Choose the right export strategy
There are three useful approaches. Your choice depends on whether visual appearance, selectable text, or semantic rows and columns matter most.
| Approach | Best for | Strengths | Trade-offs |
|---|---|---|---|
| html2canvas + jsPDF | Arbitrary React markup and CSS | Direct control over capture scale, crop, page geometry and placement | Produces a raster image in the PDF; unsupported CSS may differ from the browser |
| html2pdf.js | A packaged element-to-PDF workflow | Combines html2canvas and jsPDF with filename, image, page-break and format options | Automatic pagination can require inspection and adjustment |
| Structured component exporter | Libraries with semantic export APIs, such as DevExtreme DataGrid | Rows, columns and pagination remain document-oriented | Only applies to supported components and requires the library’s exporter setup |
If selectable/searchable text is essential, prefer a structured PDF renderer when your component library provides one. A canvas capture is fundamentally a bitmap placed on PDF pages, so visual fidelity and document semantics are different goals.
Install the browser-side libraries
npm install html2canvas jspdf
Import them in the component or export utility:
import html2canvas from 'html2canvas';
import { jsPDF } from 'jspdf';
Build a high-resolution React export
1. Give the target a stable print layout
Use a ref on a wrapper with an explicit background, predictable width and print-safe styles. Avoid exporting a container whose dimensions change during animation or responsive transitions.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
import React, { useRef } from 'react';
export default function Report() {
const reportRef = useRef(null);
async function exportPdf() {
const element = reportRef.current;
if (!element) return;
await exportElementToPdf(element, 'report.pdf');
}
return (
<>
<button onClick={exportPdf}>Export PDF</button>
<section ref={reportRef} className="report">
<h1>Quarterly report</h1>
{/* component content */}
</section>
</>
);
}
2. Wait for fonts and images
Capturing immediately after rendering can produce fallback fonts or empty image boxes. Wait for the document fonts and every image inside the target.
async function waitForAssets(element) {
if (document.fonts?.ready) await document.fonts.ready;
const images = [...element.querySelectorAll('img')];
await Promise.all(images.map(img => {
if (img.complete) return Promise.resolve();
return new Promise(resolve => {
img.addEventListener('load', resolve, { once: true });
img.addEventListener('error', resolve, { once: true });
});
}));
}
3. Capture at a deliberate scale
html2canvas‘s scale controls the internal canvas pixel density and defaults to window.devicePixelRatio. Starting at that value generally preserves the density users see on a high-DPI display. Try a higher value only after checking canvas memory and output size.
async function exportElementToPdf(element, filename) {
await waitForAssets(element);
const scale = Math.max(2, window.devicePixelRatio || 1);
const canvas = await html2canvas(element, {
scale,
useCORS: true,
backgroundColor: '#ffffff',
imageSmoothingEnabled: true,
logging: false
});
const pdf = new jsPDF({ unit: 'mm', format: 'a4', orientation: 'portrait' });
const margin = 10;
const pageWidth = pdf.internal.pageSize.getWidth();
const pageHeight = pdf.internal.pageSize.getHeight();
const contentWidth = pageWidth - margin * 2;
const contentHeight = canvas.height * contentWidth / canvas.width;
if (contentHeight <= pageHeight - margin * 2) {
pdf.addImage(canvas, 'PNG', margin, margin, contentWidth, contentHeight);
} else {
addCanvasSlices(pdf, canvas, margin, contentWidth, pageHeight - margin * 2);
}
pdf.save(filename);
}
The height calculation preserves the canvas aspect ratio, preventing stretching. The PDF’s physical page size does not change the canvas pixels; it changes how those pixels are placed on paper.
Paginate long components without blurry seams
One very tall canvas can consume substantial memory and may be awkward to place on pages. Slice it into source-canvas regions whose displayed height equals the usable page height.
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
function addCanvasSlices(pdf, canvas, margin, outputWidth, outputHeight) {
const sourceSliceHeight = Math.floor(canvas.width * outputHeight / outputWidth);
let sourceY = 0;
let firstPage = true;
while (sourceY < canvas.height) {
const sliceHeight = Math.min(sourceSliceHeight, canvas.height - sourceY);
const slice = document.createElement('canvas');
slice.width = canvas.width;
slice.height = sliceHeight;
const context = slice.getContext('2d');
context.drawImage(canvas, 0, sourceY, canvas.width, sliceHeight,
0, 0, canvas.width, sliceHeight);
if (!firstPage) pdf.addPage();
firstPage = false;
const displayedHeight = sliceHeight * outputWidth / canvas.width;
pdf.addImage(slice, 'PNG', margin, margin, outputWidth, displayedHeight);
sourceY += sliceHeight;
}
}
Inspect every boundary. A heading, table row or chart can be split between pages because the canvas has no knowledge of document semantics. For predictable breaks, divide the React content into page-sized sections and capture each section separately, or use CSS page-break rules with html2pdf.js.
Use html2pdf.js when its pagination model fits
html2pdf.js wraps html2canvas and jsPDF and exposes page-break modes, image settings, margins and PDF format in one configuration.
import html2pdf from 'html2pdf.js';
const options = {
margin: 0.25,
filename: 'component.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: {
scale: Math.max(2, window.devicePixelRatio || 1),
useCORS: true
},
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' },
pagebreak: { mode: ['css', 'legacy'] }
};
await html2pdf().set(options).from(document.querySelector('.report')).save();
Use break-before, break-after or break-inside: avoid in your print stylesheet where supported. Automatic rules are convenient, but verify tables, cards and charts at actual page boundaries.
Cross-origin images, SVG and iframes
Images normally need to be same-origin. useCORS: true helps only when the image server returns appropriate CORS headers. Otherwise, serve the asset through a same-origin endpoint or a properly configured proxy. A failed or blocked image can taint the canvas and prevent export.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
- INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
- SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
- EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
- SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning
html2canvas reconstructs the DOM and implemented CSS; it is not a literal browser screenshot. Complex filters, shadows, gradients, replaced elements and newer CSS features can render differently. Cross-origin iframes cannot be read because browser security prevents access to their document. Replace an iframe with a server-rendered representation or export its content separately.
Improve sharpness without crashing the tab
- Start with
window.devicePixelRatio; test 2 or 3 only for the component sizes you actually export. - Remember that doubling scale multiplies canvas pixels in both dimensions, so memory and file size can rise dramatically.
- Capture only the needed element rather than the whole application shell.
- Resize oversized charts and photographs before capture.
- Use JPEG for photographic reports when a smaller file is more important than lossless text and line art; use PNG for crisp diagrams and transparency.
- Disable animations and wait for charts to finish drawing.
- Test on the least capable supported device, not only a desktop development machine.
Common failures and fixes
Text is still soft
Confirm the requested element is not being scaled down by CSS, verify the canvas dimensions, and increase scale cautiously. A raster PDF cannot create detail that was absent from the canvas.
Images are missing or export throws a security error
Check the image response’s CORS headers, use useCORS: true, and avoid drawing inaccessible cross-origin content. A proxy may be required.
The PDF is stretched or clipped
Derive displayed height from canvas.height * displayedWidth / canvas.width. Do not hard-code both dimensions independently. For tall content, slice the canvas or capture page sections.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #4
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
The PDF differs from the browser
Remove transitions, wait for fonts and images, set explicit colors and dimensions, and identify unsupported CSS. Compare representative SVG, gradients, shadows, filters and embedded images in the target PDF viewer.
The browser tab runs out of memory
Lower scale, capture smaller sections, reduce image dimensions, and release temporary canvases after each page. Very large DOM surfaces can exceed browser canvas limits even when the page looks normal.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When a semantic exporter is better
If the component is a supported DevExtreme grid, DevExpress documents a React PDF exporter based on exportDataGrid and jsPDF 2.3.1 or later. That route is preferable when rows, columns and pagination must remain structured rather than becoming one bitmap. Use DOM capture for arbitrary visual layouts; use a library exporter for data surfaces that already expose one.
Or skip the browser setup
For a URL-based capture, ScreenshotNeo provides a single API request and handles the browser environment for you. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesIt also supports full-page lazy-image loading, CSS-selector element capture, device presets and custom viewports, retina scale, custom CSS and JavaScript, waits, request blocking, cookies, headers, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture and PDF options. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
Best Value
- OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
- CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
- STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
- PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
- AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss
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}`);
See the ScreenshotNeo API documentation for parameters and PDF settings. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
Frequently Asked Questions
Can a canvas-based PDF keep selectable text?
Usually not. html2canvas renders pixels, so choose a structured PDF exporter when searchable, selectable text is a requirement.
Should I always use scale 3 or 4?
No. Start at device-pixel ratio and increase only after checking memory, export time and file size on your supported devices.
Why does an iframe disappear?
A browser cannot read a cross-origin iframe’s document. Export its content separately or provide a server-rendered equivalent.
Quick Recap
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.

