About this endpoint
What it does
Converts a web page at the given URL into a PDF file. The request body controls page orientation, paper size, margins, and optional custom header/footer HTML, and the response is the generated PDF as binary data.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| url | String | Yes | URL of the web page to convert to PDF. Must be an http/https URI. |
| landscape | Boolean | No | Page orientation. true for landscape, false for portrait. Default: false. |
| page_size | String | No | Page size. Default: A4. Allowed values: A4, Letter, Legal, A3, Tabloid. |
| margin_top | String | No | Top margin with CSS units. Default: 10mm. |
| footer_html | String | No | Custom footer HTML. Supports pageNumber and totalPages spans. |
| header_html | String | No | Custom header HTML. Supports pageNumber and totalPages spans. |
| margin_left | String | No | Left margin with CSS units. Default: 10mm. |
| margin_right | String | No | Right margin with CSS units. Default: 10mm. |
| margin_bottom | String | No | Bottom margin with CSS units. Default: 10mm. |
| print_background | Boolean | No | Print background graphics. Default: true. |
Response
Returns a binary string containing the generated PDF file.
| Attribute | Type | Mandatory | Description |
|---|---|---|---|
| binary | String | Yes | The generated PDF document returned as binary data. |