write_qr.json

The JSON file of the “QR codes” example. The code an invoice, a boarding pass or a label ends up wanting, drawn into the document rather than fetched as a picture and pasted in.

JSON 185 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 creates 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

QR is the code most documents end up wanting: a payment to make on an invoice, a boarding pass, a link to a case file, a serial number on a label. It is also the one most often fetched from some website, downloaded as a picture and pasted in — which works until the day the picture is resized and the code stops reading.

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
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
  "metadata": {
    "title": "QR codes, drawn as squares"
  },
  "items": [
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 794, "urx": 523.276, "ury": 813.2},
      "content": [
        "QR codes, drawn as squares"
      ],
      "font": "DejaVuSans",
      "font_size": 16
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 770, "urx": 523.276, "ury": 782.6},
      "content": [
        "A QR code holds a link or a reference that a telephone reads in one shot. It is"
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 755, "urx": 523.276, "ury": 767.6},
      "content": [
        "drawn square by square here, so it stays readable at any size it is printed at."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "qr",
      "content": "https://example.test/invoice/FR-1964413",
      "rect": {"llx": 72, "lly": 628, "urx": 183, "ury": 739}
    },
    {
      "type": "text",
      "rect": {"llx": 84, "lly": 560, "urx": 284, "ury": 636},
      "content": ["https://example.test/invoice/FR-1964413"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    },
    {
      "type": "qr",
      "content": "REF 2026-07-16/ACME",
      "rect": {"llx": 283.6875, "lly": 628, "urx": 382.6875, "ury": 727}
    },
    {
      "type": "text",
      "rect": {"llx": 295.6875, "lly": 560, "urx": 495.6875, "ury": 636},
      "content": ["REF 2026-07-16/ACME"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    },
    {
      "type": "qr",
      "content": "a-Z 0..9 +*#% and on",
      "rect": {"llx": 421.648438, "lly": 628, "urx": 520.648438, "ury": 727}
    },
    {
      "type": "text",
      "rect": {"llx": 433.648438, "lly": 560, "urx": 570, "ury": 636},
      "content": ["a-Z 0..9 +*#% and on"],
      "font": "DejaVuSans",
      "font_size": 8,
      "leading": 8
    },
    {
      "type": "qr",
      "content": "20260716",
      "mode": "numeric",
      "rect": {
        "llx": 72,
        "lly": 488,
        "urx": 159,
        "ury": 575
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 84.0,
        "lly": 472.0,
        "urx": 679.276,
        "ury": 488.0
      },
      "content": "20260716",
      "font": "DejaVuSans",
      "font_size": 8,
      "first_baseline": {
        "points": 0
      }
    },
    {
      "type": "qr",
      "content": "HQF-2026-0917",
      "correction": "high",
      "rect": {
        "llx": 183,
        "lly": 488,
        "urx": 282,
        "ury": 587
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 195.0,
        "lly": 472.0,
        "urx": 790.276,
        "ury": 488.0
      },
      "content": "HQF-2026-0917",
      "font": "DejaVuSans",
      "font_size": 8,
      "first_baseline": {
        "points": 0
      }
    },
    {
      "type": "qr",
      "content": "HQF BYTES 2026",
      "rect": {
        "llx": 306,
        "lly": 488,
        "urx": 393,
        "ury": 575
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 318.0,
        "lly": 472.0,
        "urx": 913.276,
        "ury": 488.0
      },
      "content": "HQF BYTES 2026",
      "font": "DejaVuSans",
      "font_size": 8,
      "first_baseline": {
        "points": 0
      }
    },
    {
      "type": "qr",
      "content": "LOT 4472",
      "correction": "quartile",
      "rect": {
        "llx": 72,
        "lly": 348,
        "urx": 159,
        "ury": 435
      }
    },
    {
      "type": "flow",
      "rect": {
        "llx": 84.0,
        "lly": 332.0,
        "urx": 679.276,
        "ury": 348.0
      },
      "content": "LOT 4472",
      "font": "DejaVuSans",
      "font_size": 8,
      "first_baseline": {
        "points": 0
      }
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 310, "urx": 523.276, "ury": 322.6},
      "content": [
        "The last code holds 230 dark modules out of 441."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    }
  ]
}