rendex_screenshot
Capture screenshots or generate PDFs from webpages or raw HTML with options for full-page capture, dark mode, ad blocking, custom viewports, and CSS/JS injection.
Instructions
Capture a screenshot or PDF of any webpage or raw HTML. Supports full-page capture, dark mode, ad blocking, custom viewports, CSS/JS injection, cookie/header injection, PDF output, HTML rendering, and progressive fallback for heavy sites. Returns partial renders on timeout by default (bestAttempt mode).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | The webpage URL to capture. Mutually exclusive with 'html'. | |
| html | No | Raw HTML to render and capture. Mutually exclusive with 'url'. Great for invoices, social cards, email templates, OG images. | |
| format | No | Output format — png (lossless), jpeg (smaller), webp (smallest), or pdf (document). Use pdf for invoices, reports, archival. | png |
| fullPage | No | Capture the full scrollable page instead of just the viewport | |
| darkMode | No | Emulate dark color scheme (prefers-color-scheme: dark) | |
| width | No | Viewport width in pixels (320-3840) | |
| height | No | Viewport height in pixels (240-2160) | |
| quality | No | Image quality 1-100 (JPEG/WebP only, ignored for PNG/PDF) | |
| delay | No | Milliseconds to wait after page load before capture (useful for JS-rendered content) | |
| blockAds | No | Block ads and trackers before capture | |
| blockResourceTypes | No | Block specific resource types to speed up capture. E.g. ['font', 'image'] for text-only screenshots. | |
| deviceScaleFactor | No | Device pixel ratio (1 = standard, 2 = retina). Defaults to 2× Retina. | |
| timeout | No | Maximum seconds to wait for page load (5-60). Cloudflare has a 60s hard cap. | |
| waitUntil | No | Page readiness event. networkidle2 (default) is best for most sites. Use domcontentloaded for speed, networkidle0 for completeness. | networkidle2 |
| waitForSelector | No | CSS selector to wait for before capture. Essential for SPAs (e.g. '.main-content', '#app-loaded') | |
| bestAttempt | No | If true (default), capture whatever is rendered on timeout instead of failing. Set to false to get a hard error on timeout. | |
| selector | No | CSS selector of a specific element to capture instead of the full page. Useful for OG images, component extraction (e.g. '#hero', '.pricing-card') | |
| css | No | Custom CSS to inject into the page before capture. Hide cookie banners, add watermarks, override styles. Max 50KB. | |
| js | No | Custom JavaScript to execute in the page before capture. Runs in the browser sandbox. Max 50KB. | |
| cookies | No | Cookies to set before capture. Useful for authenticated pages. Max 50 cookies. | |
| headers | No | Custom HTTP headers to send with the page request. Cannot override Host, Connection, Content-Length, or Transfer-Encoding. | |
| userAgent | No | Override the browser user agent string. | |
| pdfFormat | No | PDF page size. Only used when format='pdf'. Default: A4 | |
| pdfLandscape | No | PDF landscape orientation. Only used when format='pdf'. | |
| pdfPrintBackground | No | Print background colors/images in PDF. Default: true | |
| pdfScale | No | PDF scale factor (0.1-2). Default: 1 | |
| pdfMargin | No | PDF page margins. Only used when format='pdf'. Accepts CSS values. | |
| async | No | Process capture asynchronously. Returns a jobId immediately instead of waiting. Poll GET /v1/jobs/:jobId for status, or use webhookUrl for push notification. | |
| webhookUrl | No | URL to receive a POST callback when async capture completes. Payload is HMAC-SHA256 signed. Requires async=true. | |
| cacheTtl | No | Seconds to cache the result in R2 storage (3600-2592000). Returns a signed URL for retrieval. Requires async=true. | |
| geo | No | ISO 3166-1 alpha-2 country code for geo-targeted capture (e.g., 'US', 'DE', 'JP'). Renders the page as seen from that country. Pro/Enterprise only. Note: CSS/JS injection, cookies, element capture, dark mode, and some other features are not available with geo-targeting. | |
| geoCity | No | City for more precise geo-targeting (e.g., 'Berlin', 'New York'). Requires 'geo'. | |
| geoState | No | State or region for more precise geo-targeting (e.g., 'California'). Requires 'geo'. |