CODE 128 C

CODE 128 subset C barcode in PHP: numeric pairs, even length requirement, code example and SVG output

Subset C encodes two digits per symbol character, so a numeric payload comes out at half the width of the other subsets. The payload has to be digits, and it has to be an even number of them.

Type Token

ItemValue
Type tokenC128C
Enum caseBarcodeType::C128C
FamilyLinear
StandardISO/IEC 15417
Class\Com\Tecnick\Barcode\Type\Linear\CodeOneTwoEight\CodeOneTwoEightC

Input

ItemValue
Character setdigits
Lengthan even number of digits
Checkmodulo 103, computed by the library
Extra parametersnone

Examples

Ten digits in five symbol characters

<?php

require_once __DIR__ . '/vendor/autoload.php';

$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
    type: 'C128C',
    code: '0123456789',
    width: -3,
    height: -30,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

echo $bobj->getInlineSvgCode();

CODE 128 C barcode encoding 0123456789

Errors

These payloads raise \Com\Tecnick\Barcode\Exception:

PayloadMessage
123The length of each FNC1-separated code block must be even
12ABInvalid character sequence

See Also