To capture a whole page with html2canvas, render the page root and set the rendering viewport to that element’s complete scroll dimensions. The key options are windowWidth: element.scrollWidth and windowHeight: element.scrollHeight. Capture document.body (or the wrapper that actually scrolls), then export the returned canvas as a PNG.
The working full-page capture
Load html2canvas in a browser, select the element containing the page, and pass its scroll dimensions as the virtual rendering viewport:
const element = document.body;
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
scrollX: 0,
scrollY: 0,
backgroundColor: '#ffffff'
});
const pngDataUrl = canvas.toDataURL('image/png');
const link = document.createElement('a');
link.download = 'full-page.png';
link.href = pngDataUrl;
link.click();
windowWidth and windowHeight control the layout viewport used while html2canvas clones and renders the document. They are not the same as the output canvas dimensions. Using the root element’s scrollWidth and scrollHeight gives content below the visible browser window room to lay out.
Use a page wrapper when it is the real scroll root
Some applications keep body short and put scrolling on an app shell. Measure and capture that shell instead:
#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
const element = document.querySelector('#app');
if (!element) throw new Error('Scrollable app element not found');
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
scrollX: 0,
scrollY: 0,
backgroundColor: '#fff'
});
Choose the element whose dimensions include every section you want. Measuring document.body while #app owns overflow: auto can still produce a clipped result.
Why the default captures only what you see
html2canvas reconstructs the DOM in a cloned document and lays it out using browser viewport assumptions. With the default window.innerWidth and window.innerHeight, content may be laid out as if only the visible area exists; the resulting canvas can stop at the fold or omit lower sections. The scroll-dimension settings change that virtual layout to the full intended page size.
Scrolling the real tab to the bottom is not a substitute. html2canvas is rendering a clone, so the important values are the dimensions supplied to the renderer and the element selected for capture.
Complete browser example
The following example waits for the page to load, temporarily removes a fixed consent panel in the clone, captures the full document, and downloads a PNG. It changes only the clone, not the live page.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js"></script>
<script>
async function captureWholePage() {
if (document.fonts?.ready) await document.fonts.ready;
const element = document.body;
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
scrollX: 0,
scrollY: 0,
backgroundColor: '#ffffff',
scale: Math.min(window.devicePixelRatio || 1, 2),
useCORS: true,
onclone: (clonedDocument) => {
clonedDocument
.querySelectorAll('[data-html2canvas-ignore], .cookie-banner, .chat-widget')
.forEach(node => node.remove());
}
});
const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
if (!blob) throw new Error('Could not encode the canvas');
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'full-page.png';
link.click();
URL.revokeObjectURL(url);
}
captureWholePage().catch(console.error);
</script>
The version in the script tag is an example browser inclusion. Pin the version you have tested in your own application rather than relying on an unpinned asset in production.
Options that affect a whole-page result
windowWidth and windowHeight
Set these to the selected element’s scrollWidth and scrollHeight. They determine layout and are the main fix for viewport-only output.
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
width and height
These set the output canvas size or crop area. They do not replace the virtual viewport settings. Setting only width and height can create a larger bitmap while the cloned page is still laid out at viewport size.
scale
By default, html2canvas uses the device pixel ratio. A higher scale can make text sharper, but multiplies pixel count, memory use, encoding time and file size. For long pages, cap it deliberately, for example at 1 or 2, and reduce it if the browser runs out of memory.
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 & 11scrollX and scrollY
These are the scroll offsets used during rendering. Zero values are usually right for a full document. If fixed or sticky elements appear in the wrong place, test offsets that match the intended capture position and inspect the cloned layout.
backgroundColor
Set an explicit color when transparent or inherited backgrounds would make the exported image appear wrong. Use null only when you intentionally need transparency and the page’s styles support it.
useCORS and proxy
useCORS: true asks the browser to load cross-origin images with CORS. It works only when the image server returns an appropriate CORS header. A proxy can retrieve those resources through a same-origin path when you control a suitable proxy. Neither option bypasses browser security policy by itself.
onclone
This callback receives the cloned document just before rendering. Use it to hide transient controls, remove a modal, add a white background, or expand a panel for the screenshot without changing the page that the visitor is using.
Ignoring nodes
Add data-html2canvas-ignore to elements that must not appear:
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.
<button data-html2canvas-ignore>Print</button>
You can also remove matching nodes inside onclone, which is useful for third-party overlays you cannot edit directly.
Scrollable panels are a separate problem
A child element with overflow: auto has its own scrollable surface. Capturing the document root does not automatically include content hidden inside that panel. Select the panel itself and use its dimensions:
const panel = document.querySelector('.results-panel');
const canvas = await html2canvas(panel, {
windowWidth: panel.scrollWidth,
windowHeight: panel.scrollHeight,
scrollX: 0,
scrollY: 0
});
If the panel’s content is still clipped, use onclone to set the cloned panel’s height to auto and overflow to visible. This expands only the rendering copy. Be careful with virtualized lists: rows that have never been mounted in the DOM cannot be captured until the application renders them.
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 →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Limits you cannot fix with options
Canvas size limits
Browsers impose maximum canvas dimensions and total pixel areas. The limits vary by browser, operating system, hardware and available device memory. A very tall page can therefore produce a blank, truncated or failed canvas even when the scroll dimensions are correct.
- Capture sections separately and stitch them when one bitmap is too large.
- Lower
scaleand remove unnecessary margins or whitespace. - Prefer a PDF or server-side browser workflow for extremely long pages.
- Check the actual
canvas.widthandcanvas.heightbefore encoding.
Cross-origin images and tainted canvases
html2canvas cannot bypass content-policy restrictions. Images from another origin need server permission through CORS, or a proxy that returns them in a same-origin response. If permission is absent, images may be skipped; in other cases the canvas becomes unreadable when you call toDataURL or toBlob. Configure the image server rather than attempting to disable browser security.
CSS and embedded content fidelity
html2canvas is not a browser screenshot engine. CSS properties must be implemented individually, so it does not provide complete CSS support. Filters, complex effects, unusual blend modes, some form controls, plug-ins, cross-origin frames and other embedded content can differ from what the tab displays. Test the specific styles your page depends on.
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
For a pixel-accurate browser view, a native extension capture API or a real browser controlled by Puppeteer or Playwright is generally a better fit. Those approaches also handle content that html2canvas cannot reconstruct from DOM and computed styles.
Troubleshooting checklist
The image stops at the viewport
- Capture the actual scrolling root, not an unrelated wrapper.
- Set both
windowWidthandwindowHeightfrom that element’s scroll dimensions. - Check whether a parent has clipping, fixed height or
overflow: hidden.
The result is blank or only partly rendered
- Reduce
scaleand test a shorter page; canvas limits are likely. - Inspect for cross-origin images and configure CORS or a proxy.
- Wait for fonts, images and lazy-loaded sections before capture.
- Look for a child scrolling container and capture or expand it separately.
Images are missing
Confirm that the image URL is reachable, the server permits CORS when cross-origin, and the image has loaded before calling html2canvas. A proxy is an alternative when you cannot change the image server.
Sticky headers or fixed banners repeat
Use scrollX and scrollY deliberately, then hide or restyle the element in onclone. Mark known controls with data-html2canvas-ignore.
The page works in the browser but fails in Node.js
html2canvas relies on browser APIs such as window, document and computed styles; those APIs do not exist in Node.js. Run it in a real browser, or use a browser automation tool that renders a page and captures the tab.
Performance and reliability choices
Measure before rendering, avoid an unnecessarily high scale, and capture after layout has settled. Lazy images must be loaded or they will not appear. Large canvases consume contiguous memory, so a section-by-section workflow is safer for long reports. For repeatable production captures, log the selected element, scroll dimensions, scale, browser errors and output dimensions.
Recommended Free Tools
Client-side capture is convenient because it runs in the visitor’s browser and can access the already-rendered DOM. It is less predictable across devices and cannot overcome browser canvas limits or cross-origin policy. Server-side browser capture is more consistent for scheduled jobs and authenticated pages, but requires browser infrastructure, timeouts, resource controls and a policy for private URLs.
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 provides a website screenshot API when you need a rendered page rather than a DOM canvas. A single request returns PNG, JPEG, WebP or PDF; full-page capture loads lazy images. It removes cookie and consent banners, newsletter popups and chat widgets before capture, and failed loads, blank pages, bot checks and cache hits are not billed. Each response identifies the page result and billing state with X-Page-Verdict and X-Billed headers. An MCP server also lets Claude, Cursor and other MCP clients call screenshot tools.
See the parameter reference and complete request options in the ScreenshotNeo documentation.
cURL
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,
)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));
The free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesFAQ
Can html2canvas capture an entire page without increasing the browser window?
Yes. The browser window can remain unchanged; set the cloned rendering viewport to the target element’s scrollWidth and scrollHeight.
Should I use document.documentElement or document.body?
Use whichever element owns the page content and reports the correct full dimensions. Verify both values on layouts that use an application shell or custom scrolling.
Can I capture a page that requires login?
Client-side html2canvas can capture content already available in the current browser session. A remote API needs an authenticated request strategy, such as supported cookies or headers, and should be used only with pages you are authorized to access.
Frequently Asked Questions
Can html2canvas capture an entire page without increasing the browser window?
Yes. Set the cloned rendering viewport to the target element’s scrollWidth and scrollHeight; the visible browser window does not need to be resized.
Free tools Windows power users keep installed
One-click scans. No signup required.
Should I use document.documentElement or document.body?
Use whichever element owns the content and reports the correct full dimensions. Custom app shells often work better than body.
Can I capture a page that requires login?
html2canvas can capture content already available in the current browser session. A remote API requires an authorized authentication strategy.
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.




