write_codes.json

The JSON file of the “QR and Data Matrix Settings Side by Side” example. The same text at the four QR correction levels, one QR code per kind of text, and Data Matrix codes on a strip or at a size chosen in advance.

JSON 125 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

A square code is not one thing. A code printed on a crate that gets scratched needs more of itself kept in reserve than a code on a screen; a code that must fit a narrow label has to be a strip rather than a square; a code that the printing works has laid out in advance has to come out at exactly the size the layout left for it. Getting one of these wrong shows up at the far end, when the code does not scan.

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
{
  "metadata": {
    "title": "The codes a request can ask for by shape, by size, by level and by mode"
  },
  "items": [
    {
      "type": "text",
      "rect": {"llx": 56, "lly": 794, "urx": 539, "ury": 813.2},
      "content": [
        "Codes asked for by shape, by size, by level and by mode"
      ],
      "font": "DejaVuSans",
      "font_size": 16
    },
    {
      "type": "text",
      "rect": {"llx": 56, "lly": 762, "urx": 539, "ury": 782.6},
      "content": [
        "The same text at the four correction levels: low, medium, quartile, high."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "qr",
      "content": "https://example.test/lot/FR-1964413",
      "correction": "low",
      "rect": {"llx": 56, "lly": 650, "urx": 166, "ury": 760}
    },
    {
      "type": "qr",
      "content": "https://example.test/lot/FR-1964413",
      "correction": "medium",
      "rect": {"llx": 180, "lly": 650, "urx": 290, "ury": 760}
    },
    {
      "type": "qr",
      "content": "https://example.test/lot/FR-1964413",
      "correction": "quartile",
      "rect": {"llx": 304, "lly": 650, "urx": 414, "ury": 760}
    },
    {
      "type": "qr",
      "content": "https://example.test/lot/FR-1964413",
      "correction": "high",
      "rect": {"llx": 428, "lly": 650, "urx": 538, "ury": 760}
    },
    {
      "type": "text",
      "rect": {"llx": 56, "lly": 620, "urx": 539, "ury": 640.6},
      "content": [
        "One text to a mode: digits, capitals and punctuation, and any byte at all."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "qr",
      "content": "31964413000271026",
      "mode": "numeric",
      "rect": {"llx": 56, "lly": 500, "urx": 166, "ury": 610}
    },
    {
      "type": "qr",
      "content": "LOT FR-1964413/2026",
      "mode": "alphanumeric",
      "rect": {"llx": 180, "lly": 500, "urx": 290, "ury": 610}
    },
    {
      "type": "qr",
      "content": "lot fr-1964413",
      "mode": "byte",
      "correction": "quartile",
      "rect": {"llx": 304, "lly": 500, "urx": 414, "ury": 610}
    },
    {
      "type": "text",
      "rect": {"llx": 56, "lly": 470, "urx": 539, "ury": 490.6},
      "content": [
        "A Data Matrix on a strip: the smallest oblong symbol that holds the text."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "data_matrix",
      "content": "SN:ACME-4472",
      "shape": "rectangle",
      "rect": {"llx": 56, "lly": 380, "urx": 236, "ury": 460}
    },
    {
      "type": "data_matrix",
      "content": "TUBE-77",
      "shape": "rectangle",
      "rect": {"llx": 260, "lly": 380, "urx": 440, "ury": 460}
    },
    {
      "type": "text",
      "rect": {"llx": 56, "lly": 350, "urx": 539, "ury": 370.6},
      "content": [
        "A Data Matrix of a size the request names: two texts, one symbol size."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "data_matrix",
      "content": "FR-1964413",
      "size": {"height": 16, "width": 48},
      "rect": {"llx": 56, "lly": 240, "urx": 296, "ury": 340}
    },
    {
      "type": "data_matrix",
      "content": "FR-2",
      "size": {"height": 16, "width": 48},
      "rect": {"llx": 300, "lly": 240, "urx": 540, "ury": 340}
    },
    {
      "type": "data_matrix",
      "content": "FR-1964413/2026-08",
      "size": {"height": 22, "width": 22},
      "rect": {"llx": 56, "lly": 120, "urx": 176, "ury": 230}
    }
  ]
}