Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a long page with html2canvas, set the render window to the target element’s full scroll dimensions. For example, pass document.documentElement.scrollWidth and document.documentElement.scrollHeight as windowWidth and windowHeight. This can prevent output from being clipped to the visible viewport, but it cannot overcome browser canvas-size limits or make html2canvas reproduce every browser-rendered pixel.

What html2canvas captures—and what it does not

html2canvas runs in the browser and reconstructs an image from the page’s DOM and styles. It is not a literal screenshot of the browser’s rendered pixels. Its output can differ from what you see on screen, and CSS properties that the library does not implement may be missing or rendered differently. See the html2canvas documentation and its FAQ.

That distinction matters when a capture is incomplete or visually inaccurate: some problems are about the dimensions html2canvas was asked to render, while others reflect browser canvas limits, cross-origin security, or unsupported CSS. The full-page settings address the first category, not all of them.

Capture a full page with html2canvas

1. Load html2canvas in a browser page

Install or include html2canvas in the browser application where you want the capture. It relies on browser APIs such as window and document; it is not a Node.js server-side renderer. If you use a bundler, import the library in your client-side code according to your project setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

2. Render the document at its scroll dimensions

This example targets the document element and exports the result as a PNG download:

const element = document.documentElement;

const canvas = await html2canvas(element, {
  windowWidth: element.scrollWidth,
  windowHeight: element.scrollHeight,
});

const link = document.createElement('a');
link.download = 'full-page.png';
link.href = canvas.toDataURL('image/png');
link.click();

Run it after the page and the content you need have loaded. The temporary link triggers a download in many browser contexts, but browser policies and application context can affect whether a download starts in exactly this way.

3. Choose the right target

document.documentElement is a practical document-wide target. You can instead capture document.body or a particular container when only that content belongs in the image. The target’s scrollWidth and scrollHeight determine the full dimensions used above. A nested scrolling panel may have its own scroll dimensions; selecting that element captures the panel rather than automatically capturing the entire document.

The rendering window options define the window html2canvas uses while rendering and may affect media queries. Setting them to the target’s scroll size helps avoid a viewport-sized render when the desired output is the whole page. It does not guarantee that the browser can allocate a canvas of that size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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

Adjust dimensions, scale and captured content

Use configuration options to shape the result, but keep the requested image within practical canvas limits:

Option What it controls When to use it
windowWidth, windowHeight The rendering window dimensions; can affect media queries. Set to the target’s scrollWidth and scrollHeight for a full scroll-height capture.
width, height The canvas dimensions. Specify an output size when you do not need the entire target at its natural dimensions.
x, y The crop region’s origin. Capture a particular portion instead of the entire rendered area.
scale The rendering scale. The documented default is window.devicePixelRatio. Reduce it if a very large capture runs into memory or canvas-size constraints; a higher value creates larger output dimensions.
scrollX, scrollY The scroll position used when rendering the element. Adjust rendering where the element’s scroll position or fixed positioning affects the result.
data-html2canvas-ignore Marks elements to omit from the render. Add the attribute to page elements, such as controls, that should not appear in the image.
cullOffscreen Can skip painting nodes outside the captured viewport. Consider it for viewport-sized rendering of a large page; it is not a general fix for full-page clipping.

For example, to omit a toolbar, mark it in the HTML:

<div class="toolbar" data-html2canvas-ignore>
  Controls not needed in the screenshot
</div>

Configuration names and behavior are documented in the html2canvas configuration reference. A smaller scale can help keep a long page within resource limits, but it also reduces output resolution; check the resulting image at the size at which it will be used.

Why a full-page canvas may be blank or cut off

Rendering window and canvas limits are different problems

If the output stops near the visible viewport, first check that windowWidth and windowHeight match the target’s scroll dimensions. If the dimensions are already correct, the requested canvas may exceed browser or device limits. Raising windowHeight cannot remove those limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

The html2canvas FAQ provides rough, non-guaranteed guidance: Chrome/Chromium and Firefox have a maximum dimension of about 32,767 pixels; the listed maximum canvas areas are about 268 million pixels for Chrome/Chromium and 472 million pixels for Firefox. Desktop Safari is also listed at about 32,767 pixels per dimension. iOS Safari limits are lower and depend on device RAM. The FAQ cautions that limits vary by browser and platform, and exceeding them can produce blank or partially rendered output. These are approximate documentation figures, not permanent specifications for every browser version or device.

Reduce the size or use a different capture approach

  • Reduce scale to lower the output dimensions.
  • Capture a smaller element rather than the whole document if that meets the need.
  • For browser extensions, the html2canvas FAQ points to native screenshot APIs.
  • For server-side screenshot generation, the FAQ names Puppeteer and Playwright; these operate as browser automation approaches rather than html2canvas running on a server.

Very long pages can exceed limits even when the full-page dimension settings are correct. If an exact, reliable capture of a rendered page is essential, use a real-browser screenshot workflow and validate the output rather than assuming DOM reconstruction will match the browser view.

Make cross-origin images and frames work

html2canvas does not bypass browser security rules. By default, allowTaint is false, so images that would taint the canvas are skipped. To attempt to load cross-origin images, set useCORS: true only if the image server sends a compatible Access-Control-Allow-Origin response header. If it does not, use an appropriately configured proxy or serve the image from an origin you control. useCORS does not grant access by itself.

const canvas = await html2canvas(document.documentElement, {
  windowWidth: document.documentElement.scrollWidth,
  windowHeight: document.documentElement.scrollHeight,
  useCORS: true,
});

A canvas already tainted by cross-origin content may also be unreadable to html2canvas. Same-origin iframes are rendered recursively, but cross-origin iframes and sandboxed iframes without allow-same-origin cannot be accessed because of browser security restrictions. See the FAQ and configuration reference for the documented options and constraints.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

Check CSS differences before relying on the image

Because html2canvas reconstructs the page and implements CSS properties individually, its output is not guaranteed to match the browser’s actual rendering. The project’s FAQ states that it does not have full CSS support. Compare the output with the source page, especially when the design depends on effects, positioning, or other properties whose support you have not confirmed.

Consult the project’s supported features list for the properties relevant to your page. If a required property is missing or incomplete, the project recommends preparing a test case and opening an issue. Do not treat an empty or visually different result as proof that the page itself failed to render: the library may be unable to reproduce some of its presentation.

Troubleshoot common failures

Symptom Likely cause What to try
Capture ends near the viewport or is clipped The render window was viewport-sized, or the canvas exceeds a browser or device limit. Set window dimensions from the target’s scroll dimensions. If they are already correct, reduce scale or capture a smaller target.
Canvas is blank or partly blank on a long page The requested canvas may exceed platform limits. Reduce output dimensions or use a real-browser screenshot method when a full-length result is required.
Images from another site are missing The image server does not permit cross-origin access, or the image would taint the canvas. Use useCORS: true only when the server sends an appropriate CORS header; otherwise use a suitable proxy or same-origin resource.
An iframe’s content is absent The frame is cross-origin or sandboxed without allow-same-origin. Browser security prevents access. Use a capture method with legitimate access to that content rather than expecting html2canvas to bypass the restriction.
Styling differs from the page A CSS property may be unsupported or incompletely implemented. Check the supported-features list and validate with a test case; use a real-browser screenshot if pixel fidelity is required.
Download does not start The browser or embedding context may restrict the scripted download flow. Check the browser console and application context; test the generated canvas separately and use a download flow permitted by that environment.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When html2canvas is—and is not—the right tool

Use html2canvas when client-side DOM-based rendering is acceptable and you want to generate an image from content available to the page. It can be convenient for selected elements or moderate-sized pages, provided its CSS support and cross-origin behavior fit your requirements.

Choose browser-native capture or browser automation when you need the browser’s actual rendered pixels, server-side execution, or a workflow less constrained by HTML canvas dimensions. The html2canvas project FAQ specifically names Puppeteer and Playwright for server-side screenshots. No single approach is a universal winner: the choice depends on whether you need DOM reconstruction, true browser capture, access to external resources, and a page size that fits the available rendering limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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

If you need a screenshot through an API instead of running html2canvas on the page, ScreenshotNeo provides a GET endpoint. For example, save a PNG from a URL with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.png

See the ScreenshotNeo API documentation for request details. ScreenshotNeo accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info and capture_pdf for AI agents using Claude, Cursor or another MCP client. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.

Frequently asked questions

Can I use html2canvas in Node.js?

Not as a server-side renderer: html2canvas depends on browser APIs such as window and document. The project FAQ names Puppeteer and Playwright for server-side screenshot generation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does setting windowHeight guarantee the entire page will render?

No. It addresses the rendering-window dimensions, but browser and device canvas limits still apply, and the page may contain resources or CSS that html2canvas cannot reproduce.

Will useCORS: true load any image from another domain?

No. The image server must send an appropriate CORS response header; otherwise, browser security prevents access through this method.

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.