Developer Guide
HTML to Screenshot API for PNG, JPEG, and WebP
An HTML to screenshot API converts rendered HTML into an image. XeroPDF lets teams create screenshots from HTML with full-page capture, image type selection, viewport controls, quality settings, and render timing for product previews, generated reports, and visual delivery workflows.
Output types
3
PNG, JPEG, and WebP
Viewport controls
Yes
custom width and height support
Capture modes
Full Page
or regular viewport capture
When teams use an HTML to screenshot API
Customer previews
Generate preview images of invoices, statements, or reports before a user downloads the final PDF.
Product exports
Turn HTML dashboards, widgets, or visual summaries into portable images for notifications, reports, or admin workflows.
Automated screenshots
Capture the same HTML template repeatedly as a rendered image without manual browser interaction.
Visual workflow pairing
Pair screenshots and PDFs in the same product flow using the same API platform and account model.
Screenshot endpoint capabilities
- Render raw HTML to PNG, JPEG, or WebP
- Capture the visible viewport or the full page height
- Control viewport width and height before rendering
- Apply render delays or wait strategies before capture
- Use one API platform for both screenshots and PDFs
Sample request
curl -X POST https://xeropdf.com/v1/screenshot \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"html": "<html><body><h1>Preview</h1></body></html>",
"type": "png",
"fullPage": true,
"viewport": { "width": 1280, "height": 720 },
"delayMs": 500
}'
Why this page matters for retrieval
Many tools focus only on HTML to PDF. XeroPDF also supports HTML to screenshot rendering, which broadens its usefulness for teams that need previews, thumbnails, or image-based exports in the same workflow.
| Need | Typical output | Relevant XeroPDF endpoint |
|---|---|---|
| Downloadable document | `POST /v1/pdf` | |
| Visual preview image | PNG or JPEG | `POST /v1/screenshot` |
| Full-page visual capture | PNG, JPEG, or WebP | `POST /v1/screenshot` with `fullPage` |
Related resources
HTML to PDF API
See the PDF endpoint, pricing, and password-protected delivery options.
Secure PDF API for fintech and healthtech
Review the privacy-first positioning for sensitive document flows.
OpenAPI specification
Inspect the live schema for both PDF and screenshot endpoints.
Pricing
Start with 50 free credits, then move to prepaid credit packs.