v1

latestOpenAPI 3.0.02026-07-132010.3 KB

Convert HTML to PDF

Converts an HTML payload into a PDF document. Operates entirely in RAM for zero-retention compliance. Supports synchronous response or asynchronous delivery via webhooks.

post/v1/pdf

Request body

htmlstring required

The raw HTML string to convert into a PDF.

formatstring

Optional page format such as A4, Letter, or Legal.

widthstring

Optional custom page width, e.g. 8.27in or 1200px. Overrides format when set.

heightstring

Optional custom page height, e.g. 11.69in or 1800px. Overrides format when set.

landscapeboolean

Render the PDF in landscape orientation.

scalenumber

Scale factor between 0.1 and 2.

pageRangesstring

Optional page ranges, e.g. 1-3, 5, 8-10.

printBackgroundboolean

Whether to include CSS backgrounds in the output.

preferCSSPageSizeboolean

Prefer @page CSS size rules over the format option.

headerTemplatestring

Optional HTML template for the PDF header. Must be valid HTML with inline CSS.

footerTemplatestring

Optional HTML template for the PDF footer. Must be valid HTML with inline CSS.

passwordstring

Optional password to encrypt the generated PDF (AES-256).

waitUntilstring

Lifecycle event to wait for before rendering. Supported values: load, domcontentloaded, networkidle, commit.

waitForSelectorstring

Optional CSS selector to wait for before rendering.

delayMsinteger

Optional extra render delay in milliseconds. Maximum 10000.

webhookUrlstring uri

Optional URL for asynchronous delivery. If provided, the API responds with 202 Accepted and POSTs the generated PDF to this URL.

Response

Successful synchronous PDF generation.

All 2 operations