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

Fix Persian rendering in html2canvas by isolating four variables in order: right-to-left direction, font readiness, spacing and wrapping, and the renderer mode. html2canvas has historical RTL support, but it reconstructs the DOM in the browser and does not implement every CSS property. A page that looks correct in the browser can therefore produce a canvas with reversed punctuation, separated glyphs, fallback-font metrics, or different line breaks.

The reliable approach is to record your exact environment, reproduce the failure in a small test page, wait for the intended font, test conservative RTL and spacing styles, and compare the default renderer with foreignObjectRendering where supported. Treat old issue comments as diagnostic clues rather than universal fixes.

Why Persian text can change in the captured canvas

html2canvas is a browser-side renderer. It reads a DOM element and reconstructs it as a canvas; it does not ask a server to render the page. The project also states: “Every CSS property must be manually implemented to render correctly, so html2canvas will never have full CSS support.” That limitation matters for Persian because shaping, bidirectional text, font metrics, line breaking and punctuation placement interact.

RTL support was added in historical project work, including pull request #2653, but that does not prove that every Persian layout works in every html2canvas release, browser or operating system. A visible failure may be an RTL-direction problem, a font-loading race, unsupported CSS, or a combination of them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
2PCS Universal Farsi (Persian Language) Keyboard Stickers, Matte Keyboard Stickers with White Font on Black Background for Laptops or Desktops, Keyboard Alphabet Replacement Stickers
  • The Farsi keyboard stickers are made of matte finish material, it is durable and waterproof, can be used for long time without fading or wearing off.
  • Size of Each Key Sticker: 0.43" x 0.51"]
  • Package contents: 2 pcs of laptop keyboard stickers
  • High quality stickers, designed for any computer, desktop, laptop, notebook, PC Keyboards.
  • Easy to apply and remove. You can easy to turn the keyboard to another language by choosing one you need.

Start with a reproducible diagnosis

Record the environment

  • Installed html2canvas version.
  • Browser name and version, operating system, and whether the capture runs in a normal tab, iframe or automation context.
  • Font family, font source (local, same-origin or remote), and the CSS that selects it.
  • The element’s computed direction, unicode-bidi, alignment, spacing and wrapping rules.
  • Whether the failure affects Persian-only text, mixed Persian and Latin text, punctuation, or all of them.

Historical reports cover different versions and browsers. A workaround that helped an old release is not evidence of a current defect or a universal solution.

Make a small comparison page

Use one short Persian-only line, one mixed-direction line and the exact font and styles from the failing component. Compare the browser DOM with the resulting image. For example:

<div id="capture" lang="fa" dir="rtl">
  <p class="fa-only">این یک آزمایش کوتاه است.</p>
  <p class="mixed">نسخه 2.0 — html2canvas</p>
</div>
<script>
  document.fonts.ready.then(async () => {
    const canvas = await html2canvas(document.querySelector('#capture'));
    document.body.appendChild(canvas);
  });
</script>

Keep the test case small enough that you can change one variable at a time. The project’s FAQ recommends a reproducible test when a CSS property is missing or incomplete.

Check RTL direction and bidirectional content

Set direction at the component boundary

Apply dir="rtl" or direction: rtl to the element being captured, not only to a distant page wrapper. Set alignment explicitly when the design requires it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#capture {
  direction: rtl;
  text-align: right;
}

Inspect the computed value in developer tools. If Persian-only text is correct but Latin fragments, numbers or punctuation move, the problem is likely bidirectional ordering rather than missing Persian glyphs. Test the mixed line separately and avoid changing several bidi properties at once.

Do not assume RTL support means full CSS support

The project history confirms that RTL support was added, while the documentation still cautions that CSS support is incomplete. Therefore, test your exact release and browser. If the browser DOM is correct but the canvas is not, preserve the minimal example for an issue report instead of assuming that adding more direction rules will help.

Rank #2
Persian Language Keyboard Skin Compatible for 2026-2022 MacBook Air 13.6 & 15 M5 M4 M3 M2 A3449 A3448 A3241 A3114, MacBook Pro 14 & 16 M5-M1 A3426 A3427 A3434 A3428 A3429 A3403, MacBook Neo 13 A18 Pro
  • Uhamn silicone keyboard cover skin is designed to be Compatible for 2026 MacBook Neo 13 inch A18 Pro Chip, Compatible for MacBook Pro 16 inch M5 / M4 / M3 / M2 / M1 Pro/Max chip 2026-2021 model A3428 / A3429 / A3403 / A3186 / A2991 / A2780 / A2485, Compatible for MacBook Pro 14 inch M5 / M4 / M3 / M2 / M1 Pro/Max chip 2026-2021 model A3426 / A3427 A3434 / A3401 / A3112 / A3185 / A2918 / A2992 / A2779 / A2442, Compatible for 2026-2022 MacBook Air 13.6 inch M5 M4 M3 M2 chip model A3449 / A3240 / A3113 / A2681, Compatible for 2026-2023 MacBook Air 15.3 inch M5 / M4 M3 M2 chip model A3448 / A3241 / A3114 / A2941 --- You can check the product description for more compatible details.
  • Please check your MacBook model number "A1xxx" on back of the MacBook to confirm the compatibility. This is US version MacBook keyboard skin ("Enter" key is a rectangle), don't fit EU versions ("Enter" key looks like number "7")
  • The Persian keywords are printed on the keyboard cover, which is designed for those who use Persian or learning Persian.
  • Durable, washable, easy to apply and remove for cleaning .
  • Waterproof and dustproof, helps protect your keyboard from dust, dirt, scratches and liquid......

Wait for the Persian-capable font

A fallback font can have different glyph coverage, shaping behavior and character widths. Historical reports describe captures made before fonts were available and captures involving dynamically uploaded fonts; those reports are old and version-specific, but they make font readiness an essential check.

Use a font-readiness gate

await document.fonts.ready;
const target = document.querySelector('#capture');
const canvas = await html2canvas(target);

Run the capture only after the intended font has loaded. Confirm in developer tools that the computed font family is the one you expect, and compare a capture made before and after readiness. If the result changes, the original problem was at least partly a timing or fallback-metric issue. This gate does not guarantee correct Persian shaping when another CSS or renderer limitation is involved.

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

Check remote-font conditions

  • Verify that the font request succeeds before capture.
  • Confirm the font is usable in the page’s origin and frame context.
  • Do not diagnose glyph shaping from a capture taken while a user-selected font is still being uploaded or applied.
  • Keep the font declaration identical in the minimal test and the production component.

Test spacing and wrapping without destroying shaping

Separated-looking Arabic or Persian letters can result from CSS spacing or word splitting rather than from the font itself. Historical issue comments reported improvement after restoring normal letter spacing and avoiding aggressive word breaking. These are user-reported experiments, not official guarantees.

Run controlled CSS experiments

  1. Capture the baseline with the application’s current CSS.
  2. Temporarily set letter-spacing: normal.
  3. Remove character-level breaking such as word-break: break-word and capture again.
  4. Change only one rule per capture, then compare the images.
#capture .persian-text {
  letter-spacing: normal;
  word-break: normal;
  overflow-wrap: normal;
}

Do not treat these declarations as a universal Persian stylesheet. They are diagnostic controls that can reveal whether spacing or wrapping rules are causing the discrepancy. If your layout requires a deliberate overflow policy, restore it after identifying the failing rule and test a narrower alternative.

Compare html2canvas renderer modes

The documented foreignObjectRendering option can be compared with the default renderer in browsers that support it:

await document.fonts.ready;
const element = document.querySelector('#capture');

const normalCanvas = await html2canvas(element);
const foreignCanvas = await html2canvas(element, {
  foreignObjectRendering: true
});

This is an experiment, not a Persian-specific fix. Browser support, security restrictions and CSS behavior can differ between modes. Keep the mode that reproduces the required visual result in your supported browsers, and document the browser/version assumption in your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
JPYXKM Wireless Arabic Keyboard, Minority Language Ultra Thin Lightweight Silent Bluetooth Keyboards for Laptop/PC/Tablet/Desktop/Smart TV (Arabic)
  • 【ENHANCE YOUR WORKSPACE】Whether you are working from home or taking online courses, our keyboard will give you slim size, comfortable and ergonomic feel. Purpose built for Windows/Apple/Androids Systems, it features a 78-key layout, 6 multimedia keys, 10 languages, 13 shortcut keys, and visually stunning aluminum body.
  • 【STRONG WIRELESS CONNECTION】Connect With Bluetooth 3.0, the cordless keyboard establishes a stable connection from up to 32ft away via Bluetooth. This eliminates excess cables and clutter, providing a clean workspace.
  • 【A SOPHISTICATED TYPING EXPERIENCE】Each keycap on our low profile wireless USB keyboard is designed with a concave shape and scissor flexor technology. This allows for smooth and responsive keystrokes. Also, for wrist comfort, an angled kickstand is integrated.
  • 【SIMPLE SETUP】This slim keyboard is completely connect and play. Simply connect Bluetooth with your computer and begin. Also, two AAA batteries provides up to 2-3 months of run time. (not include batteries).
  • 【ADD LANGUAGES LAYOUT ON PC】-Open the start menu and select "Control Panel". -Select "Change keyboards or other input methods" under the Clock, Language, and Region section. -In the new window, click on the button that says "Change keyboards...". -Another window will open and show all currently installed keyboards. -Click "Add..." -International should now show on the list of keyboards installed. Click "Apply" and then "OK".

A complete capture routine for a controlled test

async function capturePersian(selector, options = {}) {
  const element = document.querySelector(selector);
  if (!element) throw new Error(`No element found for ${selector}`);

  if (document.fonts && document.fonts.ready) {
    await document.fonts.ready;
  }

  return html2canvas(element, {
    ...options,
    // Set this to true only for a supported-browser comparison.
    foreignObjectRendering: Boolean(options.foreignObjectRendering)
  });
}

const canvas = await capturePersian('#capture');
document.body.appendChild(canvas);

Use the routine in your minimal page first. Then add production features one by one—dynamic font loading, mixed-direction labels, custom spacing, and complex layout—so the first change that alters the output identifies the likely cause.

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

Troubleshooting common symptoms

Letters appear disconnected or unusually far apart

Check that the intended font is ready, then test letter-spacing: normal. Remove word-break: break-word or similar character splitting and recapture. If only the canvas is affected, compare renderer modes and retain the minimal reproduction.

Text is in the wrong visual order

Inspect computed direction on the captured element. Test a Persian-only line against a mixed Persian/Latin line. Explicitly set the component’s RTL direction and alignment, then determine whether punctuation or Latin fragments are the only misplaced parts.

The browser uses one font but the image uses another

Capture after document.fonts.ready, verify the font request and computed family, and compare before/after images. Historical font reports do not establish that every current html2canvas release mishandles fonts, so confirm the behavior in your installed version.

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

Line breaks differ from the DOM

Look for unsupported or partially implemented CSS, width changes, word-breaking rules and fallback-font metrics. Simplify the element, remove one layout rule at a time, and test the exact browser and html2canvas version.

foreignObjectRendering fails or changes the result

That option is conditional on browser support and is not documented as a Persian remedy. Test it only in a supported browser and keep the default renderer as a fallback when the alternate mode is unavailable or less consistent.

Rank #4
Farsi (Persian) Language Stickers for Keyboard Transparent Black Letters for Any Pc Computer Laptop Desktop Keyboards
  • High Quality Stickers for any Computer, Desktop, Laptop, Notebook Keyboards
  • Transparent Background Keyboard Computer Stickers with Black Letters
  • Perfect for Communication, Education, Learning a New Language, or Great Gifts!
  • Easy to Apply! Best way to Learn a Language

The minimal example still fails

Prepare an issue report containing the smallest HTML and CSS example, html2canvas version, browser and operating system, font-loading method, and the visible DOM versus canvas result. The project FAQ asks for a test case when a CSS property is missing or incomplete.

Performance and reliability considerations

  • Capture only the smallest element that meets your requirement; large full-page DOMs increase work and make font or layout races harder to diagnose.
  • Wait for fonts before every capture path, including user-selected or dynamically loaded fonts.
  • Keep a browser/version matrix for RTL and mixed-direction components instead of validating only one desktop setup.
  • Use deterministic test content containing Persian, Latin, numbers and punctuation so regressions are visible.
  • Do not infer correctness from a single screenshot. Compare the DOM and canvas after each controlled change.

Or skip the browser setup

If you need a clean website image rather than a browser-side reproduction, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF. It accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups and chat widgets before capture. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status.

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

See the ScreenshotNeo documentation for all options. A cURL request is:

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

ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. It supports full-page and selector captures, device and viewport settings, retina scale, custom CSS and JavaScript, waits, blocking rules, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture and a usage API.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Sign up free for ScreenshotNeo.

Frequently Asked Questions

Does upgrading html2canvas automatically fix Persian text?

No. RTL support exists in the project history, but CSS support is incomplete and behavior depends on the release, browser, font and styles. Reproduce the issue with your actual environment before changing versions.

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.

Should I always enable foreignObjectRendering for Persian?

No. The option is browser-dependent and is not documented as a Persian-specific fix. Compare it with the default renderer in the browsers you support.

Can a paid Persian font guarantee a correct html2canvas capture?

No. A suitable font can provide glyph coverage and metrics, but the available evidence does not establish that purchasing a font fixes html2canvas direction, shaping or CSS reconstruction.

What information belongs in an html2canvas bug report?

Include a minimal HTML/CSS reproduction, html2canvas version, browser and operating system, font source and loading method, and a comparison of the browser DOM with the captured canvas.

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.