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

To export an html2canvas capture offline, make sure every image, font, stylesheet, script, and other pixel source is available locally and readable from the page’s origin before rendering. If you open the page with file:// and local files trigger origin errors, serve the folder from localhost instead. For an image hosted elsewhere, useCORS: true works only when that image server permits the request with suitable CORS headers. Changing from toDataURL() to toBlob() does not make a tainted canvas exportable.

Why a canvas becomes tainted

Browsers mark a canvas as not origin-clean when it contains pixel data drawn from a source the page is not allowed to read. The image may still appear on screen, but exporting its pixels with toDataURL(), toBlob(), or reading them with getImageData() can throw a SecurityError. This restriction prevents a page from extracting private data from another origin. The HTML Standard’s canvas security rules describe the export checks; MDN’s canvas image guide explains the practical effect for cross-origin images.

html2canvas does not take a native screenshot of the browser window. It walks the DOM and recreates the parts it supports on a canvas. Its result can differ from the page’s appearance where a CSS feature or embedded content is unsupported. It also cannot read a nested canvas that was already tainted before the capture began. See the project’s overview and limitations.

For a fully offline capture, localize the dependencies and load them under a consistent local origin. “The capture code runs offline” is not enough if the page still requests an online image, font, stylesheet, script, or proxy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • 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 the resource causing the problem

Check every element that contributes pixels inside the capture area—not only visible <img> elements. Background images, SVG references, web fonts, video frames, and nested canvases can matter too. An image omitted from the final result may be a clue that html2canvas skipped a resource it expected would taint the canvas.

  1. Check the browser console. Look for CORS messages, failed network requests, or errors involving local files. The network panel can show which assets failed to load or came from a different origin.
  2. Inspect the capture subtree. Search its markup and styles for image URLs, then check for nested <canvas>, SVG, video, and externally loaded fonts.
  3. Confirm assets are ready. Start rendering after required images and other dependencies have loaded. A missing offline asset is a load problem; it is not fixed by changing the export format.
  4. Separate the page-origin issue from the offline issue. A page can be offline but served from localhost, or online while opened as a file:// document. These conditions have different consequences for browser security.

The html2canvas FAQ documents same-origin and proxy considerations, cross-origin frames, and pre-tainted canvases. Cross-origin iframes are blocked by browser security restrictions; the renderer cannot use a proxy to read their contents as if they belonged to the page.

Make an offline page work from localhost

Double-clicking an HTML file opens it with a file:// URL. Modern browsers commonly treat file URLs as opaque origins, so two files in the same folder are not necessarily considered same-origin for security checks. MDN documents this behavior in its guidance on CORS requests that are not HTTP and the same-origin policy.

For local development, serve the project folder through a development server and open its localhost address. Files served using the same localhost scheme and domain share an origin. This avoids the particular ambiguity of file origins; it does not bypass CORS for unrelated remote websites. If the computer must stay disconnected, the HTML, JavaScript library, stylesheets, fonts, images, and other required files still need to be available locally.

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.
Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • 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)

The project’s Getting Started guide describes browser setup and lists modern evergreen browsers including Chrome or Chromium-based browsers, Firefox, and Safari. It says the library runs in the browser rather than Node.js. Its documentation does not establish a release number for the option behavior discussed here, so check the documentation matching the copy of the library in your project.

Choose a fix for each image or embedded source

Source or situation Recommended action Works fully offline?
Local image, font, or stylesheet Include it with the project, serve it from the same local origin, and wait for it to load. Yes, if all required files are already available locally.
Remote image server that supports CORS Request it with useCORS: true and confirm the server sends an appropriate Access-Control-Allow-Origin header. No, unless the needed resource has already been made available locally.
Remote image server you cannot configure Use an application-controlled proxy, or omit or replace the image. A proxy must fetch and return the asset through your application’s origin. No for an online proxy; only if the asset and required proxy service are available locally.
Unneeded image or widget Exclude it from the rendered subtree or mark the element with data-html2canvas-ignore. Yes; the excluded pixels will not appear.
Already-tainted nested canvas Remove or replace that canvas, or recreate its contents from permitted resources before capturing. Yes, if the replacement uses available, permitted resources.

The configuration guide explains the available settings and defaults. A proxy adds a server dependency and should be designed for your application’s security and availability needs; it is not an offline workaround unless the necessary resources are already local. General background on the server-side mechanism is in MDN’s CORS guide.

Use CORS settings only when the server permits them

For a remote image, useCORS: true asks html2canvas to load it using a CORS-enabled image request. The image host must cooperate by returning suitable CORS headers. The setting cannot make a non-cooperating server grant permission. This is why it is usually not helpful for a genuinely offline workflow: an offline browser cannot fetch an unavailable remote image, and a cached image is not automatically authorized for canvas export.

allowTaint is easy to misread. Its default is false; in that mode, html2canvas skips resources it expects would taint the output. Setting it to true allows a cross-origin resource to be drawn even if that leaves the canvas tainted. It does not authorize pixel export. If the goal is a downloadable image, use same-origin assets, a server that supports CORS, or omit the resource. The configuration reference and FAQ explain these options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • 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, export, and download a PNG

Assuming html2canvas is loaded and the capture element’s dependencies are ready, this example renders the selected element and downloads a PNG. The CORS option is appropriate only if the page contains cross-origin images whose servers actually grant CORS access. For a local-only page with same-origin assets, it can be omitted.

const target = document.querySelector('#capture');
if (!target) {
  throw new Error('Could not find #capture');
}

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 objectUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = 'capture.png';
link.href = objectUrl;
link.click();
setTimeout(() => URL.revokeObjectURL(objectUrl), 0);

The project’s examples show a toDataURL('image/png') download pattern. toBlob() is another way to produce the file, but both obey the same origin-clean rule. If either export method throws, changing serializers will not repair the canvas: identify the source that tainted it, then fix or exclude that source.

Troubleshoot errors and missing content

SecurityError from toDataURL(), toBlob(), or getImageData()

Cause: At least one drawn source tainted the canvas, or a nested canvas was tainted before html2canvas captured it. Fix: Check the resource list and network console, replace cross-origin content with local files or CORS-authorized assets, and remove or recreate pre-tainted canvases. Do not keep swapping export methods; they are all subject to the browser’s origin-clean checks.

Images disappear from the html2canvas output

Cause: The image failed to load, was unavailable offline, or was skipped because it was expected to taint the canvas. Fix: Verify its URL and load status, place the asset under the local app origin for offline work, or configure the image server for CORS and use the CORS loading option. If the image is not needed, exclude it intentionally rather than relying on a failed request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

A local sibling file fails only when opening the HTML directly

Cause: The browser is applying its special file:// origin behavior. Fix: Serve the folder from localhost, then ensure the asset paths resolve from that server. This addresses file-origin ambiguity; it does not authorize a request to another site.

useCORS: true makes no difference

Cause: The remote host does not return a suitable CORS header, the request cannot reach it, or the failing source is something other than a CORS-enabled image. Fix: Check the actual response headers and network failure, make the resource local for offline captures, use an application-controlled proxy where appropriate, or omit the source. The browser’s policy cannot be overridden by an html2canvas option.

The export succeeds but the capture looks different

Cause: html2canvas reconstructs the DOM using the browser APIs and CSS features it supports; it is not a pixel-for-pixel browser screenshot. A missing or altered feature may be a rendering limitation rather than a canvas security error. Fix: Check the project’s documented limitations, simplify or replace unsupported styling, and compare the rendered output before troubleshooting export security.

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 an online screenshot service fits the job, ScreenshotNeo offers a website screenshot API and MCP server. It is not an offline replacement for html2canvas: the API captures a URL, so use the local workflow above when the page and assets must remain offline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • 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

For an online page, one GET request returns an image or PDF. For example, this cURL request saves a WebP capture of Stripe; replace the URL with the page you need. See the ScreenshotNeo documentation for request options and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python:

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)

Or in Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Frequently Asked Questions

Can I export an html2canvas image if I am completely offline?

Yes, if the page, library, and every resource needed for the capture are available locally and loaded from an origin the browser permits. A remote dependency that cannot be reached will not become available just because the export code is local.

Does changing the output from PNG to JPEG or WebP remove canvas taint?

No. Canvas origin-clean checks apply to export regardless of the image format.

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

Can I capture a cross-origin iframe with html2canvas?

Not by reading the iframe’s contents across origins. Browser security blocks access to cross-origin frame content.

Does ScreenshotNeo capture a page that exists only on my computer?

The API example captures a URL; it is not an offline capture of a local-only page. Use the local html2canvas approach when the page must remain offline.

Quick Recap

Bestseller No. 4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.