Everything that can be drawn on a page
The one required key: the list of what gets drawn, in drawing order. Twenty-four kinds in all.
Summary
Everything else settles the document; this one fills it. Text, a table, a photograph, a barcode, a line, a tick box: each thing says what it is and where it goes. The last one written passes over the ones before, like sheets stacked on a desk, which is how a stamp ends up on top of the page it crosses.
Technically
Written at the top level of a request, under
"items"
items is the one key a request must carry. It is an array, in drawing order, where each entry has a type key saying which of the twenty-four kinds it is; that order is paint order, so a later item covers an earlier one. Most kinds share a common base of settings: the rectangle they live in, the pages they appear on, the layer they belong to, a rotation or a transform. Each kind has a detail page of its own.
Request schema
-
items— array, required. The one key a request must carry. -
Each entry is an object carrying
type, or an array whose first element is the label. An object with notypeis refused; twotypekeys in one object are refused too. -
Twenty-four
typevalues, each with a page of its own, listed below. -
Settings most kinds share:
pages, either an array of one-based integers, empty by default and meaning every page, or a rule:every, one ofpage(the default),odd_pageoreven_page;fromandto, one-based page numbers, each included, absent running from the first page and to the last;but, an array of pages left out, each a number or an expression, so"{page_of_headline}"leaves out the page an item opened on.layer(the name of a declared layer),idandrelative_to(placement relative to another item),transform(six numbers) orrotate(degrees) — both together are refused.
The twenty-four things an item can be
Each has a page of its own: what it is, what it does technically, the schema of the request it takes, and a whole request showing it.
Text
-
A block of text placed on the page
textSet text inside a chosen rectangle, with its font, size and colour, and give one word in the middle of a sentence a style of its own. -
Text in paragraphs, with indents and tab stops
flowLay several paragraphs in a frame, with a first-line indent, space between them, bulleted lists and neat columns of figures. -
A stamp laid across the page
stampLay one word across an area, at the size that fills the box: draft, paid, copy, cancelled, on the diagonal or flat. -
A line of words set along a path
text_pathRun one line of text round a seal, over an arch or along the edge of a map: every letter stands on the curve and leans the way it leans. -
Blocks laid one under the other, page after page
stackPile paragraphs, tables, pictures and rules in reading order and let them find their own pages: what does not fit carries on in the box of the next one.
Tables
-
A table that carries on from page to page
tableRows and columns flowing over as many pages as needed, with a repeated header, rules, coloured backgrounds and merged cells.
Pictures and imported pages
-
A picture placed in a rectangle
imagePlace a photo or a logo supplied with the request in a chosen frame, stretched to the edges or kept at its own proportions. -
A page of a supplied PDF, placed on the page
pdf_pageTake one page of a PDF sent with the request and place it in a frame, at its own proportions, among the other items.
Barcodes and square codes
-
A barcode of vertical bars
barcodeDraw a barcode a scanner reads: Code 128, Code 39, Code 93, ITF-14, Codabar, EAN-13, UPC-A, EAN-8, UPC-E, GS1 DataBar and the two add-ons. -
A square QR code, read with a phone
qrDraw a QR code carrying a web address or a piece of text, read by any phone, with its white margin all around. -
An Aztec code, with no white margin around it
aztecDraw an Aztec code, the one on train tickets: square, needing no margin, with the share of safety you choose. -
A Data Matrix code, very small and very sturdy
data_matrixDraw a Data Matrix code, the one on parcels and small parts: as much content as a QR code in far less room. -
A PDF417 code, carrying a whole form
pdf417Draw a PDF417 code of stacked bars, the one on boarding passes: it carries a whole form, not merely a number.
Shapes
-
A free path: lines, curves and filled shapes
pathDraw a shape point by point, with straight segments and curves, filled with a colour or a gradient, and outlined with a stroke. -
A rectangle, filled or outlined
rectPlace a rectangle: a coloured band behind a heading, a frame around an area, or both, with the stroke you choose. -
A straight line between two points
linePull a line from one point to another, at the thickness, colour and dash you want: a divider, an underline, a ruled row. -
A drawing declared once and placed as often as wanted
drawingPut a drawing the request declared on the page, where you want it and at the size you want, without the file carrying the same ink twice.
Form fields
-
A field the reader types into
text_fieldAdd a field to fill in: a name, an address, a comment over several lines, a hidden password, or a number one square per digit. -
A box the reader ticks
check_boxAdd a tick box: accepting terms, choosing an option, with the mark you pick and the value the form reports. -
A list the reader picks from
choice_fieldOffer a list of answers: an open list, a drop-down menu, or a menu the reader may also type an answer into. -
Several buttons, one answer
radio_groupPlace buttons of which only one stays chosen at a time, each in its own spot, all belonging to the same question. -
The place kept for a signature
signature_fieldKeep a spot on the page where an electronic signature will settle, with its name and its frame. -
A button the reader presses
push_buttonPlace a button that acts instead of answering: open an address, go to a page, send the form or reset it.
Navigation
-
A patch of page a reader clicks
linkMake a patch of page clickable: it opens a web address, or takes the reader to another page of the same document.
A whole request that creates a PDF
{
"standard_fonts": [{ "name": "sans", "face": "helvetica" }],
"items": [
{
"type": "rect",
"rect": { "llx": 60, "lly": 700, "urx": 535, "ury": 780 },
"fill": [0.93, 0.95, 0.98]
},
{
"type": "text",
"id": "headline",
"rect": { "llx": 72, "lly": 730, "urx": 523, "ury": 760 },
"content": ["Drawn second, so it sits on top"],
"font": "sans",
"font_size": 16
},
{
"type": "text",
"rect": { "llx": 72, "lly": 690, "urx": 523, "ury": 712 },
"relative_to": { "id": "headline", "edge": "bottom", "offset": -18 },
"content": ["Placed under the line above, wherever that one landed"],
"font": "sans",
"font_size": 11
},
{
"type": "text",
"rect": { "llx": 72, "lly": 60, "urx": 523, "ury": 76 },
"pages": { "every": "even_page", "from": 3, "but": [7] },
"content": ["On the even pages from page three, page seven excepted"],
"font": "sans",
"font_size": 9
}
]
}
What is drawn, and how it comes out
The file's weight and the time it takes The first page, shown while the rest arrives Layers reading software shows or hides A name that stands for several layers at once A drawing made once, shown by a button The sets of layers reading software offers Layers reading software shows one of at a time
Where to go next
Every JSON key of a request, in one page The other forty-one settings of a request