POST
/
api
/
render
curl --request POST \
  --url https://vortexpdf.com/api/render \
  --header 'Content-Type: application/json' \
  --data '{
  "emulate_media_type": "print",
  "evaluate_js": {
    "expression": "<string>"
  },
  "footer_template": "<string>",
  "header_template": "<string>",
  "include_backgrounds": true,
  "margin": {
    "bottom": 10,
    "left": 10,
    "right": 10,
    "top": 10,
    "unit": "mm"
  },
  "orientation": "portrait",
  "output_format": "pdf/a",
  "pages": "",
  "parts": [
    "https://example.com",
    "<h1>Hello World</h1>",
    {
      "content": "<div>Structured HTML content</div>",
      "type": "html"
    }
  ],
  "prefer_css_page_size": false,
  "render_header_footer": false,
  "scale": 1,
  "set_cookie": {
    "domain": "<string>",
    "name": "<string>",
    "value": "<string>"
  },
  "size": "a4",
  "wait_for": {
    "attribute": "<string>",
    "selector": "<string>"
  },
  "output_encoding": "binary"
}'
"<any>"

Body

application/json
Render options

Options for synchronous PDF rendering, where the PDF is returned directly in the API response.

parts
array
required

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.

Example:
[
  "https://example.com",
  "<h1>Hello World</h1>",
  {
    "content": "<div>Structured HTML content</div>",
    "type": "html"
  }
]
emulate_media_type
enum<string>
default:print

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.

Available options:
screen,
print
evaluate_js
object

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.

header_template
string

HTML template for the page header. Supports special classes like 'date', 'title', 'url', 'pageNumber', and 'totalPages' for dynamic content.

include_backgrounds
boolean
default:true

Whether to include background images and colors in the rendered PDF. Set to false to optimize for printing or reduce file size.

margin
object

Document margins specification with unit. Controls the space between the page edges and content.

Example:
{
  "bottom": 10,
  "left": 10,
  "right": 10,
  "top": 10,
  "unit": "mm"
}
orientation
enum<string>
default:portrait

Page orientation for the PDF. 'portrait' is taller than wide, 'landscape' is wider than tall.

Available options:
portrait,
landscape
output_format
enum<string>
default:pdf/a

Output file format. 'pdf/a' is PDF/A-2b compliant for archiving, while 'pdf' is standard PDF.

Available options:
pdf/a,
pdf
pages
string
default:

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.

prefer_css_page_size
boolean
default:false

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
number
default:1

Scale factor for the webpage rendering. Values below 1.0 reduce size, above 1.0 enlarge content.

Required range: 0.1 <= x <= 2

Sets a cookie before rendering, useful for authenticated content or personalized views.

size
default:a4

Standard document size preset name.

Available options:
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
letter,
legal,
tabloid,
ledger
Example:

"a4"

wait_for
object

Waits for a specific element attribute to be set before rendering, useful for ensuring dynamic content is fully loaded.

output_encoding
enum<string>
default:binary

Specifies how the PDF should be encoded in the response. 'binary' returns raw bytes, while 'base64' returns a base64-encoded string.

Available options:
binary,
base64

Response

200
application/pdf
Render succeeded

Response from a synchronous render request, containing the generated PDF file.