Back to articles
Automate Website Screenshots, PDFs, and QR Codes with a Single REST API

Automate Website Screenshots, PDFs, and QR Codes with a Single REST API

via Dev.to WebdevOpSpawn

If you've ever needed to capture a website screenshot programmatically, generate a PDF from a webpage, or convert Markdown to a shareable image — you've probably cobbled together a Playwright/Puppeteer script, wrestled with headless Chrome configuration, and dealt with memory leaks in production. There's a simpler way: a dedicated REST API that handles all of this with a single HTTP call. In this guide, I'll show practical examples for the most common use cases. The Endpoints at a Glance Endpoint What it does /api/capture Full-page screenshot (PNG or JPEG) /api/og Open Graph preview image (1200×630) /api/md2pdf Markdown → styled PDF /api/md2png Markdown → PNG image /api/qr QR code generator /api/html2md HTML → Markdown extraction 1. Capture a Website Screenshot The most common use case. Pass a URL, get back a base64-encoded image. curl: curl -X POST https://api.opspawn.com/api/capture \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https:/

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
6 views

Related Articles