Codabar dates from 1972 and encodes digits and six punctuation marks, one character per four bars and three spaces.
Four letters, A to D, serve as the start and stop characters. The library brackets the payload with A at both ends and rejects those four letters inside it, since a scanner reading one mid-symbol would take it for the end of the code.
Type Token
| Item | Value |
|---|---|
| Type token | CODABAR |
| Enum case | BarcodeType::CODABAR |
| Family | Linear |
| Standard | USS-Codabar, ANSI/AIM BC3 |
| Class | \Com\Tecnick\Barcode\Type\Linear\Codabar |
Input
| Item | Value |
|---|---|
| Character set | 0-9, -, $, :, /, ., + |
| Length | 1 to 30000 characters |
| Check | none |
| Extra parameters | none |
Examples
Ten digits
<?php
require_once __DIR__ . '/vendor/autoload.php';
$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
type: 'CODABAR',
code: '0123456789',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
echo $bobj->getInlineSvgCode();
Errors
These payloads raise \Com\Tecnick\Barcode\Exception:
| Payload | Message |
|---|---|
A0123456789B | The characters A, B, C and D are reserved as start/stop characters |
12* | Invalid character: 42 |
See Also
- tc-lib-barcode : the library overview.
- Rendering Options : size, colour, padding.
- Output Formats : every renderer.
- CODE 11 : the other format with a dedicated start character.
- API reference : the generated class documentation.