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

Vertical cropping after an onclone change usually means the cloned document is still being rendered inside a short window or a constrained scroll box. Measure the target, set windowWidth and windowHeight to the intended scroll dimensions, remove clone-only height and overflow limits, and set the correct scrollY. Then check nested scrollers, responsive breakpoints, rendering mode, and browser canvas limits.

Why an onclone edit can make the bottom disappear

onclone receives the temporary document that html2canvas renders; it does not edit the live page. html2canvas establishes the rendering window from windowWidth, windowHeight, scrollX, and scrollY, then loads the clone inside those bounds. A clone that gains a short height, max-height, overflow:hidden, a hidden wrapper, or a different responsive layout can therefore produce a canvas that ends at a wrapper or viewport boundary.

The same visual symptom has several causes. A target may genuinely have little content, the target may be a nested scrolling element, the page may be captured from a stale scroll origin, or the output may exceed the browser’s canvas area limit. Fix the layout and coordinate system before changing scale or stitching images.

Measure the target before changing the capture

Run this in the same page state in which you call html2canvas. The values distinguish a short layout from a crop introduced during cloning:

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.
#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
const target = document.querySelector('#capture');

if (!target) {
  throw new Error('The #capture element was not found');
}

const rect = target.getBoundingClientRect();
console.table({
  scrollWidth: target.scrollWidth,
  scrollHeight: target.scrollHeight,
  clientWidth: target.clientWidth,
  clientHeight: target.clientHeight,
  rectWidth: rect.width,
  rectHeight: rect.height,
  pageScrollX: window.scrollX,
  pageScrollY: window.scrollY
});
  • scrollHeight versus clientHeight: a larger scroll height proves that content extends beyond the visible box.
  • scrollWidth: use it when a horizontal scrollbar or responsive breakpoint affects the layout.
  • getBoundingClientRect(): shows the target’s current viewport position and visible size.
  • Page offsets: a nonzero window.scrollY matters when the capture is intended to start at the top.

If scrollHeight is already close to clientHeight, the missing content is probably hidden by application logic rather than cropped by the canvas. If the crop ends exactly at a viewport or wrapper edge, continue with the clone-window repair.

Set the clone window to the content dimensions

For a tall element whose complete contents should be rendered, start with the element’s scroll dimensions and make the capture top-anchored. The clone-only style changes leave the live interface untouched:

const target = document.querySelector('#capture');

const canvas = await html2canvas(target, {
  windowWidth: target.scrollWidth,
  windowHeight: target.scrollHeight,
  scrollX: 0,
  scrollY: 0,
  onclone: (doc) => {
    const cloneTarget = doc.querySelector('#capture');
    cloneTarget.style.height = `${cloneTarget.scrollHeight}px`;
    cloneTarget.style.maxHeight = 'none';
    cloneTarget.style.overflow = 'visible';
  }
});

document.querySelector('#output').replaceChildren(canvas);

The important relationship is that the rendering window is at least as large as the content you intend to include. Setting only height on the clone does not help if windowHeight remains a short viewport. Conversely, a large window cannot reveal content that an ancestor still clips.

Repair nested scrolling elements separately

A page-level window does not automatically expose the contents of a child with overflow:auto or overflow:scroll. Measure the actual scrolling child and alter that child in the clone:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const target = document.querySelector('#capture');
const scroller = target.querySelector('.results-scroll');

if (!scroller) {
  throw new Error('The nested scrolling element was not found');
}

const contentWidth = scroller.scrollWidth;
const contentHeight = scroller.scrollHeight;

const canvas = await html2canvas(target, {
  windowWidth: Math.max(target.scrollWidth, contentWidth),
  windowHeight: Math.max(target.scrollHeight, contentHeight),
  scrollX: 0,
  scrollY: 0,
  onclone: (doc) => {
    const cloneScroller = doc.querySelector('.results-scroll');
    cloneScroller.style.width = `${contentWidth}px`;
    cloneScroller.style.height = `${contentHeight}px`;
    cloneScroller.style.maxHeight = 'none';
    cloneScroller.style.overflow = 'visible';
  }
});

Use the child dimensions when the child is the intended capture target. If the parent also has a fixed height, remove that parent constraint in onclone. Check every ancestor for clipping, not just the element returned by querySelector('#capture').

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

Neutralize capture-only CSS without changing the live UI

Interactive layouts often rely on constraints that are correct for users but wrong for a document image. In the clone, remove or override:

  • height: 0, fixed heights, and max-height values that hide overflow;
  • overflow: hidden, clipping, masks, or transforms that cut descendants;
  • collapsed panels or wrappers that are hidden solely for the live interaction state;
  • off-screen positioning used for menus, drawers, or virtualized content;
  • contain rules that prevent descendants from contributing to the measured box.

Apply these changes only to the cloned document. For broad rules, add a temporary style element:

onclone: (doc) => {
  const style = doc.createElement('style');
  style.textContent = `
    #capture,
    #capture * {
      max-height: none !important;
    }
    #capture {
      height: auto !important;
      overflow: visible !important;
      contain: none !important;
    }
  `;
  doc.head.appendChild(style);
}

Do not blindly force every descendant to overflow: visible. That can change intended visual effects or create enormous boxes. Override the specific scrolling or clipping ancestors identified by measurement.

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

Correct the scroll origin and responsive layout

Top-anchored full capture

Use scrollY: 0 and scrollX: 0 when the image should begin at the document’s top-left coordinate. A stale page offset can make a result look vertically shifted or truncated.

Viewport or fixed-position capture

If the purpose is to reproduce what a user sees at the current position, pass the intended page offset instead of forcing zero. Fixed headers and sticky elements can otherwise appear at the wrong position relative to the content.

Media queries

windowWidth affects responsive breakpoints. A width copied from a narrow browser viewport can activate a mobile layout whose cards wrap, collapse, or hide content. Set it to the width that represents the layout you want, then use the corresponding content height. Re-measure after clone styles are applied if a breakpoint changes the page structure.

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.

foreignObjectRendering

If foreignObjectRendering is enabled, test one run with it disabled. An issue has reported a mode-specific case in which the actual document viewport was used instead of supplied dimensions. Treat this as release-dependent: record your html2canvas version and compare both modes rather than assuming one is universally correct.

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

Rule out browser canvas limits

Extremely tall or wide canvases can be cut off or fail even after the layout is correct. Browsers impose maximum canvas area and dimension limits, and available memory varies by device. Signs include a correct DOM measurement but a blank, partially painted, or unexpectedly short canvas.

  • Lower scale to reduce pixel dimensions and memory use.
  • Capture logical sections separately and stitch or display the tiles.
  • Reduce unnecessary width before increasing height; total area is what matters.
  • Test on the browsers and devices that will run the capture, not only on a desktop development machine.

A smaller scale changes output resolution; tiling changes the capture workflow. Choose the smallest change that preserves the image quality your use case needs.

A practical diagnostic workflow

  1. Confirm the target: verify that the selector resolves to the element containing the missing content.
  2. Record dimensions: compare scrollHeight and clientHeight, including any nested scroller.
  3. Capture from the intended origin: use zero offsets for a top-anchored document or explicit offsets for a viewport capture.
  4. Match the window: set windowWidth and windowHeight to the relevant scroll dimensions.
  5. Open the clone: remove the identified fixed height, maximum height, clipping, hidden state, or containment rule in onclone.
  6. Check ancestors: inspect wrappers for overflow:hidden, height:100%, and clipping.
  7. Compare rendering modes: if foreign-object rendering is enabled, test the disabled path.
  8. Reduce output size: lower scale or tile the capture only after layout and coordinates are correct.

Common symptoms, causes, and fixes

Symptom Likely cause Fix
Image ends exactly at the browser viewport windowHeight is still the viewport height Set it to the target’s intended scroll height and use the matching clone dimensions.
Image ends at a card or panel boundary Fixed height, max-height, or overflow:hidden Remove that constraint from the affected clone element and its clipping ancestor.
Only a table, feed, or results list is cut off Nested overflow:auto container Measure the child, set its clone height to scrollHeight, and make its overflow visible.
Content is shifted or the top is missing Incorrect scrollY or scrollX Use zero for a top-anchored capture or pass the deliberate page offset.
Layout changes after adding a large window Media query triggered by windowWidth Choose the desired responsive width and re-measure the resulting clone.
Disabling clone edits fixes the image The edit introduced a hidden or constrained state Apply the smallest style override in onclone; do not alter the production DOM.
Correct dimensions but blank or truncated output Canvas area or memory limit Lower scale, reduce dimensions, or split into tiles.

Performance and reliability considerations

Large captures cost time and memory before the canvas is encoded. Lazy-loaded images may not be present when measurement occurs, so wait until the content is loaded before reading scroll dimensions. Keep clone CSS narrow to avoid expensive reflow across the entire document. When using a delay or application-specific readiness signal, measure after that signal, not before it.

For repeatable jobs, log the target dimensions, window options, scroll origin, scale, html2canvas version, and whether foreign-object rendering was used. Those values make a crop reproducible. A successful DOM measurement does not guarantee a successful canvas if the final pixel area exceeds a browser limit.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server when you need a rendered image without maintaining browser automation. It accepts a URL and can return PNG, JPEG, WebP, or PDF. Before capture, it accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.

Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

One GET request

See the parameter reference in the ScreenshotNeo documentation.

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(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

For pages that need deterministic rendering, ScreenshotNeo also supports full-page capture with lazy images loaded, CSS-element selection, dark mode, device presets or custom viewports, retina scale, custom CSS and JavaScript, clicks, selector or network-idle waits, blocked ads or resource types, headers, cookies, user agents, authorization, timezone and geolocation. It can resize images, use a chosen cache TTL, create signed image links, submit asynchronous jobs with signed webhooks, capture up to 100 URLs per bulk call, and expose usage and OpenAPI endpoints. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Every feature is on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to get 1,000 screenshots a month without a card.

FAQ

Should I set windowHeight to document.body.scrollHeight?

Only when the whole document is the intended target. For an element capture, use that element’s scroll dimensions; for a nested scroller, use the child’s dimensions and remove its clone overflow constraint.

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.

Why does the crop appear only on one browser?

Canvas limits, responsive breakpoints, and rendering-mode behavior can differ by browser and device. Compare the same dimensions, scale, and foreignObjectRendering setting, then test a smaller or tiled output.

Can I fix the problem by increasing scale?

No. A higher scale increases pixel dimensions and can make a canvas-limit failure worse. Correct the clone window and overflow rules first; lower scale only when the final canvas is too large.

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.

Frequently Asked Questions

Should I set windowHeight to document.body.scrollHeight?

Only when the whole document is the intended target. For an element capture, use that element’s scroll dimensions; for a nested scroller, use the child’s dimensions and remove its clone overflow constraint.

Why does the crop appear only on one browser?

Canvas limits, responsive breakpoints, and rendering-mode behavior can differ by browser and device. Compare the same dimensions, scale, and foreignObjectRendering setting, then test a smaller or tiled output.

Can I fix the problem by increasing scale?

No. A higher scale increases pixel dimensions and can make a canvas-limit failure worse. Correct the clone window and overflow rules first; lower scale only when the final canvas is too large.

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.

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