A barcode of vertical bars

Draw a barcode a scanner reads: Code 128 for text, and EAN-13, UPC-A or EAN-8 for a retail article number.

Asked for with "type": "barcode"

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 run of black bars the cashier passes under the little red lamp. You give the text or the article number and the frame it must fit into: the bars are drawn at the right width, with the white margin readers ask for at either end. Because the bars are truly drawn rather than pasted in as a photo, they stay crisp in print, even on a tiny label. If you also want the number written out in figures under the bars, you add a block of text just below.

For a developer

Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.

The bars and the quiet zones fill the rectangle's width, and the bars take its whole height. Four symbologies: Code 128, which carries the printable ASCII characters, and the three retail codes, which carry an article number. For EAN-13, twelve digits are the number and the check digit is computed, thirteen are the whole code and the check digit is verified; the same rule holds for UPC-A at eleven or twelve digits, and for EAN-8 at seven or eight. Text the chosen symbology can encode is accepted; anything else answers 400.

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; rect. Optional: symbology, one of code128 (default), ean13, upc_a or ean8; fill, the colour of the bars (default black), written as colour is written everywhere else: one number for grey, three for red, green and blue, four for the four inks, {"gray": n}, or {"space": "name", "components": …}; 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 item draws the bars alone; the human-readable digits are laid with a text item.

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": "barcode",
      "content": "FR-1964413",
      "rect": {"llx": 72, "lly": 700, "urx": 237, "ury": 740}
    }
  ]
}

The line that sends it, in three languages

Barcodes and square codes

A square QR code, read with a phone An Aztec code, with no white margin around it A Data Matrix code, very small and very sturdy A PDF417 code, carrying a whole form

Where to go next

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

See the prices See the examples

Glossary

CMYK
The four inks a printing press lays down: cyan, magenta, yellow and black. A screen mixes light instead, so a document going to a press states its colours in inks, not in screen colours.
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.

Every word the site explains