PDFPipe

Linear (1D) / Code 93

Code 93 barcode in a PDF

Code 39 made denser and stricter: the same character set in about three quarters of the width, with two check characters that are not optional.

Where the symbol comes from

This API renders HTML to PDF. It does not generate barcodes, so the Code 93 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

The same 43 characters as Code 39 natively, meaning digits, upper case letters, space and six punctuation marks. Full ASCII is reachable through four shift characters that pair with a base character, at two symbol characters per encoded character. Length is variable. Each character is nine modules made of three bars and three spaces, which is where the density comes from: the same data takes roughly 25 percent less width than Code 39.

The check digit, and who computes it

Two of them, conventionally called C and K, both modulo 47 over a weighted sum of the symbol characters. The encoder computes and appends both, and neither appears in the human readable line under the symbol. This is the sharpest difference from Code 39, where a check character is optional and frequently omitted: in Code 93 the two are part of the symbol and a reader that finds them wrong rejects the scan outright.

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: 0.19mm is the practical floor and it is a tighter floor than it looks. Code 39 has two element widths, wide and narrow, so a printer only has to keep two things apart. Code 93 is a multi-width symbology where an element can be one, two, three or four modules, so the decoder is measuring absolute widths rather than comparing two of them, and a printer that spreads ink evenly across every bar still shifts every measurement.
  • Quiet zone: 10 times the X-dimension at each end, with 6.4mm as the usual stated minimum. The same figure as Code 39, and the same reason it goes missing: the symbol looks finished without it.

Where it is used

  • postal supplementary delivery information, where the density over Code 39 is the whole reason for choosing it
  • internal automotive and manufacturing labels that outgrew the width Code 39 needed
  • military and defence logistics labelling that specifies it in place of Code 39
  • any label where Code 39 was the obvious choice and there was not enough room for it

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
<!-- Encoded by your own library. Note there is no check digit in the
     caption: C and K are inside the symbol and are not for people. -->
<figure class="c93">
  <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0i..." alt="Part 4471-A">
  <figcaption>4471-A</figcaption>
</figure>

<style>
.c93 {
  margin: 0;
  padding: 0 7mm; /* quiet zone, kept out of the encoder's output */
  width: max-content;
}
.c93 img {
  /* Absolute width, because the X-dimension is a physical measurement.
     Narrower than the Code 39 equivalent for the same data, which is
     the reason to be on this page at all. */
  width: 52mm;
  height: 16mm;
  display: block;
}
.c93 figcaption {
  font: 10pt/1.2 "IBM Plex Mono", monospace;
  letter-spacing: 0.12em;
  text-align: center;
  margin-top: 1.5mm;
}
</style>

What goes wrong on paper

Treating it as Code 39 with better density and printing it the same way. It is not a two-width symbology, so the tolerance for ink spread is smaller: bars that gain a hundredth of a millimetre each in a thermal transfer print are still distinguishable as wide and narrow in Code 39 and are not necessarily still one, two, three and four modules in Code 93. If a label is going onto absorbent stock, this is the symbology that notices.

First thing to check when it will not scan

Check the scanner has Code 93 turned on. Most handheld units ship with Code 39 and Code 128 enabled and Code 93 disabled, so the first symptom of a working symbol is usually a scanner that behaves as though nothing is there. Verify against a second reader before touching the artwork.

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 Code 93 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. 0.19mm is the practical floor and it is a tighter floor than it looks. Code 39 has two element widths, wide and narrow, so a printer only has to keep two things apart. Code 93 is a multi-width symbology where an element can be one, two, three or four modules, so the decoder is measuring absolute widths rather than comparing two of them, and a printer that spreads ink evenly across every bar still shifts every measurement. 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.