A drawing made once, shown by a button

Describe a drawing under a name, with lines and shapes, so a form button carries it as its icon.

Summary

A button you click on says more with a small drawing on it than with a word: a green tick, an arrow, a cross. The motif is worked out from lines and shapes rather than photographed, so it stays crisp whether the button is the size of a stamp or of a postcard.

Technically

Written at the top level of a request, under "drawings"

drawings declares the drawings the document defines for itself, each as a form XObject with its own /BBox and /Matrix, under the name a button's icon shows it by. A drawing carries the same items a page does — a path, a rectangle, a line, a block of text — laid out in a space of its own rather than on a sheet. Nothing fresh is invented there: they are the items the schema already has. It is written into the file once and painted by name, however many times it is shown. A drawing declared here is placed on a page by a drawing item, and shown as a button's icon by name.

Request schema

  • drawings — array, optional, empty by default.
  • drawings[].name — string, required. The name an icon shows it by. A name declared twice keeps the last.
  • drawings[].box — object, required. The area of the drawing's space that is kept: llx, lly, urx, ury, numbers, all required. Nothing outside it is drawn.
  • drawings[].items — array, required. The shapes it is made of, in drawing order. Four kinds: path, rect, line, text.
  • drawings[].matrix — array of six numbers, optional. What the drawing's own space is worth in the space it is shown in. Absent, it is shown as it was drawn.
  • An item of a drawing declaring pages, layer, id or relative_to is refused: a drawing is not on a page, and its coordinates name no page variable.
  • An image and a code are planned for a future version inside a drawing: a drawing has no access to the request's images.
  • The button showing it is a push_button item, through its icon, rollover_icon or down_icon key, with icon_fit for the framing and layout for where the caption sits.

A whole request that creates a PDF

{
  "drawings": [
    {
      "name": "tick",
      "box": { "llx": 0, "lly": 0, "urx": 20, "ury": 20 },
      "items": [
        {
          "type": "line",
          "from": { "x": 3, "y": 10 },
          "to": { "x": 8, "y": 4 },
          "stroke": { "width": 2, "color": [0.09, 0.42, 0.24] }
        },
        {
          "type": "line",
          "from": { "x": 8, "y": 4 },
          "to": { "x": 17, "y": 16 },
          "stroke": { "width": 2, "color": [0.09, 0.42, 0.24] }
        }
      ]
    }
  ],
  "standard_fonts": [{ "name": "sans", "face": "helvetica" }],
  "items": [
    {
      "type": "push_button",
      "name": "approve",
      "rect": { "llx": 60, "lly": 740, "urx": 84, "ury": 764 },
      "font": "sans",
      "font_size": 10,
      "icon": "tick",
      "layout": "icon_only"
    }
  ]
}

The line that sends it, in three languages

What is drawn, and how it comes out

Everything that can be drawn on a page 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 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

See the prices See the examples