Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To convert an HTML table to a JPG, render the table to a canvas in the browser and call canvas.toDataURL('image/jpeg', quality). The example below captures the complete table—including content outside the viewport—sets a solid background, handles high-DPI displays, and downloads table.jpg. For repeatable server jobs, use a real headless browser or a screenshot API instead of a DOM-reconstruction library.

Choose the right conversion method

Your choice depends on where the table is rendered, how exact the image must be, and whether the conversion runs once or repeatedly.

Method Best for Important limitation Data and operating model
ScreenshotNeo Automated URL, HTML/CSS, scheduled, or batch captures Requires an API request and an accessible page or HTML payload Hosted API; clean shots remove consent banners, popups, and chat widgets, and only clean shots are billed
html2canvas in the browser A table already displayed in your page Reconstructs pixels from the DOM; unsupported CSS and cross-origin content can differ Runs client-side; table data does not need to leave the browser
Native browser screenshot A one-off manual image Not a repeatable or easily parameterized pipeline Interactive browser workflow
Puppeteer or Playwright Server-side jobs needing a real browser More setup, memory, and maintenance than client-side code You operate the browser process and its data access

A small, static, same-origin table is a good fit for html2canvas. A long-running export service, pages requiring JavaScript, or a high-volume schedule generally benefits from a headless browser or hosted API.

Convert the table in a browser with html2canvas

1. Give the table a stable selector

Use an ID or another selector that identifies only the table to export. Avoid selecting a parent that contains navigation, buttons, or unrelated content.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.
<table id="table-to-capture">
  <tr><th>Plan</th><th>Price</th></tr>
  <tr><td>Basic</td><td>$10</td></tr>
</table>
<button id="save-jpg" type="button">Save JPG</button>

2. Load the library and export JPEG

The following complete page uses the published CDN build, waits for the button click, captures the table’s full scroll dimensions, and starts a download. html2canvas returns a Promise that resolves to a canvas in modern evergreen browsers.

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas-next/1.8.0/html2canvas.min.js"></script>
<script>
document.getElementById('save-jpg').addEventListener('click', async () => {
  const table = document.getElementById('table-to-capture');

  try {
    const canvas = await html2canvas(table, {
      backgroundColor: '#ffffff',
      scale: window.devicePixelRatio,
      windowWidth: table.scrollWidth,
      windowHeight: table.scrollHeight,
      useCORS: true
    });

    const link = document.createElement('a');
    link.download = 'table.jpg';
    link.href = canvas.toDataURL('image/jpeg', 0.92);
    link.click();
  } catch (error) {
    console.error('Table capture failed:', error);
  }
});
</script>

Place the script after the table and button, or run the setup after the DOM has loaded. The browser’s download policy can require the click handler to be triggered by a real user gesture; do not move the download into an unrelated timer.

Control dimensions, sharpness, and file size

Capture the entire table, not just what is visible

The windowWidth and windowHeight options above use the element’s scrollWidth and scrollHeight. This includes columns and rows outside the current viewport, which prevents the common “only the visible part was saved” result. If a responsive stylesheet changes the table at a particular viewport width, set windowWidth to the layout width you actually want and test that breakpoint.

Use scale for high-DPI output

scale: window.devicePixelRatio gives a denser canvas on Retina and other high-density screens. A larger scale can improve text sharpness, but it multiplies pixel count and memory use. Very large values can hit browser canvas limits or cause the tab to run out of memory, so increase it gradually and test on the least powerful device you support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set a JPEG background and quality

JPEG has no alpha channel. The explicit white backgroundColor turns transparent regions into white instead of leaving an unexpected black or transparent-looking area. Change it to match your design, such as '#101820' for a dark table.

The second argument to toDataURL('image/jpeg', quality) is a value from 0 to 1. Higher values generally preserve more detail and produce larger files. A value of 0.92 is a practical starting point; the final byte size depends on the table’s text, colors, dimensions, and the browser’s encoder.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Crop or capture a different region

Selecting the table itself is the simplest crop. For a deliberate rectangle, html2canvas also accepts x, y, width, and height. Keep those coordinates in the same coordinate system as the element you are rendering, and verify the result when the page has zoom or transforms applied.

Make the rendered table stable before capture

Wait for data, fonts, and images

Call html2canvas only after your table rows have been inserted and the layout has settled. If rows arrive through fetch or another asynchronous operation, await that operation first. For image cells, wait for the images to finish loading; otherwise the canvas may contain empty boxes. Web fonts can also change column widths after the first paint, so wait for the document’s font loading to complete when your design depends on custom fonts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use deterministic styles

  • Give header and data cells explicit background and text colors.
  • Set borders, padding, and line height instead of relying on browser defaults.
  • Use a fixed or minimum table width when automatic column sizing could reflow between frames.
  • Hide interactive controls that should not appear in the JPG.
  • For dark themes, set both the table background and the capture background so JPEG conversion does not expose transparent gaps.

Cross-origin images, iframes, and CSS fidelity

html2canvas builds an image from the DOM and computed styles; it does not take a native operating-system screenshot. CSS that the library does not implement can be missing or rendered differently from the live page. Same-origin iframes can be read, but a cross-origin iframe cannot be accessed through its contentDocument because of browser security rules.

Images hosted on another origin can taint the canvas. useCORS: true works only when the image server supplies suitable Access-Control-Allow-Origin headers. If you control neither the image server nor its headers, serve the image through a same-origin proxy or replace it with a same-origin asset. A tainted canvas cannot be read reliably with toDataURL().

These restrictions matter for logos, avatars, chart images, and any table cell that embeds an external resource. Test the actual production origins rather than assuming that a local development page has identical permissions.

Long tables and browser canvas limits

A very tall or wide table can exceed browser-specific canvas dimensions or total-area limits. Current desktop Chrome, Firefox, and Safari implementations are often discussed around an approximate 32,767-pixel limit per dimension, with lower practical limits on iOS; the exact limit varies by browser release, device, and available memory. Treat that figure as rough implementation guidance, not a guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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 one canvas is too large

  1. Measure the intended output width and height before calling html2canvas.
  2. Split the table by row groups, such as 50 or 100 rows per image, and export each group with its own stable wrapper.
  3. Use a lower scale only after checking that text remains readable.
  4. Combine the resulting JPGs outside the browser if a single artifact is mandatory, or choose PDF for a paginated document.

Splitting is safer than silently receiving a blank canvas or a truncated image. Keep each segment’s header row so the exported pieces remain understandable.

Server-side and manual alternatives

Headless browser for repeatable jobs

Puppeteer and Playwright drive a real browser, so they can execute page JavaScript, wait for network activity, and capture the rendered result rather than reconstructing it from DOM information. They are appropriate for scheduled exports, authenticated dashboards, and pages whose CSS fidelity matters more than a zero-install client-side script. The trade-off is browser installation, process management, memory consumption, and the need to handle login, timeouts, and failed navigations.

For a one-off image, the browser’s built-in screenshot command or developer tools is faster than writing code. It is not a dependable pipeline: viewport, zoom, extensions, and manual timing can change each result.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Point it at a page containing your table, or use its HTML/CSS-to-image capability, and request a JPG without installing a browser locally. The API accepts a single GET request; the documentation is at https://screenshotneo.com/docs/.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/table.html -o table.jpg
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com/table.html"},
    timeout=90,
)
r.raise_for_status()
open("table.jpg", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com/table.html'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('table.jpg', data));
  • Cookie-consent banners are accepted and removed before capture, along with more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. The response identifies the result with X-Page-Verdict and X-Billed headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The Free plan includes 1,000 shots per month without a card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan.

When your table URL is public, this one-call approach avoids maintaining browser binaries and makes scheduled or bulk captures straightforward. Sign up free for ScreenshotNeo with 1,000 shots a month and no card.

Troubleshooting a blank, cut-off, or wrong JPG

The image is blank or all white

  • Confirm the selector returns an element: document.querySelector('#table-to-capture') should not be null.
  • Run the capture after rows are inserted and after the table is visible; an element with display: none has no useful layout to render.
  • Check the browser console for a security error indicating a tainted canvas caused by a cross-origin image.
  • Set backgroundColor explicitly and verify that your CSS is not painting white text on a white background.

Only the visible rows or columns appear

Use the table’s scrollWidth and scrollHeight for windowWidth and windowHeight, as in the complete example. If a parent has a restrictive width or overflow rule, temporarily capture a wrapper with the intended dimensions or adjust the layout before rendering.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Images or logos are missing

Ensure the image URLs are reachable, wait for their load events, and use useCORS: true only when the origin sends an appropriate CORS header. Otherwise move the assets to the same origin or proxy them.

Text is blurry or clipped

Increase scale in small increments, wait for web fonts, and inspect the resulting pixel dimensions. A very high scale can create a canvas that exceeds memory or dimension limits. Also check for CSS transforms, fractional widths, and cells whose content wraps differently at the chosen windowWidth.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Export fails only on very large tables

Measure the canvas size, reduce scale, or split the table into sections. iOS devices generally have less practical canvas capacity than desktop browsers. If you need one reliable server artifact, use a real headless browser or ScreenshotNeo rather than forcing one enormous client-side canvas.

The JPG looks different from the page

That is expected when the page uses CSS or browser features html2canvas does not implement, cross-origin frames, animations, or late layout changes. Freeze animations, wait for the final state, and compare against a native browser screenshot. If pixel fidelity is a requirement, capture with a real browser.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Privacy, reliability, and cost considerations

  • Privacy: html2canvas keeps the table in the user’s browser unless your own code sends the resulting file elsewhere. A hosted API receives the target URL and renders it remotely, so review the data exposure and access controls for private tables.
  • Reliability: Client-side output depends on the visitor’s browser, device memory, fonts, network, and CORS headers. Headless and hosted workflows centralize those variables but still need timeout, authentication, and retry handling.
  • Repeatability: Set a fixed viewport, wait condition, background, scale, and URL state. Record the page version or data timestamp if images are used in reports.
  • Cost: html2canvas and native capture add no service charge, but consume browser CPU and memory. Headless browsers add infrastructure cost. ScreenshotNeo’s Free plan provides 1,000 shots monthly without a card; paid plans begin at $5 for 3,000 shots, and only clean shots are billed.

FAQ

Can I preserve transparency in a JPG?

No. JPEG has no alpha channel. Choose a deliberate background color before export, or use PNG when transparent pixels are part of the required result.

Does html2canvas create a true browser screenshot?

No. It reconstructs an image from DOM information and computed styles. A real browser screenshot from Puppeteer, Playwright, or a hosted browser service is the better choice when exact rendering is more important than a client-only setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

How should I export a table that changes every few seconds?

Capture a defined state: stop or disable the animation, wait for the data request and fonts to settle, then render. For scheduled exports, move the workflow to a headless browser or API so timing is controlled outside an individual user’s tab.

Frequently Asked Questions

Can I preserve transparency in a JPG?

No. JPEG has no alpha channel. Choose a deliberate background color before export, or use PNG when transparent pixels are part of the required result.

Does html2canvas create a true browser screenshot?

No. It reconstructs an image from DOM information and computed styles. A real browser screenshot from Puppeteer, Playwright, or a hosted browser service is the better choice when exact rendering is more important than a client-only setup.

How should I export a table that changes every few seconds?

Capture a defined state: stop or disable the animation, wait for the data request and fonts to settle, then render. For scheduled exports, move the workflow to a headless browser or API so timing is controlled outside an individual user’s tab.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Bottom Line

Use html2canvas for a small, same-origin table already in the browser; use a real browser or ScreenshotNeo when you need repeatable, high-fidelity, or automated JPG exports.

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.