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

If html2canvas cuts off the bottom of a tall element, set its virtual rendering window to the element’s scroll dimensions—not the browser viewport. For a full document, use the document’s scroll dimensions. Then check cropping, scroll position, canvas limits, cross-origin images, and CSS or iframe constraints if the output is still incomplete.

Set the rendering window to the content size

html2canvas renders a page from the DOM; it does not take a native browser screenshot. Its default rendering window can be smaller than a tall element, so content beyond that window may be omitted or the result may be cut off. The project FAQ’s direct fix is to set windowWidth and windowHeight to the element’s scroll dimensions. See the html2canvas FAQ.

const element = document.querySelector('#capture');
if (!element) throw new Error('Capture element not found');

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

This assumes html2canvas is already loaded and the call runs in an async function or module. scrollWidth and scrollHeight describe the full scrollable content, unlike clientWidth and clientHeight, which describe the visible interior. The windowWidth and windowHeight options control the virtual window used to render; they are not just output crop dimensions.

Capture a whole document

For a document rather than a single element, use the document’s scroll dimensions. A common choice is document.documentElement; depending on the page, document.body may be the relevant scrolling element. Check the measured values in the page you are capturing rather than assuming the viewport represents the whole document.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
const target = document.documentElement;
const canvas = await html2canvas(target, {
  windowWidth: target.scrollWidth,
  windowHeight: target.scrollHeight,
});

If the page uses an unusual scrolling structure, inspect document.scrollingElement and the element being passed to html2canvas. The capture target and the dimensions used for the rendering window should correspond to the content you want.

Choose the output crop and scroll position

Correcting the virtual window does not always mean you want every pixel of the target. html2canvas supports x, y, width, and height to control the captured area. Use these when you intentionally need a crop, or when you need to make the output bounds explicit. The configuration reference documents these options.

const canvas = await html2canvas(element, {
  windowWidth: element.scrollWidth,
  windowHeight: element.scrollHeight,
  x: 0,
  y: 0,
  width: element.scrollWidth,
  height: element.scrollHeight,
});

For a capture taken after scrolling, scrollX and scrollY determine the scroll position used for rendering. A fixed header, sticky navigation, or nested scrolling container can therefore affect what appears and where. If a nested scroller is clipped, a practical workaround may be to temporarily expand the target or remove its inner scrolling constraint before capture, then restore its original styles.

Keep the live page unchanged

When a temporary layout change is needed, save the original inline styles, apply the capture-only values, wait for the layout to settle, capture, and restore the styles in a finally block. Alternatively, use the onclone callback to adjust the cloned document used for rendering. This avoids changing the visible live document, though cloned layout changes still need to be deliberate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Use a diagnostic capture before changing more settings

This example makes the output bounds explicit, caps scale at 2 to avoid needlessly multiplying pixels on high-density displays, enables CORS image loading, and removes nodes marked to be ignored from the cloned document. Use useCORS only if the image host sends suitable CORS headers; it does not bypass browser security.

async function captureWholeElement(element) {
  if (!element) throw new Error('Pass an element to capture');

  const width = element.scrollWidth;
  const height = element.scrollHeight;
  if (!width || !height) throw new Error('Capture element has no measurable size');

  return html2canvas(element, {
    windowWidth: width,
    windowHeight: height,
    width,
    height,
    scale: Math.min(window.devicePixelRatio || 1, 2),
    useCORS: true,
    onclone: (clonedDocument) => {
      clonedDocument
        .querySelectorAll('[data-html2canvas-ignore]')
        .forEach((node) => node.remove());
    },
  });
}

const canvas = await captureWholeElement(document.querySelector('#capture'));

Add data-html2canvas-ignore to controls, overlays, or other elements that should not appear in the image. html2canvas recognizes this attribute. The onclone callback edits the cloned document used for rendering, not the live page.

Check canvas dimensions and scale

A canvas can be blank or partial even when the dimensions appear correct: browsers impose maximum canvas dimensions and total pixel-area limits, and may fail silently. The html2canvas FAQ gives rough current guidance of about 32,767 pixels per dimension for Chrome/Chromium, Firefox, and desktop Safari, with lower limits on iOS Safari; these are approximate browser guidance, not guaranteed specifications. Total pixel-area limits vary too. See the FAQ’s canvas-size notes.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Output pixel dimensions grow with the scale option. By default, scale follows window.devicePixelRatio; a tall capture rendered at high scale can exceed a limit sooner than its CSS dimensions suggest. The configuration reference documents scale.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Log the target’s scroll dimensions and the resulting canvas’s width and height.
  • Lower scale if the canvas is excessively large. This reduces output resolution as well as memory pressure.
  • If a complete image still exceeds browser limits, capture smaller vertical sections and stitch them, taking care to avoid gaps or duplicated sticky content.
  • For reliable server-side screenshots of long pages, consider browser automation rather than a single oversized canvas.

Resolve missing images, CSS differences, and iframes

Cross-origin images

With the default allowTaint: false, html2canvas checks images that could taint the canvas and skips ones it cannot safely use. Setting useCORS: true asks the browser to load images through CORS, but the image server must send an appropriate Access-Control-Allow-Origin header. If it does not, configure the image host or load the asset through a same-origin proxy you control. These restrictions are browser security behavior, not a crop setting. See the html2canvas FAQ and configuration reference.

Unsupported or partially supported CSS

html2canvas reconstructs the image from DOM and CSS rather than asking the browser for a native screenshot. Its documentation explains that CSS properties must be manually implemented, so support is not complete. A complete canvas can therefore still look different from the page. Check the project’s features list for the properties relevant to your layout. If fidelity depends on CSS html2canvas does not implement, changing the capture dimensions will not fix it.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Cross-origin iframes

A page inside a cross-origin iframe cannot be read through the parent page’s DOM: browser same-origin security prevents access to its contentDocument. html2canvas documents that cross-origin iframes cannot be rendered. Capture the content from its own origin, if you control it, or use a screenshot workflow that can access the rendered browser surface. See the html2canvas documentation.

Troubleshoot by symptom

Symptom Likely cause What to try
Only the visible portion appears Rendering window follows viewport-sized dimensions Set windowWidth and windowHeight to the target’s scroll dimensions.
Bottom is cut off or canvas is blank Canvas dimension or total pixel-area limit Lower scale, capture sections, and inspect the actual canvas dimensions.
Images are absent Cross-origin image lacks suitable CORS headers Use useCORS: true only when supported by the host, or use a same-origin proxy.
Sticky header or nested area looks wrong Scroll position, fixed positioning, or inner overflow affects rendering Set scrollX/scrollY as needed; temporarily expand the inner scroller or hide the obstruction in the clone.
Image differs despite complete dimensions CSS feature is unsupported or only partly implemented Check the html2canvas features list; use a browser screenshot method if exact browser rendering is necessary.
Embedded content is missing Cross-origin iframe cannot be inspected by the page Capture it from its own origin or use a browser-level screenshot workflow.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to switch from html2canvas

For an in-browser DOM rendering where an approximate reconstruction is acceptable, html2canvas can be useful. For a screenshot that must match the browser’s actual rendering, very tall pages, or content constrained by iframe and CSS limitations, the html2canvas FAQ points to native extension screenshot APIs for browser extensions and Puppeteer or Playwright for server-side screenshots. Those approaches have different setup and operational requirements; choose based on rendering fidelity, page height, access to cross-origin content, output format, and where the capture must run.

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.

Or skip the browser setup

If you need a screenshot of a live website rather than a canvas generated from an already loaded DOM, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. Its capture steps can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

Install your preferred HTTP client and replace the URL with the page you want to capture. See the ScreenshotNeo API documentation for request options and response details.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. These are website captures through an API, not a fix for html2canvas’s rendering of a DOM element in your own page. Sign up for 1,000 free screenshots a month with no card.

FAQ

Does html2canvas take a native screenshot of the browser?

No. It builds a canvas by interpreting the page’s DOM and supported CSS, so its result can differ from the browser’s native rendering.

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.

Can I use html2canvas to capture a cross-origin iframe?

No. Browser same-origin restrictions prevent the parent page from reading a cross-origin iframe’s document.

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.