The pages parameter allows you to specify which pages from the rendered document should be included in the final PDF output.

Overview

When generating a PDF from content that spans multiple pages, you may want to include only specific pages or ranges of pages. The pages parameter lets you select exactly which pages appear in the final document.

Parameter details

pages
string
default:""

Specifies which pages from the rendered document should be included in the final PDF output

Default: Empty string (includes all pages)

Usage

{
  "parts": "https://example.com",
  "pages": "1-5, 8, 11-13"
}

Behavior

The pages parameter accepts a comma-separated list of page ranges using one-based indexing:

  • Single page: "3" (includes only page 3)
  • Page range: "1-5" (includes pages 1 through 5)
  • Multiple selections: "1-5, 8, 11-13" (includes pages 1-5, page 8, and pages 11-13)
  • Empty string: "" (includes all pages)

Important notes:

  • Pages will always be included in the document’s natural order regardless of the specified range
  • Each page will only be included once, even if it appears multiple times in the range specification
  • One-based indexing is used (the first page is page 1, not page 0)

Use cases

This parameter is particularly useful for:

  1. Extracting specific content: Include only the relevant pages from a larger document.

  2. Creating document excerpts: Generate shorter versions of documents with only key pages.

  3. Removing unnecessary pages: Exclude cover pages, advertisements, or other unwanted content.

  4. Combining specific pages: Select non-consecutive pages that belong together logically.

Examples

Including only the first page

{
  "parts": "https://example.com",
  "pages": "1"
}

Including a range of pages

{
  "parts": "https://example.com",
  "pages": "2-10"
}

Including multiple ranges and individual pages

{
  "parts": "https://example.com",
  "pages": "1-3, 5, 7-9"
}

Including all pages (default behavior)

{
  "parts": "https://example.com",
  "pages": ""
}