Pharmacode

Pharmacode barcode in PHP: value range 3 to 131070, code example and SVG output

Pharmacode represents a single integer as a sequence of thin and thick bars, read from right to left. There is no character set behind it, no start or stop pattern and no check digit.

The design target was verification on a packaging line: the symbol can be printed in any colour on any background, and a reader only has to distinguish two bar widths. PHARMA-CODE is a trademark of Laetus GmbH.

Type Token

ItemValue
Type tokenPHARMA
Enum caseBarcodeType::PHARMA
FamilyLinear
Class\Com\Tecnick\Barcode\Type\Linear\Pharma

Input

ItemValue
Character setdigits, read as one integer
Lengtha value from 3 to 131070
Checknone
Extra parametersnone

Examples

A value in the middle of the range

<?php

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

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

echo $bobj->getInlineSvgCode();

Pharmacode barcode encoding 123456

Errors

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

PayloadMessage
2Invalid barcode value: the code must be an integer between 3 and 131070
131071Invalid barcode value: the code must be an integer between 3 and 131070

See Also