A straight line between two points
Pull a line from one point to another, at the thickness, colour and dash you want: a divider, an underline, a ruled row.
Asked for with
"type": "line"
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 ruled stroke: you give the starting point, the finishing point and the thickness. It serves as a divider under a heading, as a line to fill in on a paper form, or as a rule on a notebook page. You can have it dotted or dashed, with round or squared ends, in the colour you choose. It is the shortest piece to write when all you want is to separate two things.
For a developer
Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.
Two points and a stroke: that is all the item carries, and the coordinates take expressions, so a line runs from one margin to the other without the page width being known. The stroke carries its thickness, its colour, its dash pattern with its phase, the shape of its ends and that of its joins. A line goes on the pages it names, turns, transforms and sits on a layer like the other drawn items.
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: from and to, objects of x and y, each a number or an expression; stroke, an object with a required width plus color (default black), dash (an object with a required lengths — at least one length, none negative, not all zero — and a phase, default 0), cap (butt by default, round, projecting) and join (miter by default, round, bevel). Optional: 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.
A whole request that draws it
Post this as it stands and a PDF comes back. Nothing has been left out of it.
{
"items": [
{
"type": "line",
"from": {"x": 72, "y": 720},
"to": {"x": "{page_width} - 72", "y": 720},
"stroke": {"width": 1.2, "color": [0.11, 0.31, 0.55]}
}
]
}
Shapes
A free path: lines, curves and filled shapes A rectangle, filled or outlined
Where to go next
Every key of a request, in one page The other twenty things you can draw
Glossary
- 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.