October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Canvas

How to Take Full-Page Screenshots with html2canvas

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

To render an entire page with html2canvas, pass the page element and set windowWidth and windowHeight to that element’s scrollWidth and scrollHeight. This corrects the common case where the result is blank or clipped because html2canvas rendered using viewport dimensions. It does not turn html2canvas into a pixel-perfect browser screenshot: the library rebuilds an image from DOM information, and canvas size limits, cross-origin security, and incomplete CSS support still apply.

Capture a full page with html2canvas

html2canvas runs in the browser. It reads the page’s DOM and styles, then paints a canvas representation; it does not capture the browser’s actual pixels. Use it when client-side rendering and a downloadable image are suitable, and verify the output against the page you intend to capture.

Install or load html2canvas in your page before calling it. With a bundler, for example, install the package with npm install html2canvas and import it in a browser-side module. Then use this pattern:

import html2canvas from 'html2canvas';

async function captureFullPage() {
  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();
}

captureFullPage().catch((error) => {
  console.error('Could not render the page:', error);
});

The dimensions passed as windowWidth and windowHeight define the rendering window. Using the target’s scroll dimensions allows the render window to cover its full scrollable extent instead of only the visible viewport. The configuration can affect media queries, so a page that changes layout at different widths may render differently from its current on-screen appearance.

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

Choose the right target element

document.documentElement is a practical document-wide target, but it is not the only choice. Use document.body if the body is the content you mean to export, or select a particular container when only one section should appear. Set the rendering dimensions from that same target:

const element = document.querySelector('#report');
if (!element) throw new Error('Report element was not found');

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

A selected container limits the capture to that element; it does not automatically mean the browser page outside it will be included. Confirm that the target’s scroll dimensions cover the content you need.

Download as PNG

The temporary anchor and toDataURL('image/png') pattern above follows the project’s documented export example. It creates a PNG data URL and asks the browser to download it. Browser policy or the surrounding application can affect download behavior, so treat this as a browser-side pattern rather than a guarantee that every embedded context permits a download.

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

Why the result may not match the browser

html2canvas reconstructs a page image from DOM nodes and computed style information. It can only reproduce CSS features that it implements; it is not a screenshot API that reads the browser’s final composited pixels. The project notes that every CSS property must be implemented manually, so full CSS support is not available. Check its supported-features list when a particular effect is missing, and compare the generated canvas with the page itself.

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

This distinction matters when the page relies on unsupported styling, embedded content, or browser rendering behavior that is not represented by the DOM information html2canvas can read. A successful promise does not prove that every visible detail was reproduced faithfully.

Options that affect full-page output

Option What it controls How to use it
windowWidth, windowHeight The window dimensions used for rendering; they can affect media queries. For a full scroll-height render, use the target element’s scrollWidth and scrollHeight.
width, height Canvas dimensions. Set them when you intentionally need a particular output size; avoid assuming they remove browser canvas limits.
x, y The origin of a crop region. Use with a deliberate crop rather than as a substitute for setting full-page window dimensions.
scale Output scale. Its documented default is window.devicePixelRatio. A higher scale creates more pixels and can make a large capture hit canvas limits sooner. Lower it when the output is too large.
scrollX, scrollY The scroll position used when rendering, including for cases involving fixed positioning. Adjust only when the captured element’s scroll position or fixed elements need specific treatment.
data-html2canvas-ignore Excludes marked elements from the render. Add the attribute to content such as controls that should not appear in the capture.
cullOffscreen Can skip painting nodes outside the captured viewport. The documentation describes it for viewport-sized captures of large pages; do not treat it as a general remedy for full-page clipping.

Fix blank or partially clipped canvases

First compare the requested rendering window with the target’s scroll dimensions. The full-page pattern fixes a viewport-versus-document dimension mismatch, but it cannot exceed the browser’s canvas limits. The html2canvas FAQ gives approximate guidance—not guaranteed, permanent specifications—for maximum canvas dimensions and areas:

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.
Browser category Approximate guidance in the html2canvas FAQ Qualification
Chrome/Chromium About 32,767 pixels per dimension; about 268 million pixels of area. Limits vary by browser and platform.
Firefox About 32,767 pixels per dimension; about 472 million pixels of area. Limits vary by browser and platform.
Desktop Safari About 32,767 pixels per dimension. The FAQ does not give an area figure here.
iOS Safari Lower limits. Limits depend on device RAM.

When a page is extremely tall, the product of its width, height, and scale can become too large even if the dimensions look reasonable individually. If output is blank or stops partway through, try these steps:

  1. Confirm the target is the intended element and that its scrollWidth and scrollHeight include the content to capture.
  2. Reduce scale to reduce the output pixel dimensions and area.
  3. Capture a smaller element or split the content into smaller captures if a single canvas remains too large.
  4. If reliable pixel capture is essential, use a browser-native screenshot workflow or a real-browser tool instead of relying on one enormous canvas.

The FAQ recommends native screenshot APIs for browser extensions and names Puppeteer or Playwright for server-side screenshots. These are different workflows from html2canvas: html2canvas is browser-side DOM reconstruction, while browser screenshot workflows capture rendered browser output.

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

Make cross-origin images appear

html2canvas cannot bypass browser cross-origin restrictions. By default, allowTaint is false, so images that would taint the canvas are skipped. Set useCORS: true only when the image server sends an appropriate Access-Control-Allow-Origin response header, or configure a proxy that can retrieve the resource under suitable access rules:

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
const canvas = await html2canvas(document.documentElement, {
  windowWidth: document.documentElement.scrollWidth,
  windowHeight: document.documentElement.scrollHeight,
  useCORS: true,
});

This option requests CORS-enabled image loading; it does not grant access if the remote server does not allow it. An already-tainted canvas on the source page may also be unreadable to html2canvas. Same-origin iframes can be rendered recursively, but cross-origin iframes and sandboxed iframes without allow-same-origin cannot be accessed because of browser security restrictions.

Common troubleshooting cases

  • The canvas is blank or cuts off halfway. Check windowWidth and windowHeight against the target’s scroll dimensions. If they are correct, reduce scale or capture a smaller area; canvas limits may be the cause.
  • Remote images are missing. Check whether the image server sends an appropriate CORS header. Enable useCORS only when it does; otherwise use a permitted proxy or omit those images.
  • An iframe is absent. Same-origin frames may be traversed, but cross-origin frames and restricted sandboxed frames cannot be read by the page script.
  • Shadows, layout, or other styling differs. The renderer’s CSS support is incomplete. Check the supported-features list; if a property is missing or incomplete, the project advises creating a test case and opening an issue.
  • The page layout changes in the output. The render window dimensions can affect media queries. Check the chosen target width and the page’s responsive breakpoints.
  • The capture runs out of memory or becomes unwieldy. A larger scale increases pixel count. Reduce it or capture smaller sections rather than asking the browser to allocate one very large canvas.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use a different screenshot approach

Use html2canvas when the capture can run in a browser page, DOM-based reconstruction is acceptable, and you can manage CORS and canvas sizing. Choose a real-browser screenshot workflow when you need the browser’s rendered pixels, need server-side automation, or cannot safely fit the page into a canvas. The html2canvas project FAQ points to Puppeteer or Playwright for server-side screenshot generation; it does not establish a universal winner or benchmark between approaches.

Or skip the browser setup

If you want a screenshot returned by one HTTP request instead of adding an in-page canvas renderer, ScreenshotNeo is a website screenshot API and MCP server for developers. It can return PNG, JPEG, WebP, or PDF. For example, save a screenshot of a page as WebP with cURL:

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.
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 and parameter details. Cookie and consent banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets can be removed before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up free for 1,000 screenshots a month, with no card required.

FAQ

Can html2canvas run in Node.js?

Not as a standalone server-side renderer: it depends on browser APIs such as window and document. For server-side screenshots, the project FAQ points to Puppeteer or Playwright.

Does increasing scale improve a full-page screenshot?

It increases the output pixel dimensions, but also increases the canvas size and the chance of hitting platform limits. Use it only when the added resolution is useful and the target remains within practical limits.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Can it include a cross-origin iframe if the iframe’s page allows CORS?

The FAQ’s limitation is iframe access under browser security rules: cross-origin frames cannot be accessed recursively by html2canvas. The image CORS setting does not remove that iframe restriction.

How can I omit a button or other element?

Add the data-html2canvas-ignore attribute to the element before rendering; html2canvas will skip marked elements.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.