Skip to main content
The margin parameter allows you to specify the spacing between the page edges and the content of your rendered document.

Overview

When generating PDFs or other documents, controlling the margins ensures proper spacing around your content. The margin parameter lets you define precise margins for all four sides of the document with support for different measurement units.

Parameter details

object
Specifies the spacing between the page edges and the content of your rendered document

Usage

Behavior

The margin parameter creates empty space around the content of your document. Each margin value must be a non-negative number (minimum: 0).

Use cases

This parameter is particularly useful for:
  1. Print-ready documents: Set appropriate margins for documents intended for printing.
  2. Professional reports: Create polished documents with consistent spacing around content.
  3. Custom layouts: Adjust margins to accommodate headers, footers, or binding space.
  4. Mobile-friendly PDFs: Optimize reading experience on smaller screens with appropriate margins.

Examples

Standard document margins

Asymmetric margins for binding

Minimal margins

Using different units