What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To save a specific <div> as an image in a web app, use html2canvas to render the element into a canvas, then download that canvas as a PNG. This is a browser-side reconstruction of the element—not a pixel-perfect screenshot—and cross-origin images or unsupported CSS can affect the result.
Save a div as a PNG with html2canvas
The basic flow is: select the element, render it with html2canvas, turn the resulting canvas into a data URL, and trigger a download. Install and import html2canvas using the package setup appropriate for your project; the project’s getting-started guide documents passing an element to the function.
import html2canvas from 'html2canvas';
async function saveDivAsPng() {
const element = document.querySelector('#capture');
if (!(element instanceof HTMLElement)) {
throw new Error('Could not find the element to capture.');
}
const canvas = await html2canvas(element);
const link = document.createElement('a');
link.download = 'capture.png';
link.href = canvas.toDataURL('image/png');
link.click();
}
document.querySelector('#save-button')?.addEventListener('click', () => {
saveDivAsPng().catch((error) => {
console.error('Image export failed:', error);
});
});
In this example, the page contains an element with id="capture" and a button with id="save-button". If your project loads the library another way, keep the function and adapt the import. Run the capture in response to a user action, such as clicking the save button, and give the output a useful filename.
Wait until the content is ready
If the div contains data, fonts, or images loaded asynchronously, capture it only after those resources and the content have settled. Otherwise the canvas may reflect an earlier state, before the visible page is complete. A selector check is also important: passing a missing element cannot produce the intended capture.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- Features an 8 Megapixel camera for capturing Ultra High Definition live images up to 3264 x 2448 pixels
- High frame rate for lag-free live streaming – streams at up to 30 fps at full HD, and up to 15 fps at 3264 x 2448 pixel
- Fast focusing speed helps minimize interruptions for frequent switching between different materials; features Sony CMOS Image Sensor for exceptional noise reduction and color Reproduction – great for capturing in dimly lit environments
- Designed and made in Taiwan. Multi-jointed stand offers a simple fix for tightening loose joints caused by heavy daily use.Max Shooting Area:13.46 inch x 10.04 inch
- Works with a variety of software and applications on Mac, PC and Chromebook that allows you to use it in different ways. System Requirements - Mac Intel Core i5 CPU 2.5 GHz or higher, OS X 10.10 or higher, Solid-state drive, and 200MB of free hard disk space, 256MB of dedicated video memory (For lag-free live streaming up to 1920 x 1080, and video recording of 1920 x 1080). Windows Recommended Requirements - Microsoft Windows 10,Intel Core i5 CPU 3.40 GHz or higher, 4 GB RAM, 200MB of free hard disk space, 256MB of dedicated video memory (For lag-free live streaming up to 1920 x 1080, and video recording of 1920 x 1080)
What html2canvas captures—and what it does not
html2canvas reads the DOM and builds a canvas-based representation using the styles and content it understands. It does not simply take a screenshot of the browser’s pixels. As the html2canvas project documentation explains, “As a result, it is only able to render correctly properties that it understands, meaning there are many CSS properties which do not work.” Check the output for your particular layout, especially when it uses complex styling.
- CSS fidelity: Supported properties and rendered appearance depend on the library’s implementation. Consult the supported-features documentation for the version installed in your app, and test the exact styles the element uses.
- Cross-origin iframes: The project documentation says cross-origin iframes cannot be rendered because the page cannot access their documents.
- Remote images: The browser’s canvas security rules apply. A remote image must be served with suitable CORS permission if it is to be included in an exportable canvas.
- Browser differences: The project lists current evergreen browsers, but compatibility does not mean every CSS feature or page will render identically across browsers.
For a requirement that the image exactly match the browser’s rendered pixels, DOM reconstruction may not be the right technique. Consider a browser screenshot workflow instead. That captures a page through a browser process, but it has different setup and security trade-offs from generating a canvas in the page.
Handle cross-origin images and canvas export errors
A canvas that includes pixels from an image the page is not allowed to read becomes “tainted.” In that state, the browser blocks export methods including toDataURL() and toBlob(). MDN Web Docs states: “Attempting any of these when the canvas is tainted will cause a SecurityError to be thrown.”
Rank #2
- Document camera with Image reversal function: The image reversal function can be realized through the button (no need to pass the software). When video chatting or picture output, the picture can be freely reversed left and right, up and down; The PAKOTOO document camera connects the computer via USB 2.0 cable, it does not support zoom and HDMI features, nor it does compatible with iPad.
- Document camera for teachers with 3 levels of brightness adjustment and 10 levels of exposure adjustment: The brightness function can be realized by buttons to ensure that you can get clearer images. It can also realize the Selfie fill light function in dark and bright environments
- Document camera for classroom with Foldable: Embedded design, takes up little space after folding, and is easy to carry; multi-joint supports multi-angle free rotation, which can better capture 2D and 3D objects. Maximum coverage area: 16.5" x 11.6" in (A3 paper)
- USB document camera with autofocus: 2448P high-definition document cameras, press the focus (AF) button once, and the document camera will automatically focus once. Move the object under the lens, the image will not be blurred. Macro captures objects as small as 3.94"
- Important: PAKOTOO Document camera is not plug and play. You need to select "USB Camera" in the system that comes with your computer. The document camera is equipped with a USB-C cable, which can be directly used with devices with USB-C interface such as MacBook. Compatible with Windows PCS, Macs and Chromebooks, works with Tiktok, Google Meet, Skyp-Microsoft Teams, Zoom; If you encounter any problems during the use of the product, or the computer does not recognize the camera, please be sure to contact our friendly support team for a quick solution.
For remote images that you need in the PNG, the html2canvas FAQ recommends trying useCORS: true when the image server sends the required CORS headers, or using a proxy when it does not. For example:
const canvas = await html2canvas(element, {
useCORS: true
});
useCORS: true asks the library to load images using CORS; it cannot grant permission that the remote server has not provided. If the server does not allow the request, use an image source you control or a correctly configured proxy. Do not rely on allowTaint: true to make a tainted canvas downloadable: allowing tainted content does not bypass the browser’s restriction on reading or exporting those pixels.
Choose output scale, background, and capture size
Capture options affect the image’s dimensions and appearance. Check the configuration reference for the version of html2canvas in your dependency rather than assuming an option or default is identical across versions.
Rank #3
- AIKOR 2MP 3-in-1 USB Webcam, Document Camera and Visualiser: It can be used as a webcam for video chats and teleconferences. The rotating lens allows for image clarity adjustment during live demonstrations. Featuring a flexible 0.47-inch diameter hose design, it can be adjusted to any angle.
- Portable Document Camera: This lightweight document camera weighs only 1.1 pounds, extends up to 20.4 inches in height, and features a 360-degree adjustable and rotatable camera for capturing images and videos from multiple angles. It can present objects of varying sizes and positions, and the weighted base ensures excellent operational stability. This document camera combines portability with high performance, making it an ideal choice for educators and professionals.
- Manual focus webcam: This document camera uses precise manual focus to avoid the repeated unclear focus caused by auto focus. It can achieve virtualized real-life effect shooting when needed, supports 1080P full HD resolution, and refresh rate up to 30 frames per second. Manual focus helps to stabilize the focus and restore the true color and texture.
- Versatile Document Camera: Equipped with a CMOS image sensor and built-in sealed silicon microphone to reduce noise and improve sound quality, achieving excellent noise reduction and color reproduction. Suitable for education, home and office (video conferencing, online teaching, online tutoring, home office, video calls, making teaching videos, animations, games and live demonstrations).
- High compatibility: The visualiser document camera comes with a USB-C cable and can be used directly with devices equipped with a USB-C port (such as MacBook). Compatible with Windows PC, Mac and Chromebook, and can be used with software such as TikTok, Google Meet, Skype, etc. It can be used with all major web conferencing software applications (Zoom, Google Meet, etc.).
| Need | Option or approach | What to consider |
|---|---|---|
| More pixels for a high-density display | scale |
The examples use scale: window.devicePixelRatio. A higher scale creates a larger canvas, so choose it based on the intended display or downstream use. |
| Transparent rather than white surroundings | backgroundColor: null |
The options reference describes white as the configured default. Transparency also depends on the element’s styling and what the renderer supports. |
| Control the rendering viewport | windowWidth and windowHeight |
These settings can affect appearance and dimensions. Use values appropriate to the layout you want rendered and verify the result. |
For example, a higher-density capture can be requested like this:
const canvas = await html2canvas(element, {
scale: window.devicePixelRatio
});
This is a size trade-off, not a guarantee of improved visual fidelity: increasing the pixel dimensions cannot add support for a CSS property the renderer does not implement. Large canvases also require more memory, so avoid an unnecessarily high scale.
Download as JPEG or WebP instead
PNG is the straightforward lossless choice for a general-purpose export. The canvas API also accepts formats such as JPEG and WebP through toDataURL(), where supported by the browser. For JPEG, specify a quality value between 0 and 1 if you want to control compression:
Rank #4
- [Crystal-Clear Imaging and Smooth Video Streaming] 8 Megapixel Ultra-High definition SONY camera captures live images at up to 3264 x 2448 pixels with lag-free video streaming at 30 fps across all resolutions.
- [Your Space-Saving Multi-Joint Camera] Experience the durability of our multi-joint design while enjoying a generous viewing size of 14.72 x 11 inches. This compact camera is perfect for your desktop set up.
- [Powerful Features, Crisp Image] Featuring LED light, and an anti-glare sheet for exposure challenges in varying lighting. 7-segment brightness control, image flip, and built-in mic ensure top-notch performance. Autofocus lens and macro capability (capturing objects as close as 3.9 inches).
- [Feature-Packed INSWAN Documate Software] The bundled full-function INSWAN Documate software offers digital zoom, image annotation, hue adjustment, image rotation/flip, video recording, snapshots and other useful features. Download the latest version for free and access tutorial videos!
- [Plug-n-Play & High Compatibility for Effortless Conferencing] The INS-1 comes with a USB-A cable for instant plug-and-play operation. Seamlessly works with Documate and other webinar software on PC (Windows 7/8/10/11), Mac (OS13.5 or higher), iPad (OS 17 or higher; must have a USB-C port) , Chromebook (38.0 or higher). Designed and made in Taiwan.
const dataUrl = canvas.toDataURL('image/jpeg', 0.9);
const link = document.createElement('a');
link.download = 'capture.jpg';
link.href = dataUrl;
link.click();
JPEG does not preserve transparency. Select the format based on whether the image needs a transparent background, broad compatibility, or smaller compressed output, and test it in the browsers your app supports.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Alternative workflow: render the div yourself
If the element consists of simple graphics, a direct canvas implementation can give you control over drawing and export without reconstructing arbitrary page CSS. This works best when you own the rendering logic and can draw each shape, text block, and image into the canvas yourself. It is not a drop-in method for capturing any existing styled div: you must reproduce the desired content and layout in drawing operations.
For an existing web page where the target is a particular DOM element, html2canvas is more direct. For an exact browser-rendered view, use a browser screenshot process. Choose according to whether you need DOM-based element selection, full rendered-page fidelity, or a custom drawing you control.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Best Value
- 8MP visualiser with adjustable image reversal: In video chat or image output, the image can be freely adjusted left/right and up/down; you can also manually adjust the reversed image that appears in the device to a normal image. The first usb camera that can manually adjust image reversal
- Adjustable Image Brightness: the usb document camera has brightness buttons, you can manually adjust the image brightness with 10 degree, to make sure that you can get the clear image. 3 levels of brightness adjustable, which can eliminate shooting problems under difficult lighting conditions, allowing you to capture objects in dark and bright environments, and it can also achieve Selfie fill-in function
- Foldable visualiser for teaching: embedded design, occupies a small space after folding, easy to carry; Multi-joint support with multi-angle rotate freely usb camera can capture 2D and 3D objects better and shooting high-definition images and videos. Maximum covering area: 16.5" x 116" in (A3 paper)
- 8MP/2448P document camera for teachers with 30fps: using High-end image sensor, it output ultra-high-definition images and videos live transmission, up to 2448P megapixels. Press the focus button once to automatically focus the document camera once. Moving the object under the lens, the camera will not be arbitrary automatic focus and the image dance. Macro can capture objects as close as 3.94"
- Plug-n-Play & High Compatibility: the Kitchbai Visualiser comes with a USB-C cable that allows for instant plug-and-play operation for distance education and web conferencing. It applicable to Windows PCS (Windows 7/8/10/11) , Macs (OS10.11 or higher), and Chromebooks(38.00 or higher), and work with Tiktok, Google Meet, Skyp-Microsoft Teams, Zoom; it has built-in dual silicon microphones, which can reduce noise and improve sound quality
Troubleshooting common export failures
The download does nothing
- Confirm that the selector matches an element and that the capture function runs after the save button is clicked.
- Check the browser console for a rejected capture promise or a security exception.
- Make sure the canvas is created before reading its data URL;
html2canvasis asynchronous.
Images are missing
- Wait for the image content to load before calling
html2canvas. - For images hosted on another origin, check that the server returns suitable CORS headers and try
useCORS: true. - If the image host does not permit CORS, use a permitted proxy or a source you control. The browser will not allow a tainted canvas to be exported.
The exported design differs from the page
- Check whether the relevant CSS properties are supported by the installed html2canvas version.
- Verify the configured scale, background color, and viewport dimensions against the desired output.
- Remember that the library reconstructs from DOM and styles rather than copying the browser’s pixels; for unsupported styling or embedded content, use a different rendering approach.
The image has a white background
White is the configured default in the options reference. Try backgroundColor: null if you need transparency, then confirm that the element and renderer preserve the transparent areas you expect.
The canvas throws a SecurityError
Look for cross-origin images in the captured element. The failure means the canvas cannot be read or exported under the browser’s security rules. The fix is to obtain valid CORS permission from the asset host or route the asset through an appropriately configured proxy—not to set allowTaint and expect unrestricted downloads.
Or skip the browser setup
If you need a screenshot of a published page rather than a particular local DOM node, ScreenshotNeo can return an image from one API request. It captures a URL, not an arbitrary div selected in your app; use html2canvas when the div itself is the required target. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or 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, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. Its MCP server provides screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.
Frequently Asked Questions
Can I save a div as SVG with html2canvas?
html2canvas produces a canvas representation for raster-image export; this workflow does not create a vector SVG of the element.
Can html2canvas capture a div on another website?
It operates on a DOM element the page can access. Browser same-origin restrictions prevent a page from reading another origin’s document, including a cross-origin iframe.
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.

