1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-05-01 19:55:29 +00:00

GS1: new GS1RAW_MODE (CLI "--gs1raw") and GS1 Syntax Engine

"Unbracketed AI" (caret) options for specifying GS1 input
  (ticket #350, props Mario Verbruggen)
DBAR_EXP_CC/DBAR_EXPSTK_CC: fix separator over finder patterns
  when linear part is greater than 4 codeblocks
general: left-over raw_text -> content_segs in comments;
  update & expand some GS1 General Specs refs;
  some minor code fiddling
test suite: suppress some additional ZINT_SANITIZEM false positives
  (& add new ZINT_TESTUTIL_SANITIZEM_INIT helpers)
This commit is contained in:
gitlost
2026-02-26 15:05:45 +00:00
parent 3b24d129d7
commit 0a8a79fa6c
59 changed files with 7504 additions and 4206 deletions

View File

@@ -320,10 +320,15 @@ context menu by right-clicking the preview.
In the middle of the Data tab is an area for creating composite symbologies
which appears when the currently selected symbology supports the GS1 Composite
symbology standard. GS1 data can then be entered with square brackets used to
separate Application Identifier (AI) information from data as shown here. Round
brackets (parentheses) can be used instead if the `"GS1 ()"` checkbox is set.
For details, see [6.3 GS1 Composite Symbols (ISO 24723)].
symbology standard - namely EAN-13, EAN-8, GS1-128, GS1 DataBar (all variants),
UPC-A and UPC-E. See [6.3 GS1 Composite Symbols (ISO 24723)] for details.
If the `"Add 2D Component"` checkbox is checked, GS1 data can then be entered in
the `"2D Component Data"` text box, with square brackets used to separate
Application Identifier (AI) information from data as shown here, or using one of
the other formats described in [4.11.3 GS1 Data Entry and Options], where the
GS1 checkbox options `"()"` (Parentheses), `"Raw"`, `"No Check"` and `"Strict"`
are also discussed.
## 3.3 Additional ECI/Data Segments Groupbox
@@ -1163,11 +1168,11 @@ zint -d "1234" --scalexdimdp=0.33mm,300dpi
### 4.9.2 Scaling Example
The GS1 General Specifications Section 5.2.6.6 'Symbol dimensions at nominal
size' gives an example of an EAN-13 barcode using the X-dimension of 0.33mm. To
print that example as a PNG at 12 dpmm, the approximate equivalent of 300 dpi
(`dpi = dpmm * 25.4`), specify a scale of 2, since `0.33 * 12 = 3.96` pixels, or
4 pixels rounding to the nearest pixel:
The GS1 General Specifications 26.0 Section 5.2.6.6 "Symbol dimensions at
nominal size" gives an example of an EAN-13 barcode using the X-dimension of
0.33mm. To print that example as a PNG at 12 dpmm, the approximate equivalent of
300 dpi (`dpi = dpmm * 25.4`), specify a scale of 2, since `0.33 * 12 = 3.96`
pixels, or 4 pixels rounding to the nearest pixel:
```bash
zint -b EAN13 -d "501234567890" --compliantheight --scale=2
@@ -1281,15 +1286,8 @@ character encoding then it will take advantage of the ECI (Extended Channel
Interpretations) mechanism to encode the data if the symbology supports it - see
[4.11.2 Input Modes and ECI] below.
GS1 data can be encoded in a number of symbologies. Application Identifiers
(AIs) should be enclosed in `[square brackets]` followed by the data to be
encoded (see [6.1.10.3 GS1-128]). For matrix symbologies, GS1 Digital Link URIs
can also be given. To encode GS1 data use the `--gs1` option. Alternatively,
use the `--gs1strict` option, which strictly verifies the GS1 data.
GS1 mode is assumed (and doesn't need to be set) for GS1-128, EAN-14, GS1
DataBar and GS1 Composite symbologies but is also available for Aztec Code, Code
16K, Code 49, Code One, Data Matrix, DotCode, QR Code and Ultracode.
GS1 data can be encoded in a number of symbologies - see [4.11.3 GS1 Data Entry
and Options].
Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec
Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR
@@ -1470,6 +1468,121 @@ zint -b QRCODE --binary -d "UTF-8 data"
![`zint -b QRCODE --binary -d "\xE2\x82\xAC\xE5\xB8\xB8"
--esc`](images/qrcode_binary_utf8.svg){.i2d}
### 4.11.3 GS1 Data Entry and Options
The following symbologies accept GS1 data:
Symbology Implicit AI? Assumed? Supports Composite?
------------- ------------ -------- -------------------
Aztec Code No No No
Code 16K No No No
Code 49 No No No
Code One No No No
Data Matrix No No No
DotCode No No No
EAN-13, EAN-8 Yes (01) Yes Yes
EAN-14 Yes (01) Yes No
GS1-128 No Yes Yes
GS1 DataBar Expanded (Stacked) No Yes Yes
GS1 DataBar (all others) Yes (01) Yes Yes
NVE-18 Yes (00) Yes No
QR Code No No No
rMQR No No No
Ultracode No No No
UPC-A, UPC-E Yes (01) Yes Yes
Table: GS1-Enabled Symbologies
#### 4.11.3.1 GS1 Data Entry
Those that encode an implicit AI take numeric data in their linear part without
any further markup - see respective descriptions in [6. Types of Symbology].
GS1-128, GS1 DataBar Expanded (including Expanded Stacked), the matrix
symbologies and the 2D component of GS1 Composite symbologies, all of which can
encode multiple AIs, require markup in the data to distinguish AIs.
The traditional way in Zint of specifying GS1 data for these cases is to delimit
the GS1 AIs in square brackets:
```bash
zint -b AZTEC -d "[01]09520123456788[10]BATCH4[21]07" --gs1
```
(Note that for the matrix symbologies the `--gs1` option must be given.)
Parentheses (round brackets) may be used instead by giving the `--gs1parens`
option:
```bash
zint -b AZTEC -d "(01)09520123456788(10)BATCH4(21)07" --gs1parens
```
If the data includes opening parentheses when using the latter format, they must
be escaped and the `--esc` option given:
```bash
zint -b AZTEC -d "(01)09520123456788(90)Var\(34)" --esc --gs1parens
```
Closing parentheses may also be escaped for clarity.
For matrix symbologies, a GS1 Digital Link URI may be used:
```bash
zint -b AZTEC -d "https://example.com/01/09520123456788/10/BATCH4/21/07" --gs1
```
A further way to specify GS1 input is "Unbracketed AI", a GS1 Syntax Engine
format[^10] that uses carets (`^`) to indicate any required `FNC1`s.[^11] The
data must start with a caret:
```bash
zint -b AZTEC -d "^010952012345678810BATCH4^2107" --gs1
```
[^10]: For more information on the "Unbracketed AI" format for GS1 data entry,
see the [GS1 Barcode Syntax Engine overview](
https://gs1.github.io/gs1-syntax-engine/).
[^11]: `FNC1`s are required to terminate the data of any AI (except when the
last) **apart** from those whose **first two digits** match the following: 00,
01, 02, 03, 11, 12, 13, 15, 16, 17, 20, 31, 32, 33, 34, 35, 36 and 41, as
specified in GS1 General Specifications 26.0 Table 7-6 "Element strings with
predefined length using GS1 Application Identifiers". Note that this applies
even to AIs with fixed lengths, so e.g. the data for AI 3940 must have a
terminating `FNC1` (except when the last AI).
The final way to specify input is the related "raw" mode using the `--gs1raw`
option. Here `FNC1`s are indicated by Group Separators (`GS`, ASCII 29, escape
sequence `\G`). It does not start with a `GS`:
```bash
zint -b AZTEC -d "010952012345678810BATCH4\G2107" --esc --gs1raw
```
#### 4.11.3.2 GS1 Options
Apart from `--gs1`, `--gs1parens` and `--gs1raw` discussed above, there are two
other GS1 options.
- `--gs1strict`, which enables the use the GS1 Syntax Engine to
strictly validate GS1 data, including GS1 Digital Link URIs (by default Zint
does not validate Digital Links at all). It requires that the `gs1encoders`
library was present when Zint was built, otherwise the default built-in
validation will be used.
- `--gs1nocheck`, for use with legacy systems that have data that does not
conform to the current GS1 standard. Printable ASCII input is still checked for,
as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and
GS1 Composite input that is not in the GS1 encodable character set 82 (see GS1
General Specifications 26.0 Table 7-2 "GS1 AI encodable character set 82"),
otherwise encodation would fail. In "Unbracketed AI" and raw mode, overlong AI
data will also fail.
All the GS1 options imply `--gs1`.
## 4.12 Batch Processing
Data can be batch processed by reading from a text file and producing a
@@ -1936,10 +2049,10 @@ int main(int argc, char **argv)
```
will print the SVG output to `stdout` (the file `"mem.svg"` is not created).
This is particularly useful for the textual formats EPS and SVG,[^10] allowing
This is particularly useful for the textual formats EPS and SVG,[^12] allowing
the output to be manipulated and processed by the client.
[^10]: BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines
[^12]: BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines
(LF) on both Windows and Unix, i.e. not CR+LF on Windows.
## 5.7 Setting Options
@@ -1960,7 +2073,7 @@ Member Name Type Meaning Default Value
`height` float Symbol height in Symbol dependent
X-dimensions, excluding
fixed width-to-height
symbols.[^11]
symbols.[^13]
`scale` float Scale factor for 1.0
adjusting size of image
@@ -2010,7 +2123,7 @@ Member Name Type Meaning Default Value
`.eps`, `.pcx`, `.svg`,
`.tif` or `.txt` followed
by a terminating
`NUL`.[^12]
`NUL`.[^14]
`primary` character Primary message data for `""` (empty)
string more complex symbols,
@@ -2122,7 +2235,7 @@ Member Name Type Meaning Default Value
array of content segments if
segments `BARCODE_CONTENT_SEGS`
set in `output_options`
- see [5.16 Feedback].
- see [5.16 Feedback].
`content_seg_count` integer Number of content (output only)
segments.
@@ -2138,13 +2251,13 @@ Member Name Type Meaning Default Value
Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol}
[^11]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
[^13]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode,
QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed
height).
[^12]: For Windows, `outfile` is assumed to be UTF-8 encoded.
[^14]: For Windows, `outfile` is assumed to be UTF-8 encoded.
To alter these values use the syntax shown in the example below. This code has
the same result as the previous example except the output is now taller and
@@ -2310,10 +2423,10 @@ Value Effect
------------------------- ---------------------------------------------------
0 No options selected.
`BARCODE_BIND_TOP` Boundary bar above the symbol only.[^13]
`BARCODE_BIND_TOP` Boundary bar above the symbol only.[^15]
`BARCODE_BIND` Boundary bars above and below the symbol and
between rows if stacking multiple symbols.[^14]
between rows if stacking multiple symbols.[^16]
`BARCODE_BOX` Add a box surrounding the symbol and whitespace.
@@ -2340,7 +2453,7 @@ Value Effect
Symbols in Memory (raster)].
`BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any
specified whitespace).[^15]
specified whitespace).[^17]
`BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults.
@@ -2362,13 +2475,13 @@ Value Effect
Table: API `output_options` Values {#tbl:api_output_options}
[^13]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD
[^15]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD
Code].
[^14]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
[^16]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14].
[^15]: Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN,
[^17]: Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN,
ITF-14, UPC-A and UPC-E have compliant quiet zones added by default.
## 5.11 Setting the Input Mode
@@ -2412,6 +2525,9 @@ Value Effect
`GS1SYNTAXENGINE_MODE` Use the GS1 Syntax Engine (if available) to strictly
validate GS1 input.
`GS1RAW_MODE` Process GS1 data literally (no AI delimiters), parsing
Group Separators (`GS`, ASCII 29) as `FNC1`s.
------------------------------------------------------------------------------
Table: API `input_mode` Values {#tbl:api_input_mode}
@@ -2421,8 +2537,8 @@ from the default for the CLI and GUI, which is `UNICODE_MODE`.)
`DATA_MODE`, `UNICODE_MODE` and `GS1_MODE` are mutually exclusive, whereas
`ESCAPE_MODE`, `GS1PARENS_MODE`, `GS1NOCHECK_MODE`, `HEIGHTPERROW_MODE`,
`FAST_MODE`, `EXTRA_ESCAPE_MODE` and `GS1SYNTAXENGINE_MODE` are optional. So,
for example, you can set
`FAST_MODE`, `EXTRA_ESCAPE_MODE`, `GS1SYNTAXENGINE_MODE` and `GS1RAW_MODE` are
optional. So, for example, you can set
```c
symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
@@ -2444,22 +2560,11 @@ is not valid.
Permissible escape sequences (`ESCAPE_MODE`) are listed in
[#tbl:escape_sequences], and the special Code 128-only `EXTRA_ESCAPE_MODE`
escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)]. An
example of `GS1PARENS_MODE` usage is given in section [6.1.10.3 GS1-128].
escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)].
`GS1NOCHECK_MODE` (CLI `--gs1nocheck`) is for use with legacy systems that have
data that does not conform to the current GS1 standard. Printable ASCII input is
still checked for, as is the validity of GS1 data specified without AIs (e.g.
linear data for GS1 DataBar Omnidirectional/Limited/etc.). Also checked is GS1
DataBar Expanded and GS1 Composite input that is not in the GS1 encodable
character set 82 (see GS1 General Specifications Figure 7.11.1 'GS1 AI encodable
character set 82'), otherwise encodation would fail.
In contrast `GS1SYNTAXENGINE_MODE` (CLI `--gs1strict`) enables the use the GS1
Syntax Engine to strictly validate GS1 data, including GS1 Digital Link URIs (by
default ZINT does not validate Digital Links at all). It requires that the
`gs1encoders` library was present when Zint was built, otherwise the default
built-in validation will be used.
The GS1 options `GS1PARENS_MODE` (CLI `--gs1parens`) , `GS1NOCHECK_MODE` (CLI
`--gs1nocheck`), `GS1SYNTAXENGINE_MODE` (CLI `--gs1strict`) and `GS1RAW_MODE`
(CLI `--gs1raw`) are described in [4.11.3 GS1 Data Entry and Options].
For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height].
The `height` member should be set to the desired per-row value on input (it will
@@ -2634,7 +2739,7 @@ Value Meaning
`ZINT_CAP_STACKABLE` Is the symbology stackable? Note that stacked
symbologies are not stackable.
`ZINT_CAP_EANUPC`[^16] Is the symbology EAN/UPC?
`ZINT_CAP_EANUPC`[^18] Is the symbology EAN/UPC?
`ZINT_CAP_COMPOSITE` Does the symbology support composite data? (see
[6.3 GS1 Composite Symbols (ISO 24723)] below)
@@ -2670,7 +2775,7 @@ Value Meaning
Table: API Capability Flags {#tbl:api_cap}
[^16]: `ZINT_CAP_EANUPC` was previously named `ZINT_CAP_EXTENDABLE`, which is
[^18]: `ZINT_CAP_EANUPC` was previously named `ZINT_CAP_EXTENDABLE`, which is
still recognised.
For example:
@@ -2697,7 +2802,7 @@ On successful encodation (after using `ZBarcode_Encode()` etc.) the `option_1`,
create the barcode. This is useful for feedback if the values were left as
defaults or were overridden by Zint.
In particular for symbologies that have masks,[^17] `option_3` will contain the
In particular for symbologies that have masks,[^19] `option_3` will contain the
mask used as `(N + 1) << 8`, N being the mask. Also Aztec Code will return the
actual ECC percentage used in `option_1` as `P << 8`, where P is the integer
percentage, the low byte containing the values given in [#tbl:aztec_eccs] (with
@@ -2715,7 +2820,7 @@ least one.
The `source`, `length` and `eci` members of `zint_seg` will be set accordingly -
the unconverted data in `source`, the data length in `length`, and the character
set the data was converted to in `eci`. Any check characters encoded will be
included,[^18] and for GS1 data any `FNC1` separators will be represented as
included,[^20] and for GS1 data any `FNC1` separators will be represented as
`GS` (ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13, as
will EAN-8 but only if it has an add-on (otherwise it will remain at 8 digits),
and any add-ons will follow the 13 digits directly (no separator). GS1 Composite
@@ -2727,16 +2832,16 @@ is `DATA_MODE`, it remains in binary; otherwise it will be in UTF-8. The UTF-8
source may be converted to the character set of the corresponding `eci` member
using the two helper functions discussed next.
[^17]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks.
[^19]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks.
Rectangular Micro QR Code has a fixed mask (4).
[^18]: Except for Japanese Postal Code, whose check character is not truly
[^20]: Except for Japanese Postal Code, whose check character is not truly
representable in the encoded data.
## 5.17 UTF-8 to ECI convenience functions
As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in
two helper functions (compatible with the `libzueci`[^19] functions
two helper functions (compatible with the `libzueci`[^21] functions
`zueci_utf8_to_eci()` and `zueci_dest_len_eci()`):
@@ -2756,7 +2861,7 @@ returned in `p_dest_length`, may be smaller than the estimate given by
NUL-terminated. The destination buffer is not NUL-terminated. The obsolete ECIs
0, 1 and 2 are supported.
[^19]: The library `libzueci`, which can convert both to and from UTF-8 and ECI,
[^21]: The library `libzueci`, which can convert both to and from UTF-8 and ECI,
is available at [https://sourceforge.net/projects/libzueci/](
https://sourceforge.net/projects/libzueci/).
@@ -2918,7 +3023,7 @@ UPC-A is used in the United States for retail applications, and encodes a
GTIN-12, a 12-digit Global Trade Item Number that includes a standard GS1 check
digit.
![`zint -b UPCA --compliantheight -d "72527270270"`](images/upca.svg){.upcean}
![`zint -b UPCA --compliantheight -d "01234500005"`](images/upca.svg){.upcean}
Input up to 11 digits may be given, to which a check digit will be added by
Zint. A 12-digit input including the check digit may also be supplied, in which
@@ -2928,11 +3033,11 @@ Input less than 11 digits will be zero-filled.
In addition 2-digit and 5-digit add-on symbols can be added, their data
separated from the main data by a `'+'` character or a space. For example, to
draw a UPC-A symbol with the data "72527270270" and 5-digit add-on data "12345"
draw a UPC-A symbol with the data "01234500005" and 5-digit add-on data "12345"
use the command:
```bash
zint -b UPCA -d "72527270270+12345"
zint -b UPCA -d "01234500005+12345"
```
or using the API:
@@ -2940,20 +3045,20 @@ or using the API:
```c
symbol->symbology = BARCODE_UPCA;
/* Using '+' */
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0);
error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
/* Or a space */
error = ZBarcode_Encode_and_Print(symbol, "72527270270 12345", 0, 0);
error = ZBarcode_Encode_and_Print(symbol, "01234500005 12345", 0, 0);
```
![`zint -b UPCA --compliantheight -d
"72527270270+12345"`](images/upca_5.svg){.upcean}
"01234500005+12345"`](images/upca_5.svg){.upcean}
A quiet zone indicator can be added to the HRT by setting `--guardwhitespace`
(API `output_options |= EANUPC_GUARD_WHITESPACE`). For UPC, this is only
relevant when there is an add-on:
```bash
zint -b UPCA -d "72527270270+12345" --guardwhitespace
zint -b UPCA -d "01234500005+12345" --guardwhitespace
```
or using the API:
@@ -2961,10 +3066,10 @@ or using the API:
```c
symbol->symbology = BARCODE_UPCA;
symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0);
error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
```
![`zint -b UPCA --compliantheight -d "72527270270+12345"
![`zint -b UPCA --compliantheight -d "01234500005+12345"
--guardwhitespace`](images/upca_5_gws.svg){.upcean}
You can adjust the gap between the main symbol and an add-on in integral
@@ -2981,7 +3086,7 @@ Zint. If 7 digits are given then the first must be '0' or '1' (the latter is
known as number system 1 and is non-standard). Input less than 7 digits will be
zero-filled.
![`zint -b UPCE --compliantheight -d "123456"`](images/upce.svg){.upcean}
![`zint -b UPCE --compliantheight -d "123455"`](images/upce.svg){.upcean}
An 8-digit input including the check digit may also be supplied, in which case
Zint will verify the check digit, or the symbology `BARCODE_UPCE_CHK` (38) may
@@ -2993,10 +3098,10 @@ when there is an add-on by setting `--guardwhitespace` (API `output_options |=
EANUPC_GUARD_WHITESPACE`):
```bash
zint -b UPCE -d "123456+12" --guardwhitespace
zint -b UPCE -d "123455+12" --guardwhitespace
```
![`zint -b UPCE --compliantheight -d "123456+12"
![`zint -b UPCE --compliantheight -d "123455+12"
--guardwhitespace`](images/upce_2_gws.svg){.upcean}
You can adjust the gap between the main symbol and an add-on in integral
@@ -3018,7 +3123,7 @@ EAN-13 encodes a GTIN-13, a 13-digit Global Trade Item Number that includes a
standard GS1 check digit.
![`zint -b EAN13 --compliantheight -d
"451234567890"`](images/ean13.svg){.upcean}
"952012345678"`](images/ean13.svg){.upcean}
Input up to 12 digits may be given, to which a check digit will be added by
Zint, or a 13-digit input can be supplied in which case Zint will validate the
@@ -3028,7 +3133,7 @@ A 2-digit or 5-digit add-on can be added by using a '+' or space character as
with UPC symbols. For example:
```bash
zint -b EAN13 -d "451234567890+21"
zint -b EAN13 -d "952012345678+21"
```
will encode an EAN-13 symbol with a 2-digit add-on. As before these results
@@ -3036,20 +3141,20 @@ can be achieved using the API:
```c
symbol->symbology = BARCODE_EAN13;
error = ZBarcode_Encode_and_Print(symbol, "451234567890+21", 0, 0);
error = ZBarcode_Encode_and_Print(symbol, "952012345678+21", 0, 0);
```
![`zint -b EAN13 --compliantheight -d
"451234567890+21"`](images/ean13_2.svg){.upcean}
"952012345678+21"`](images/ean13_2.svg){.upcean}
Options to add quiet zone indicators and to adjust the add-on gap and the guard
bar descent height are the same as for [6.1.3.2 UPC Version E]. For instance:
```bash
zint -b EAN13 -d "4512345678906" --guarddescent=2.5 --guardwhitespace
zint -b EAN13 -d "9520123456788" --guarddescent=2.5 --guardwhitespace
```
![`zint -b EAN13 --compliantheight -d "4512345678906"`
![`zint -b EAN13 --compliantheight -d "9520123456788"`
--guarddescent=2.5 --guardwhitespace](images/ean13_gd_gws.svg){.upcean}
#### 6.1.4.2 EAN-8
@@ -3057,7 +3162,7 @@ zint -b EAN13 -d "4512345678906" --guarddescent=2.5 --guardwhitespace
EAN-8 is a shortened version of EAN-13, encoding a GTIN-8 (a GTIN-13 with 5
leading zeroes implied), for use with small packages.
![`zint -b EAN8 --compliantheight -d "7432365"`](images/ean8.svg){.upcean}
![`zint -b EAN8 --compliantheight -d "9520000"`](images/ean8.svg){.upcean}
Input up to 7 digits may be supplied, to which Zint will add a standard GS1
check digit. An 8-digit input including the check digit may also be given, in
@@ -3068,7 +3173,7 @@ Options to add quiet zone indicators and to adjust the guard bar descent height
are the same as for [6.1.3.2 UPC Version E]. For instance:
```bash
zint -b EAN8 -d "7432365" --guardwhitespace
zint -b EAN8 -d "9520000" --guardwhitespace
```
or using the API:
@@ -3076,10 +3181,10 @@ or using the API:
```c
symbol->symbology = BARCODE_EAN8;
symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "7432365", 0, 0);
error = ZBarcode_Encode_and_Print(symbol, "9520000", 0, 0);
```
![`zint -b EAN8 --compliantheight -d "7432365"`
![`zint -b EAN8 --compliantheight -d "9520000"`
--guardwhitespace](images/ean8_gws.svg){.upcean}
2-digit and 5-digit add-ons may also be added, and the gap adjusted, as with
@@ -3361,7 +3466,7 @@ alphanumerics) are not recommended.
#### 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
It is sometimes advantageous to stop Code 128 from using Code Set C which
compresses numerical data. The `BARCODE_CODE128AB`[^20] variant (symbology 60)
compresses numerical data. The `BARCODE_CODE128AB`[^22] variant (symbology 60)
suppresses Code Set C in favour of Code Sets A and B.
![`zint -b CODE128AB -d "130170X178"`](images/code128ab.svg){.lin}
@@ -3369,26 +3474,19 @@ suppresses Code Set C in favour of Code Sets A and B.
Note that the special extra escapes mentioned above are not available for this
variant (nor for any other).
[^20]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
[^22]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
still recognised.
#### 6.1.10.3 GS1-128
A variation of Code 128 previously known as UCC/EAN-128, this symbology is
defined by the GS1 General Specifications. Application Identifiers (AIs) should
be entered using [square bracket] notation. These will be converted to
parentheses (round brackets) for the Human Readable Text. This method allows the
inclusion of parentheses in the AI data without escaping.
defined by the GS1 General Specifications. Data should be in one of the formats
described in [4.11.3.1 GS1 Data Entry]. Here we will use the square bracket
format.
![`zint -b GS1_128 --compliantheight -d
"[01]98898765432106[3202]012345[15]991231"`](images/gs1_128.svg){.lin}
For compatibility with data entry in other systems, the option `--gs1parens`
(API `input_mode |= GS1PARENS_MODE`) may be used to signal that AIs are encased
in parentheses. If there are any opening parentheses in the AI data, they must
be escaped with a backslash (`\(`). Optionally, for clarity, closing parentheses
may also be escaped,
Fixed length data should be entered at the appropriate length for correct
encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters.
Check digits for GTIN data AI (01) are not generated and need to be included in
@@ -3398,12 +3496,6 @@ the input data. The following is an example of a valid GS1-128 input:
zint -b GS1_128 -d "[01]98898765432106[3202]012345[15]991231"
```
or using the `--gs1parens` option:
```bash
zint -b GS1_128 --gs1parens -d "(01)98898765432106(3202)012345(15)991231"
```
#### 6.1.10.4 EAN-14
A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14 takes a
@@ -3533,11 +3625,9 @@ less than 13 digits will be zero-filled.
#### 6.1.11.3 GS1 DataBar Expanded
Previously known as RSS Expanded this is a variable length symbology capable of
encoding data from a number of AIs in a single symbol. AIs should be encased in
[square brackets] in the input data, which will be displayed as parentheses
(round brackets) in the Human Readable Text. This method allows the inclusion of
parentheses in the AI data without escaping. The AIs may alternatively be
encased in parentheses using the `--gs1parens` switch - see [6.1.10.3 GS1-128].
encoding multiple AIs in a single symbol. Data should be in one of the formats
described in [4.11.3.1 GS1 Data Entry], and will be displayed using parentheses
(round brackets) in the Human Readable Text.
![`zint -b DBAR_EXP --compliantheight -d
"[01]98898765432106[3202]012345[15]991231"`](images/dbar_exp.svg){.lin}
@@ -3976,7 +4066,7 @@ first and last digit are ignored, leaving a 4-digit DX Extract number in any
case, which must be in the range 16 to 2047. The second format `"NNN-NN"`
represents the DX Extract as two numbers separated by a dash (`-`), the first
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
0 to 15).[^21]
0 to 15).[^23]
The optional frame number is a number in the range 0 to 63, and may have a half
frame indicator `"A"` appended. Special character sequences (with or without a
@@ -3986,7 +4076,7 @@ number 62, `"K"` or `"00"` means frame number 63, and `"F"` means frame number
A parity bit is automatically added by Zint.
[^21]: The DX number may be looked up in The (Modified) Big Film Database at
[^23]: The DX number may be looked up in The (Modified) Big Film Database at
[https://thebigfilmdatabase.merinorus.com](
https://thebigfilmdatabase.merinorus.com).
@@ -5163,7 +5253,7 @@ company references in particular.
May 2004)
- AIM ITS/04-023 International Technical Standard - Extended Channel
Interpretations Part 3: Register (Version 2, February 2022)
- GS1 General Specifications Release 25.0 (Jan 2025)
- GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard