GS1-128 is CODE 128 carrying structured data: one or more Application Identifiers, each followed by its data field. AI 01 is a trade item number, 10 a batch, 17 an expiry date, and so on through the GS1 General Specifications.
Write the payload in the bracketed form, (ai)value(ai)value. The library parses it against the AI definitions, checks each field for length and character set, and inserts the FNC1 separators where a variable-length field needs one. Brackets are delimiters, so they cannot appear inside a value.
Type Token
| Item | Value |
|---|---|
| Type token | GS1128 |
| Enum case | BarcodeType::GS1128 |
| Family | Linear |
| Standard | GS1 General Specifications, ISO/IEC 15417 |
| Class | \Com\Tecnick\Barcode\Type\Linear\GsOneOneTwoEight |
Input
| Item | Value |
|---|---|
| Character set | the printable ASCII characters, in the bracketed element string form |
| Length | up to 48 data characters |
| Check | per Application Identifier, where the definition specifies one |
| Extra parameters | none |
Examples
A trade item number and a batch
<?php
require_once __DIR__ . '/vendor/autoload.php';
$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
type: 'GS1128',
code: '(01)09501101020917(10)AB-123',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
echo $bobj->getInlineSvgCode();
Production and expiry dates
$bobj = $barcode->getBarcodeObj(
type: 'GS1128',
code: '(11)260920(17)280920',
width: -3,
height: -30,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
Errors
These payloads raise \Com\Tecnick\Barcode\Exception:
| Payload | Message |
|---|---|
01090150 | An Application Identifier in brackets is expected at position 0: 01090150 |
(01)0950110102091A | The data field of the Application Identifier (01) must be a number |
See Also
- tc-lib-barcode : the library overview.
- Rendering Options : size, colour, padding.
- Output Formats : every renderer.
- CODE 128 : the underlying symbology.
- SSCC-18 : the fixed form for AI 00.
- GS1-14 : the fixed form for AI 01.
- API reference : the generated class documentation.