Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Call html2canvas(element) once for each selected element, then wait for the returned Promises before using the canvases. For a set of independent captures, Promise.all is concise; for a large set, a sequential for...of loop lets you avoid starting every render at once. Each canvas corresponds to the element at the same position in your selection.
Capture every matching element with Promise.all
html2canvas renders one element per call and resolves asynchronously with a canvas. Select the elements, turn the collection into an array, and map each element to a call. The following assumes html2canvas is installed in your project and the code runs in a browser context where the elements are present:
import html2canvas from 'html2canvas';
async function captureAll(selector) {
const elements = [...document.querySelectorAll(selector)];
const canvases = await Promise.all(
elements.map((element) => html2canvas(element))
);
return canvases;
}
const canvases = await captureAll('.capture');
querySelectorAll returns matching nodes in document order. Promise.all preserves the input order in its results, so canvases[i] is the rendered result for elements[i]. The array conversion makes the selection easy to map and reuse.
Recommended Free Tools
For a page with a collection such as cards, reports, or product tiles, add the same class to each target:
#1 Best Overall
- Model: Dell OptiPlex 7050 Small Form Factor (SFF)
- Processor: Intel Core i7-7700 3.60 GHz
- Memory: 32GB DDR4 Ram
- Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
- Operating System: Windows 11 Pro (64-bit)
<article class="capture">First card</article>
<article class="capture">Second card</article>
Then use captureAll('.capture'). If your script runs before the markup has been added, wait until the elements exist—for example, call the function from a handler that runs after rendering, or after the page’s DOM is ready.
Keep each canvas tied to its source element
If later processing needs to know which element produced a canvas, return a record for each capture instead of relying on array indexes:
async function captureRecords(selector) {
const elements = [...document.querySelectorAll(selector)];
return Promise.all(
elements.map(async (element) => ({
element,
canvas: await html2canvas(element),
}))
);
}
const records = await captureRecords('.capture');
for (const { element, canvas } of records) {
console.log(element, canvas);
}
This makes the association explicit if you filter results, attach status information, or pass captures to another part of your application. It does not change what html2canvas renders: each call still reconstructs a rendering for one DOM element.
Use a sequential loop when you want to limit simultaneous work
Promise.all starts all mapped calls without waiting between them. For a long list of large targets, you may prefer to await each render before starting the next:
Rank #2
- AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
- FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
- FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
- UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
- A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.
async function captureSequentially(selector) {
const elements = [...document.querySelectorAll(selector)];
const canvases = [];
for (const element of elements) {
canvases.push(await html2canvas(element));
}
return canvases;
}
Sequential processing is an implementation choice, not a documented guarantee that captures will be faster or avoid every resource limit. It avoids launching the whole batch at once, but it also means the routine waits for each capture in turn. Use concurrent aggregation for a modest set when simplicity and having all results together matter; use sequential processing when you want to control how much rendering work is in flight.
Choose rendering options for the problem you have
Pass an options object as the second argument to each call. Keep defaults unless a specific setting addresses a visible issue; options that affect viewport dimensions can change responsive layout and media-query behavior.
| Option or mechanism | When it may help |
|---|---|
scale |
Adjusts output scale; by default it follows the device pixel ratio. A larger output can increase canvas dimensions and memory use. |
width, height, x, y |
Set render dimensions or crop offsets when you need a particular output region. |
scrollX, scrollY, windowWidth, windowHeight |
Control aspects of the rendering viewport and scroll position. Be mindful that changing window dimensions can affect media queries. |
useCORS, proxy |
May help with external images when the remote server and browser security policy permit access. They do not bypass browser content restrictions. |
onclone |
Lets you make changes to the cloned document used for rendering, such as adjusting presentation before capture. |
ignoreElements or data-html2canvas-ignore |
Exclude unwanted nodes from a render; the attribute can be placed on content that should be ignored. |
Apply options consistently by passing the same object to each call, or compute options for each element if the targets need different dimensions:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
const canvases = await Promise.all(
elements.map((element) =>
html2canvas(element, { scale: 1, useCORS: true })
)
);
This example is illustrative: setting useCORS does not grant access to an image whose server or the browser does not allow cross-origin use.
Rank #3
- Performance: Powered by Intel Celeron N4500 dual-core processor with up to 2.8 GHz burst frequency and 4MB L3 cache, this HP Chromebook delivers smooth multitasking for everyday computing. With 4GB LPDDR4x-2933 RAM and Intel UHD Graphics, enjoy seamless web browsing, video streaming, and productivity apps. Chrome OS boots in seconds and updates automatically, keeping your laptop secure and running at peak performance for students, professionals, and home users.
- Immersive 14-Inch HD Display: Experience clear, vibrant visuals on the 14-inch diagonal HD (1366 x 768) anti-glare display with 250 nits brightness and 62.5% sRGB color accuracy. The micro-edge design maximizes your viewing area with an impressive 80% screen-to-body ratio, perfect for streaming movies, video calls, and document editing. The anti-glare coating reduces eye strain during extended use, making it ideal for all-day productivity and entertainment in any lighting condition.
- Advanced Connectivity & Ports: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.3 for seamless device pairing. Equipped with versatile ports including 1 USB Type-C 10Gbps (with USB Power Delivery and DisplayPort 1.4), 2 USB Type-A 5Gbps ports, 1 HDMI 1.4b, and 1 headphone/microphone combo jack. Connect external monitors, transfer files quickly, charge your device, and expand your workspace effortlessly for maximum productivity and flexibility.
- All-Day Battery & Premium Design: The battery keeps you powered throughout your day, while the included 45W USB Type-C power adapter ensures fast charging. Featuring a sleek modern grey finish with vertical brushing pattern on the keyboard deck, this lightweight 3.35 lb Chromebook combines style and portability. The full-size modern grey keyboard and HP Imagepad provide comfortable typing and precise navigation for work, school, or entertainment on the go.
- Enhanced Security & Multimedia: Built-in H1 secure microcontroller protects your data and privacy with enterprise-grade security. The HP True Vision 720p HD camera with integrated dual array digital microphones delivers crystal-clear video calls and online meetings. HD Audio with stereo speakers provides rich, immersive sound for music, videos, and calls. With 64GB eMMC storage, you have ample space for essential files while Chrome OS seamlessly integrates with Google Drive for cloud storage.
Export each result after capture
The returned value is a canvas, not a downloaded image file. For example, convert each canvas to a PNG data URL and create a download link:
function downloadCanvas(canvas, filename) {
const link = document.createElement('a');
link.download = filename;
link.href = canvas.toDataURL('image/png');
link.click();
}
const elements = [...document.querySelectorAll('.capture')];
const canvases = await Promise.all(
elements.map((element) => html2canvas(element))
);
canvases.forEach((canvas, index) => {
downloadCanvas(canvas, `capture-${index + 1}.png`);
});
Call export only after the awaited capture finishes. If the canvas contains a cross-origin image that taints it, reading pixels or exporting can fail; a library option cannot override that browser security restriction. For a different output format, use the canvas export method appropriate to that format and check its browser support and quality needs.
Understand the limits before treating a canvas as a screenshot
html2canvas is a DOM-based reconstruction tool, not a native screenshot of the browser’s rendered pixels. The project documentation warns that its output may not be fully accurate to the actual representation. Its result depends on the page information and CSS features the library supports.
CSS support is selective rather than complete. The project’s feature list identifies transform as having limited support and lists properties including box-shadow, filter, object-fit, and mix-blend-mode as unsupported. If one of those effects is important to the capture, inspect the feature list and consider whether a browser-level screenshot approach is more appropriate.
Rank #4
- [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
- [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
- [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
- [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
- [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
Canvas dimensions also face browser and device limits. The html2canvas FAQ gives examples such as maximum dimensions of 32,767 pixels and maximum area of 268,435,456 pixels for Chrome, and 32,767 pixels and 472,907,776 pixels for Firefox; it gives an 8,192-pixel dimension example for Internet Explorer and iOS examples that vary with device memory. The FAQ’s page date is not stated, and these are documentation examples—not a current universal guarantee for every browser, operating system, or device. A very large element or a large batch of high-scale captures can produce blank, clipped, or failed output. Consider reducing scale, capturing smaller targets, or processing sequentially. The FAQ also suggests setting rendering-window dimensions from an element’s scrollWidth and scrollHeight where appropriate.
Troubleshoot common capture failures
No canvases are returned or the results are empty
- Check that the selector actually matches elements when the capture function runs. Log
elements.lengthbefore mapping. - Make sure the function is awaited.
html2canvasreturns a Promise; accessing the results before it resolves means they are not ready. - If you use
Promise.all, one rejected capture rejects the aggregate Promise. Add error handling if the batch should report failures per element rather than stop as a whole.
External images are missing
Cross-origin images are governed by browser security rules and can taint a canvas. With allowTaint: false, html2canvas will not draw an image that would taint the canvas. The documentation describes CORS-enabled loading or a proxy as possible approaches, subject to the remote server’s policy and browser restrictions. Verify that the image host sends suitable CORS headers; do not assume useCORS: true will make an inaccessible image available.
The output is clipped, blank, or export fails
- Reduce the target dimensions or scale, especially if many large canvases are being held in memory together.
- Try sequential captures if concurrent rendering creates resource pressure.
- Check whether the canvas was tainted by cross-origin content before calling
toDataURLor otherwise reading its pixels. - If viewport settings were changed, compare the capture with the page at the same viewport: media queries may produce a different layout.
Shadows, filters, or image fitting look different
Check the documented CSS support for the property in question. Because html2canvas rebuilds an image from DOM and style information rather than taking a native screenshot, unsupported or partially supported styling cannot be fixed simply by changing loop structure.
Or skip the browser setup
If your goal is a screenshot of a public webpage rather than a separate canvas for selected DOM nodes, ScreenshotNeo can return an image or PDF from one request. It is not a drop-in replacement for html2canvas when you specifically need one canvas per matching element inside your app. It can be a simpler fit when you need captures of pages by URL.
Best Value
- 🖥POWERFUL PROCESSOR and SUPERIOR STORAGE: Configured with top of the Intel Core i5 processor for lightning-fast, reliable and consistent performance to ensure an exceptional PC experience. 16GB RAM memory to smoothly run multiple applications and browser tabs all at once. 2TB HDD storage space to store apps, games, photos, music, and movies. Loaded with 16GB to zip through multiple tasks in a hurry without lag.
- 🖥️New 22 Inch Full HD (1920x1080) LED monitor: with 75hz, High-Quality panel with quick refresh rate and response time. With 1080p resolution, you can enjoy gaming or a modern computing experience. 22 Inch monitor has a Smart Contrast to provide optimized image quality. Bezel-less and sleek design with glossy finish, crisp edge-to-edge visuals. Wide Viewing Angles for clarity from any viewpoint. VESA Mountable and built-in tilt options allow for a variety of monitor configurations.
- ⌨️ +🖱️ RGB KEYBOARD AND MOUSE | RGB SPEAKER: 3 LED Colors - Blue, red, green, Backlight LED Lights for use at night time, looks amazing. The keyboard mouse and speaker are responsive, reliable, and probably plastered in RGB lights. It's important you pick the right one for your desktop.
- 💿 WINDOWS 10 Pro LATEST: A new installation of the latest Microsoft Windows 11 Professional 64 Bit Operating System software, free of bloatware commonly installed from other manufacturers. As Microsoft's latest and best OS to date, Windows 10 Pro 64 Bit will maximize the utility of each PC for years to come. Optional software such as Anti-Virus and Office 365 can also be easily downloaded through the Microsoft Windows App Store.
cURL example, with the target URL adapted from the documented example:
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. The same request can be made in Python or Node.js:
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}`);
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server offers screenshot and PDF tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick 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.

