A stamp laid across the page
Lay one word across an area, at the size that fills the box: draft, paid, copy, cancelled, on the diagonal or flat.
Asked for with
"type": "stamp"
In plain words
Written for anybody. It says what this puts on a sheet of paper, and asks nothing of you beyond that.
This is the big word you see lying across a document: DRAFT, PAID, COPY. You give the word and the area it must cross, and it takes by itself the size needed to fill it. You choose the direction: rising towards the top-right corner, falling towards the bottom-right corner, or lying flat. A pale colour and a light shadow are enough to make it felt without getting in the way of the document underneath.
For a developer
Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.
A stamp is what a document says about itself rather than what it says. Its font size is derived: the engine fits the line to the diagonal or to the width of the box, then applies the share of the box asked for, 0.95 by default, which leaves a margin all round. The same stamp therefore suits a label and a poster with no change of setting. The shadow's offset is counted in points on the page, so it falls the same way whichever way the line runs. A rotation adds itself on top of the chosen slant.
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.
Required keys: content, a string, the stamp's line; rect; font, the name of a declared font. Optional: span, a number, the share of the box filled, 1 filling it whole, default 0.95; slant, one of up (default, from the lower-left corner to the upper-right one), down or flat; color (default black); shadow, an object of dx, dy and color, all three required; pages, an array of one-based integers, default empty; transform, six numbers; rotate, degrees counter-clockwise about the centre of the box; layer, the name of a declared layer. Cross refusal: transform together with rotate. The font size follows from the box: the wire exposes span to tune it.
A whole request that draws it
Post this as it stands and a PDF comes back. Nothing has been left out of it.
{
"standard_fonts": [{"name": "sans", "face": "helvetica_bold"}],
"items": [
{
"type": "stamp",
"content": "DRAFT",
"rect": {"llx": 72, "lly": 500, "urx": 523, "ury": 700},
"font": "sans",
"color": [0.75, 0.16, 0.16]
}
]
}
Text
A block of text placed on the page Text in paragraphs, with indents and tab stops
Where to go next
Every key of a request, in one page The other twenty things you can draw
Glossary
- font
- The drawing of every letter, digit and mark a document writes, held in a file of its own. A PDF carries the fonts it is set in inside itself, which is why it opens looking the same on a machine that has never had them. Leave them out and a reader puts another font in their place, and the layout moves.
- layer
- A named group of things drawn on a page that a reader can switch on and off, like tracing paper laid over a plan. A drawing can hold its measurements on one and its notes on another, and a layer can be set to show on screen and stay off the printer.