The Template under the Pages
Lay the document's pages over a PDF already created: a letterhead, a contract background, a signature sheet.
See It in a Real PDF
A long table handed over whole, deciding for itself where the pages break: its heading on top of every page, its footnote under every page, a quarter's cell spanning its rows and written again at the top of the next page when a page cuts it, and a note you draw under each page at the exact place the table reports.
Open the PDF The Whole Example
Also shown in: An Agreement Built on Three Supplied Templates
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. -
templates.fields— object, optional, absent by default. Whether the form fields a template page comes with are laid down again on every page it backs, where it shows them:font, required, the name of the font a text field, a choice or a button it brings along is set in;font_size, required, the size they are set at, in points. Absent, a template brings its drawing alone. -
templates.redact— array, optional, empty by default. The patches taken out of template pages, each an object:template, required, the name a position gives the template;page, required, the page of that template, counting from one;llx,lly,urx,ury, required, the edges of the patch in points, measured on the template page;fill, optional, the colour the emptied patch is filled with, left blank when absent.
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.
What lies under a patch of templates.redact — letters, pictures, shapes — is removed from the created file, not covered: no reader and no program reading the file finds it again. A request naming a template no position brings in, or a page the template does not have, is refused.
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 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 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 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