CODE 32 (Italian Pharmacode)

CODE 32 Italian pharmacode barcode in PHP: AIC number input, check digit, code example and SVG output

Every medicine sold in Italy carries a nine-digit AIC number. CODE 32 converts that number to six characters in radix 32 and draws them as a CODE 39 symbol, so the printed symbol is shorter than the number it represents. AIFA assigns the AIC number; the library encodes whatever it is given.

Type Token

ItemValue
Type tokenC32
Enum caseBarcodeType::C32
FamilyLinear
StandardItalian Pharmacode, IMH, radix 32
Class\Com\Tecnick\Barcode\Type\Linear\CodeThreeTwo

Input

ItemValue
Character setdigits
Length8 digits, or 9 with a valid check digit
Checkmodulo 10, appended when the payload is 8 digits and verified when it is 9
Extra parametersnone

Examples

An AIC number

<?php

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

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

echo $bobj->getInlineSvgCode();

CODE 32 (Italian Pharmacode) barcode encoding 012345676

Errors

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

PayloadMessage
12345678AInput code must be a number
012345670Invalid check digit: 6

See Also