Puppeteer and Playwright are great libraries. Running them in production just to make screenshots or PDFs costs more than it looks.
// Before: puppeteer
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle0" });
const png = await page.screenshot({ fullPage: true });
await browser.close();
// After: one HTTP call
const r = await fetch("https://shotmint.creasework.com/v1/screenshot?" + new URLSearchParams({ url, full_page: "true", wait_until: "networkidle" }),
{ headers: { "X-API-Key": process.env.SHOTMINT_KEY } });
const png = Buffer.from(await r.arrayBuffer());
| Puppeteer | Shotmint |
|---|---|
page.setViewport({width, height, deviceScaleFactor}) | width, height, device_scale_factor |
screenshot({fullPage: true}) | full_page=true |
(await page.$(sel)).screenshot() | selector=sel |
emulateMediaFeatures([{name:'prefers-color-scheme',value:'dark'}]) | dark_mode=true |
page.pdf({format, landscape, margin, printBackground, scale}) | /v1/pdf with format, landscape, margin, print_background, scale |
page.setContent(html) | html in the POST body |
Be honest with yourself here. If you need multi-step flows (log in, click, fill forms), you render millions of pages a month, or pages are only reachable inside your private network, self-hosting is the right call. An API pays off when rendering is a side feature you'd rather not operate.
No signup, no card. Get a key in one click, then buy credits only if you need more (from €5 for 2,000, never expire).
Get a free API key Full API reference