Use width and height to set the capture bounds, scale to control pixel density, and x and y with those dimensions to capture a region. For content cut off at a scroll boundary, set windowWidth and windowHeight to the element’s scrollWidth and scrollHeight, then check the resulting canvas dimensions and layout.
Set the canvas dimensions
The basic call is html2canvas(element, options). The width and height options set the canvas bounds; if omitted, they default to the target element’s dimensions. An explicit scale avoids relying on the browser’s device pixel ratio, which is the default. The following example assumes html2canvas is already loaded in the page and that an element with the ID capture exists:
const element = document.querySelector("#capture");
if (!element) {
throw new Error('Could not find the element "#capture"');
}
const canvas = await html2canvas(element, {
width: 1200,
height: 800,
scale: 1,
});
document.body.appendChild(canvas);
console.log(`Canvas bitmap: ${canvas.width} × ${canvas.height}`);
This sets explicit capture bounds and requests one-to-one scale rather than the browser’s device-pixel-ratio default. Inspect canvas.width and canvas.height after the render: those properties report the bitmap’s dimensions, which is especially useful when using a scale other than 1. The bounds do not resize the element’s CSS layout; they determine the area represented in the output canvas.
The options and defaults are documented in the html2canvas configuration reference. For repeatable output across displays, specify a scale explicitly instead of allowing the device pixel ratio to determine the rendering density.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#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
Choose bounds, density, or a crop
- Set output bounds: use
widthandheight. These default to the target element’s dimensions. - Change pixel density: use
scale. Higher scale increases the bitmap dimensions and can make the result sharper on high-density output, but also uses more memory. - Capture a subsection: use
xandyas the region’s offsets, together withwidthandheightfor its size.
For example, this requests a 400-by-300 region beginning at offsets 100, 100, at scale 1:
const canvas = await html2canvas(element, {
x: 100,
y: 100,
width: 400,
height: 300,
scale: 1,
});
The official html2canvas examples use these offsets and dimensions to crop a region. If the crop is unexpectedly positioned or clipped, verify that the offsets and size describe the intended area of the rendered target, then inspect the actual canvas width and height. Scaling affects rendered resolution in addition to the selected logical area, so avoid assuming the bitmap will match the requested bounds when scale is not 1.
Capture a long or wide scrollable element
If the output stops at the visible scroll area, set the rendering window to the element’s scroll dimensions. The project FAQ recommends this pattern:
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
const element = document.querySelector("#capture");
if (!element) {
throw new Error('Could not find the element "#capture"');
}
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
});
document.body.appendChild(canvas);
console.log(`Canvas bitmap: ${canvas.width} × ${canvas.height}`);
scrollWidth and scrollHeight describe the element’s full scrollable extent, rather than just the currently visible portion. This can help capture content that would otherwise be cut off. The pattern comes from the html2canvas FAQ.
Changing windowWidth or windowHeight can also change which responsive layout is rendered: media queries may respond to those window dimensions. If a full-height capture unexpectedly switches to a desktop or mobile arrangement, check whether the requested rendering window produces that layout. Choose dimensions that yield the responsive presentation you actually want, and verify the cloned result rather than assuming that a taller capture preserves the current viewport layout.
Use scroll positions for fixed-position content
The configuration reference describes scrollX and scrollY as scroll positions used when rendering the element. They are separate from x and y: the latter set the capture region’s offsets, while the scroll options specify the rendering scroll position. This distinction matters when an element includes fixed-position content or when the page’s scroll state affects what appears in the capture.
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.
When a fixed header, toolbar, or other pinned item looks misplaced, first reproduce the intended scroll state, then set the scroll-position options if you need to control that state explicitly. Do not use a crop offset as a substitute for setting the rendering scroll position: they address different parts of the capture configuration. The configuration reference lists the available sizing and scroll options.
Balance sharpness against canvas and memory limits
A larger scale creates a larger bitmap, and a large capture area combined with high scale can consume substantial memory or exceed a browser’s canvas limits. There is no single guaranteed maximum: limits vary by browser, platform, and available device memory. The html2canvas FAQ, accessed in 2026, gives approximate guidance for current evergreen browsers, not a device specification:
| Browser/platform in the FAQ | Approximate guidance | Qualification |
|---|---|---|
| Chrome/Chromium | About 32,767 pixels per dimension; about 268 million pixels maximum area | Approximate project-documentation figures; limits vary |
| Firefox | About 32,767 pixels per dimension; about 472 million pixels maximum area | Approximate project-documentation figures; limits vary |
| Desktop Safari | About 32,767 pixels per dimension | iOS Safari limits are lower and depend on device RAM |
These estimates are not promises that a particular device can allocate a canvas of that size. The FAQ points readers to a canvas-size library for more current browser and platform tests. For a practical recovery path, reduce scale, split a very large capture into smaller sections, or capture only the needed region, then test in the browser and device where the code will run.
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
Know what html2canvas can and cannot reproduce
Correct dimensions do not guarantee a pixel-identical image of what the browser painted. html2canvas traverses the DOM and reconstructs a rendering from information it can read; it does not take a literal screenshot. Its documentation warns that the result may not be fully accurate to the real representation. Unsupported or incompletely supported CSS can therefore look different even if the canvas bounds are right. See the project’s documentation on how html2canvas works and its limitations.
Cross-origin images may be omitted unless the image host permits CORS or a proxy is used. Browser security also prevents html2canvas from reading cross-origin iframe documents. These are access and fidelity issues, not dimension settings: increasing width, height, or scale will not make an inaccessible image or frame readable. The FAQ and documentation describe these limitations.
If the requirement is a screenshot inside a browser extension, the html2canvas FAQ recommends native extension screenshot APIs as a more reliable option without canvas-size limits. It names chrome.tabs.captureVisibleTab() and browser.tabs.captureVisibleTab(). Those APIs address extension screenshot capture rather than html2canvas’s DOM reconstruction workflow.
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 & 11Best 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.
Troubleshoot blank, clipped, or unexpected output
- The canvas is blank or partly rendered: reduce scale and capture area, then retry in the target browser. Large canvases can hit browser or device limits.
- The capture ends before the element’s scrollable content: set
windowWidthandwindowHeightfromscrollWidthandscrollHeight, and confirm the changed window dimensions have not triggered an unwanted media-query layout. - The image is the wrong size: log
canvas.widthandcanvas.height, setwidth,height, andscaleexplicitly, and remember that the default scale is the browser’s device pixel ratio. - A crop is shifted or incomplete: confirm the intended
x,y,width, andheightregion, and check the output dimensions after rendering. - Images are missing: check whether they are cross-origin and whether the server allows CORS; html2canvas may skip them otherwise.
- An iframe’s contents are absent: a cross-origin iframe document cannot be read because of browser security restrictions.
- The page looks different despite correct dimensions: inspect CSS support and responsive layout. html2canvas reconstructs from DOM information rather than capturing the browser’s painted pixels.
Or skip the browser setup
If you need a website screenshot rather than a DOM-rendered canvas, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return an image or PDF; its clean-shot options accept cookie banners before capture and remove more than 60 known consent platforms, newsletter popups, and chat widgets, with each step configurable. Bot checks, blank pages, and failed loads are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf.
For example, this cURL request saves a WebP screenshot of a URL (replace the URL with the page you need):
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 request options. It is a server-side API alternative, not an html2canvas setting: choose it when you want a website screenshot without setting up an in-page DOM capture. Plans include 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.
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.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches




