Code128Encoder

Pure-Kotlin Code 128 barcode encoder (code sets B and C).

Encodes a string into the module-width pattern of a Code 128 symbol, including the start code, weighted mod-103 checksum and stop pattern. Subset selection is automatic: digit runs of four or more are packed two-per-symbol in code set C (the standard density optimisation) while everything else uses code set B.

Scope. Only the printable ASCII range (32..126) is supported. Code set A (control characters, ASCII 0..31) and the special function characters (FNC1-4) are intentionally out of scope; any character outside 32..126 — including an empty input, which cannot produce a valid symbol — is rejected with IllegalArgumentException.

Functions

Link copied to clipboard

Encodes data into a Code128Barcode.