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.

Summary

The stroke you would draw against a ruler: a start, a finish, and nothing in between to think about. Round or squared ends, dotted or dashed, in the colour that suits the page. It is the shortest piece to write when all you want is to separate two things.

Technically

Asked for with "type": "line"

Two points and a stroke: that is all the item carries, written as a single m and l pair stroked with S, and the coordinates take expressions, so a line runs from one margin to the other without the page width being known. The stroke states 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.

Request schema

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 rectangle; layer, the name of a declared layer. Cross refusal: transform together with rotate.

A whole request that creates a PDF

{
  "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],
        "cap": "round",
        "join": "round"
      }
    }
  ]
}

The line that sends it, in three languages

Shapes

A free path: lines, curves and filled shapes A rectangle, filled or outlined A drawing declared once and placed as often as wanted

Where to go next

Every JSON key of a request, in one page The other twenty-two things you can draw

See the prices See the examples