Code 128 and retail barcodes
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.
PDF417 is the code on identity documents, transport tickets and shipping papers. It carries far more text than a row of bars can, and it survives a laser scanner dragged across it rather than a camera held still — which is what a counter clerk and a loading bay actually have in their hands.
Choose PDF417 when the code will be swept by a laser rather than photographed, and when there is a paragraph to carry rather than a line. It is a stack of narrow rows, so a hand-held scanner dragged across it takes the whole thing in one movement — which is what a clerk at a check-in desk and a driver at a loading bay actually do. It carries well over a thousand characters, enough for a name, an address and a date together, which is why identity documents, transport tickets and shipping papers settle on it. How wide it comes out is yours to set: you say how many columns of data it runs in, and the rows follow from the text, so it can be made to fit a strip along the foot of a ticket.
Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.
Read the Rust source Read the Python source Read the JSON source
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.
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.
The code industry marks small parts with: still readable at sizes where a QR code has given up, on a circuit board or a phial in a laboratory tray.
The code on rail and airline tickets, and the reason is room: it needs no band of white around it, which is the first thing trimmed off a layout that has run tight.
A document made to be followed rather than looked at: every line of the contents lands on the page it names, and every page leads back to where it came from.
Links and marks hung on text the engine has already placed: a band behind a line, an underline, a boxed cell — every rectangle taken from what the layout and the table report afterwards, none of it measured by hand.