ScreenshotNeo

BlogHow-to

How to Capture a Full-Page Screenshot of a Webpage in Tamil Using Playwright

Capture a webpage as one full-page image with Playwright, preserve its rendered Tamil text, and learn when browser locale settings matter.

By the ScreenshotNeo team4 October 20267 min read

Use Playwright’s JavaScript API to capture the entire scrollable page as one image: await page.screenshot({ path: 'screenshot.png', fullPage: true }). This captures the page as the browser renders it; it does not translate content into Tamil. If the webpage already contains Tamil, wait for its fonts and content to render before taking the screenshot. Set the browser context locale to ta-IN only if you also want locale-sensitive site behavior to use Tamil as spoken in India.

1. Install Playwright

Start a small Node.js project and install Playwright, then install its Chromium browser:

npm init -y
npm install playwright
npx playwright install chromium

Playwright’s installation guide describes setup. The example below uses Chromium and writes a PNG to the current directory.

2. Capture the full page with JavaScript

Save this as screenshot.js. Replace the example URL with the webpage you want to capture.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    // Optional: use ta-IN when the site should behave as though
    // the browser's locale is Tamil (India). This does not translate text.
    const context = await browser.newContext({ locale: 'ta-IN' });
    const page = await context.newPage();

    await page.goto('https://example.com', {
      waitUntil: 'networkidle',
      timeout: 60000,
    });

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

Run it with node screenshot.js. The Page screenshot API defines fullPage: true as capturing the full scrollable page rather than just the visible viewport. The optional context locale controls locale emulation for pages in that context; a site decides how to respond to it.

3. Make sure Tamil text is ready to render

Playwright captures rendered pixels. Tamil text must be present in the page and supported by the fonts available to the browser. For a page using web fonts, wait for the font-loading promise before capture:

await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'webpage-tamil.png', fullPage: true });

This waits for the document’s font loading set, but it cannot fix a missing font, a failed font request, or text the site has not inserted yet. If Tamil glyphs appear as squares or are missing, inspect the page’s font requests and the fonts installed in the browser environment. When running in a container or a minimal Linux image, confirm that a font with Tamil glyph coverage is available to Chromium.

If the page content is already Tamil, you do not need locale: 'ta-IN' just to capture it. Locale emulation can affect locale-sensitive behavior such as a site’s language selection, date formatting, or number formatting, depending on how that site is built. It does not rewrite English content into Tamil.

4. Handle lazy-loaded and changing pages

A full-page screenshot specifies the capture extent; it does not guarantee that every site-specific lazy image, delayed widget, or changing section has finished loading. If content appears only after scrolling, scroll through the page before capture and allow the page to update. A simple helper can trigger common scroll-based loading:

async function scrollToLoadPage(page) {
  await page.evaluate(async () => {
    const step = Math.max(400, window.innerHeight);
    for (let y = 0; y < document.body.scrollHeight; y += step) {
      window.scrollTo(0, y);
      await new Promise(resolve => setTimeout(resolve, 150));
    }
    window.scrollTo(0, 0);
  });
}

await page.goto('https://example.com', { waitUntil: 'networkidle' });
await scrollToLoadPage(page);
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'webpage-tamil.png', fullPage: true });

The delay is an example, not a guarantee: increase it if the target site needs longer, or wait for a known selector that indicates the desired content is ready. For example, await page.locator('.article-content').waitFor() waits for that element to appear. Avoid relying on a fixed delay when the page exposes a more reliable readiness signal.

5. Choose output and capture options

Need Option Effect
Capture below the viewport fullPage: true Captures the full scrollable page.
Write directly to disk path: 'file.png' Saves the screenshot at the given path.
Process or upload in code Omit path The API returns screenshot bytes, which can be handled as a buffer.
Choose an image format type: 'png', 'jpeg', or 'webp' Selects the documented output format; JPEG also supports a quality setting.
Choose pixel density scale: 'css' or 'device' Controls whether output uses CSS-pixel or device-pixel scaling.

Example returning bytes instead of writing a file:

const image = await page.screenshot({ fullPage: true, type: 'png' });
// `image` is a Buffer; pass it to your image-processing or upload code.

For a command-line capture, Playwright’s CLI has a screenshot --full-page option. The CLI is useful for a one-off capture; the Page API is easier to combine with navigation, readiness checks, locale settings, and application logic. See the Playwright CLI documentation.

6. Troubleshoot common problems

Symptom Likely cause What to do
Only the visible screen is in the image The screenshot call omitted fullPage: true or used a different capture path. Set fullPage: true in page.screenshot(); for the CLI use --full-page.
Tamil characters show as boxes or are absent The required font did not load, lacks Tamil glyphs, or the text is not in the rendered page. Wait for document.fonts.ready; inspect font-loading failures and install or make available a Tamil-capable font in the browser environment.
The page remains in English Locale emulation does not translate content, or the site does not use the requested locale. Use a Tamil-language page or the site’s own language selector. Use locale: 'ta-IN' only to emulate locale-sensitive browser behavior.
Images or sections are missing farther down The site loads them on scroll or after an application-specific event. Scroll through the page, wait for a known element or event, then capture. Inspect the saved screenshot.
Navigation times out waiting for networkidle The site keeps network requests open or never reaches an idle state. Use a less strict navigation condition such as domcontentloaded, then wait for the specific content you need before capture.
Browser launch reports a missing executable The Playwright package is installed, but its browser binary is not. Run npx playwright install chromium in the deployment environment.
Capture is unexpectedly large or slow A very long page or high device-pixel scale creates a large image. Use PNG only when lossless output is needed, consider JPEG or WebP where suitable, or capture a specific region if the full page is not required.

7. Performance, reliability, and cost

Playwright runs a browser, so each capture uses browser startup time and memory in addition to page loading and rendering. Reuse a browser for multiple captures in a worker instead of launching a fresh browser for every URL, while creating an isolated context when pages need separate cookies or locale settings. Set navigation and readiness timeouts to fit your workload, and close pages, contexts, and the browser when finished.

For reliable output, wait for the content that matters rather than assuming a navigation event means every dynamic section is ready. Inspect representative screenshots when a site changes, especially if it uses lazy loading or custom font delivery. Full-page images can consume substantial memory for very tall pages; output dimensions and file size depend on page length, scale, and image format.

Playwright itself is an open-source browser automation library; operational costs come from the compute and storage used to run and retain captures. The reviewed Playwright documentation provides no general performance benchmark or per-screenshot cost, so actual resource use depends on the page and runtime.

Or skip the browser setup

If you need a screenshot without installing or operating a browser, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return an image or PDF, and its documented API options include full-page capture. See the ScreenshotNeo API documentation.

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

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={
        "access_key": "YOUR_API_KEY",
        "url": "https://example.com",
        "full_page": "true",
    },
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com',
  full_page: 'true',
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const bytes = Buffer.from(await res.arrayBuffer());
require('node:fs').writeFileSync('shot.webp', bytes);

Cookie banners, newsletter popups, and chat widgets are removed before the shot, with each cleanup step configurable. 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 use screenshot tools. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000 screenshots. ScreenshotNeo does not translate page content, so the target page still needs to serve or render Tamil text. Sign up for 1,000 free screenshots a month, with no card required.

FAQ

Does fullPage: true make the screenshot Tamil?

No. It changes how much of the page is captured. The page itself must contain Tamil text for Tamil to appear.

Should I always set locale: 'ta-IN'?

No. Set it when locale-sensitive page behavior should use Tamil for India. Omit it when you only need to capture Tamil content already on the page.

Can I capture a full page as JPEG or WebP?

Yes. Playwright documents PNG, JPEG, and WebP screenshot output. Choose the format that fits your quality and file-size needs.

Will full-page capture trigger every lazy-loaded item?

Not necessarily. Site-specific lazy loading may require scrolling or waiting for an application-specific signal before capture.