What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
For a quick image made inside the page, use html2canvas to render a DOM element to a canvas, then export the canvas as a PNG. It is not a literal capture of the browser’s pixels: html2canvas reconstructs the image from DOM and style information, so some CSS, cross-origin content, and frames may not appear as expected. If you need a screenshot of what a real browser rendered—especially in an automated job—use browser automation such as Playwright or Puppeteer instead.
Choose the capture method that matches your goal
“Screenshot the current page” can mean several different things. Pick based on where your code runs and whether you need an image of a page, an automated browser capture, or a live stream of a user-selected screen.
| Need | Suitable approach | What to expect |
|---|---|---|
| Save a page or element from code running in the page | html2canvas | Builds a canvas from DOM and style information; output may differ from the browser’s actual rendering. |
| Capture a browser page in an automated workflow | Playwright or Puppeteer | Controls a real browser; Playwright documents viewport and full-page screenshots. |
| Let a user choose a screen, window, or tab for sharing or recording | getDisplayMedia() |
Prompts for a display surface and returns a media stream, not a one-time screenshot image. |
| Capture a tab from a browser extension | The target browser’s extension screenshot API | Use the browser’s current API documentation and check permissions and restrictions. |
The examples below focus first on an in-page PNG, then show when browser automation or screen sharing is a better fit.
Save the current page as a PNG with html2canvas
Load html2canvas using the setup documented by its project, then run this code in a browser page where document is available. This version waits for rendering, creates a temporary download link, and reports failures rather than silently doing nothing.
#1 Best Overall
- 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.
import html2canvas from 'html2canvas';
async function savePageScreenshot() {
try {
const canvas = await html2canvas(document.body);
const link = document.createElement('a');
link.download = 'screenshot.png';
link.href = canvas.toDataURL('image/png');
link.click();
} catch (error) {
console.error('Could not create or export the screenshot:', error);
}
}
savePageScreenshot();
The import syntax assumes a JavaScript build setup that can resolve the installed package. For the project’s supported setup, consult html2canvas Getting Started. The important sequence is: await the library’s Promise, export the resulting canvas, and trigger a download. The simpler documented pattern uses html2canvas(document.body).then(...); async/await makes the same asynchronous step more explicit.
Capture one element instead of the whole document
If you only need a card, report, or other component, pass that element rather than document.body. Check that the selector exists before calling the library:
import html2canvas from 'html2canvas';
async function saveElementScreenshot() {
const element = document.querySelector('#capture');
if (!element) {
throw new Error('No element matches #capture');
}
const canvas = await html2canvas(element);
const link = document.createElement('a');
link.download = 'element.png';
link.href = canvas.toDataURL('image/png');
link.click();
}
saveElementScreenshot().catch(console.error);
Choose an element whose rendered area you intend to export. Passing document.body is not a guarantee that every layout will yield a complete full-page image; verify the resulting dimensions and content for your page.
Rank #2
- 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.
What the canvas represents
html2canvas walks the DOM and uses available element and style information to construct a canvas. Its documentation cautions that the result “may not be 100% accurate to the real representation” because it does not take an actual screenshot. Treat it as a convenient DOM-derived rendering, not a pixel-perfect record of browser output. Check the saved file for missing or altered styles, fonts, images, and other visual details.
Capture an actual browser rendering with Playwright
When the screenshot is for a test, documentation, or a server-side job, use an automation framework that launches and controls a browser. Playwright’s Page API supports viewport screenshots and a fullPage option for the entire scrollable page. For example, once you have a Playwright page navigated to the target URL:
await page.goto('https://example.com');
await page.screenshot({ path: 'page.png' });
await page.screenshot({ path: 'full-page.png', fullPage: true });
The first call captures the page viewport; the second asks Playwright for a full-page capture. See the Playwright Page API for the current screenshot options and Playwright’s screenshot guide for examples. Playwright also documents options such as masking specified elements and omitting the background for transparency. The provided snippet assumes you already have a configured browser and a page object; it is not a substitute for the project’s installation and launch steps.
Rank #3
- 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.
When Puppeteer is the better fit
Puppeteer is another JavaScript browser-automation library. Chrome for Developers describes it as a tool for browser automation that includes screenshots and PDF generation. Choose between Puppeteer and Playwright based on the browser workflow and options your project needs; do not use html2canvas when the requirement is specifically a capture of the real browser’s rendered pixels.
Use getDisplayMedia only for user-selected screen capture
getDisplayMedia() is for a user who chooses a screen surface—such as a display or window—and grants access. It returns a media stream that an application can record or share; it is not a silent shortcut for saving the current webpage as a PNG. Chrome documents controls for privacy, including excluding the current tab and configuring audio capture. See Chrome’s screen-sharing controls documentation before implementing such a flow.
Understand the main limitations before exporting
Cross-origin images can taint the canvas
Images loaded from another origin may make a canvas unreadable under browser security rules. html2canvas cannot bypass those policies. A page may display an image normally while exporting the canvas with toDataURL() still fails. A proxy may be necessary for assets you are authorized to retrieve; use only a proxy you control or trust, since it will handle the requested resources.
Rank #4
- 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 are inaccessible
Same-origin frames can be rendered recursively, but a cross-origin iframe cannot be read through the page’s DOM because of browser security restrictions. If important content lives in another origin’s frame, do not assume the parent page’s canvas will include it. Use an authorized capture approach that can access the rendered browser surface, or capture content from a context with the appropriate origin access.
Full page, viewport, and element are different targets
A viewport image shows the visible browser area; a full-page image covers the scrollable page; an element image isolates a specific DOM node. With Playwright, use fullPage: true for its documented full-scrollable-page option. With html2canvas, selecting document.body alone does not promise a full-page result for every layout, so inspect the canvas and adjust the capture target or dimensions as needed.
Canvas export must be allowed
Even when a canvas was created, export depends on whether it remains readable. Cross-origin resources can taint it, preventing toDataURL() from returning the image data. Keep the render and export inside the try/catch path, and investigate the assets and browser console if the export fails.
Best Value
- 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.
Run html2canvas in a browser context
The library relies on browser APIs such as window and document. It is not a Node.js screenshot engine by itself. For server-side captures, run a real browser through Playwright or Puppeteer rather than trying to call html2canvas without a page environment.
Troubleshoot a missing or incorrect screenshot
- The import fails: The page or bundler is not resolving html2canvas. Follow the project’s setup instructions for your environment and make sure the function runs after the library is available.
- The image looks unlike the page: This is a DOM reconstruction, not a browser-pixel screenshot. Check unsupported or incompletely implemented CSS, fonts, images, and the actual saved output. Use Playwright or Puppeteer when fidelity to the real browser rendering is essential.
- Export throws a security error: A cross-origin image or other resource may have tainted the canvas. Check asset origins and browser security restrictions; html2canvas cannot override them.
- Frame content is missing: A cross-origin iframe cannot be accessed recursively from the parent. Treat it as an origin boundary, not as a selector or timing bug.
- The capture omits content below the fold: The chosen target or its dimensions may not represent the entire page. Confirm whether you need a viewport, element, or full-scrollable-page capture; Playwright documents
fullPage: truefor the latter. - Nothing downloads: Confirm the Promise resolved, that the link is created with a non-empty data URL, and that the download code runs in a browser page. Log rejected Promises and inspect the browser console.
Or skip the browser setup
If you need a screenshot from a URL without writing page-capture code or configuring a browser automation job, ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request returns PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be switched off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify 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.
For example, save a WebP screenshot of a page with cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for the request parameters and response details. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free to try it.
Recommended Free Tools
Frequently Asked Questions
Can html2canvas capture a page without the user clicking anything?
It can run from JavaScript already executing in the page. That differs from getDisplayMedia(), which prompts the user to select a display surface.
Can I use html2canvas in Node.js?
Not by itself: it depends on browser APIs such as window and document. Use browser automation such as Playwright or Puppeteer for a server-side job.
Does html2canvas save a PDF?
The examples here export a canvas as an image. For automated browser PDF generation, Puppeteer is documented as supporting PDF generation; ScreenshotNeo’s API also returns PDFs.
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.

