ScreenshotNeo

BlogHow-to

Screenshotlayer API Not Capturing Devanagari Text: Font and Encoding Fixes

Diagnose missing or mangled Devanagari in Screenshotlayer captures by checking Unicode text, font coverage and delivery, shaping, capture timing, and cache.

By the ScreenshotNeo team4 October 20268 min read

If Screenshotlayer captures omit or mangle Devanagari, check the source text and encoding, the selected font’s glyph coverage, whether the webfont loads in the capture environment, script shaping and fallback, capture timing, and cached results. Screenshotlayer documents general Webfont and CSS3 capability, a custom stylesheet URL, capture delay, and cache controls. Its public documentation does not promise Devanagari-specific shaping or explain the worker’s installed fonts, so diagnose each layer instead of assuming a URL-encoding change will solve it.

1. Compare the page and capture

  1. Open the exact target URL in an ordinary browser and compare it with the Screenshotlayer image.
  2. If Devanagari is broken in both, investigate the page’s text and fonts first. If it is correct in the browser but broken in the capture, focus on what the remote renderer can fetch and render.
  3. Save the exact request parameters and response image so you can compare changes one at a time.

This comparison narrows the investigation; it does not by itself establish a Screenshotlayer defect or identify its cause.

2. Check that the page contains the intended Unicode text

Confirm that the HTML contains the intended Unicode characters, rather than text encoded through a legacy font-specific mapping. Check the document’s declared character encoding and the actual response bytes. A page that looks correct in one local setup is not, by itself, proof that the underlying text is correctly encoded.

<!doctype html>
<html lang="hi">
<head>
  <meta charset="utf-8">
  <title>Devanagari rendering check</title>
</head>
<body>
  <p>नमस्ते दुनिया</p>
</body>
</html>

Use your real page content for diagnosis. This sample is a minimal Unicode sanity check, not a Screenshotlayer test result. Percent-encoding a correctly formed target URL is necessary when the URL contains reserved characters, but changing URL encoding alone does not fix missing font glyphs or shaping.

3. Verify font coverage, font fetching, and shaping

Devanagari display depends on mapping Unicode sequences to glyphs, with shaping and fallback involved. A font that lacks required glyphs may result in missing or substituted output. The Unicode Standard describes fallback behavior when a conjunct is unavailable; that is script-rendering context, not documentation of Screenshotlayer’s implementation. See the Unicode Standard, Version 17.0 and the W3C Devanagari Layout Requirements.

  1. Inspect the computed font stack for the affected text in the ordinary browser.
  2. Check that the intended font covers the specific Devanagari characters and conjuncts shown on the page. Test with a known Devanagari-capable font your site is licensed to serve.
  3. In browser developer tools, inspect the font request. Confirm it succeeds, follows redirects as expected, and is not blocked by cross-origin restrictions or access controls.
  4. If using a hosted webfont, verify it can be fetched from the public page context. Screenshotlayer’s FAQ claims general Webfont and CSS3 support, but does not guarantee every font URL, format, or capture environment.
  5. Check whether the output differs in character order, conjunct formation, or glyph shape. These symptoms can point toward shaping or fallback rather than a simple missing-character encoding issue.

Screenshotlayer’s FAQ answers the question “Does the API support Graphs, Canvas, Webfonts or CSS3?” with: “Yes, our rendering engine is capable of processing all of the above.” This is a general capability statement, not a Devanagari-specific shaping guarantee. See the Screenshotlayer FAQ.

4. Apply a known font with Screenshotlayer’s stylesheet option

If you can host a stylesheet publicly, use Screenshotlayer’s optional css_url parameter to select your intended font. The stylesheet must be reachable by the remote capture worker. The specifications document this parameter along with capture delay and cache controls: Screenshotlayer API specifications.

/* Host this stylesheet at a URL the capture worker can reach. */
html, body, body * {
  font-family: "YourDevanagariFont", sans-serif !important;
}

Use the actual family name declared by your font and ensure its font-face definition is available on the page or in a stylesheet the page loads. A stylesheet that selects a family does not install that font on Screenshotlayer’s workers; the font file still has to be fetched successfully through the page’s normal font loading path.

5. Allow the page and font to load, then rule out cache

Screenshotlayer documents a delay control and cache behavior. If the page adds text or styles dynamically, or the font loads after initial HTML, increase the delay as a diagnostic and request a fresh capture. There is no universal delay that guarantees a webfont is ready on every page.

When supported by the current API parameters, disable caching for a diagnostic request or wait for the documented cache TTL before comparing results. Screenshotlayer’s specifications document cache controls and a default TTL; check the current specification for exact parameter names and accepted values. Otherwise, a previously generated image can make a successful change appear ineffective.

6. cURL example

Replace the placeholder credentials and URLs with your account key, target page, and publicly reachable stylesheet. URL-encode parameter values containing reserved characters.

curl -G "https://api.screenshotlayer.com/api/capture" \
  --data-urlencode "access_key=YOUR_ACCESS_KEY" \
  --data-urlencode "url=https://example.com/page" \
  --data-urlencode "css_url=https://example.com/screenshot-fonts.css" \
  --data-urlencode "delay=2" \
  -o devanagari-capture.png

Use the API host, endpoint, authentication and output parameters from your Screenshotlayer account and the current official specifications. The example shows the documented concepts; it does not assert a particular account configuration or guarantee that two seconds is sufficient.

7. Python example

import requests

endpoint = "https://api.screenshotlayer.com/api/capture"
params = {
    "access_key": "YOUR_ACCESS_KEY",
    "url": "https://example.com/page",
    "css_url": "https://example.com/screenshot-fonts.css",
    "delay": 2,
}

response = requests.get(endpoint, params=params, timeout=90)
response.raise_for_status()
with open("devanagari-capture.png", "wb") as image_file:
    image_file.write(response.content)

Configure the endpoint and parameters to match your Screenshotlayer account and current API specification. Check the response content type and API error behavior for your plan before treating a response body as an image.

8. Node.js example

const endpoint = new URL("https://api.screenshotlayer.com/api/capture");
endpoint.search = new URLSearchParams({
  access_key: "YOUR_ACCESS_KEY",
  url: "https://example.com/page",
  css_url: "https://example.com/screenshot-fonts.css",
  delay: "2",
}).toString();

const response = await fetch(endpoint);
if (!response.ok) {
  throw new Error(`Screenshotlayer returned HTTP ${response.status}`);
}
const image = Buffer.from(await response.arrayBuffer());
await import("node:fs/promises").then(fs => fs.writeFile("devanagari-capture.png", image));

As with the other examples, verify the precise endpoint, parameter names, and response format against your account’s current documentation.

9. Diagnostic checklist

  • Text: Does the source contain the intended Unicode text?
  • Encoding: Is the document served and declared using the expected character encoding?
  • Coverage: Does the selected font include the required glyphs?
  • Delivery: Can the remote page context fetch the font file without an access or cross-origin failure?
  • Shaping: Are conjuncts and glyph combinations rendered as expected, or is fallback changing the result?
  • Timing: Does a longer documented capture delay change the output?
  • Cache: Are you looking at a fresh capture after the page or stylesheet changed?

10. Common errors and fixes

Symptom Likely area What to check
Boxes or blank glyphs Font coverage or delivery Check the computed font, glyph coverage, and font request status. Try a reachable webfont with the needed Devanagari coverage.
Wrong characters or mojibake Source text or encoding Inspect the actual Unicode text and response encoding; do not rely only on local appearance.
Individual glyphs appear but conjuncts look wrong Shaping, fallback, or font behavior Compare fonts and browser output. Ask Screenshotlayer whether its current renderer supports the needed shaping behavior.
Works in browser, fails in screenshot Remote fetch or renderer difference Check public accessibility of CSS and font files, redirects, cross-origin restrictions, and capture timing.
CSS change has no visible effect CSS not fetched, selector mismatch, or cached capture Check that css_url is reachable, inspect stylesheet rules, and request a fresh result.
Intermittent missing font Loading race or network instability Inspect font loading in the page, try a longer delay, and repeat with caching ruled out.

11. Performance, reliability, and cost considerations

Additional delay increases capture latency, so use it to diagnose late content and then choose the smallest value that fits your page’s loading behavior. Font files and stylesheets add network dependencies; stable public hosting and correct cache headers can make loading more predictable. Caching may reduce repeated work, but it can also make debugging confusing until you request a fresh result or the cached entry expires.

The reviewed public material does not establish Screenshotlayer worker browser versions, operating system font inventory, worker-side font installation or preloading, or font-fetch logs. Do not assume that installing a font on the machine running your API client affects a hosted renderer. If a font still fails only in Screenshotlayer after checking the page and network path, ask the vendor whether its current workers can preload or install fonts and whether it can provide font-loading diagnostics. No issue-specific failure rate or benchmark is established by the available sources.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns a screenshot or PDF, and its docs cover the available options: ScreenshotNeo API documentation.

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

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com',
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each step can be turned off.
  • Bot checks, blank pages, timeouts, failed loads, and cache hits are never billed; response headers report the page verdict and billing status.
  • An MCP server lets AI agents, including Claude, Cursor, and other MCP clients, take screenshots.
  • 1,000 screenshots a month are free with no card. Paid plans start at $5 for 3,000 screenshots.

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

FAQ

Will changing the target URL’s encoding fix Devanagari?

Only if the URL itself is malformed or its relevant content is incorrectly encoded. It will not supply missing glyphs or guarantee correct shaping.

Does Screenshotlayer guarantee Devanagari shaping?

The reviewed FAQ describes general Webfont and CSS3 support. It does not make a Devanagari-specific shaping guarantee.

Can I install a font on my computer to fix a hosted capture?

There is no evidence in the reviewed public documentation that the hosted worker uses fonts installed on the caller’s computer or offers worker font installation. Ask Screenshotlayer support about its current renderer.

What should I send support if the issue persists?

Provide the target URL, capture request parameters with credentials removed, a browser screenshot for comparison, the affected text, and the font/CSS request results. Ask specifically about worker font loading and shaping diagnostics.