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 →The dependable browser workflow is DOM element → canvas → Blob → FormData → fetch POST. Install @html2canvas/html2canvas, render the element into a canvas, convert that canvas asynchronously to a PNG Blob, append it to FormData, and send the form with fetch. Do not set the multipart Content-Type header yourself; the browser must add the boundary.
This method is useful for a user-selected card, report, invoice, or other region already displayed in your page. It is not a pixel-perfect browser screenshot: html2canvas reconstructs the image from DOM and CSS information, so cross-origin assets, iframes, unsupported CSS, and very large canvases need special handling.
Complete browser example
Install the package in the application that owns the page:
npm install @html2canvas/html2canvas
Give the target an identifiable element and a button:
#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.
<section id="receipt">
<h2>Order 1842</h2>
<p>Two items · Total $48.00</p>
</section>
<button id="upload" type="button">Upload screenshot</button>
The following module captures that section at the device-pixel ratio, creates a PNG Blob, and uploads it as the multipart field screenshot:
import html2canvas from '@html2canvas/html2canvas';
function canvasToBlob(canvas, type = 'image/png', quality) {
return new Promise((resolve, reject) => {
canvas.toBlob(blob => {
if (blob) resolve(blob);
else reject(new Error('Canvas conversion failed'));
}, type, quality);
});
}
export async function captureAndUpload(element, endpoint) {
const canvas = await html2canvas(element, {
scale: window.devicePixelRatio,
useCORS: true
});
const blob = await canvasToBlob(canvas, 'image/png');
const formData = new FormData();
formData.append('screenshot', blob, 'screenshot.png');
const response = await fetch(endpoint, {
method: 'POST',
body: formData
});
if (!response.ok) throw new Error(`Upload failed: ${response.status}`);
return response;
}
document.querySelector('#upload').addEventListener('click', async () => {
const button = document.querySelector('#upload');
button.disabled = true;
try {
await captureAndUpload(document.querySelector('#receipt'), '/upload');
alert('Uploaded');
} catch (error) {
console.error(error);
alert(error.message);
} finally {
button.disabled = false;
}
});
The /upload URL and response format belong to your application. Your server must parse multipart form data, authenticate the request, validate the declared and detected type, enforce a size limit, and choose a storage and retention policy.
How each stage works
1. Render a DOM region
html2canvas(element) returns a Promise that resolves to a canvas. Pass the exact element whose visible content you want. The library builds a representation from DOM information; it does not ask the browser for the same native bitmap produced by an operating-system screenshot.
2. Choose scale and output type
scale: window.devicePixelRatio preserves detail on high-density displays, but increases pixel count, memory use, conversion time, and upload size. A fixed value such as 1 is safer for large reports. toBlob() is asynchronous and uses PNG when no supported type is supplied. PNG is lossless and handles text and transparency well. JPEG can be smaller for photographic content:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
const jpeg = await canvasToBlob(canvas, 'image/jpeg', 0.85);
formData.append('screenshot', jpeg, 'screenshot.jpg');
A null Blob indicates conversion failure. A canvas that contains disallowed cross-origin pixels can also make toBlob() raise a security error.
3. Build multipart data
FormData.append(name, blob, filename) supplies a normal file part. Add ordinary fields when needed:
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.
formData.append('screenId', 'receipt-1842');
formData.append('capturedAt', new Date().toISOString());
Do not add Content-Type: multipart/form-data to the fetch headers. The browser generates the boundary and the complete header when it sees a FormData body. Manually supplying the header commonly produces an unparsable request.
4. Check the response
Fetch resolves even for HTTP errors, so check response.ok (or explicitly accept the statuses your API uses). Return JSON, an upload ID, or a storage URL according to your endpoint contract.
Capture variations
Selected rectangle
When you need a crop rather than an element, render the relevant container or use the library’s position and size options. Supply x, y, width, and height in CSS pixels. Ensure the coordinates describe the same viewport and scroll position used for the render.
Full-page content
For a long page, set windowWidth and windowHeight to the document or target’s scroll dimensions and capture an element containing the full content. A full-page canvas can exceed browser dimension or area limits; split the page into sections or reduce scale when the output is blank, clipped, or partially rendered.
const target = document.documentElement;
const canvas = await html2canvas(target, {
windowWidth: target.scrollWidth,
windowHeight: target.scrollHeight,
scale: 1,
useCORS: true
});
Wait for content before rendering
Capture only after fonts, images, and application data needed by the target are ready. In an SPA, wait for the component’s loaded state rather than taking the screenshot immediately after navigation. A short application-controlled delay can help animations settle, but waiting for an explicit selector or state is more deterministic.
Hide controls or mark a capture state
Use a capture-specific class to hide buttons, focus rings, and transient UI, then remove it in a finally block:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →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.
target.classList.add('capture-mode');
try {
const canvas = await html2canvas(target);
// convert and upload canvas here
} finally {
target.classList.remove('capture-mode');
}
Cross-origin images, fonts, and iframes
Images and canvas tainting
Set useCORS: true only when the image server sends a suitable Access-Control-Allow-Origin response. The option cannot override a server’s policy. If the asset is not permitted, it may be omitted or taint the canvas, preventing safe export. A same-origin proxy that fetches the asset server-side and serves it from your origin is the usual remedy; configure that proxy with authentication, allow-lists, size limits, and content validation.
Cross-origin iframes
An iframe from another origin exposes no readable contentDocument to the parent page, so html2canvas cannot render its contents. Capture the iframe application from within its own origin, obtain an image from its owner, or use a real browser capture service instead.
CSS fidelity
Because the output is reconstructed, some browser effects, generated content, filters, plugins, video frames, and unsupported CSS can differ from what a user sees. Compare the result at the viewport and browser versions that matter to your application rather than assuming pixel identity.
Browser API and extension alternatives
Native visible-tab capture
A browser extension can use chrome.tabs.captureVisibleTab() or browser.tabs.captureVisibleTab(). This captures the visible tab through the extension platform, not a DOM reconstruction. It requires an extension manifest, the relevant permissions, an active tab, and an extension deployment model, so it is inappropriate for an ordinary web page without those privileges.
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 minuteHeadless browser automation
Puppeteer or Playwright run a real browser outside the page and are better when you need browser-level rendering, authenticated navigation, full-page screenshots, or server-side jobs. html2canvas depends on browser APIs and is not a Node.js server renderer by itself. Headless jobs require browser binaries, concurrency limits, timeouts, sandboxing, and a policy for pages that contain untrusted content.
Upload endpoint checklist
- Require authentication and authorize the user or tenant that owns the destination.
- Parse multipart data with a maintained server library; never trust the filename or MIME type alone.
- Apply request, part, and decompressed-image size limits before storing.
- Decode the image to verify its format and reject unexpected content.
- Generate a server-side object key instead of using a user-supplied filename as a path.
- Set retention, access control, malware scanning, and deletion rules appropriate to the image.
- Return a clear 2xx response and a machine-readable error body for failures.
Troubleshooting blank, incomplete, or rejected screenshots
The screenshot is blank
- Check that the element is connected, visible, and has non-zero dimensions at capture time.
- Wait until asynchronous data and images have loaded.
- Reduce
scaleand the capture area if the canvas exceeds browser limits. - Inspect cross-origin images and remove or proxy assets that cannot provide CORS permission.
- Disable transitions or animations while capturing so the cloned state is stable.
Images are missing
Confirm that each image URL is reachable and that its response includes an appropriate Access-Control-Allow-Origin header when it is not same-origin. useCORS: true is necessary in that case but is not sufficient without server cooperation. Cross-origin iframe contents remain inaccessible.
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
toBlob() returns null or throws SecurityError
The canvas may be non-origin-clean because a cross-origin resource was drawn without permission. Remove that resource, serve it through a controlled same-origin proxy, or capture with a browser-level tool. Also catch conversion errors and avoid proceeding with an empty upload.
The server says the multipart body is malformed
Remove any manually set Content-Type header and send the FormData object directly. Verify that the server’s multipart parser is enabled and that its field name matches screenshot.
The server returns 401, 403, 413, or 415
- 401/403: send the authentication mechanism your endpoint requires and verify origin and CSRF rules.
- 413: lower the pixel scale, choose JPEG where appropriate, or raise the server limit deliberately.
- 415: check the generated Blob type and the server’s accepted formats.
The upload succeeds but the image is wrong
Log the target’s dimensions, device-pixel ratio, scroll position, and application state at capture time. Compare an element capture with a smaller scale. If exact browser pixels, cross-origin frames, or video are mandatory, switch to extension or headless-browser capture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance, reliability, and cost decisions
Keep work bounded
Large DOM trees and high device-pixel ratios consume main-thread time and memory. Capture only the required element, avoid duplicate captures, and release references after upload. For repeated work, queue requests and apply back-pressure rather than launching many renders simultaneously.
Make retries safe
Use an idempotency key or client-generated capture ID so a retry after a network timeout does not create duplicate records. Abort a fetch with an application timeout, but remember that cancelling the browser request does not necessarily cancel server-side processing already received.
Protect user data
Screenshots can contain personal, financial, or secret information. Tell users what is captured, redact sensitive fields before rendering where possible, use HTTPS, and avoid logging image bytes or signed URLs in ordinary application logs.
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.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server when the target is a URL rather than an element inside your current page. One GET request returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
See the complete parameter list in the ScreenshotNeo documentation. This cURL call captures a URL without installing a browser:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Python request is:
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)
And 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}`);
Every plan includes its features. The Free plan provides 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up free for ScreenshotNeo to try it without a card.
Frequently Asked Questions
Can I upload a canvas directly with fetch?
Yes. Convert it with toBlob(), append the Blob to FormData, and send that FormData as the fetch body.
Free tools Windows power users keep installed
One-click scans. No signup required.
Why does html2canvas differ from a browser screenshot?
It reconstructs the image from DOM and CSS rather than capturing the browser’s final pixels, so unsupported styling and inaccessible resources can differ.
Should screenshots be PNG or JPEG?
Use PNG for text, UI, and transparency. Use JPEG with a chosen quality when photographic content and smaller files matter.
Can html2canvas capture another site’s iframe?
No. Cross-origin iframe documents are inaccessible to the parent page.
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.

