write_barcode.json

Die JSON-Datei des Beispiels „Code 128 und Handels-Barcodes“. Striche für die beiden Aufgaben, die sie wollen: Code 128 für beliebigen Text und die drei, die eine Kasse liest — EAN-13, UPC-A, EAN-8 —, jeder mit berechneter statt eingetippter letzter Ziffer.

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

Ein Barcode, der sich nicht scannen lässt, hält die Palette am Tor und die Schlange an der Kasse auf. Er scheitert aus Gründen, die niemand auf den ersten Blick sieht — eine um eins verschobene Prüfziffer, Striche, die eine Spur zu dünn sind, weil der Code als Bild gespeichert und dann skaliert wurde, ein weißer Rand, den jemand abgeschnitten hat, damit er passt.

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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
{
  "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,
      "pages": [
        1
      ]
    },
    {
      "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,
      "pages": [
        1
      ]
    },
    {
      "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,
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "FR-1964413",
      "rect": {
        "llx": 72,
        "lly": 700,
        "urx": 237,
        "ury": 740
      },
      "pages": [
        1
      ]
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 640,
        "urx": 382,
        "ury": 697
      },
      "content": [
        "FR-1964413"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9,
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "REF 2026-07-16/ACME",
      "rect": {
        "llx": 72,
        "lly": 580,
        "urx": 336,
        "ury": 620
      },
      "pages": [
        1
      ]
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 520,
        "urx": 382,
        "ury": 577
      },
      "content": [
        "REF 2026-07-16/ACME"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9,
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "a-Z 0..9 +*#%",
      "rect": {
        "llx": 72,
        "lly": 460,
        "urx": 270,
        "ury": 500
      },
      "pages": [
        1
      ]
    },
    {
      "type": "text",
      "rect": {
        "llx": 82,
        "lly": 400,
        "urx": 382,
        "ury": 457
      },
      "content": [
        "a-Z 0..9 +*#%"
      ],
      "font": "DejaVuSans",
      "font_size": 9,
      "leading": 9,
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "ean13",
      "content": "9780201379624",
      "digits": {
        "font": "serif",
        "light_margin": true
      },
      "rect": {
        "llx": 72,
        "lly": 340,
        "urx": 187,
        "ury": 380
      },
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "upc_a",
      "content": "036000291452",
      "digits": {
        "font": "serif",
        "light_margin": false
      },
      "rect": {
        "llx": 72,
        "lly": 220,
        "urx": 187,
        "ury": 260
      },
      "pages": [
        1
      ]
    },
    {
      "type": "barcode",
      "symbology": "ean8",
      "content": "96385074",
      "digits": {
        "font": "serif",
        "light_margin": true
      },
      "rect": {
        "llx": 72,
        "lly": 100,
        "urx": 159,
        "ury": 140
      },
      "pages": [
        1
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 72,
        "lly": 762,
        "urx": 667.276,
        "ury": 794
      },
      "content": "Codes built and sized other ways",
      "font": "DejaVuSans",
      "font_size": 16,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 72,
        "lly": 749.0,
        "urx": 667.276,
        "ury": 770
      },
      "content": "Each module below is a whole number of printer pixels, so every bar edge falls",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 72,
        "lly": 734.0,
        "urx": 667.276,
        "ury": 755
      },
      "content": "on a pixel. Under each code, what it carries and how it was built.",
      "font": "DejaVuSans",
      "font_size": 10.5,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "40063813339301",
      "code_set": "c",
      "module": {
        "width": 0.9354330708661418,
        "dpi": 288
      },
      "rect": {
        "llx": 72,
        "lly": 680,
        "urx": 204,
        "ury": 720
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 650,
        "urx": 677.276,
        "ury": 668
      },
      "content": "40063813339301",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 639,
        "urx": 677.276,
        "ury": 657
      },
      "content": "Digits packed two to a character: 112 modules of 4 pixels at 288 dpi",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "barcode",
      "symbology": "code128",
      "content": "40063813339301",
      "code_set": "b",
      "module": {
        "width": 0.9354330708661418,
        "dpi": 288
      },
      "rect": {
        "llx": 72,
        "lly": 580,
        "urx": 281,
        "ury": 620
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 550,
        "urx": 677.276,
        "ury": 568
      },
      "content": "40063813339301",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 539,
        "urx": 677.276,
        "ury": 557
      },
      "content": "The same digits one character at a time: 189 modules",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "barcode",
      "symbology": "upc_e",
      "content": "01234565",
      "module": {
        "width": 1.5,
        "dpi": 288
      },
      "digits": {
        "font": "serif"
      },
      "rect": {
        "llx": 72,
        "lly": 480,
        "urx": 178.5,
        "ury": 520
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 87,
        "lly": 443.5,
        "urx": 682.276,
        "ury": 461.5
      },
      "content": "01234565",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 87,
        "lly": 432.5,
        "urx": 682.276,
        "ury": 450.5
      },
      "content": "A UPC-E, its zeros left out: a scanner hands back the UPC-A 012345000065",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "barcode",
      "symbology": "ean13",
      "content": "9780201379624",
      "module": {
        "width": 0.9354330708661418,
        "dpi": 288
      },
      "rect": {
        "llx": 72,
        "lly": 350,
        "urx": 187,
        "ury": 390
      },
      "pages": [
        2
      ]
    },
    {
      "type": "barcode",
      "symbology": "add_on5",
      "content": "52495",
      "module": {
        "width": 0.9354330708661418,
        "dpi": 288
      },
      "rect": {
        "llx": 176,
        "lly": 350,
        "urx": 243,
        "ury": 390
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 186,
        "lly": 366.748,
        "urx": 781.276,
        "ury": 392
      },
      "content": "52495",
      "font": "serif",
      "font_size": 12.626,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 315,
        "urx": 677.276,
        "ury": 333
      },
      "content": "9780201379624",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    },
    {
      "type": "flow",
      "rect": {
        "llx": 82,
        "lly": 304,
        "urx": 677.276,
        "ury": 322
      },
      "content": "An EAN-13 with the five-digit add-on 52495 beside it, 9 modules away",
      "font": "DejaVuSans",
      "font_size": 9,
      "first_baseline": {
        "points": 0
      },
      "pages": [
        2
      ]
    }
  ]
}