The size of the pages
Give the document's pages a width and a height. Say nothing and the sheet is an A4 of 595.276 by 841.89 points.
Summary
The measure here is not centimetres but points: it takes a little over 28 of them to make one centimetre. The sheet the office printer takes, the one found all over Europe, comes to 595.276 points wide and 841.89 tall. Every page of the document comes out at the size you give, and a sheet laid the wide way round is simply one whose first number is the larger of the two.
Technically
Written at the top level of a request, under
"page"
page sets the /MediaBox of every page in the document, in typographic points (one point is one seventy-second of an inch). Coordinates start at the bottom-left corner of the sheet and the vertical axis goes up, and items are placed from there. Both numbers are required as soon as the object is present. A page that wants a size of its own goes through page_sizes, which names it by number and takes precedence. The coordinate expressions {page_width} and {page_height} carry these two numbers.
Request schema
-
page— object, optional. Absent, the sheet is 595.276 × 841.89 points (A4). -
page.width— number, required as soon aspageis present. Width in points. -
page.height— number, required as soon aspageis present. Height in points.
Scope: every page of the document. page_sizes takes over page by page, by number counting from 1. Unknown keys in an object are ignored; the same key written twice in one object is refused when the request is read.
A whole request that creates a PDF
{
"page": { "width": 420, "height": 595 },
"standard_fonts": [{ "name": "sans", "face": "helvetica" }],
"items": [
{
"type": "text",
"rect": { "llx": 40, "lly": 530, "urx": 380, "ury": 555 },
"content": ["A5 upright"],
"font": "sans",
"font_size": 18
}
]
}
The sheet, and what is laid under it
A size of its own for certain pages The unit a page is measured in 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 How far a supplied PDF is allowed to unpack The template under the pages
Where to go next
Every JSON key of a request, in one page The other forty-one settings of a request