How to Generate a Website Screenshot PDF in Hindi with BrowserCat
Use BrowserCat with Playwright to capture a Hindi website as a full-page screenshot and PDF. Learn how to check Devanagari rendering and fix common capture issues.
To generate a website screenshot and PDF in Hindi with BrowserCat, connect Playwright to BrowserCat’s hosted browser, navigate to a page that already displays Hindi, then save a full-page screenshot and print the page to PDF. BrowserCat renders the page; it does not translate it. Hindi font coverage and shaping are not guaranteed by the documentation covered here, so inspect both output files for missing glyphs, broken conjuncts, clipping, and unexpected line breaks.
This guide combines BrowserCat’s documented Playwright connection flow with Playwright screenshot and PDF methods. It is an illustrative workflow; the available documentation does not establish that Hindi rendering was tested or guaranteed. See the ScreenshotNeo documentation for its separate screenshot API options.
1. Set up BrowserCat and Playwright
- Create a BrowserCat account and obtain an API key from its account dashboard.
- Install Playwright in a Node.js project:
npm install playwright
Keep the API key in an environment variable named BROWSERCAT_API_KEY. Do not commit it to source control or place it in browser-side code.
2. Capture the page as an image and PDF
Save the following as capture.mjs, set the environment variable, and run it with Node.js. The connection endpoint and Api-Key header follow BrowserCat’s quick-start workflow. The screenshot and PDF calls use Playwright’s documented APIs.
import { chromium } from 'playwright';
const apiKey = process.env.BROWSERCAT_API_KEY;
if (!apiKey) {
throw new Error('Set BROWSERCAT_API_KEY before running this script.');
}
const url = process.argv[2] ?? 'https://example.com';
const browser = await chromium.connect('wss://api.browsercat.com/connect', {
headers: { 'Api-Key': apiKey },
});
try {
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
// Wait for web fonts to finish loading before creating either output.
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'website.png', fullPage: true });
await page.pdf({ path: 'website.pdf', format: 'A4', printBackground: true });
} finally {
await browser.close();
}
Run it with a target URL:
export BROWSERCAT_API_KEY='your-api-key'
node capture.mjs 'https://example.com/hi/'
Use a page that actually serves Hindi content. A /hi/ path is only an example; the language switcher, locale cookie, or URL structure depends on the site. If the site needs a user interaction or authentication to show Hindi, perform that step before capture using Playwright navigation and interaction methods.
3. Choose screenshot and PDF settings
Full-page screenshot
fullPage: true captures beyond the visible viewport into one tall image. Omit it or set it to false for a viewport-only image. Very long pages can produce large images and may encounter page or browser limits; for unusually long content, consider capturing sections or printing the page to PDF instead.
PDF format and print styling
page.pdf() uses print rendering. Set format to a supported paper size such as A4 or Letter; BrowserCat’s cheatsheet states Letter as the default. Use landscape: true when a wide page is more legible horizontally. printBackground: true includes background colors and images that print styles might otherwise omit. The website’s print CSS can change layout compared with its screen view.
await page.pdf({
path: 'website.pdf',
format: 'A4',
landscape: false,
printBackground: true,
margin: {
top: '12mm',
right: '12mm',
bottom: '12mm',
left: '12mm',
},
});
Margins can help prevent content from running to the paper edge. If the page’s CSS defines print margins or paper settings, check how those interact with the requested PDF settings in the resulting file.
Wait for content deliberately
networkidle is a useful starting point, but some pages keep analytics, chat, or streaming requests open and may never become idle. For those pages, wait for a specific content selector or a short, justified delay instead. Conversely, a page that loads content after initial navigation may need an explicit wait before capture.
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
await page.locator('main').waitFor({ state: 'visible', timeout: 20000 });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'website.png', fullPage: true });
Choose a selector that reliably indicates the content you need. A generic selector such as main may not exist on every site.
4. Verify Hindi text in both files
- Open
website.pngandwebsite.pdfat a readable zoom. - Check Devanagari characters, vowel signs, conjuncts, punctuation, and numerals for missing glyphs or incorrect shaping.
- Check line wraps, headers, footers, and page breaks for clipping or content that moved in print layout.
- If the text looks wrong, first confirm the page itself renders correctly in the captured browser. Then verify its font requests completed and its language or locale settings selected Hindi.
- Regenerate and inspect the output after correcting the page’s font loading or content setup.
The sources available for this guide do not specify which Devanagari fonts are installed in BrowserCat’s browser or document a custom-font installation procedure. Do not assume that setting a language attribute alone supplies a font or fixes shaping. If a site’s font is hosted remotely, check that it loads successfully in the rendered page before capture.
5. Use a template when you control the document
BrowserCat also describes a template-oriented PDF path for HTML, CSS, JavaScript, and customization data. That approach may suit a document you generate from your own template. For capturing an existing live site that needs navigation or interaction, the custom browser automation route gives you control over page loading and capture. Check BrowserCat’s current PDF generation documentation for the current template API and syntax; no template endpoint or request schema is established in the source details used here.
6. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| Connection fails before navigation | Missing or invalid API key, or connection setup differs from the current BrowserCat configuration. | Confirm BROWSERCAT_API_KEY is set in the process environment, check the key in the account dashboard, and compare the endpoint and header with the current official quick start. |
| Page is blank or incomplete | Navigation has not reached the needed content, a client-side render is still running, or the site requires a locale selection or authentication. | Check the URL in the browser workflow, wait for a meaningful page selector, and perform required navigation or sign-in steps before capture. |
networkidle wait times out |
Long-lived network requests prevent the page from becoming idle. | Use domcontentloaded or another appropriate navigation milestone, then wait for the content selector required for the capture. |
| Hindi appears as boxes or replacement characters | The required font may not have loaded or may not be available to the rendered page. | Inspect the page’s font loading and network errors, wait for document.fonts.ready, and verify both generated files. The reviewed docs do not establish a BrowserCat font inventory. |
| Hindi characters or conjuncts look incorrectly arranged | The source page’s font, shaping, or rendering may not be ready or suitable in the capture environment. | Compare the rendered browser page with the saved output, check the site’s chosen font and language setup, and regenerate after the page renders correctly. Do not treat this as a translation issue. |
| PDF layout differs from the screenshot | PDF uses print rendering and print CSS, while the screenshot reflects the browser page layout. | Review the site’s print styles, paper format, orientation, margins, and background settings. Inspect the PDF at its intended page size. |
| Bottom of a long page is missing | Lazy-loaded content may not have appeared before capture, or a very tall full-page image may exceed practical limits. | Scroll through the page to trigger lazy loading, wait for the needed content, or use PDF output or multiple section captures for exceptionally long pages. |
7. Performance, reliability, and cost considerations
A remote browser needs time to connect, load the site, wait for fonts and dynamic content, and encode the image or PDF. Full-page screenshots of long pages use more memory and produce larger files than viewport captures. Choose the smallest viewport and output scope that meet the need, and avoid waiting for network idle when it is not a useful signal.
For repeatable captures, use an explicit URL, viewport, wait condition, paper format, and margins. Pages can still vary because their content, fonts, third-party resources, or locale behavior change. Treat the resulting image and PDF as artifacts to review when correctness matters.
BrowserCat’s available profile reports a free allowance of 1,000 requests per month, but the source does not state a year and plan terms can change. Confirm current quotas and pricing directly with BrowserCat before planning usage. The available material does not provide an independently verified performance benchmark or comparative price analysis.
Or skip the browser setup
ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. A screenshot is an image rather than a PDF, so this call is a quick way to capture the rendered Hindi page when you need an image artifact:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/hi/ -o shot.webp
See the ScreenshotNeo API documentation for the other output and capture options. Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. 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.
FAQ
Does BrowserCat translate a page into Hindi?
No. It captures what the page renders. The website must already show Hindi content.
Can I save both a screenshot and a PDF in one run?
Yes. Call page.screenshot() and page.pdf() on the same Playwright page, as in the example.
Does BrowserCat guarantee Devanagari font support?
The documentation covered here does not establish a font inventory or Hindi rendering guarantee. Verify the saved screenshot and PDF for the page you need.
Which output should I use for a long article?
A PDF is usually easier to read and print across pages. A full-page screenshot is one tall image and can become unwieldy for very long pages.
Sources
- BrowserCat official documentation: quick start, Playwright cheatsheet, PDF generation glossary, and browser configuration overview.


