Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To export an html2canvas capture offline, make every image and other pixel-bearing asset available from the same local app origin before rendering. If the page is opened with file://, serve it from localhost instead: local files can have opaque origins, and sibling files are not automatically same-origin. For a remote image, useCORS: true works only when that image’s server grants access with suitable CORS headers. A tainted canvas cannot be made readable by switching from toDataURL() to toBlob().
Why html2canvas exports fail
html2canvas is a DOM renderer, not a native browser screenshot. It walks the page and paints a canvas representation using browser APIs and the CSS and DOM features it supports; some content or styling may be missing or differ from the displayed page. Its result is still subject to the browser’s canvas security rules. See the project’s overview and limitations.
When a canvas is origin-clean, code can read or export its pixels. If unapproved cross-origin image data is drawn into it, the browser marks it tainted. Calls such as getImageData(), toBlob(), and toDataURL() then throw a SecurityError; that restriction prevents a page from reading pixels it is not allowed to access. The HTML Standard specifies this behavior, and MDN explains canvas use of cross-origin images.
The practical fix is upstream of export: identify the resource that taints the rendering canvas, then make it same-origin, obtain CORS permission, or exclude it. Changing the serialization method does not change the canvas security state.
#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
Find every resource that contributes pixels
Check the target element and its descendants, not only visible <img> tags. A problematic asset can enter through CSS or embedded content.
- Images: inspect
<img>elements and CSS background images, including assets loaded by stylesheets. - Fonts and stylesheets: make sure the required files are available locally for an offline run; missing fonts or styles can alter the rendering even when they do not cause the particular taint error.
- SVG and video: check external SVG references and video frames used in the capture.
- Nested canvases: a canvas already tainted by cross-origin content cannot be read by html2canvas. Replace it, rebuild its contents from permitted resources, or omit it.
- Iframes: cross-origin iframe contents are blocked by browser security restrictions and are not a way to capture the framed page through the parent.
The html2canvas documentation describes its resource constraints, including same-origin or proxied resources. A page is not fully offline just because the html2canvas script is local: all assets needed for the capture must also be present locally or otherwise available without a network request.
Separate offline mode from file:// origin behavior
Offline describes network availability. file:// describes how the browser loads the document and assigns origins. Modern browsers commonly treat file URLs as opaque origins, so two files in the same folder are not necessarily same-origin for security checks. This can produce CORS errors even with local sibling assets. See MDN’s explanation of non-HTTP CORS requests and its same-origin policy guide.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →For local development, serve the folder through a development server and open its http://localhost address. Files served from the same localhost scheme and host share an origin. This resolves the special local-file origin ambiguity; it does not grant access to unrelated remote sites. If the machine must remain disconnected, bundle the library and assets first, then load them from the local app.
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)
Choose a fix for the resource
Use local assets for a genuinely offline capture
Place the images, stylesheets, scripts, fonts, and other required files in the local application, reference them through the same localhost origin, and wait for them to load before calling html2canvas. This is the most direct offline path: it requires no remote image host to grant CORS access and no proxy. A remote proxy is not an offline solution unless the needed resource has already been fetched and stored locally.
Use CORS for a remote image only when its server cooperates
Set useCORS: true when a remote image must be included and its host returns an appropriate Access-Control-Allow-Origin header. The option makes html2canvas attempt a CORS-enabled image request; it cannot make a server grant permission. Consult the html2canvas FAQ, configuration reference, and MDN CORS guide.
Use an application-controlled proxy when the server cannot be changed
A proxy can fetch a resource and serve it through your application’s origin, as the html2canvas FAQ describes. This adds a server-side dependency and must be designed for your application’s security and availability needs. It does not satisfy a fully offline requirement while it still needs to fetch from the network.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Exclude content you do not need
If an image is not essential to the output, leave it out of the capture. html2canvas supports the data-html2canvas-ignore attribute for excluding an element. For an already-tainted nested canvas, excluding or replacing that canvas is different from trying to export it: the original pixel data remains unreadable.
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
Render and export after fixing the source
This example is for a page whose remote image server explicitly permits CORS. It renders a selected element, exports PNG data as a blob, and triggers a download.
const target = document.querySelector('#capture');
if (!target) throw new Error('Capture element #capture was not found');
const canvas = await html2canvas(target, {
useCORS: true,
});
const blob = await new Promise((resolve, reject) => {
canvas.toBlob((result) => {
if (result) resolve(result);
else reject(new Error('Canvas export returned no blob'));
}, 'image/png');
});
const link = document.createElement('a');
link.download = 'capture.png';
link.href = URL.createObjectURL(blob);
link.click();
URL.revokeObjectURL(link.href);
For a wholly local page, keep all inputs local and omit useCORS unless you also have remote resources whose server supports CORS. The project’s examples also show a toDataURL('image/png') download flow. Both export methods require an origin-clean canvas. If the call still throws, investigate failed asset loads or nested canvases rather than repeatedly changing export formats.
Understand allowTaint before changing it
allowTaint defaults to false. In that mode, html2canvas skips cross-origin resources it expects would taint the canvas. Setting it to true allows such content to be drawn even though it can taint the resulting canvas; it does not grant permission to read or export the pixels. For a downloadable image, use same-origin or CORS-authorized assets, or omit the offending content. The documented defaults and options are in the configuration reference.
Offline capture versus a proxy or remote asset
| Approach | Works without network? | Server cooperation | Trade-off |
|---|---|---|---|
| Local assets served by the same app origin | Yes, once files are present locally | None from a remote image host | Assets must be bundled and loaded before capture |
Remote image with useCORS: true |
No, not unless it is already locally available | Remote host must return suitable CORS headers | Cannot force a non-cooperating host to authorize access |
| Application-controlled proxy | No, while it must fetch the remote resource | Your proxy fetches and serves the resource | Adds a server dependency; not inherently offline |
| Ignore or replace the resource | Yes | None | Excluded content will not appear in the capture |
Troubleshoot common failures
toDataURL() or toBlob() throws SecurityError
Cause: a cross-origin image or an already-tainted nested canvas contributed pixels. Fix: inspect image and background-image URLs, nested canvases, and other embedded content. Use local same-origin assets, configure working CORS on the image host, proxy the resource where appropriate, or exclude it. Do not expect toBlob() to bypass the restriction.
Rank #4
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
A local image fails when the HTML file is opened directly
Cause: the document uses file://, whose origin behavior differs from an HTTP page; sibling files may not pass same-origin checks. Fix: serve the directory on localhost and reference assets from that origin. For a disconnected run, ensure the required files are already on the machine.
useCORS: true is set, but the remote image is missing or export still fails
Cause: the image host may not return the required CORS response header, the request may fail, or another resource may be responsible. Fix: check the image request and response in browser developer tools, confirm the host’s CORS configuration, and inspect every other contributing resource. The option is a request strategy, not a CORS bypass.
The capture omits images or looks different from the page
Cause: an asset failed to load, was skipped to avoid taint, or the page uses a DOM/CSS feature html2canvas does not reproduce. Fix: confirm the asset is available and loaded before rendering, then check the project’s documented rendering limitations. html2canvas is not pixel-perfect by design.
Recommended Free Tools
The page works online but fails after disconnecting
Cause: the page still depends on a remote image, font, stylesheet, script, or proxy. Fix: identify each request needed by the capture, store the dependencies locally, and serve them with the page. “Offline” requires the inputs as well as the capture code to be available.
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
html2canvas runs in Node.js but browser output is unavailable
Cause: html2canvas runs in a browser, not Node.js. Its getting-started documentation lists evergreen browsers such as Chrome/Chromium-based browsers, Firefox, and Safari. Fix: run the capture in a supported browser context; do not treat it as a server-side Node renderer. See Getting Started.
Or skip the browser setup
If you need a website screenshot rather than an offline html2canvas render, ScreenshotNeo takes a shot through one API request. Its clean-shot options accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Save the response as a file; replace the example URL with the page you want to capture. See the ScreenshotNeo API documentation for the request options.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchcurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up free for 1,000 screenshots a month with no card.
FAQ
Does html2canvas capture the exact pixels a browser displays?
No. It reconstructs a rendering from the DOM and supported browser features, so some CSS or embedded content may be omitted or differ.
Can a tainted canvas be made readable after the capture?
No. You must prevent the taint by using permitted resources or exclude the content that caused it.
Does localhost make an otherwise offline page work?
It resolves the local-file origin issue, but it does not provide missing network assets. The page and its dependencies still need to be available locally.
Free tools Windows power users keep installed
One-click scans. No signup required.
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.

