If html2canvas returns a completely blank, partly rendered, or unexpectedly small image, first verify the target element and capture timing. Then use its logging and the browser’s Console and Network panels to classify the failure: missing DOM, failed resources, cross-origin images or canvases, unsupported CSS, inaccessible iframes, or an oversized canvas. Each class has a different fix; increasing a timeout or setting allowTaint cannot solve the others.
A fast diagnostic sequence
- Confirm the target. Log the element passed to
html2canvas. It must be non-null, attached to the document, and contain the content you expect when the promise starts. - Confirm readiness. Start capture only after your application has rendered the target and the resources it depends on. Wait for the specific state your app uses (for example, a data-loaded flag and required images), rather than adding an arbitrary delay.
- Enable diagnostics.
loggingis enabled by default in the configuration documented by the project. Read the browser console and inspect the Network panel for failed JavaScript, image, font, stylesheet, or API requests. - Classify what is missing. Is the entire canvas empty, are only remote images absent, is an iframe missing, or does a particular visual effect differ? This determines the next test.
- Check dimensions. If only long pages or large elements fail, set virtual window dimensions from the target’s scroll dimensions and test a smaller region.
1. Make sure you are capturing the right element at the right time
A selector can match nothing, match a hidden template, or run before a framework has mounted the real component. Capture the element after it is attached and populated:
const element = document.querySelector('#invoice-preview');
if (!element || !document.documentElement.contains(element)) {
throw new Error('Capture target is missing from the document');
}
const canvas = await html2canvas(element, { logging: true });
document.querySelector('#result').src = canvas.toDataURL('image/png');
Check the element’s getBoundingClientRect(), computed visibility, and scrollWidth/scrollHeight in DevTools. A zero-sized element, a detached clone, or a container whose content is rendered later can produce an apparently blank result even though the page eventually looks correct.
For asynchronous apps, wait on the application’s actual readiness signal. You can also verify image completion before capture:
#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
await Promise.all([...element.querySelectorAll('img')].map(img =>
img.complete ? Promise.resolve() : new Promise(resolve => {
img.addEventListener('load', resolve, { once: true });
img.addEventListener('error', resolve, { once: true });
})
));
const canvas = await html2canvas(element);
This only waits for loading; it does not bypass cross-origin policy or make unsupported CSS renderable.
2. Read logs, Console errors, and network failures
Keep logging: true while diagnosing. In the Network panel, reload and filter for requests made by the target: images, fonts, stylesheets, scripts, and data endpoints. A 404, blocked request, authentication redirect, mixed-content block, or content-security-policy violation can explain missing content. The browser console may also reveal a rejected promise or an export error when a canvas is not readable.
The documented default imageTimeout is 15,000 milliseconds. Increase it only when images are genuinely slow:
const canvas = await html2canvas(element, {
logging: true,
imageTimeout: 30000
});
A longer timeout cannot repair a CORS denial, a bad URL, a server that requires credentials, or CSS that html2canvas does not implement.
3. Fix missing remote images and tainted canvases
Images from another origin require cooperation from that image server. With the default allowTaint: false, html2canvas skips images that would taint the output. Ask the browser to request images in CORS mode:
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)
const canvas = await html2canvas(element, {
useCORS: true,
logging: true
});
The image response must include an appropriate Access-Control-Allow-Origin value for your page (or a permitted wildcard where appropriate). Inspect the response headers; adding useCORS alone does not grant permission.
Use a same-origin proxy when the image server cannot add CORS
If you control a server, fetch the asset there and expose it from your own origin, then configure html2canvas’s proxy option as documented for your installed version. The proxy must return the image with a successful response and suitable content type. Protect such an endpoint against open-proxy abuse, internal-network access, and unbounded downloads.
Why allowTaint: true is not an export fix
Allowing taint permits drawing an unsafe image but leaves the canvas unreadable by normal export APIs. A later toDataURL(), toBlob(), or pixel read can fail with a security exception. It also does not override browser origin policy. Do not use it as the remedy for a blank exported screenshot, and replace any canvas element that was already tainted before capture.
Outdated 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 matchPC 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 & 114. Correct captures that are blank or truncated because of size
Browser canvas dimensions and total pixel area have implementation-dependent limits. The html2canvas FAQ warns that when a canvas exceeds a limit, a browser may silently return a blank or partially rendered output instead of throwing an error. Limits vary by browser, platform, memory, device-pixel ratio, and browser updates, so no single maximum is a guarantee.
For an element larger than the viewport, provide virtual dimensions based on its scrollable size:
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
const element = document.querySelector('#long-report');
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
logging: true
});
If a very long capture still fails, reduce the job: capture sections separately, lower the scale, or render a shorter view. Combining sections is an application-level decision and can introduce seams or pagination work. Also remember that scale multiplies pixel dimensions; a retina-scale capture can hit limits sooner than a one-to-one capture.
5. Identify CSS that html2canvas cannot reproduce
html2canvas reconstructs a picture by traversing the DOM and interpreting supported CSS; it does not copy the browser’s final composited pixels. As the project documentation explains, every CSS property must be implemented individually, so full CSS support is not possible. Filters, complex blending, generated content, masks, unusual transforms, and other effects may be absent or look different even when the DOM is correct.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUse a controlled simplification test
- Temporarily remove suspected effects (filters, blend modes, masks, large shadows, or transforms) in DevTools.
- Capture a minimal version containing the same text, images, and layout.
- Add styles back in small groups until the discrepancy returns.
This isolates an unsupported property instead of masking unrelated failures. If exact browser pixels are required, use a native browser screenshot method rather than trying to force html2canvas to implement every effect.
Change only the cloned document
The onclone callback lets you adjust the cloned document used for rendering without changing the live page. You can disable an animation, replace a problematic style, or reveal a print-only block:
const canvas = await html2canvas(element, {
onclone: clonedDocument => {
clonedDocument.querySelectorAll('.animated, .live-chat')
.forEach(node => node.style.animation = 'none');
}
});
Use ignoreElements when an element is intentionally excluded:
Rank #4
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
const canvas = await html2canvas(element, {
ignoreElements: node => node.matches('.capture-exclude')
});
These are presentation compromises, not evidence that the omitted feature is supported.
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 →6. Check iframes and browser security boundaries
Same-origin iframe content can be read under the normal browser rules. A cross-origin frame cannot be inspected by your page, and a sandboxed frame without allow-same-origin is similarly restricted. html2canvas therefore cannot reconstruct those documents from the parent page.
Capture the content inside an authorized same-origin context, obtain cooperation from the framed application, or use a browser automation or extension approach that is allowed to capture the frame. Do not expect useCORS on an image to grant access to an entire cross-origin document.
7. Remember that html2canvas runs in a browser
The library depends on window, document, layout, and computed styles. It is not a Node.js screenshot engine. For server-side work, the project FAQ points developers toward Puppeteer or Playwright, which drive a real browser and can capture the browser’s rendered output. For a browser extension, use the extension’s native capture APIs, such as chrome.tabs.captureVisibleTab() or browser.tabs.captureVisibleTab(), subject to current browser permissions and compatibility.
Common symptoms and targeted fixes
| Symptom | Likely cause | What to do |
|---|---|---|
| Entire canvas is transparent or empty | Wrong or zero-size target, capture ran too early, or canvas-size limit | Log the target, verify attachment and dimensions, wait for rendering, then test smaller dimensions. |
| Text and layout appear, but remote photos do not | Failed request or missing CORS permission | Inspect the image response, try useCORS: true, or serve through a controlled same-origin proxy. |
| Export throws a security error | Tainted image or pre-tainted canvas | Use CORS-approved assets or a proxy; do not rely on allowTaint: true. |
| Only a long page is blank or cut off | Canvas dimension or area limit | Set windowWidth/windowHeight from scroll dimensions, lower scale, or split the capture. |
| One visual effect is wrong | Unsupported or partially supported CSS | Simplify styles, use onclone, or switch to a native browser capture. |
| An embedded app is missing | Cross-origin or sandboxed iframe | Capture in an authorized context or use browser automation with appropriate access. |
Performance, reliability, and security considerations
- Large DOM trees, high
scale, web fonts, and many images increase memory and rendering time. Capture only the necessary subtree when possible. - Keep a timeout appropriate to your assets, but distinguish a slow server from a permanently blocked request.
- Do not proxy arbitrary URLs without authentication, size limits, protocol restrictions, and response validation.
- Test on the browsers and devices you support. Canvas limits and CSS behavior are not universal.
- Record whether failures occur during DOM reconstruction, resource loading, or export; that classification makes regressions easier to diagnose.
When to keep html2canvas—and when to switch
| Requirement | html2canvas | Another capture method |
|---|---|---|
| In-page, DOM-derived image | Good fit when supported CSS and same-origin assets are sufficient | Usually unnecessary |
| Pixel-accurate browser rendering | Not its goal; it reconstructs the scene | Use a native extension capture or real-browser automation |
| Server-side screenshot | Not available in Node.js by itself | Use Puppeteer or Playwright |
| Cross-origin iframe | Blocked by browser origin rules | Capture from an authorized context |
| Very large page | Subject to browser canvas limits | Use paginated browser screenshots or smaller jobs |
Or skip the browser setup
If you need a service rather than an in-page canvas, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one request. It removes cookie-consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the result identified by X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →cURL (see the ScreenshotNeo documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
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}`);
Every plan includes the full feature set, including full-page and element capture, device and retina settings, PDF controls, custom CSS and JavaScript, waits, request blocking, headers and cookies, geolocation, caching, signed links, asynchronous webhooks, bulk capture, usage data, and an OpenAPI specification. 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.
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
Frequently Asked Questions
Can I fix a blank canvas by setting allowTaint to true?
No. That option permits unsafe pixels to be drawn but leaves the canvas tainted and normally impossible to export. Use CORS-approved images or a same-origin proxy instead.
Why does html2canvas work for a small card but fail for the full page?
The full capture may exceed a browser’s canvas dimension or area limit. Use the target’s scroll dimensions, reduce scale, or capture smaller sections.
Does html2canvas capture an iframe automatically?
Only content accessible under the browser’s origin rules, such as a same-origin frame. Cross-origin and restricted sandboxed frames require an authorized capture context.
Free tools Windows power users keep installed
One-click scans. No signup required.
Can I run html2canvas in a Node.js script?
Not by itself. It requires browser APIs; use Puppeteer or Playwright for server-side browser capture.
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.

