write_aztec.json

The JSON file of the “Aztec codes” example. The code on rail and airline tickets, and the reason is room: it needs no band of white around it, which is the first thing trimmed off a layout that has run tight.

JSON 76 lines

This file is a request: an application sends it over the network to the server, which creates the PDF and sends it back. It makes the same page as the Rust and Python versions of this example. A request names every file it uses, never its content; the call carries the request and the files together. A font the server already holds, such as DejaVuSans, is named with nothing attached. Send the request to the address the API page gives.

What this example is for

Aztec is the code on rail and airline tickets in Europe, and the reason is room. Every other two-dimensional code demands a band of white all the way round it, which on a ticket the size of a bus pass is room nobody has — and that margin is the first thing somebody trims off when the layout gets tight, quietly breaking the code.

What this example shows

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  "metadata": {
    "title": "Aztec codes, drawn as squares"
  },
  "items": [
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 794, "urx": 523.276, "ury": 813.2},
      "content": [
        "Aztec codes, drawn as squares"
      ],
      "font": "DejaVuSans",
      "font_size": 16
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 770, "urx": 523.276, "ury": 782.6},
      "content": [
        "An Aztec code asks for no white margin around it, so it fits where nothing else"
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 755, "urx": 523.276, "ury": 767.6},
      "content": [
        "would; a train ticket carries one. Beside each is what a scanner reads back."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "aztec",
      "content": "HQF2026 PARIS LONDON 14B 07JUL",
      "correction": 23,
      "rect": {"llx": 72, "lly": 643, "urx": 129, "ury": 700}
    },
    {
      "type": "text",
      "rect": {"llx": 141, "lly": 600, "urx": 341, "ury": 679.5},
      "content": ["HQF2026 PARIS LONDON 14B 07JUL"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    },
    {
      "type": "aztec",
      "content": "https://example.test/track/FR-1964413",
      "correction": 46,
      "rect": {"llx": 72, "lly": 556, "urx": 141, "ury": 625}
    },
    {
      "type": "text",
      "rect": {"llx": 153, "lly": 520, "urx": 353, "ury": 598.5},
      "content": ["https://example.test/track/FR-1964413"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    },
    {
      "type": "aztec",
      "content": "a-Z 0..9 +*#% and on",
      "correction": 5,
      "rect": {"llx": 72, "lly": 481, "urx": 129, "ury": 538}
    },
    {
      "type": "text",
      "rect": {"llx": 141, "lly": 440, "urx": 341, "ury": 517.5},
      "content": ["a-Z 0..9 +*#% and on"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    }
  ]
}