To include content outside the visible browser viewport, pass the target element to html2canvas and set windowWidth and windowHeight to that element’s scrollWidth and scrollHeight. These options expand the virtual rendering window; width and height instead control the output canvas, and neither setting can bypass browser canvas size limits.
Capture the element’s full scrollable area
Install or load html2canvas in your page, select the element you want to render, and await the returned Promise. This example assumes the page contains an element with id="capture":
const element = document.querySelector('#capture');
if (!element) {
throw new Error('Could not find #capture');
}
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
});
document.body.appendChild(canvas);
Use this inside an async function or another context where await is allowed. The Promise resolves to a canvas; wait for it before displaying the result or exporting it. The html2canvas project’s FAQ recommends matching the virtual window dimensions to the target’s scroll dimensions when a result is empty or clipped partway through.
scrollWidth and scrollHeight describe the element’s scrollable extent, which can be larger than its visible box. This is useful for a tall panel, an overflow container, or a target whose content extends beyond the current viewport. The exact result still depends on the element’s DOM, styles, resources, and the browser’s canvas limits.
#1 Best Overall
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
Export the canvas as an image
Once the Promise resolves, export the canvas. For example, this creates a PNG download:
function downloadCanvas(canvas, filename = 'capture.png') {
canvas.toBlob((blob) => {
if (!blob) {
throw new Error('The canvas could not be exported');
}
const link = document.createElement('a');
const objectUrl = URL.createObjectURL(blob);
link.href = objectUrl;
link.download = filename;
link.click();
URL.revokeObjectURL(objectUrl);
}, 'image/png');
}
downloadCanvas(canvas);
Export only after rendering finishes. If your application needs a JPEG or WebP, request that MIME type from the canvas export method and use a matching filename; browser support and output behavior can vary. If the canvas is tainted by a cross-origin image, browser security restrictions can prevent export even if the image appeared in the rendered page.
Separate the virtual window, output bounds, and scroll position
Several html2canvas options sound similar but solve different problems. The full-window dimensions are the key settings for extending a capture beyond the visible viewport.
| Option | What it controls | When to use it |
|---|---|---|
windowWidth, windowHeight |
The virtual browser-window dimensions used during rendering. By default, they use the browser’s inner dimensions and can affect media queries. | Set them to the target’s scrollWidth and scrollHeight when the complete scrollable area should be rendered. |
width, height |
The output canvas dimensions. | Use them when you deliberately need a particular output size. They are not substitutes for expanding the virtual window. |
x, y |
The crop’s starting coordinates. | Use them to capture a region rather than the whole rendered area. The official examples show a 400-by-300 region beginning at x=100, y=100. |
scrollX, scrollY |
The scroll position used while rendering an element. | Consider them when fixed-position content is involved. They do not expand the virtual window for tall content. |
cullOffscreen |
Whether nodes entirely outside the captured viewport are skipped while painting; the default is false. |
Enabling it can speed up viewport-sized captures of large pages. It is not a way to include offscreen content. |
For example, the documented crop settings can be combined with an explicit output size:
Recommended Free Tools
Rank #2
- AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
- Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
- Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
- Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
- Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
const canvas = await html2canvas(element, {
x: 100,
y: 100,
width: 400,
height: 300,
});
That example asks for a crop; it does not request a full-height rendering window. Choose crop and output options based on the final dimensions you need, and set windowWidth and windowHeight separately when the virtual window must cover the target’s scrollable extent.
Account for layout changes and content that loads later
Changing windowWidth or windowHeight can affect responsive styles because those dimensions can change which media queries apply. A capture rendered with a wider virtual window may therefore have a different layout from the one currently visible in the browser. If the goal is to reproduce a particular responsive state, use dimensions that correspond to that intended state and check the rendered canvas rather than assuming it will match the current viewport.
The dimensions are also measured when you read them. If the page adds content later, such as after an application update or delayed rendering, the element’s scroll dimensions may have changed by the time capture begins. In that situation, wait until the content is present, then measure the element and call html2canvas. The library returns a Promise, so place export or display logic after the awaited call.
Work around canvas size limits on very long content
Increasing the virtual window does not remove browser limits on canvas dimensions or total pixel area. The html2canvas project FAQ gives rough guidance—not guaranteed thresholds—for maximum canvas dimensions and area:
Rank #3
- High-Quality Video Capture, 4K HDMI Capture Card Ready: Capture smooth and vibrant video with this 4K HDMI capture card, engineered for gamers and content creators who demand crisp 1080P 60FPS video quality. Whether you're streaming to Twitch or recording gameplay for YouTube, your footage will look professional and detailed
- Plug-and-Play USB Capture Card, No Drivers Needed: Designed as a USB capture card for streaming, this device works instantly out of the box, just plug into your PC or laptop and start capturing. Fully compatible with popular software like OBS Studio, Streamlabs, and XSplit, making setup quick and stress-free for beginners and pros alike
- Universal Compatibility PS5, Xbox, Switch & More: Stream or record gameplay from virtually any HDMI-enabled device including Nintendo Switch, PS5, Xbox Series X, DSLR cameras, and PCs. The video capture card for gaming supports seamless passthrough so you can play without lag while your audience watches every frame in real time
- Low-Latency Performance for Smooth Streaming: This capture card for streaming minimizes delay between gameplay and broadcast, so you get reliable, low-latency capture that works well for competitive gaming, live broadcasts, and podcast sessions. Suitable for those building their channel with high-quality, engaging content
- Compact & Portable Design for Content Creators: Lightweight and portable, this USB 3.0 capture card works well for creators who travel or switch gaming setups often. Throw it in your bag and stream or record wherever you are, at home, events, LAN parties, streaming or studio sessions
| Browser family | Approximate guidance in the html2canvas project FAQ |
|---|---|
| Chrome/Chromium | About 32,767 px maximum dimension and about 268 million pixels maximum area. |
| Firefox | About 32,767 px maximum dimension and about 472 million pixels maximum area. |
| Desktop Safari | About 32,767 px maximum dimension; area is described as similar to Chrome. |
| iOS browsers | Limits are lower and depend on device memory; the FAQ does not provide one fixed threshold. |
These are approximate figures from the project documentation accessed in 2026; the live FAQ does not state a publication date. Actual limits vary with GPU, operating system, device, and available memory. A canvas may be blank, incomplete, or fail to export when dimensions or area exceed what a particular environment can handle.
For an unusually long page, a practical fallback is to capture smaller vertical sections and combine or export them separately. This follows from the documented limits; html2canvas does not prescribe a particular stitching workflow. Section captures reduce the size of each canvas, but you will need to manage their positions and any overlaps in your own code or image-processing workflow.
Understand what html2canvas can and cannot reproduce
html2canvas is not a pixel-level browser screenshot. The project documentation explains that it traverses the page DOM and reconstructs a representation from DOM and style information. It can only reproduce CSS properties that it implements, so some visual differences from the live page are expected. Expanding the virtual window fixes a viewport-bound issue; it does not make unsupported styling or inaccessible content render correctly.
Cross-origin images
Images from another origin need suitable CORS response headers for browser-side access. You can request CORS use with useCORS: true when the image server permits it:
Rank #4
- [Enhanced 4K-1080P Video Capture Experience] Capture the Magic: Elevate your video recordings to new heights with our upgraded anti-static 1080P Video Capture Card. Immerse yourself in stunning visuals, supporting HDMI input at 4K 60FPS and USB output for capturing in 1080P, complete with rich stereo sound. Enjoy crystal-clear video recordings, dynamic gaming live streams, and professional conference broadcasts. Note: HDMI resolution: Max input can be 3840×2160@30Hz / Video output resolution: Max output can be 1920×1080@30Hz
- [Seamless Real-Time Preview] Stay in the Moment: Our advanced ultra-low latency technology ensures seamless real-time transmission of video streams. Experience instant, lag-free previews, allowing you to capture every detail precisely. Effortlessly record video directly to your hard disk, all without compromising on quality or introducing any delays.
- [Versatility and Broad Compatibility] Your Creative Hub: Connect your DSLR, camcorder, or action camera to a wide range of operating systems, including Windows, MacOS, and Linux. Unlock a world of possibilities with real-time streaming to popular platforms like Twitch, Youtube, OBS, Zoom, Potplayer, and VLC, giving you the tools to share your content effortlessly.
- [Effortless Plug and Play] Simplicity Redefined: Say goodbye to complex installations. Our plug-and-play design eliminates the need for drivers or external power supplies. Seamlessly integrate high-definition acquisition into various scenarios, whether it's educational recordings, immersive gaming, precise medical imaging, captivating live streams, or professional broadcasting.
- [Seize Every Detail with Precision] Unleash your creativity and attention to detail with our video capture card. Capture every nuance, every color, and every moment with precision, thanks to the enhanced capabilities of our technology. Whether you're a content creator, a gamer, or a professional, our capture card empowers you to seize the finest elements and bring them to life in your recordings and live streams.
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight,
useCORS: true,
});
This option cannot override the image server’s policy or browser security rules. If you control the relevant environment, a same-origin proxy is another documented approach. If neither the server configuration nor a proxy makes the image accessible, html2canvas cannot use that image as though it were same-origin.
Iframe content
Same-origin iframe content is supported recursively. Cross-origin iframe contents are inaccessible under browser security restrictions, so do not expect html2canvas to capture their internal page as part of the parent render. The parent document cannot use this library to bypass the browser’s origin boundary.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot blank, clipped, or different-looking captures
- The capture stops at the viewport: Set both
windowWidthandwindowHeightfrom the target’sscrollWidthandscrollHeight. Check that you passed the intended element and that its scroll dimensions include the content you expect. - The result is blank or truncated despite the dimensions: Inspect the resulting canvas’s
widthandheight, the configured scale, and the total pixel area. A canvas size limit can prevent a full render; try smaller vertical captures. - Responsive styling changed: Check whether the virtual window dimensions activated different media queries. Use dimensions appropriate to the responsive layout you want.
- Images are missing or export fails: Check whether images are cross-origin. Use
useCORS: trueonly when the server sends the required CORS headers, or use a same-origin proxy where appropriate. - An iframe appears empty: Determine whether it is cross-origin. Its contents cannot be read through the parent page’s browser security context.
- Some styles do not match the page: Remember that html2canvas reconstructs a render from DOM and style data and supports only implemented CSS properties; it is not a native screenshot of browser pixels.
- Offscreen elements disappear after enabling an optimization: Check
cullOffscreen. It is intended to skip nodes outside the captured viewport, not enlarge the capture.
Or skip the browser setup
If you need a screenshot of a live URL rather than a browser-side canvas render, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return an image or PDF; the API also supports full-page capture and selecting an element by CSS selector. That is a different approach from html2canvas: it captures a website URL rather than rendering an element in your current page’s JavaScript context.
Example request and response handling are documented at ScreenshotNeo’s API documentation:
Best Value
- [HDMI Capture] Record or Live Stream Audio & Video at up to 1080P from HDMI Sources up to 4K 30 FPS (NOTE: Does NOT Support HDMI Sources That Are Copyrighted or Content-Protected)
- [AV & S-Video Capture] Record or Live Stream from Analog Video Sources Such As VCR, VHS, Camcorders, Video8, Hi8, DVD, Gaming Systems (Device Automatic Upscales to HD Resolution)
- [USB-C Plug & Play] Modern USB-C Plug and Play Interface (Works with Laptops and Desktops - Full Size USB-A Adapter Included)
- [Software Included] Video Capture & Live Streaming Software & Step By-Step Instructions Included
- [Compatible with PC, Mac, & Linux] Works with Windows 10/11/12, OS X 11.0 or higher, and Ubuntu 14.04 or higher
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
- Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; each step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses identify the page verdict and billing status in headers.
- An MCP server exposes
take_screenshot,get_page_info, andcapture_pdffor Claude, Cursor, and other MCP clients. - The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Frequently asked questions
Does html2canvas scroll the real page to capture the target?
The recommended approach expands the virtual rendering window with the target’s scroll dimensions. It is not the same as manually scrolling the visible browser page through each section.
Can a larger window make html2canvas capture a cross-origin iframe?
No. A larger virtual window does not change browser origin restrictions. Cross-origin iframe content remains inaccessible to the parent page.
Is cullOffscreen useful for a full-page capture?
It is intended to skip off-viewport nodes for viewport-sized captures. It does not expand the region being rendered.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, 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 minuteQuick 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.

