PDFPipe

2D matrix / Aztec Code

Aztec code in a PDF

The 2D code that needs no quiet zone at all, with a bullseye finder in the middle, used across European rail ticketing.

Where the symbol comes from

This API renders HTML to PDF. It does not generate barcodes, so the Aztec Code symbol itself is produced by an encoder in your own stack and placed in the markup, either as inline SVG or as a data URI. That split matters more than it sounds: the encoders are mature and correct, and almost every barcode that will not scan failed for a layout reason rather than an encoding one. Everything below is about the layout half.

What it can encode

Up to 3,832 digits or 3,067 alphanumeric characters. It is efficient at the small end: for a short payload an Aztec symbol is typically smaller than the equivalent QR code, partly because of the encoding and mostly because it does not have to reserve a margin.

The check digit, and who computes it

Reed-Solomon with a configurable proportion of the symbol given over to correction, typically defaulting to around 23 percent. Unlike QR's four fixed levels this is a continuous choice, which matters when a symbol has to survive being folded in a pocket.

Size and quiet zone

The two measurements that decide whether a scanner accepts the symbol, and the two most often lost when a design is adjusted to fit.

  • X-dimension: Module sizes comparable to QR, so around 0.4mm as a floor for a printed symbol read by a phone. Because there is no quiet zone the whole footprint is symbol, which is why it fits where a QR code will not.
  • Quiet zone: None required. That is the headline property and it is genuinely unusual: the concentric bullseye at the centre gives the decoder a locating pattern that does not depend on finding the symbol's outer edge, so the symbol can sit flush against other content.

Where it is used

  • rail tickets across Europe, where the symbol is printed on small stock and scanned at a gate
  • airline boarding passes, as an alternative to the stacked format
  • vehicle and parking permits, where the symbol shares a small area with printed text
  • any application where the design genuinely has no room for a margin

Placing it in the markup

The quiet zone is padding on the container rather than part of the encoder's output, so it survives a change of encoder. Dimensions are in millimetres, because a bar width is a physical measurement and a percentage makes it depend on whatever the container happens to be.

html
<figure class="aztec">
  <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0i..." alt="Rail ticket">
</figure>

<style>
.aztec {
  margin: 0;
  /* No quiet zone is required, which is the point of choosing Aztec.
     A millimetre of white is still cheap insurance against a trimming
     error on a small ticket, and it costs nothing to keep. */
  padding: 1mm;
  background: #fff;
  width: max-content;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.aztec img {
  width: 26mm;
  height: 26mm;
  display: block;
  image-rendering: crisp-edges;
}
</style>

What goes wrong on paper

Trusting the no-quiet-zone property through a trim. The specification does not require a margin, and a ticket cut a millimetre off true can still slice into the symbol itself. Keep a millimetre of white even though nothing demands it, because a trimming tolerance is a physical fact and a specification is not.

First thing to check when it will not scan

Look at the centre. The bullseye is the finder, so damage or a fold through the middle of an Aztec symbol is far more serious than damage at the edge, which is the opposite of every linear symbology. If the code is on something that gets folded, move the fold.

Vector, not a bitmap

Encode to SVG wherever the encoder offers it. A rasterised barcode is resampled when the PDF is printed, and at 203 or 300 dots per inch the bar edges land between printer dots, so the ratio of bar to space drifts by a fraction of a millimetre. That fraction is the whole tolerance. An SVG stays vector inside the PDF and is rendered at the printer's own resolution, which removes the entire failure mode. Where a bitmap is unavoidable, generate it at the final physical size and set image-rendering so nothing smooths the edges.

Frequently asked

Does this API generate Aztec Code symbols?

No. It renders HTML to PDF. The symbol is produced by a barcode library in your own application and embedded in the markup as SVG or as a data URI, which is the same way you would put any other generated graphic into a document. What this API is responsible for is that the symbol reaches the page at the size and position you specified.

Why does it scan on screen and fail on paper?

Three reasons, in order of frequency. The quiet zone is present on screen because the browser window is white and absent on paper because the label is not. The symbol was sized as a percentage, so it came out at a different physical width than the one that was tested. Or it is a bitmap, and printing resampled it so the bar-to-space ratio moved outside tolerance.

Can I scale the symbol to fit the space I have?

Uniformly, within the range the symbology allows, and never on one axis. Module sizes comparable to QR, so around 0.4mm as a floor for a printed symbol read by a phone. Because there is no quiet zone the whole footprint is symbol, which is why it fits where a QR code will not. is the constraint on the way down. Scaling one axis changes the bar-to-space ratio on a linear symbology and makes a 2D symbol non-square, and neither survives a scanner.

Other symbologies

Codes of the same kind, and one from each of the other kinds.

Paste the markup into the playground with your own encoder's output and see what comes out at the real page size.