A square QR code, read with a phone
Draw a QR code carrying a web address or a piece of text, read by any phone, with its white margin all around.
Asked for with
"type": "qr"
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 little square of black dots you point a phone camera at. You give what it should carry — a web address, an order number, a network password — and where to put it. The square is drawn at the right size, with the small white margin around it that lets the phone recognise it first time. The longer the text, the finer the dots: for a code read from a distance or printed small, a short text works best.
For a developer
Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.
The code is encoded in byte mode at correction level M, which covers ASCII as well as UTF-8. The square and its quiet zone on all four sides fill the rectangle's width, and the whole is anchored at the lower-left corner: the rectangle's height is headroom, its width commands. The version chosen is the smallest that holds the text; text the largest symbol accepts goes through, beyond that the answer is 400. As with the other codes, the item draws the symbol alone, and the human-readable text is laid beside it.
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 non-empty string; rect. 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. The encoding mode and the correction level are fixed: the wire exposes the content and the box.
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": "qr",
"content": "https://hqf-pdf.com/",
"rect": {"llx": 72, "lly": 680, "urx": 152, "ury": 760}
}
]
}
Barcodes and square codes
A barcode of vertical bars 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
Glossary
- byte
- The unit a file's weight is counted in, the way a parcel is counted in grams. A thousand of them make a kilobyte, and a million make a megabyte — the size of one photograph taken with a telephone. A one-page PDF here weighs between six thousand and a hundred and twenty thousand, so a hundred of them fit in the space of five photographs.
- 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.