Skip to main content
The size parameter allows you to control the dimensions of the generated PDF document.

Overview

When rendering a PDF, you can specify the page size either by using standard paper size presets (like A4, Letter) or by defining custom dimensions with a specific unit of measurement.

Parameter details

object
Controls the dimensions of the generated PDF document

Usage

Using a preset:

Using custom dimensions:

Behavior

  • When using a preset, any provided width and height values are ignored.
  • The preset property takes precedence over custom dimensions if both are provided.
  • If neither preset nor custom dimensions are specified, the default A4 size is used.

Available presets

The following standard paper size presets are available:

Use cases

This parameter is particularly useful for:
  1. Standardized documents: Use presets like a4 or letter for documents that need to conform to standard paper sizes.
  2. Custom publications: Create custom-sized documents for specialized publications like brochures, cards, or posters.
  3. Print-ready output: Ensure your PDFs match the exact dimensions required by your printing service.

Example

Creating a business card-sized PDF:
Note: For responsive web content, you may want to use the prefer_css_page_size parameter in conjunction with size to control how content is scaled to fit the page.