The template under the pages

Lay the document's pages over a PDF already made: a letterhead, a contract background, a signature sheet.

Summary

Many firms have a letterhead: the logo at the top, the address at the bottom, and a wide blank in between to write on. The same thing here, in digital form, and you may even supply three of them: one for the first page, one for the pages in between, one for the last — the signature sheet, for instance.

Technically

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

templates names up to three template PDFs stamped under the pages, by page position: the start, the middle, the end. The bytes of each template arrive alongside the request, in a form part carrying exactly that name, from the same pool the placed pages are drawn from. The middle template carries one single page, repeated as many times as needed; the start and end templates may run to several. All three keys are optional: a request may give just one.

Request schema

  • templates — object, optional, absent by default.
  • templates.start — string, optional. The name of the supplied part carrying the template laid under the document's first pages.
  • templates.middle — string, optional. The name of the supplied part carrying the single-page template laid under the pages between first and last. A template of several pages is refused here.
  • templates.end — string, optional. The name of the supplied part carrying the template laid under the document's last pages.

Each name refers to a part of the multipart/form-data body, alongside json_data. A name no part carries is refused. Bringing a page in from another document mid-page is a pdf_page item, which draws on the same pool of supplied parts.

A template is written into the document once, however many pages carry it: each of those pages refers to the same form. Laying one under a hundred pages does not copy its bytes a hundred times.

Content that does not fit carries on to the next page by itself, the way a table and a flowing text already do, and the middle template is laid under each of the pages it takes.

A page brought in from another document that shows more than ten thousand words is refused to a request carrying no licence key. Under the count the page is carried as it stands, text and all; above it, it is not. That limit is ours, not a rule of the format.

A whole request that creates a PDF

{
  "templates": { "start": "letterhead" },
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "text",
      "rect": { "llx": 60, "lly": 640, "urx": 535, "ury": 700 },
      "content": ["Dear Madam,\nThank you for your order of 4 August."],
      "font": "sans",
      "font_size": 11,
      "leading": 15
    }
  ]
}

The line that sends it, in three languages

The sheet, and what is laid under it

The size of the pages 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

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