DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
frontend debugging

How to Fix html2canvas Input Text Cropping When Fonts Change

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

When an html2canvas screenshot cuts off text inside an <input> after a font change, first wait for the intended font to finish loading and for layout to settle. Then verify the input’s computed font, content-box height, line-height, and vertical padding. html2canvas draws the input value itself and clips that drawing to the input’s content box, so a fallback font, changed metrics, or insufficient inner height can expose the crop. This sequence is a diagnosis, not a guaranteed fix for every browser or font.

Identify which kind of cropping you have

Before changing options, locate the clipping boundary. There are two different failures:

  • Glyph clipping inside the control: only the input value is cut at the top, bottom, or inner edge of the field. This points to font readiness, input geometry, or an incompletely supported style.
  • Canvas or page clipping: the whole canvas, a large region, or the page edge is missing or blank. This is an output-dimension problem and follows a different diagnostic path.

Increasing windowWidth or windowHeight can help the second case, but it is unlikely to change text clipped at the input’s own content-box boundary.

Why a font change can expose the crop

In html2canvas’s input-rendering implementation, the renderer reads a font style and size from captured computed styles, obtains font metrics, paints the input value, and clips that drawing to the input content box. The connection between a font swap and a crop is therefore a reasoned diagnosis from the implementation, not a promise that every font-loading bug has the same cause.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

A web font may still be pending when capture starts. The browser can lay out the field with a fallback face, then replace it with a face whose ascent, descent, or line metrics differ. A dynamically applied font can also alter spacing after an early capture. A historical report described changed word and letter spacing after a JavaScript-loaded font, while the same font loaded statically through CSS did not show that difference. That report was opened March 26, 2020, used html2canvas 1.0.0-rc.5 in Chrome 80 on Ubuntu 19, and concerned spacing rather than this exact cropping symptom; it does not establish behavior in current releases.

Step 1: wait for fonts before capturing

For a font loaded from CSS or added dynamically, wait for the browser’s font-loading process and then allow layout to update. The Font Loading API’s document.fonts.ready promise is a practical synchronization point:

await document.fonts.ready;
// If your code just changed classes or styles, yield once for layout/paint.
await new Promise(requestAnimationFrame);
const canvas = await html2canvas(document.querySelector('#profile-name'));

If you know the exact face and weight, request it explicitly before capture:

await document.fonts.load('16px "Inter"', 'A sample value');
await document.fonts.ready;
await new Promise(requestAnimationFrame);
const canvas = await html2canvas(document.querySelector('#profile-name'));

Use the actual CSS family, weight, style, and stretch in the font shorthand. A successful promise means the browser has completed its font-loading work; it does not guarantee that the font is available from every origin or that your CSS selected it.

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.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Step 2: confirm the input is using the intended face

Inspect the element immediately before capture. Do not assume that the requested family won the cascade.

const input = document.querySelector('#profile-name');
const styles = getComputedStyle(input);
console.table({
  fontFamily: styles.fontFamily,
  fontSize: styles.fontSize,
  fontWeight: styles.fontWeight,
  fontStyle: styles.fontStyle,
  lineHeight: styles.lineHeight,
  height: styles.height,
  paddingTop: styles.paddingTop,
  paddingBottom: styles.paddingBottom,
  boxSizing: styles.boxSizing,
  clientHeight: input.clientHeight,
  scrollHeight: input.scrollHeight
});

Check the browser’s computed font-family, not only the rule you intended to write. If it shows a fallback family, check the font URL, CORS response, family name in @font-face, requested weight, and whether a later rule overrides the input. Capture once before the font swap and once after document.fonts.ready and a layout frame. If only the immediate capture fails, concentrate on asynchronous font or style application. If both captures fail, inspect geometry and supported CSS behavior.

Step 3: inspect the input’s content box

html2canvas clips the painted input value to the content box. The CSS height you see may include padding and border, depending on box-sizing, leaving less inner room than expected. Check these values in DevTools’ Computed panel and in the box-model diagram:

  • Height: make sure the content area can contain the selected face and size.
  • Line-height: compare it with the font size; an inherited or unusually small value can move glyphs outside the clip.
  • Vertical padding: large top and bottom padding reduces available content height.
  • Border: borders consume space when the control uses border-box.
  • Box sizing: determine whether the declared height is the border box or content box.

Run a controlled experiment rather than changing everything at once. Temporarily increase the input height or reduce vertical padding. If the clipping boundary moves or disappears, geometry is involved. For a more stable baseline, give the control an explicit line-height and enough height for the selected font:

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.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
input {
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  line-height: 40px;
  font: 400 16px/40px "Inter", sans-serif;
}

That rule is an example, not a universal value. Match the control’s design and test the actual browser, font, weight, and text content used by your page.

Step 4: separate an input clip from a canvas clip

If the entire output is clipped, blank, or missing below a certain page size, test the documented canvas-dimension guidance:

const target = document.querySelector('#long-page');
const canvas = await html2canvas(target, {
  windowWidth: target.scrollWidth,
  windowHeight: target.scrollHeight
});

Browser canvas limits vary, so a very large capture can still fail even with correct dimensions. This option changes the rendering viewport and output context; it does not enlarge the input’s own content box. Use it for page-level clipping, not as the first response to glyphs cut inside a field.

Step 5: use onclone for a capture-only diagnostic

html2canvas can clone the document and invoke an onclone callback before rendering. That lets you test a larger control or a known fallback font without changing the live page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
const canvas = await html2canvas(document.querySelector('#profile-name'), {
  onclone: (clonedDocument) => {
    const clonedInput = clonedDocument.querySelector('#profile-name');
    if (!clonedInput) return;
    clonedInput.style.height = '44px';
    clonedInput.style.lineHeight = '44px';
    clonedInput.style.paddingTop = '0';
    clonedInput.style.paddingBottom = '0';
    clonedInput.style.fontFamily = 'Arial, sans-serif';
  }
});

If the enlarged or fallback-font clone renders correctly, that is evidence about geometry or typography. It is not a universal fix: the override may change the appearance, and the clone may not reproduce every runtime condition. Keep the callback limited to capture-time experiments until you have verified the result on your target browsers.

Build a minimal reproduction before filing an issue

When timing and geometry checks do not explain the crop, reduce the page to one input, one font declaration, and one capture call. Record:

  • browser name and version, operating system, and html2canvas version;
  • the input’s complete CSS, including inherited styles;
  • font-loading method: static CSS, JavaScript insertion, preload, or another mechanism;
  • font family, weight, style, and the exact value being captured;
  • whether the same font loaded statically behaves differently;
  • whether the crop occurs in the live page, the canvas, or both.

The project FAQ explains that CSS properties must be implemented manually and that html2canvas does not provide full CSS support. If a property appears unsupported or incomplete, the recommended next step is a focused test case and an issue describing the failing behavior. Avoid treating an old spacing report as proof of a current input-cropping defect.

Common symptoms, causes, and fixes

Symptom Most useful check Likely action
Only the first capture after a font swap is cropped Compare capture before and after document.fonts.ready Await font readiness and one animation frame before capture
Text is cut at the input’s top or bottom edge every time Inspect content height, line-height, padding, and box sizing Increase inner height or reduce vertical padding; verify with a clone override
Computed family is a fallback Read getComputedStyle(input).fontFamily Fix font loading, family naming, weight selection, or CSS cascade
The whole page or canvas is truncated Compare output bounds with element scroll dimensions Test windowWidth and windowHeight; consider browser canvas limits
Live DOM looks correct but canvas differs Make a minimal case and check supported CSS Use onclone diagnostically and document the exact release and browser
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and reliability considerations

Font synchronization adds waiting time only when a font is not ready, but capturing a large element still consumes memory and can hit browser canvas limits. Keep the target as small as practical while diagnosing. Avoid using a long arbitrary delay as your primary fix: it can make fast pages slower and still race a font or stylesheet that has not completed. A deterministic font promise followed by a rendering frame is easier to reason about.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Test with cold and warm caches. A cached font can hide a race that appears on a first visit. Also test the exact font weights used by the input; loading a regular face does not necessarily load a bold face. If the page depends on JavaScript that changes classes or styles, wait until that code has completed before invoking html2canvas.

Or skip the browser setup

For repeatable server-side screenshots, ScreenshotNeo accepts one GET request and returns PNG, JPEG, WebP, or PDF. Its capture pipeline accepts cookie and consent banners before removing more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

Use the API when you need a screenshot of the rendered page rather than a browser-side html2canvas canvas. The request below captures a page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for authentication and options. The service also supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper and page controls, HTML/CSS-to-image, custom JavaScript and CSS, pre-capture clicks, hidden selectors, waits for selectors, delays or network idle, request and resource blocking, headers, cookies, user agents, Authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.

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

For 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)

For 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}`);

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every feature is on every plan: 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account to try it.

A practical decision path

  1. If only input glyphs are clipped, wait for the intended font and inspect computed styles.
  2. If the clip follows the input edge, test content-box height, line-height, padding, and box sizing.
  3. If the entire canvas is clipped, test viewport dimensions and browser canvas limits.
  4. Use onclone to distinguish typography from geometry without altering the live page.
  5. If the behavior remains, create a minimal reproduction with complete environment and font-loading details.

Frequently Asked Questions

Does increasing html2canvas scale fix text clipped inside an input?

Not necessarily. Scale changes output resolution; it does not enlarge the input content box that clips the painted value.

Should I use a fixed timeout instead of document.fonts.ready?

A fixed timeout can race slow fonts and unnecessarily delay fast pages. Prefer the font-loading promise, followed by a layout frame when styles have just changed.

Can this be caused by an unsupported CSS property?

Yes. html2canvas documents that CSS support is incomplete and recommends a minimal test case when a property is missing or incomplete.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.