Render a PDF asynchronously
Generate a PDF from one or more content sources in the background and store it in the specified cloud destination. Content can be provided as URLs to fetch, raw HTML strings, or a combination of both. This endpoint returns immediately with a success status while the rendering happens asynchronously. When rendering completes, the PDF will be uploaded to the specified destination, and an optional webhook will be called.
Body
Options for asynchronous PDF rendering, where the rendering happens in the background and the result is stored in the specified destination.
An array of content parts to render into a single PDF. Each part can be a URL string, HTML content string, or a structured content object with type and content.
A content part that can be a URL string, HTML string, or a structured content object.
[
"https://example.com",
"<h1>Hello World</h1>",
{
"content": "<div>Structured HTML content</div>",
"type": "html"
}
]
Emulates the specified media type during rendering. Use 'screen' for web display styles or 'print' for print-optimized styles. Particularly useful for pages with different CSS for screen and print media queries.
screen
, print
Evaluates a JavaScript expression in the page context before rendering. Useful for manipulating the DOM, triggering actions, or waiting for dynamic content to load. If the expression returns a Promise, rendering will wait for it to resolve.
HTML template for the page footer. Supports special classes like 'date', 'title', 'url', 'pageNumber', and 'totalPages' for dynamic content.
HTML template for the page header. Supports special classes like 'date', 'title', 'url', 'pageNumber', and 'totalPages' for dynamic content.
Whether to include background images and colors in the rendered PDF. Set to false to optimize for printing or reduce file size.
Document margins specification with unit. Controls the space between the page edges and content.
{
"bottom": 10,
"left": 10,
"right": 10,
"top": 10,
"unit": "mm"
}
Page orientation for the PDF. 'portrait' is taller than wide, 'landscape' is wider than tall.
portrait
, landscape
Output file format. 'pdf/a' is PDF/A-2b compliant for archiving, while 'pdf' is standard PDF.
pdf/a
, pdf
Specifies which pages to include in the output using a comma-separated list of page ranges (e.g., '1-5, 8, 11-13'). Uses one-based indexing. Pages will be included in the document's natural order regardless of the specified range, and each page will only be included once. An empty string includes all pages.
Whether to prioritize page size defined in CSS using @page rules. When true, CSS page size takes precedence over the 'size' parameter. When false, content will be scaled to fit the specified paper size.
Whether to render the header and footer templates on each page. Must be true for header_template and footer_template to take effect.
Scale factor for the webpage rendering. Values below 1.0 reduce size, above 1.0 enlarge content.
0.1 <= x <= 2
Sets a cookie before rendering, useful for authenticated content or personalized views.
Standard document size preset name.
a0
, a1
, a2
, a3
, a4
, a5
, a6
, a7
, a8
, a9
, a10
, letter
, legal
, tabloid
, ledger
"a4"
Waits for a specific element attribute to be set before rendering, useful for ensuring dynamic content is fully loaded.
Configuration specifying where the rendered PDF should be stored when using asynchronous rendering.
{
"bucket": "my-bucket",
"path": "pdfs/document.pdf",
"provider": "aws_s3"
}
Webhook configuration for notification when the asynchronous rendering is complete.
Response
Response from a synchronous render request, containing the generated PDF file.