Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon 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×
FREEDOM251

Freedom251 › Blog › browser automation

How to Capture a Puppeteer Screenshot After an Indian-Language Web Font Loads

By Freedom251 Team · · 5 min read

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

Wait for the page’s target text to appear, then wait for the browser’s used fonts and layout to settle before calling page.screenshot(). If the exact font matters, explicitly request the intended face with document.fonts.load() and verify it loaded: document.fonts.ready alone does not prove the preferred font succeeded.

Capture the page after its text and fonts are ready

This Puppeteer workflow waits for the document to be parsed, confirms that the content you intend to capture is visible, waits for used fonts, and then saves a full-page PNG. Replace the example URL and selector with those for your page.

As an Amazon Associate I earn from qualifying purchases.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

  // Use a selector that identifies the actual content to capture.
  await page.waitForSelector('[data-screenshot-content]', { visible: true });

  // Wait for fonts currently used in the document and associated layout work.
  await page.evaluate(async () => {
    await document.fonts.ready;
  });

  await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

Puppeteer’s documentation covers navigation, page waits, and screenshot options. The Page API documents page.screenshot() and related methods. Navigation readiness and screenshot capture are separate: a page can reach DOMContentLoaded before client-rendered language content is present.

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

Request a specific script font when it is essential

If the capture must use a particular face, request it after the target content has appeared and before taking the screenshot. Use the exact CSS family name and weight configured for the page, and pass representative text so the browser can check the face for those characters.

await page.evaluate(async () => {
  const sample = document.querySelector('[data-screenshot-content]')?.textContent ?? '';
  await document.fonts.load('400 16px "Noto Sans Devanagari"', sample);
  await document.fonts.ready;
});

await page.screenshot({ path: 'page.png', fullPage: true });

This example is for Devanagari only, and only when that family is configured by the page. Substitute the correct script family, CSS weight, and sample text for your content. Check that the font request succeeded and inspect the rendered output when fidelity matters. A fulfilled promise is not, by itself, confirmation that the preferred face was used. See MDN’s Document.fonts reference for the browser API.

Choose a font stack for the language and scripts on the page

“Indian-language” does not identify one script or one font. Choose families for the actual languages and scripts in the captured content, as well as the weights, punctuation, digits, and symbols it needs. Noto recommends selecting script-specific families for the languages a site uses rather than loading its entire collection; its web-font guidance gives examples for Devanagari and Tamil.

Rank #2
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
body {
  font-family: "Noto Sans Devanagari", "Noto Sans", sans-serif;
}

For Tamil, use the corresponding Tamil family. A page containing multiple scripts may need a stack that covers each one; choose and verify it against the real text rather than assuming one family covers every glyph. Noto’s guidance also describes adding selected families through Google Fonts or using family names in CSS.

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

For a self-hosted font, check that the @font-face family name and weight match the CSS request and that the font file is reachable from the browser runtime taking the screenshot. If the requested face is unavailable, its request fails, or it lacks required glyphs, the browser may render fallback glyphs instead. Inspect the font status and network activity rather than diagnosing the cause from the image alone.

Understand what font readiness guarantees

The browser’s document.fonts exposes a FontFaceSet. Its ready promise resolves after loading and layout operations for fonts used in the document have completed. It does not necessarily load every declared font: a face that is not used may remain unloaded, and font-display behavior can affect whether a face is used.

  1. Wait for the page-specific element or text containing the language content.
  2. Await document.fonts.ready so used-font loading and related layout work can finish.
  3. If a particular face is required, call document.fonts.load() with its intended CSS font shorthand and representative text; inspect the result and confirm the request succeeded.
  4. Take the screenshot after those checks, then inspect it if exact glyph appearance matters.

A navigation milestone such as load or DOMContentLoaded is not proof that asynchronously rendered text exists or that the intended font was selected. Network idle can be useful on some pages, but it is not a semantic check for either condition. MDN explains the readiness behavior in its FontFaceSet reference.

Rank #4
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

Adapt the capture to the page

  • Asynchronous content: Wait for the selector, text, or other page-specific condition that confirms the content is ready. The sample selector is illustrative, not a universal one.
  • Several scripts: Ensure the chosen families and fallbacks cover all scripts in the captured region, not just its first language.
  • Weights and symbols: Match the CSS weight in document.fonts.load() to the face used by the page, and test relevant punctuation, digits, and symbols as well as letters.
  • Runtime differences: Check font file access and rendering in the same browser/container environment used for the capture; local developer output does not establish identical rendering elsewhere.

Exact glyph coverage, shaping, and pixel-identical output depend on the selected font and runtime. Validate the actual page and browser environment when those details are important.

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

Troubleshoot missing or incorrect glyphs

  • The screenshot shows fallback glyphs: Confirm the page’s CSS family name and weight, then check whether the corresponding font request succeeded. Verify that the font has the required glyphs for the text.
  • Text is missing from the capture: The page may render it asynchronously. Wait for the target content itself before waiting for fonts; font readiness does not wait for application-specific content to appear.
  • The font-ready wait completes but the preferred face is not visible: A resolved document.fonts.ready means used-font loading and layout work completed, not that a specific preferred face loaded. Explicitly request the face with document.fonts.load() and inspect the result and network request.
  • The problem appears only in CI or a container: Check font-file reachability and font loading in that capture runtime. Validate its output directly rather than assuming the local browser and deployed runtime behave identically.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can capture a URL through one GET request. Its API accepts an output format such as PNG, JPEG, or WebP, or can return a PDF. Example with cURL:

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

See the ScreenshotNeo API documentation for request options. Before capture, it accepts the cookie or consent banner as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

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.

browser automationIndian languagesPuppeteerscreenshotsWeb Fonts

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.

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

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.