generate-image-from-html
Render HTML and CSS into a PNG image, or into an A4 vector PDF with format "pdf". Provide complete, self-contained HTML and put styles in an inline block. Remote image URLs load if they are real and publicly accessible; embed generated or local images as base64 data URIs rather than inventing URLs. Returns the rendered image plus a shareable CDN URL; PDF renders return the URL only. Consumes one credit per call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | Optional additional CSS to inject into the page. | |
| dpi | No | Scale factor / device pixel ratio (1-4) for higher-resolution output. | |
| html | Yes | The full HTML markup to render. Include CSS in an inline <style> block. Publicly accessible remote image URLs work; use base64 data URIs for images that are not hosted anywhere. | |
| width | No | Viewport width in pixels (1-5000). Defaults to 1920. | |
| format | No | Output format. "png" (default) returns an image sized by width and height. "pdf" returns an A4 portrait vector PDF with selectable, searchable text and automatic pagination; width, height, dpi and fullpage are ignored. Use "pdf" for documents such as invoices, reports, certificates and tickets. Use "png" for social cards, OG images and anything displayed at fixed pixel dimensions. | |
| height | No | Viewport height in pixels (1-5000). Defaults to 1080. | |
| fullpage | No | Capture the full scrollable page instead of just the viewport. | |
| ms_delay | No | Milliseconds to wait before capturing (1-5000), e.g. to let fonts or animations settle. | |
| wait_for_selector | No | Wait until this CSS selector is present before capturing. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Shareable CDN URL of the rendered file, at full resolution. | |
| format | Yes | The output format that was rendered. | |
| credits_remaining | Yes | Credits left on the plan after this render. |