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.

When a text-shadow looks wrong in an html2canvas capture, first verify that it is really a text shadow, then compare an explicit scale, wait for web fonts to finish loading, and inspect the cloned document with onclone. html2canvas reconstructs a canvas from DOM and style information rather than copying the browser’s already-rasterized pixels, so a property can be officially supported without producing pixel-identical output in every browser, font, and device-pixel-ratio combination.

What html2canvas supports—and what it does not

The project’s feature list marks text-shadow as supported, but marks box-shadow as unsupported. They are different rendering effects:

  • text-shadow follows glyphs and is declared on text, for example text-shadow: 2px 2px 4px rgba(0,0,0,.35).
  • box-shadow follows an element’s rectangular box, border radius, and clipping.

If the artifact is around a card edge, rounded corner, or border, do not report it as a text-shadow failure. A historical report associated a black border artifact with border-radius and box-shadow in html2canvas 1.4.1; that report is not evidence of a text-shadow defect or of universal behavior today.

The project documentation describes html2canvas as taking “screenshots” directly in the user’s browser by recreating the page from the DOM. That architecture explains why computed styles, font metrics, scale, cross-origin images, and browser differences can affect the result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

1. Reduce the problem to one text node

Start with a minimal reproduction. Keep one element, one short string, a fixed font declaration, and the exact shadow. Remove transforms, filters, animations, pseudo-elements, gradients, and unrelated layout until the mismatch is easy to describe.

<!doctype html>
<style>
  #sample {
    font-family: Inter, Arial, sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #202124;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, .35);
  }
</style>
<div id="sample">Shadow test</div>
<button id="capture">Capture</button>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js"></script>
<script>
  document.querySelector('#capture').onclick = async () => {
    await document.fonts.ready;
    const canvas = await html2canvas(document.querySelector('#sample'), {
      scale: 1,
      logging: true
    });
    document.body.append(canvas);
  };
</script>

Record the html2canvas release, browser and operating-system versions, viewport size, device-pixel ratio, exact CSS, and whether the intended font had loaded. Save both the browser view and generated canvas. A useful report compares the same reproduction rather than a large application page.

2. Test scale as a controlled variable

The configuration reference says scale defaults to window.devicePixelRatio. That means the same CSS can be rasterized at different output resolutions on different displays. Capture the identical element twice: once with an explicit scale of 1, and once with the default. Do not change CSS, viewport, or font between runs.

const target = document.querySelector('#sample');
await document.fonts.ready;

const atOne = await html2canvas(target, { scale: 1, logging: true });
const atDefault = await html2canvas(target, { logging: true });

A project pull request is titled “fix: text-shadow blur-radius doesn't match scale.” The title is direct evidence that blur and scale have interacted in project-level work, but it does not prove that every current release has the same bug. If changing scale changes the shadow, report the exact scale values and library release. Avoid unexplained CSS offsets that merely hide the difference at one resolution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

3. Make sure the real font is ready

Fallback fonts can change glyph width, baseline, outline, and therefore the apparent shadow position. Before capture, wait for the Font Loading API:

if (document.fonts && document.fonts.ready) {
  await document.fonts.ready;
}
const canvas = await html2canvas(document.querySelector('#sample'));

For a specific family, check its status as well:

await document.fonts.load('700 48px Inter');
await document.fonts.ready;

An older issue for html2canvas 1.0.0-rc3 described squished or displaced text while fonts were downloading and attributed the symptoms to fallback metrics. It covered several browsers, but it is a historical user report, not a controlled statement about current releases. Verify the hypothesis on your exact version by capturing once before and once after font readiness.

4. Inspect the cloned document with onclone

onclone runs after html2canvas clones the document and lets you inspect or adjust only the capture copy. Use it to confirm that the target class, text, and computed styles survived cloning.

const canvas = await html2canvas(document.querySelector('#sample'), {
  logging: true,
  onclone: (clonedDocument) => {
    const copy = clonedDocument.querySelector('#sample');
    if (!copy) return;
    console.log('clone text:', copy.textContent);
    console.log('clone shadow:', getComputedStyle(copy).textShadow);
    console.log('clone font:', getComputedStyle(copy).font);
    copy.dataset.debug = 'html2canvas-clone';
  }
});

Use this hook for diagnostics, such as disabling an animation in the clone or adding a visible outline. Do not assume a style that exists in the original document is necessarily present in the clone; log the computed value that html2canvas will read.

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

5. Keep capture dimensions and timing deterministic

The configuration reference includes width, height, viewport dimensions, image-loading controls, and logging. Change only the option relevant to the symptom:

  • Use windowWidth and windowHeight when responsive CSS changes the font or layout.
  • Use width and height when you need a fixed capture boundary; do not use them to compensate for a shadow offset.
  • Wait for a known selector, a delay, or application-specific readiness before capturing dynamic content.
  • Keep animations paused or disabled so the text is not captured between frames.

Capture after layout has settled. For applications that load styles asynchronously, wait for the stylesheet and font promises your app owns, not just a fixed timeout.

Common symptoms and targeted fixes

Symptom Likely variable What to check
Blur is too wide or too narrow Scale interaction Compare scale: 1 with the default device-pixel-ratio scale.
Letters are squished or shifted Fallback font metrics Await document.fonts.ready, then compare computed font and shadow.
No shadow, or wrong shadow property Property confusion or clone styles Confirm text-shadow, inspect getComputedStyle in onclone, and check CSS specificity.
Dark outline around a rounded component box-shadow or border-radius Remove box effects and reproduce only the glyph shadow.
Different result on another machine Browser, font, or device-pixel ratio Record all versions, viewport dimensions, and explicit scale.

6. Build a useful bug report

Escalate only after the minimal page still fails. Include:

  • A self-contained HTML/CSS reproduction with one text node.
  • The exact html2canvas version and whether you used the non-minified build.
  • Browser and operating-system versions, viewport dimensions, and device-pixel ratio.
  • The requested scale (or that the default was used).
  • Whether the intended font was loaded before capture.
  • Console output with logging enabled and browser-versus-canvas comparison images.

Check the latest project release and current issue guidance before filing. An old issue template asked reporters to use the latest release, inspect the non-minified build, and include console information; treat that as historical reporting context, not a guarantee that the same template is current.

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

Or skip the browser setup

If you need a clean image or PDF rather than a DOM-reconstruction experiment, ScreenshotNeo provides a website screenshot API. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status.

One GET request is enough (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

Python:

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)

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}`);
const data = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', data);

ScreenshotNeo also offers an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. It supports full-page and selector captures, custom CSS and JavaScript, waits, blocking rules, headers and cookies, device presets, retina scale, PDF controls, signed links, asynchronous jobs, bulk capture, caching, and a usage API. Every feature is on every plan: 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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

FAQ

Does setting scale: 1 permanently fix text shadows?

No. It is a diagnostic control that makes output resolution explicit. Your correct value depends on the reproduction and target output; report the value that still fails.

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

Can I replace text-shadow with box-shadow?

No. They render different shapes, and html2canvas lists box-shadow as unsupported.

Best Value
Sale
JavaScript and jQuery: Interactive Front-End Web Development
  • JavaScript Jquery
  • Introduces core programming concepts in JavaScript and jQuery
  • Uses clear descriptions, inspiring examples, and easy-to-follow diagrams

Should I treat an old issue as proof of a current bug?

No. Historical reports identify useful hypotheses. Reproduce them with the current release, exact browser, font state, and scale before drawing a current conclusion.

Why does the browser look right while the canvas looks wrong?

The browser paints its own final pixels, while html2canvas rebuilds a representation from DOM and styles. Differences in font readiness, computed styles, scale, or browser behavior can therefore appear only in the generated canvas.

Frequently Asked Questions

Does setting scale: 1 permanently fix text shadows?

No. It is a diagnostic control that makes output resolution explicit. Your correct value depends on the reproduction and target output; report the value that still fails.

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

Can I replace text-shadow with box-shadow?

No. They render different shapes, and html2canvas lists box-shadow as unsupported.

Should I treat an old issue as proof of a current bug?

No. Historical reports identify useful hypotheses. Reproduce them with the current release, exact browser, font state, and scale before drawing a current conclusion.

Why does the browser look right while the canvas looks wrong?

The browser paints its own final pixels, while html2canvas rebuilds a representation from DOM and styles. Differences in font readiness, computed styles, scale, or browser behavior can therefore appear only in the generated canvas.

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$14.94
SaleBestseller No. 2
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05
SaleBestseller No. 3
SaleBestseller No. 5
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript Jquery; Introduces core programming concepts in JavaScript and jQuery; Uses clear descriptions, inspiring examples, and easy-to-follow diagrams
$22.80

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.

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