A Size of Its Own for Certain Pages

Give one named page a width and a height of its own, leaving every other page of the document as it is.

See It in a Real PDF

Images on a Page

A photograph that goes in exactly as it came out of the camera, and one with transparent parts that keeps them, each on a page cut to its own size.

Open the PDF The Whole Example

Also shown in: Every Picture a Scanner Put in One File · A Sheet as It Goes to the Press

Summary

In a bound folder, one sheet is sometimes larger than the rest: a plan, a wide table of figures, a map folded into the binding. Here the sheet is named by its number, and as many of them can be named as you like — one plan on page four, another on page eleven, each with a size of its own.

Technically

Written at the top level of a request, under "page_sizes"

page_sizes is a list of entries, each naming a page by its one-based number and giving it a /MediaBox of two dimensions in points; every other page stays on the document's size. An entry states the size of a page, it does not create one: naming a page past the end of the document leaves the document as long as it already was. A page named twice takes the last size given for it.

Request Schema

  • page_sizes — array, optional, empty by default.
  • page_sizes[].page — integer ≥ 1, required. The page the entry is for.
  • page_sizes[].width — number, required. Width in points.
  • page_sizes[].height — number, required. Height in points.

An entry overrides page for the one page it names. For a page to exist, an item names it in its pages, or content flows down to it. Every other page keeps the size from page, A4 by default.

A Whole Request That Creates a PDF

{
  "page_sizes": [{ "page": 2, "width": 841.89, "height": 595.28 }],
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "text",
      "pages": [1],
      "rect": { "llx": 60, "lly": 760, "urx": 535, "ury": 785 },
      "content": ["Page one, upright"],
      "font": "sans",
      "font_size": 14
    },
    {
      "type": "text",
      "pages": [2],
      "rect": { "llx": 60, "lly": 540, "urx": 780, "ury": 565 },
      "content": ["Page two, wider than it is tall"],
      "font": "sans",
      "font_size": 14
    }
  ]
}

The line that sends it, in three languages

The sheet, and what is laid under it

The Size of the Pages The Unit a Page Is Measured In Where a Page's Sheet Sits in the Drawing The Areas a Page States The Shapes a Page Lays over What It Draws Which Way up a Page Is Shown How a Page Arrives, and How Long It Stands A PDF You Send, as the Pages Themselves How Far a Supplied PDF Is Allowed to Unpack The Template under the Pages A Watermark Laid across a Run of Pages Named Regions a Page Marks for Filling

Where to Go Next

Every JSON key of a request, in one page The other forty-one settings of a request

See the Prices See the Examples