Соответствие рендеринга штрихкодов, тихие зоны, HRI, ECC по ISO/AIM/GS1

Большинство движков рендеринга штрихкодов, включая bwip-js, не обеспечивают соответствие спецификациям самостоятельно. Они рисуют то, что запрашивает вызывающая сторона. Вызывающий должен знать правильную ширину зоны молчания, правильный флаг HRI (человекочитаемой интерпретации), правильный уровень коррекции ошибок и правильные правила контрольной цифры для каждой символогии, а затем передать их. Эта страница документирует набор опций, которые Abundera передаёт для каждого типа, опубликованный стандарт, которому удовлетворяет каждая опция, и номер раздела, где это можно проверить. Код рендерера находится в site/js/app.js (generate2DBarcode и renderMicroQRResult).

Почему соответствие рендеринга важно

Industrial scanners do not guess. A Zebra DS3678 reading a Code 128 carton label expects a 10-X quiet zone on each side. Hand it 5 X and it rejects the read, every time. The label looks fine to a human. The scanner sees a corrupt symbol because the spec it was certified against says quiet zones are part of the symbol, not decoration around it. ISO/IEC 15417 §4.1 is explicit on this point, and every conformance lab tests against it.

Human-readable interpretation is not a stylistic choice in retail. ISO/IEC 15420 §4.4 requires the digits below an EAN-13 to be present and legible. A point-of-sale scanner that fails the laser read falls back to the cashier keying the digits; if HRI is missing, the cashier cannot complete the sale. A retailer who receives unmarked cartons from a supplier has standing to refuse the shipment.

Error correction is the margin between a code that survives the real world and one that does not. A QR Code at ECC level L tolerates roughly 7% damage; level H tolerates roughly 30%. Print contrast loss, ink bleed, fold creases, and oleophobic smudges all eat into that margin. Spec defaults exist because the standards bodies measured what fails in practice, and "what the library happens to default to" is not the same answer as "what ISO/IEC 18004 §7.5 recommends for a 25 mm code on coated stock."

The general posture: read the section number, set the option explicitly, do not rely on library defaults. Every value documented below is one we set on purpose and can defend against the relevant clause.

Таблица соответствия по символогиям

СимвологияСтандартЗона молчания (каждая сторона)HRIECC / контрольная цифраПрочее
QR CodeISO/IEC 18004:20154 modules (top/bottom/left/right)Not usedReed-Solomon, levels L/M/Q/H (~7/15/25/30%)Mode auto-selection (numeric, alphanumeric, byte, kanji)
Micro QRISO/IEC 18004:2015 Annex M2 modules (each side)Not usedRS, levels L/M/Q only (no H); version M1 has fixed ECCSingle finder pattern; max version M4 (17×17)
rMQRISO/IEC 23941:20222 modules each sideNot usedRS, levels M and HRectangular; 32 size variants (R7×43 to R17×139)
Data MatrixISO/IEC 16022:20061 module each sideNot usedECC 200 (Reed-Solomon, fixed; not user-selectable)L-shaped finder + clock track; square or rectangular
AztecISO/IEC 24778:2008None requiredNot usedRS, 5%–95% selectable; 23% default, 50% for transit/IATABullseye finder; rotation-invariant
PDF417ISO/IEC 15438:20152 modules each side (horizontal); 0 verticalNot used (optional)RS, security levels 0–8 (2 to 512 codewords)Stacked linear; row height 3× module width minimum
AAMVA driver licenseAAMVA Card Design Standard v10Per PDF417 (2 modules horizontal)Not usedPDF417 ECC level 5 minimum (jurisdiction-set)Compact PDF417 prohibited; mandatory element separators
Code 128ISO/IEC 15417:200710 X each sideRequired if used; below symbolMod-103 check digit (calculated, not encoded as data)Three subsets A/B/C; auto-shift for density
Code 39ISO/IEC 16388:200710 X each sideOptional; below symbol if shownMod-43 check digit optional (required by HIBC, LOGMARS)Self-checking; * start/stop characters
Code 93AIM USS Code 9310 X each sideOptionalTwo mod-47 check digits (C and K), mandatoryHigher density than Code 39; 47 unique symbols + shifts
CodabarAIM USS Codabar10 X each sideOptionalNo check digit by spec; library/user can add mod-16Start/stop characters A/B/C/D; library-tracking heritage
EAN-13ISO/IEC 15420:2009Left 11 X, right 7 XRequired; specific 1-6-6 grouping belowMod-10 check digit (13th digit)Add-on 2/5 supplemental allowed (periodicals, books)
EAN-8ISO/IEC 15420:20097 X each sideRequired; 4-4 grouping belowMod-10 check digit (8th digit)Reserved for small-package goods
UPC-AISO/IEC 15420:2009Left 9 X, right 9 XRequired; 1-5-5-1 grouping (first/last digit outside guard bars)Mod-10 check digit (12th digit)North American retail; equivalent to EAN-13 with leading 0
UPC-EISO/IEC 15420:2009Left 9 X, right 7 XRequired; number system + 6 digits + check belowMod-10, computed from expanded UPC-A equivalentZero-suppressed UPC-A; only specific manufacturer codes qualify
ITF-14ISO/IEC 16390:200710 X each sideRequired; below symbolGS1 mod-10 check digit (14th digit)Mandatory bearer bars (top/bottom or full box); GTIN-14 carton mark
VINISO 3779:2009Per carrier symbology (usually Code 39 or Data Matrix)Required when printed; the 17-char VIN itselfPosition-9 check digit (mod-11, North America)17 characters, uppercase, excludes I/O/Q

QR Code

QR Code is the workhorse 2D symbology and the type with the most renderer-default trapdoors. The 4-module quiet zone is non-negotiable per ISO/IEC 18004 §6.3.3. Many libraries default to a smaller margin to save pixels in low-DPI use; we override that explicitly.

Error correction defaults to level M. We let the user upgrade to Q or H for printed codes that will live on a coffee cup or a sun-bleached window decal. We do not default to H because the data-density penalty is material and most digital-display QR codes do not need it.

Options we set: QR Code does not go through bwip-js, we render it with the qrcode.js library and apply a QUIET_ZONE_MODULES = 4 constant of margin around the finder grid. ECC defaults to user choice (L/M/Q/H) and auto-bumps to H whenever a logo, background image, or Swiss QR-bill payload is present.

Micro QR

Micro QR is QR's small-payload sibling for very tight label real estate. ISO/IEC 18004 Annex M caps it at version M4 (17×17 modules) and forbids ECC level H. Quiet zone drops to 2 modules per Annex M §M.4. Our renderer enforces both, passing 4 modules of padding here would inflate the symbol footprint by 50% for no gain.

Options we set: Micro QR does not go through bwip-js, we render it with the qrean library and manually paint QZ_MODULES = 2 modules of quiet zone around the bare module grid. ECC is forced to QR_ERRORLEVEL_L (Annex M's smallest allowed level for tightest payloads); Q and H are not exposed.

rMQR

rMQR (rectangular Micro QR) is the 2022 ISO/IEC 23941 addition for narrow-strip applications: pharma vial labels, cable wraps, side-of-pill-pack marking. 32 size variants from R7×43 up to R17×139. Quiet zone is 2 modules. Only ECC levels M and H are defined; L and Q do not exist in this spec.

Options we set: rMQR does not go through bwip-js, we render it with the qrean library and manually paint QZ_MODULES = 2 modules of quiet zone around the grid. ECC is forced to QR_ERRORLEVEL_M; L and Q are not in the ISO/IEC 23941 spec and the UI does not surface them.

Data Matrix

Data Matrix uses ECC 200, a fixed Reed-Solomon scheme with no user-selectable level. ISO/IEC 16022 §5.3 specifies a 1-module quiet zone, the smallest of any 2D symbology. The L-shaped finder and the dotted clock track on the opposite edges form the entire fiducial; nothing else is needed. For direct part marking on metal or plastic, ISO/IEC 29158 governs grading separately.

Options we set:bcid: "datamatrix", scale: 4, paddingwidth: 8, paddingheight: 8. No ECC option is passed, Reed-Solomon ECC 200 is internal to the symbology.

Aztec

Aztec is the only common 2D symbology that requires no quiet zone. The bullseye finder pattern in the centre is self-locating, so the symbol decodes even when cropped flush against another graphic. ISO/IEC 24778 §5.4 makes the zero-quiet-zone requirement explicit. Error correction is selectable from 5% to 95% of data codewords; we default to 23% (matches QR-M for general use) and recommend 50% for IATA boarding passes and transit tickets.

Options we set:bcid: "azteccode", scale: 4, paddingwidth: 8, paddingheight: 8, eclevel: 23 (numeric percentage of data codewords reserved for ECC).

PDF417

PDF417 is the only 2D symbology a 1D laser scanner can read, because it is a stack of linear rows. Quiet zone per ISO/IEC 15438 §5.8 is 2 modules left and right; the top and bottom can be flush. Security level (the spec's term for ECC) runs 0–8, where each level adds 2× the codewords of the previous. Level 5 is the AAMVA-mandated minimum for driver licenses; level 4 is typical for FedEx/UPS airbills.

Options we set:bcid: "pdf417", scale: 4, paddingwidth: 16, paddingheight: 16, eclevel: 5. Columns and the compact-vs-full flag are passed through from the caller's _bwipOptsFor() selection when set; otherwise bwip-js auto-fits.

AAMVA driver license

AAMVA driver licenses use PDF417 with additional constraints layered on top of ISO/IEC 15438. The Card Design Standard v10 forbids Compact PDF417 (which omits the right-side row indicators) and mandates a minimum security level of 5. Element separators (ASCII 0x0A line feed between subfile elements) are required, not optional. Our renderer treats AAMVA as a PDF417 variant with these constraints pre-set rather than as a separate symbology.

Options we set: AAMVA routes through the PDF417 renderer with the same dictionary: bcid: "pdf417", scale: 4, paddingwidth: 16, paddingheight: 16, eclevel: 5. The payload assembler emits the mandatory AAMVA header (@, line feed, ANSI , IIN, version) before subfile data; bwip-js does not see that as a separate option.

Code 128

Code 128's quiet zone is 10 X (10 narrow modules) on each side per ISO/IEC 15417 §4.1. The mod-103 check digit is computed by the encoder, not supplied by the caller; misimplementations that ask the user to include the check digit produce double-checked symbols that reject. HRI is required when used, placed below the symbol per §4.4.

Options we set:bcid: "code128", scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. Subset (A/B/C) auto-selection is bwip-js's default behaviour; we do not override it.

Code 39

Code 39 is self-checking by design, so the mod-43 check digit is optional in the base spec, but mandatory under HIBC (Health Industry Bar Code) and LOGMARS (the US DoD adoption). 10 X quiet zone each side per ISO/IEC 16388 §5.5. The * start/stop characters are part of the symbol, not the data; encoders add them automatically.

Options we set:bcid: "code39", scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. The mod-43 check digit is left to bwip-js's default (off); HIBC/LOGMARS callers that need it can layer the check at the payload level.

Code 93

Code 93 always carries two check characters, C and K, both mod-47, computed and appended by the encoder. AIM USS Code 93 is the canonical spec; it is not an ISO standard but is the long-standing AIM publication every reader supports. Quiet zone 10 X each side. Higher density than Code 39, lower than Code 128, used where Code 39's symbol set is sufficient but space is tight.

Options we set:bcid: "code93", scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. The C and K check characters are always added by bwip-js (no opt-out, per spec).

Codabar

Codabar predates most ISO work; AIM USS Codabar is the controlling document. No check digit by spec, though library and blood-bank traditions add their own (Modulus 16 for blood-bag tracking). Start and stop are A/B/C/D characters chosen by the encoder. Quiet zone 10 X each side.

Options we set:bcid: "rationalizedCodabar" (bwip-js's identifier for the modern variant), scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. Start/stop characters come from the caller's payload string, we do not pin them.

EAN-13

EAN-13 is the global retail bar code. ISO/IEC 15420 §5.2.4.4 mandates asymmetric quiet zones: 11 X on the left, 7 X on the right. HRI is required and grouped 1-6-6: the leading digit sits in the left quiet zone, the next six under the left half, the last six under the right half. Mod-10 check digit is the 13th digit, computed by the encoder if the caller passes only 12.

Options we set:bcid: "ean13", scale: 4, paddingleft: 44, paddingright: 28, paddingheight: 0, includetext: true, guardwhitespace: true. The asymmetric margins (44 px = 11 modules × 4 scale on the left, 28 px = 7 modules × 4 scale on the right) enforce the §5.2.4.4 quiet-zone requirement explicitly rather than relying on bwip defaults.

EAN-8

EAN-8 is the small-package retail variant. Quiet zone 7 X each side per ISO/IEC 15420 §5.2.4.4. HRI is required, grouped 4-4. The 8th digit is the mod-10 check digit. EAN-8 numbers are issued by GS1 directly to applicants; they are not derived from EAN-13 by truncation.

Options we set:bcid: "ean8", scale: 4, paddingwidth: 56 (7 modules × 4 scale × 2 sides), paddingheight: 0, includetext: true, guardwhitespace: true. bwip-js computes the check digit when 7 digits are supplied.

UPC-A

UPC-A is the North American retail bar code, equivalent to EAN-13 with a leading 0. ISO/IEC 15420 §5.2.4.4 specifies 9 X quiet zones each side. HRI is grouped 1-5-5-1: the leading number-system digit sits to the left of the left guard bar, then five digits under the left half, five under the right half, and the check digit to the right of the right guard bar.

Options we set:bcid: "upca", scale: 4, paddingwidth: 72, paddingheight: 0, includetext: true, guardwhitespace: true. The 1-5-5-1 HRI grouping is bwip-js's default for this bcid; we do not override.

UPC-E

UPC-E is the zero-suppressed UPC-A variant for very small packages. Only specific UPC-A codes (those with manufacturer code patterns ending in 00000, 00001, 00002, or with trailing zeros) qualify for compression to UPC-E. The mod-10 check digit is computed from the expanded UPC-A equivalent, not from the displayed UPC-E digits. HRI shows the number system digit, six middle digits, and the check digit.

Options we set:bcid: "upce", scale: 4, paddingwidth: 72, paddingheight: 0, includetext: true, guardwhitespace: true. Validation of the underlying UPC-A → UPC-E compression happens in the payload layer before bwip-js sees the input.

ITF-14

ITF-14 is the GTIN-14 carton mark, the bar code on shipping cases that scans through shrink wrap. ISO/IEC 16390 specifies the Interleaved 2 of 5 base symbology; the GS1 General Specifications add the ITF-14 application: 14 digits, mod-10 check, 10 X quiet zones, and mandatory bearer bars. Bearer bars are the heavy black bars above and below (or fully boxing) the symbol. They prevent partial scans of a damaged or partially-occluded code from decoding as a different but valid GTIN.

Options we set:bcid: "itf14", scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. The bearer bar is rendered by bwip-js's itf14 bcid at its default borderwidth; we do not override it.

VIN

The Vehicle Identification Number is a 17-character alphanumeric string defined by ISO 3779. It is not itself a barcode; it is encoded as Code 39 (most common, NHTSA standard for under-the-hood labels) or Data Matrix (more common for newer assembly-line marking). Position 9 carries the check digit using a specific weighted mod-11 (North American) calculation. Letters I, O, and Q are excluded to avoid confusion with 1 and 0.

Options we set: when the user picks "VIN" we route to bwip-js with bcid: "code39", scale: 4, paddingwidth: 80, paddingheight: 0, includetext: true. The VIN's position-9 mod-11 check digit and the I/O/Q exclusion are enforced in the payload validator before the symbol is rendered, not via a bwip option.

Ссылки

  1. ISO/IEC 18004:2015, QR Code bar code symbology specification (includes Annex M for Micro QR).
  2. ISO/IEC 23941:2022, Rectangular Micro QR Code (rMQR) bar code symbology specification.
  3. ISO/IEC 16022:2006, Data Matrix bar code symbology specification.
  4. ISO/IEC 24778:2008, Aztec Code bar code symbology specification.
  5. ISO/IEC 15438:2015, PDF417 bar code symbology specification.
  6. ISO/IEC 15417:2007, Code 128 bar code symbology specification.
  7. ISO/IEC 16388:2007, Code 39 bar code symbology specification.
  8. ISO/IEC 15420:2009, EAN/UPC bar code symbology specification.
  9. ISO/IEC 16390:2007, Interleaved 2 of 5 bar code symbology specification (the base spec ITF-14 sits on top of).
  10. AIM USS Code 93, Uniform Symbology Specification, AIM Global.
  11. AIM USS Codabar, Uniform Symbology Specification, AIM Global.
  12. GS1 General Specifications (current edition; freely downloadable from gs1.org). Application-layer rules for ITF-14 bearer bars, GS1 element strings, GS1 Digital Link.
  13. AAMVA Card Design Standard (current version), American Association of Motor Vehicle Administrators.
  14. ISO 3779:2009, Road vehicles, Vehicle identification number (VIN), Content and structure.

См. также

Последняя проверка: 2026-04-26 against bwip-js v4 + project commit 6d48d09ae2.