EAN 5-digit add-on

EAN-5 add-on barcode in PHP: 5 digit input, code example and SVG output

Five digits printed to the right of an EAN or UPC symbol. On books the supplement carries the suggested retail price, with the first digit naming the currency.

Type Token

ItemValue
Type tokenEAN5
Enum caseBarcodeType::EAN5
FamilyLinear
StandardGS1 General Specifications
Class\Com\Tecnick\Barcode\Type\Linear\EanFive

Input

ItemValue
Character setdigits
Length1 to 5 digits
Checknone; the parity pattern of the five digits carries the check
Extra parametersnone

Examples

A price supplement

<?php

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

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

echo $bobj->getInlineSvgCode();

EAN 5-digit add-on barcode encoding 52250

Errors

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

PayloadMessage
123456The code is too long: 6 digits (maximum 5 for EAN5)
xyInput code must be a number

See Also