write_barcode.json

The JSON file of the “Code 128 and retail barcodes” example. Stripes for the two jobs that want them: Code 128 for any text at all, and the three a till reads — EAN-13, UPC-A, EAN-8 — each with its last digit worked out rather than typed.

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

A barcode that does not scan stops the pallet at the door and the queue at the till. It fails for reasons nobody can see by looking — a check digit one out, bars a shade too thin because the code was saved as a picture and then resized, a white margin somebody trimmed off to make it fit.

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
186
187
188
189
190
{
  "metadata": {
    "title": "Barcodes, drawn as bars"
  },
  "items": [
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 794, "urx": 523.276, "ury": 813.2},
      "content": [
        "Barcodes, drawn as bars"
      ],
      "font": "DejaVuSans",
      "font_size": 16
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 770, "urx": 523.276, "ury": 782.6},
      "content": [
        "Each barcode below is drawn as bars, not pasted in as a picture, so it prints"
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "text",
      "rect": {"llx": 72, "lly": 755, "urx": 523.276, "ury": 767.6},
      "content": [
        "exactly as wide as it should. Under each one is what a scanner reads back."
      ],
      "font": "DejaVuSans",
      "font_size": 10.5
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "FR-1964413",
      "rect": {
        "llx": 72,
        "lly": 700,
        "urx": 237,
        "ury": 740
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 640,
        "urx": 382,
        "ury": 697
      },
      "content": [
        "FR-1964413"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "REF 2026-07-16/ACME",
      "rect": {
        "llx": 72,
        "lly": 580,
        "urx": 336,
        "ury": 620
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 520,
        "urx": 382,
        "ury": 577
      },
      "content": [
        "REF 2026-07-16/ACME"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "a-Z 0..9 +*#%",
      "rect": {
        "llx": 72,
        "lly": 460,
        "urx": 270,
        "ury": 500
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 400,
        "urx": 382,
        "ury": 457
      },
      "content": [
        "a-Z 0..9 +*#%"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    },
    {
      "type": "barcode",
      "symbology": "ean13",
      "content": "9780201379624",
      "rect": {
        "llx": 72,
        "lly": 340,
        "urx": 187,
        "ury": 380
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 280,
        "urx": 382,
        "ury": 337
      },
      "content": [
        "9780201379624"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    },
    {
      "type": "barcode",
      "symbology": "upc_a",
      "content": "036000291452",
      "rect": {
        "llx": 72,
        "lly": 220,
        "urx": 187,
        "ury": 260
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 160,
        "urx": 382,
        "ury": 217
      },
      "content": [
        "036000291452"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    },
    {
      "type": "barcode",
      "symbology": "ean8",
      "content": "96385074",
      "rect": {
        "llx": 72,
        "lly": 100,
        "urx": 159,
        "ury": 140
      }
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 40,
        "urx": 382,
        "ury": 97
      },
      "content": [
        "96385074"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9
    }
  ]
}