Six digits instead of twelve, for packages too small to carry UPC-A. The compression works by suppressing runs of zeros in the manufacturer and product fields, so only UPC-A codes with the right zero pattern have a UPC-E form at all.
A code with no UPC-E form is rejected at encode time, before it reaches a label.
Type Token
| Item | Value |
|---|---|
| Type token | UPCE |
| Enum case | BarcodeType::UPCE |
| Family | Linear |
| Standard | ISO/IEC 15420, GS1 General Specifications |
| Class | \Com\Tecnick\Barcode\Type\Linear\UpcE |
Input
| Item | Value |
|---|---|
| Character set | digits, plus + to introduce an add-on |
| Length | 6 digits, or the 8 or 12 digit form it expands to |
| Check | computed from the expanded UPC-A form |
| Extra parameters | none |
Examples
A compressed product code
<?php
require_once __DIR__ . '/vendor/autoload.php';
$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
type: 'UPCE',
code: '725277',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
echo $bobj->getInlineSvgCode();
With a two-digit add-on
$bobj = $barcode->getBarcodeObj(
type: 'UPCE',
code: '725277+12',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
Errors
These payloads raise \Com\Tecnick\Barcode\Exception:
| Payload | Message |
|---|---|
1234567 | The code cannot be represented as a UPC-E symbol: 1234567 |
123456789 | The code cannot be represented as a UPC-E symbol: 123456789 |
See Also
- tc-lib-barcode : the library overview.
- Rendering Options : size, colour, padding.
- Output Formats : every renderer.
- UPC-A : the twelve-digit form it compresses.
- EAN-8 : the other small-package symbol.
- API reference : the generated class documentation.