write_codes.json

Die JSON-Datei des Beispiels „QR- und Data-Matrix-Einstellungen nebeneinander“. Derselbe Text in den vier QR-Fehlerkorrekturstufen, ein QR-Code pro Textart und Data-Matrix-Codes als Streifen oder in einer vorab festgelegten Größe.

JSON 125 Zeilen

Diese Datei ist eine Anfrage: Eine Anwendung sendet sie über das Netz an den Server, der das PDF erzeugt und zurücksendet. Sie erzeugt dieselbe Seite wie die Rust- und die Python-Fassung dieses Beispiels. Eine Anfrage nennt jede Datei, die sie verwendet, nie ihren Inhalt; der Aufruf trägt die Anfrage und die Dateien zusammen. Eine Schrift, die der Server bereits vorhält, etwa DejaVuSans, wird ohne Anhang genannt. Senden Sie die Anfrage an die Adresse, die die API-Seite angibt.

Wofür dieses Beispiel da ist

Quadratcode ist nicht gleich Quadratcode. Ein Code auf einer Kiste, die verkratzt wird, braucht mehr Reserve als ein Code auf einem Bildschirm; ein Code für ein schmales Etikett muss ein Streifen statt eines Quadrats sein; ein Code, für den die Druckerei im Layout vorab Platz gelassen hat, muss genau in dieser Größe herauskommen. Wer hier falsch wählt, merkt es am anderen Ende: Der Code lässt sich nicht scannen.

Was dieses Beispiel zeigt

  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}
    }
  ]
}