Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC 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 & 11To save an html2canvas result, export the returned canvas and trigger an anchor download. For small images, canvas.toDataURL() is the shortest path. For larger captures, convert the canvas with toBlob(), create a temporary object URL, click an <a download> element, and revoke the URL afterward. PNG is the safest default because browsers must support it.
The reliable download pattern
html2canvas does not return a file. It renders the selected DOM into an HTML <canvas>. Your code must perform two separate jobs: export the pixels and ask the browser to download them.
- Wait for
html2canvas(element)to resolve. - Encode the canvas as a Blob or data URL.
- Create an anchor element, set its
downloadfilename, and click it. - Release any temporary object URL when the download has started.
Recommended implementation with toBlob()
async function downloadElementAsPng(element, filename = "screenshot.png") {
const canvas = await html2canvas(element);
const blob = await new Promise((resolve, reject) => {
canvas.toBlob((result) => {
if (result) resolve(result);
else reject(new Error("Canvas export returned no image."));
}, "image/png");
});
const objectUrl = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = objectUrl;
link.download = filename;
link.click();
setTimeout(() => URL.revokeObjectURL(objectUrl), 1000);
}
downloadElementAsPng(document.querySelector("#capture"));
The callback form of toBlob() can return null, so the example rejects explicitly rather than silently creating a broken download. The short timeout leaves the object URL alive long enough for the browser to begin reading it; revoke it once it is no longer needed.
Minimal documented pattern with toDataURL()
html2canvas(document.querySelector("#capture")).then((canvas) => {
const link = document.createElement("a");
link.download = "screenshot.png";
link.href = canvas.toDataURL("image/png");
link.click();
});
This is convenient for a small image and mirrors html2canvas’s example. However, toDataURL() creates one large, encoded in-memory string containing the complete image. MDN recommends preferring toBlob() and URL.createObjectURL() for larger output.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Choosing toBlob() or toDataURL()
| Method | Memory and lifecycle | Best use | Trade-off |
|---|---|---|---|
toBlob() plus object URL |
Produces a Blob; the browser references it through a temporary URL. | Large or high-resolution captures. | Requires a callback or Promise wrapper and URL cleanup. |
toDataURL() |
Builds the entire encoded image as a JavaScript string. | Small images and the shortest implementation. | Higher peak memory use as dimensions increase. |
Use the requested MIME type in either API. JPEG and WebP may be available, but an unsupported type falls back to PNG. If the extension must describe the actual bytes, inspect blob.type (or the data-URL prefix) before naming the file.
PNG, JPEG and WebP downloads
PNG: the dependable default
async function downloadPng(element) {
const canvas = await html2canvas(element);
const blob = await new Promise((resolve, reject) =>
canvas.toBlob((value) => value ? resolve(value) : reject(new Error("PNG export failed")), "image/png")
);
const url = URL.createObjectURL(blob);
const a = Object.assign(document.createElement("a"), {
href: url,
download: "capture.png"
});
a.click();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
PNG preserves transparency and lossless detail, and browser canvas implementations are required to support it.
JPEG or WebP with quality
async function downloadJpeg(element, quality = 0.9) {
const canvas = await html2canvas(element);
const blob = await new Promise((resolve, reject) =>
canvas.toBlob((value) => value ? resolve(value) : reject(new Error("JPEG export failed")), "image/jpeg", quality)
);
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "capture.jpg";
a.click();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
Quality values affect formats that support lossy compression. JPEG does not retain transparency. WebP can be requested with image/webp, but you should verify blob.type because unsupported requests are encoded as PNG instead.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Capture the right element and improve output
Pass the element you actually want, rather than the entire document:
const card = document.querySelector("#invoice-card");
if (!card) throw new Error("#invoice-card was not found");
const canvas = await html2canvas(card, {
scale: window.devicePixelRatio,
useCORS: true
});
html2canvas’s options also let you crop with x, y, width, and height; increase scale for denser output; and omit controls by adding data-html2canvas-ignore to elements that should not appear. These settings change what is rendered, not how the resulting file is downloaded.
Wait for content before exporting
Capture after the target has its final text, fonts, and images. If your page inserts data asynchronously, await that work first. For an image you control, wait for its load event before calling html2canvas. A canvas can faithfully capture an element that is still loading, so the resulting file may be blank or incomplete without producing a JavaScript error.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Why images disappear or export throws SecurityError
Cross-origin resources are the most common failure. html2canvas cannot circumvent browser content policy restrictions. A remote image without suitable permission can be skipped, or it can taint the canvas so pixel readback and export are blocked.
Use CORS only when the server permits it
const canvas = await html2canvas(document.querySelector("#capture"), {
useCORS: true
});
useCORS: true requests CORS-aware loading; it does not grant permission. The image server must send an appropriate Access-Control-Allow-Origin response for your page’s origin. Configure that response if you control the server.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsUse an authorized proxy when CORS cannot be enabled
If you are allowed to retrieve the resource but cannot change its headers, route it through a trusted server-side proxy and render the permitted response. Do not proxy content you are not authorized to access. html2canvas documents a proxy option for this situation.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Do not rely on allowTaint
allowTaint: true does not make a tainted canvas exportable. Browser security still prevents reading pixels that came from an unapproved cross-origin source. Fix the resource’s CORS policy or use an appropriate proxy instead.
Common download problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing downloads | The function runs before the canvas Promise resolves, or the click is not reached. | Put the anchor click inside await html2canvas(...) or its then callback, and log errors. |
| Downloaded file is 0 bytes or export returns null | Canvas encoding failed. | Reject a null Blob, check canvas dimensions, and reduce an extreme capture size. |
File is named .jpg but is PNG |
The requested MIME type was unsupported and fell back to PNG. | Check blob.type and use a matching extension. |
| Remote image missing | CORS response is absent or incorrect. | Enable useCORS and configure the image server, or use an authorized proxy. |
SecurityError during export |
The canvas is tainted by cross-origin pixels. | Remove the offending resource or provide valid CORS; allowTaint is not a bypass. |
| Popup or download blocked | Browser policy or a non-user-initiated flow. | Start the async operation from a user gesture such as a button click and provide a visible fallback link. |
| Capture differs from the page | html2canvas reconstructs DOM content; it is not a native browser screenshot. | Apply supported CSS, wait for fonts and images, and hide unsupported or unwanted elements. |
Browser and environment boundaries
html2canvas depends on browser APIs and is intended for modern evergreen Chrome/Chromium-based browsers, Firefox, and Safari. It is not suitable for Node.js by itself. If you need server-side rendering, use a browser automation or screenshot service instead of attempting to run this DOM-dependent library in a Node process with no browser.
Very large dimensions consume substantial memory during rendering and encoding. Prefer toBlob(), capture only the required element, and use a sensible scale. Revoke every object URL you create; retaining them for a long-lived single-page application can keep image data alive.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP, or PDF, so you do not need to build a canvas-export flow for a page you can access by URL. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for authentication and options. 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)
And 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}`);
const bytes = new Uint8Array(await res.arrayBuffer());
ScreenshotNeo also supports full-page and element captures, device presets, custom viewports, retina scale, PDF settings, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, geolocation, resizing, chosen-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration. 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 each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it.
FAQ
Can I save the canvas without a server?
Yes. The anchor’s download attribute and a data URL or object URL perform the download entirely in the browser, subject to browser download policy.
Does html2canvas capture the browser’s address bar or other tabs?
No. It renders DOM content from the page you pass to it; it does not capture browser chrome or arbitrary screen pixels.
Why is my transparent background black?
Request PNG and ensure the rendered element and canvas background are transparent. JPEG cannot represent transparency and will replace it with a solid background.
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.

