What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use html2canvas in a browser to render a text-containing DOM element into a canvas, then export that canvas as a PNG with the browser’s Canvas API. The result is a DOM-and-CSS reconstruction, not a native screenshot, so wait for fonts and layout to settle and use a higher scale when you need sharper text.
What html2canvas does—and what it does not
html2canvas traverses an element’s DOM and reads its styles to create a visual representation on a canvas. It runs in a browser and depends on browser APIs, so it is not a Node.js rendering library. The official project describes it as taking “screenshots” of webpages or parts of them “directly in the users browser,” but it does not capture the browser’s already-painted pixels. Unsupported CSS, plugins, or inaccessible external content can make the output differ from what you see on screen. See the project documentation and FAQ.
This approach is useful when you need to capture text that already exists in the current page and can be rendered from its DOM. If you need a closer pixel-for-pixel browser capture, or the target is not available in the current page’s DOM, consider a native browser screenshot or a server-side renderer instead.
Install html2canvas and capture a text element
The package’s getting-started guide uses npm and an ES module import. The capture call returns a Promise that resolves to a canvas.
#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
npm install @html2canvas/html2canvas
Then in browser-side JavaScript:
import html2canvas from '@html2canvas/html2canvas';
async function captureText() {
const element = document.querySelector('#text-to-capture');
if (!element) {
throw new Error('Could not find #text-to-capture');
}
const canvas = await html2canvas(element, {
backgroundColor: '#ffffff',
scale: window.devicePixelRatio,
});
document.body.appendChild(canvas);
return canvas;
}
captureText();
The selector must point to the element you actually want to render. For example:
<div id="text-to-capture">
<h1>A headline to save</h1>
<p>This paragraph will be rendered into the canvas.</p>
</div>
Appending the returned canvas is optional; it is useful for checking the result on screen while developing. In a production flow, you can export it directly without displaying it.
Download the result as a PNG
Rendering and downloading are separate steps. Once the Promise resolves, convert the canvas to a data URL and trigger a download:
const link = document.createElement('a');
link.download = 'text.png';
link.href = canvas.toDataURL('image/png');
link.click();
For applications that need to upload or otherwise handle a file object, use canvas.toBlob() rather than building a data URL:
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
canvas.toBlob((blob) => {
if (!blob) {
throw new Error('Could not export canvas as PNG');
}
// Use blob with your upload or file-handling code.
}, 'image/png');
toDataURL() can be convenient for a direct browser download, while a Blob is generally the appropriate output to pass into file or upload workflows. Both export the canvas that html2canvas created; neither changes what the library was able to render.
Make text sharp without making captures unnecessarily large
The scale option sets output density. Its default is window.devicePixelRatio; setting it deliberately can make small text and fine strokes clearer, but a larger output canvas consumes more memory and can take longer to render.
const canvas = await html2canvas(element, {
scale: 2,
backgroundColor: '#ffffff',
});
Use a scale appropriate to the final use: screen display, a high-density display, or a larger printed asset may need different output dimensions. There is no official numeric benchmark specifying a universally best scale; check the exported image at its actual display size and watch for browser memory or canvas-size limits.
Wait for web fonts before capturing
If a custom font is still loading, the browser may initially use fallback glyphs. That can change both the appearance and line breaks in the rendered text. Coordinate capture with your app’s own ready state and wait for the document fonts before calling html2canvas:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRank #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.
await document.fonts.ready;
const canvas = await html2canvas(element, { scale: window.devicePixelRatio });
Likewise, wait until text content has been inserted and any layout-affecting state has settled. html2canvas does not decide when your application’s content is ready.
Set the background, crop, and viewport
The background defaults to white. Set backgroundColor explicitly when you want a predictable background, or set it to null for transparency.
const transparentCanvas = await html2canvas(element, {
backgroundColor: null,
});
Use x, y, width, and height to render a particular rectangle. These options are useful when the element’s full bounds are not the output you need. The windowWidth and windowHeight options set the viewport dimensions used for layout and media queries, while scrollX and scrollY set scroll positions, including for captures involving fixed-position content. Consult the configuration options for the complete option list and defaults.
For a long text block that is clipped or laid out at an unintended responsive breakpoint, set a viewport that matches the layout you want, then confirm the resulting canvas dimensions. A viewport setting affects responsive CSS; it is not a guarantee that arbitrarily large content will fit within browser canvas limits.
Recommended Free Tools
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
Keep controls and unrelated UI out of the image
Add data-html2canvas-ignore to controls or surrounding elements that should not appear in the capture:
<button data-html2canvas-ignore>Save image</button>
You can also use the ignoreElements configuration callback when the elements to omit need to be selected in JavaScript. The documentation’s configuration page lists the supported options.
Handle images, CORS, and iframes
Text-only captures avoid many image-related problems, but a text container may include a logo, background image, or other external asset. Browser security still applies: html2canvas cannot bypass content-policy rules. A cross-origin image can taint the canvas, preventing exports such as toDataURL().
- Set
useCORS: trueonly if the image server returns suitable CORS headers. - If the image host cannot provide those headers, serve the resource through a same-origin proxy configured with html2canvas’s
proxyoption. - Do not rely on
allowTaintto make a tainted canvas exportable; it does not remove the browser’s export restrictions. - Use the
onErrorcallback to report resource failures, including an image or SVG that could not load.
Cross-origin iframes cannot be rendered because browser security prevents access to their contentDocument. Same-origin iframes are supported recursively. If the text is inside a third-party frame, capture it through a method that has access to that page rather than expecting html2canvas on the parent page to read it. See the FAQ on tainted canvases and browser limitations.
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.
Common problems and fixes
| Symptom | Likely cause | What to do |
|---|---|---|
| The canvas is empty or the wrong content appears | The selector does not point to the intended element, or the element is not visible in the capture viewport. | Check the selector and inspect the element’s visibility and dimensions before calling html2canvas. |
| Text uses the wrong font or wraps differently | A web font or content update had not completed before capture. | Wait for the page’s ready state and for document.fonts.ready, then capture. |
| Text looks blurry | The output canvas density is too low for the intended use. | Set a higher scale, then check render time, memory use, and output dimensions. |
| A long capture is cut off | The element or viewport dimensions do not include the desired content, or the browser has reached a canvas size limit. | Review the element’s scroll dimensions and set appropriate windowWidth and windowHeight. Browser canvas limits can still apply. |
| An image is missing or PNG export fails | A resource failed to load, or a cross-origin image tainted the canvas. | Check the resource load and onError; use CORS only with valid server headers, or a same-origin proxy. |
| Part of the design differs from the visible page | html2canvas reconstructs the DOM and CSS rather than capturing native browser pixels; a style or external item may be unsupported or inaccessible. | Check the project’s supported behavior and constraints. If exact browser-painted pixels are essential, use a native screenshot approach. |
When to use html2canvas instead of a browser screenshot
Choose html2canvas when browser-side JavaScript state matters and the target content is accessible in the page DOM. Its output control includes element selection, crop and viewport settings, transparency, and canvas export, but fidelity depends on the library’s DOM/CSS reconstruction and browser access to resources. A native browser screenshot is a better fit when the requirement is to capture what the browser actually painted. A server-side renderer is useful when capture must run outside a visitor’s browser, but involves a separate rendering environment. The official html2canvas sources do not publish a quantitative benchmark against those alternatives, so choose based on pixel fidelity, CSS coverage, cross-origin access, JavaScript state, deployment needs, output controls, and memory cost rather than an assumed speed or quality ranking.
Or skip the browser setup
If your goal is to capture a live webpage rather than an element already in your app’s DOM, ScreenshotNeo provides a screenshot API and MCP server for developers. A single GET request can return PNG, JPEG, WebP, or PDF. For example, with cURL:
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 API documentation for setup and request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000. Sign up for the free plan.
Frequently Asked Questions
Can I use html2canvas in Node.js?
No. It depends on browser APIs and is intended to run in a browser.
Free tools Windows power users keep installed
One-click scans. No signup required.
Does html2canvas take a true screenshot?
No. It reconstructs a representation from DOM and CSS rather than reading the browser’s painted pixels.
Can html2canvas capture text inside a cross-origin iframe?
No. The browser does not expose a cross-origin iframe’s document to the parent page.
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.

