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 by 842 points.

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

In plain words

Written for anybody. It says what this puts on a sheet of paper, and asks nothing of you beyond that.

A sheet of paper has a width and a height. It works the same way here: you give the width, you give the height, and every page comes out that size. Say nothing and you get the sheet the office printer holds, the one found all over Europe. The measure is not centimetres but points: it takes a little over 28 of them to make one centimetre. That office sheet is 595 points wide and 842 tall.

For a developer

Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.

page sets the size 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 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.

Every key, with its default

The reference: which keys are required, which are optional, what each one defaults to and which combinations the server declines.

  • page — object, optional. Absent, the sheet is 595 × 842 points (A4).
  • page.width — number, required as soon as page is present. Width in points.
  • page.height — number, required as soon as page is 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 draws it

Post this as it stands and a PDF comes back. Nothing has been left out of it.

{
  "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 line that sends it, in three languages

The sheet, and what is laid under it

A size of its own for certain pages The areas a page states Which way up a page is shown The headed paper under the pages

Where to go next

Every key of a request, in one page The other thirty-two settings of a request

See the prices See the examples

Glossary

typographic point
The unit printing measures with, worth a little over a third of a millimetre: seventy-two of them make an inch. The paper, the margins and the height of the lettering are all counted in them, and so is every measurement written inside a PDF file.
request
One call to the service: you send what the document should say, and get the document back. Your bill counts these calls, one for each document. The number of pages inside a document is never counted.

Every word the site explains