Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/docs/manual.pmd @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 % Zint Barcode Generator and Zint Barcode Studio User Manual | |
| 2 % Version 2.13.0.9 | |
| 3 % December 2024 | |
| 4 | |
| 5 # 1. Introduction | |
| 6 | |
| 7 The Zint project aims to provide a complete cross-platform open source barcode | |
| 8 generating solution. The package currently consists of a Qt-based GUI, a CLI | |
| 9 command line executable and a library with an API to allow developers access to | |
| 10 the capabilities of Zint. It is hoped that Zint provides a solution which is | |
| 11 flexible enough for professional users while at the same time takes care of as | |
| 12 much of the processing as possible to allow easy translation from input data to | |
| 13 barcode image. | |
| 14 | |
| 15 The library which forms the main component of the Zint project is currently able | |
| 16 to encode data in over 50 barcode symbologies (types of barcode), for each of | |
| 17 which it is possible to translate that data from either UTF-8 (Unicode) or a raw | |
| 18 8-bit data stream. The image can be rendered as a | |
| 19 | |
| 20 - Windows Bitmap (BMP), | |
| 21 - Enhanced Metafile Format (EMF), | |
| 22 - Encapsulated PostScript (EPS), | |
| 23 - Graphics Interchange Format (GIF), | |
| 24 - ZSoft Paintbrush (PCX) image, | |
| 25 - Portable Network Graphic (PNG) image, | |
| 26 - Tagged Image File Format (TIF), or a | |
| 27 - Scalable Vector Graphic (SVG). | |
| 28 | |
| 29 Many options are available for setting the characteristics of the output image | |
| 30 including the size and colour of the image, the amount of error correction used | |
| 31 in the symbol and the orientation of the image. | |
| 32 | |
| 33 ## 1.1 Glossary | |
| 34 | |
| 35 Some of the words and phrases used in this document are specific to barcoding, | |
| 36 and so a brief explanation is given to help understanding: | |
| 37 | |
| 38 symbol | |
| 39 | |
| 40 : A symbol is an image which encodes data according to one of the standards. | |
| 41 This encompasses barcodes (linear symbols) as well as any of the other | |
| 42 methods of representing data used in this program. | |
| 43 | |
| 44 symbology | |
| 45 | |
| 46 : A method of encoding data to create a certain type of symbol. | |
| 47 | |
| 48 linear | |
| 49 | |
| 50 : A linear or one-dimensional symbol is one which consists of bars and spaces, | |
| 51 and is what most people associate with the term 'barcode'. Examples include | |
| 52 Code 128. | |
| 53 | |
| 54 stacked | |
| 55 | |
| 56 : A stacked symbol consists of multiple linear symbols placed one above | |
| 57 another and which together hold the message, usually alongside some error | |
| 58 correction data. Examples include PDF417. | |
| 59 | |
| 60 matrix | |
| 61 | |
| 62 : A matrix symbol is one based on a (usually square) grid of elements called | |
| 63 modules. Examples include Data Matrix, but MaxiCode and DotCode are also | |
| 64 considered matrix symbologies. | |
| 65 | |
| 66 composite | |
| 67 | |
| 68 : A composite symbology is one which is made up of elements which are both | |
| 69 linear and stacked. Those currently supported are made up of a linear | |
| 70 'primary' message above which is printed a stacked component based on the | |
| 71 PDF417 symbology. These symbols also have a separator which separates the | |
| 72 linear and the stacked components. The stacked component is most often | |
| 73 referred to as the 2D (two-dimensional) component. | |
| 74 | |
| 75 X-dimension | |
| 76 | |
| 77 : The X-dimension of a symbol is the size (usually the width) of the smallest | |
| 78 element. For a linear symbology this is the width of the smallest bar. For | |
| 79 matrix symbologies it is the width of the smallest module (usually a | |
| 80 square). Barcode widths and heights are expressed in X-dimensions. Most | |
| 81 linear symbologies can have their height varied whereas most matrix | |
| 82 symbologies have a fixed width-to-height ratio where the height is | |
| 83 determined by the width. | |
| 84 | |
| 85 GS1 data | |
| 86 | |
| 87 : This is a structured way of representing information which consists of | |
| 88 'chunks' of data, each of which starts with an Application Identifier (AI). | |
| 89 The AI identifies what type of information is being encoded. | |
| 90 | |
| 91 Reader Initialisation (Programming) | |
| 92 | |
| 93 : Some symbologies allow a special character to be included which can be | |
| 94 detected by the scanning equipment as signifying that the data is used to | |
| 95 program or change settings in that equipment. This data is usually not | |
| 96 passed on to the software which handles normal input data. This feature | |
| 97 should only be used if you are familiar with the programming codes relevant | |
| 98 to your scanner. | |
| 99 | |
| 100 ECI | |
| 101 | |
| 102 : The Extended Channel Interpretations (ECI) mechanism allows for | |
| 103 multi-language data to be encoded in symbols which would usually support | |
| 104 only Latin-1 (ISO/IEC 8859-1 plus ASCII) characters. This can be useful, for | |
| 105 example, if you need to encode Cyrillic characters, but should be used with | |
| 106 caution as not all scanners support this method. | |
| 107 | |
| 108 Two other concepts that are important are raster and vector. | |
| 109 | |
| 110 raster | |
| 111 | |
| 112 : A low level bitmap representation of an image. BMP, GIF, PCX, PNG and TIF | |
| 113 are raster file formats. | |
| 114 | |
| 115 vector | |
| 116 | |
| 117 : A high level command- or data-based representation of an image. EMF, EPS and | |
| 118 SVG are vector file formats. They require renderers to turn them into | |
| 119 bitmaps. | |
| 120 | |
| 121 | |
| 122 # 2. Installing Zint | |
| 123 | |
| 124 ## 2.1 Linux | |
| 125 | |
| 126 The easiest way to configure compilation is to take advantage of the CMake | |
| 127 utilities. You will need to install CMake and `libpng-dev` first. For instance | |
| 128 on `apt` systems: | |
| 129 | |
| 130 ```bash | |
| 131 sudo apt install git cmake build-essential libpng-dev | |
| 132 ``` | |
| 133 | |
| 134 If you want to take advantage of Zint Barcode Studio you will also need to have | |
| 135 Qt and its component `"Desktop gcc 64-bit"` installed, as well as `mesa`. For | |
| 136 details see `"README.linux"` in the project root directory. | |
| 137 | |
| 138 Once you have fulfilled these requirements unzip the source code tarball or | |
| 139 clone the latest source | |
| 140 | |
| 141 ```bash | |
| 142 git clone https://git.code.sf.net/p/zint/code zint | |
| 143 ``` | |
| 144 | |
| 145 and follow these steps in the top directory: | |
| 146 | |
| 147 ```bash | |
| 148 mkdir build | |
| 149 cd build | |
| 150 cmake .. | |
| 151 make | |
| 152 sudo make install | |
| 153 ``` | |
| 154 | |
| 155 The CLI command line program can be accessed by typing | |
| 156 | |
| 157 ```bash | |
| 158 zint [options] | |
| 159 ``` | |
| 160 | |
| 161 The GUI can be accessed by typing | |
| 162 | |
| 163 ```bash | |
| 164 zint-qt | |
| 165 ``` | |
| 166 | |
| 167 To test that the installation has been successful a shell script is included in | |
| 168 the `"frontend"` sub-directory. To run the test type | |
| 169 | |
| 170 ```bash | |
| 171 ./test.sh | |
| 172 ``` | |
| 173 | |
| 174 This should create numerous files in the sub-directory `"frontend/test_sh_out"` | |
| 175 showing the many modes of operation which are available from Zint. | |
| 176 | |
| 177 ## 2.2 BSD | |
| 178 | |
| 179 The latest Zint CLI, `libzint` library and GUI can be installed from the `zint` | |
| 180 package on FreeBSD: | |
| 181 | |
| 182 ```bash | |
| 183 su | |
| 184 pkg install zint | |
| 185 exit | |
| 186 ``` | |
| 187 | |
| 188 and on OpenBSD (where the GUI is in a separate `zint-gui` package): | |
| 189 | |
| 190 ```bash | |
| 191 su | |
| 192 pkg_add zint zint-gui | |
| 193 exit | |
| 194 ``` | |
| 195 | |
| 196 To build from source (including for NetBSD) see `"README.bsd"` in the project | |
| 197 root directory. | |
| 198 | |
| 199 ## 2.3 Microsoft Windows | |
| 200 | |
| 201 For Microsoft Windows, Zint is distributed as a binary executable. Simply | |
| 202 download the ZIP file, then right-click on the ZIP file and `"Extract All"`. A | |
| 203 new folder will be created within which are two binary files: | |
| 204 | |
| 205 * `qtZint.exe` - Zint Barcode Studio | |
| 206 * `zint.exe` - Command Line Interface | |
| 207 | |
| 208 For fresh releases you will get a warning message from Microsoft Defender | |
| 209 SmartScreen that this is an 'unrecognised app'. This happens because Zint is | |
| 210 a free and open-source software project with no advertising and hence no income, | |
| 211 meaning we are not able to afford the $664 per year to have the application | |
| 212 digitally signed by Microsoft. | |
| 213 | |
| 214 To build Zint on Windows from source, see `"win32/README"`. | |
| 215 | |
| 216 ## 2.4 Apple macOS | |
| 217 | |
| 218 The latest Zint CLI and `libzint` can be installed using Homebrew.[^1] To | |
| 219 install Homebrew input the following line into the macOS terminal | |
| 220 | |
| 221 ```bash | |
| 222 /bin/bash -c "$(curl -fsSL \ | |
| 223 https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| 224 ``` | |
| 225 | |
| 226 Once Homebrew is installed use the following command to install the CLI and | |
| 227 library | |
| 228 | |
| 229 ```bash | |
| 230 brew install zint | |
| 231 ``` | |
| 232 | |
| 233 To build from source (and install the GUI) see `"README.macos"` in the project | |
| 234 root directory. | |
| 235 | |
| 236 [^1]: See the Homebrew website [https://brew.sh](https://brew.sh). | |
| 237 | |
| 238 ## 2.5 Zint Tcl Backend | |
| 239 | |
| 240 The Tcl backend in the `"backend_tcl"` sub-directory may be built using the | |
| 241 provided TEA (Tcl Extension Architecture) build on Linux, Windows, macOS and | |
| 242 Android. For Windows, an MSVC6 makefile is also available. See [Annex C. Tcl | |
| 243 Backend Binding] for further details. | |
| 244 | |
| 245 | |
| 246 # 3. Using Zint Barcode Studio | |
| 247 | |
| 248 Zint Barcode Studio is the graphical user interface for Zint. If you are | |
| 249 starting from a command line interface you can start the GUI by typing | |
| 250 | |
| 251 ```bash | |
| 252 zint-qt | |
| 253 ``` | |
| 254 | |
| 255 or on Windows | |
| 256 | |
| 257 ```bash | |
| 258 qtZint.exe | |
| 259 ``` | |
| 260 | |
| 261 See the note in section [2.3 Microsoft Windows] about Microsoft Defender | |
| 262 SmartScreen. | |
| 263 | |
| 264 Below is a brief guide to Zint Barcode Studio. | |
| 265 | |
| 266 ## 3.1 Main Window and Data Tab | |
| 267 | |
| 268 {.win} | |
| 270 | |
| 271 This is the main window of Zint Barcode Studio. The top of the window shows a | |
| 272 preview of the barcode that the current settings would create. These settings | |
| 273 can be changed using the controls below. The text box in the `"Data to Encode"` | |
| 274 groupbox on this first Data tab allows you to enter the data to be encoded. When | |
| 275 you are happy with your settings you can use the `"Save..."` button to save the | |
| 276 resulting image to a file. | |
| 277 | |
| 278 The `"Symbology"` drop-down box gives access to all of the symbologies supported | |
| 279 by Zint shown in alphabetical order. The text box to its right can filter the | |
| 280 drop-down to only show matching symbologies. For instance typing `"mail"` will | |
| 281 only show barcodes in the drop-down whose names contain the word `"mail"`. Each | |
| 282 word entered will match. So typing `"mail post"` will show barcodes whose names | |
| 283 contain `"mail"` or `"post"` (or both). | |
| 284 | |
| 285 The ellipsis button `"..."` to the right of the data text box invokes the Data | |
| 286 Dialog - see [3.7 Data Dialog] for details. The delete button | |
| 287 {.btn} next to it will clear the data text box | |
| 288 and the ECI (Extended Channel Interpretations) drop-down if set. | |
| 289 | |
| 290 To set the barcode as a Programming Initialisation symbol click the | |
| 291 `"Reader Init"` checkbox. The `"1234.."` button to its right invokes the | |
| 292 Sequence Dialog - see [3.8 Sequence Dialog]. The zap button | |
| 293 {.btn} will clear all data and reset all settings for | |
| 294 the barcode to defaults. | |
| 295 | |
| 296 The `"BMP"` and `"SVG"` buttons at the bottom will copy the image to the | |
| 297 clipboard in BMP format and SVG format respectively. Further copy-to-clipboard | |
| 298 formats are available by clicking the `"Menu"` button, along with | |
| 299 `"CLI Equivalent..."`, `"Save As..."`, `"Factory Reset..."`, `"Help"`, | |
| 300 `"About..."` and `"Quit"` options. Most of the options are also available in a | |
| 301 context menu by right-clicking the preview. | |
| 302 | |
| 303 {.win} | |
| 305 | |
| 306 ## 3.2 GS1 Composite Groupbox | |
| 307 | |
| 308 {.win} | |
| 310 | |
| 311 In the middle of the Data tab is an area for creating composite symbologies | |
| 312 which appears when the currently selected symbology is supported by the GS1 | |
| 313 Composite symbology standard. GS1 data can then be entered with square brackets | |
| 314 used to separate Application Identifier (AI) information from data as shown | |
| 315 here. For details, see [6.3 GS1 Composite Symbols (ISO 24723)]. | |
| 316 | |
| 317 ## 3.3 Additional ECI/Data Segments Groupbox | |
| 318 | |
| 319 {.win} | |
| 320 | |
| 321 For symbologies that support ECIs (Extended Channel Interpretations) the middle | |
| 322 of the Data tab is an area for entering additional data segments with their own | |
| 323 ECIs. Up to 4 segments (including the main `"Data to Encode"` as segment 0) may | |
| 324 be specified. See [4.16 Multiple Segments] for details. | |
| 325 | |
| 326 ## 3.4 Symbology-specific Groupbox | |
| 327 | |
| 328 {.win} | |
| 330 | |
| 331 Many symbologies have extra options to change the content, format and appearance | |
| 332 of the symbol generated. For those with few additional options (and no support | |
| 333 for GS1 data or ECIs), the middle of the Data tab is an area for setting those | |
| 334 options. | |
| 335 | |
| 336 Here is shown the check digit options for an Interleaved Code 2 of 5 symbol (see | |
| 337 [6.1.2.4 Interleaved Code 2 of 5 (ISO 16390)]). | |
| 338 | |
| 339 Symbologies with more than a few options (or support for GS1 data or ECIs) have | |
| 340 a second Symbology-specific tab, shown next. | |
| 341 | |
| 342 ## 3.5 Symbology-specific Tab | |
| 343 | |
| 344 {.win} | |
| 345 | |
| 346 A second tab appears for those symbologies with more than a few extra options. | |
| 347 | |
| 348 Here is shown the options available for an Aztec Code symbol. | |
| 349 | |
| 350 You can adjust its size or error correction level (see [6.6.8 Aztec Code (ISO | |
| 351 24778)]), select how its data is to be treated (see [4.11 Input Modes]), and set | |
| 352 it as part of a Structured Append sequence of symbols (see [4.17 Structured | |
| 353 Append]). | |
| 354 | |
| 355 ## 3.6 Appearance Tab | |
| 356 | |
| 357 {.win} | |
| 359 | |
| 360 The Appearance tab can be used to adjust the dimensions and other properties of | |
| 361 the symbol. | |
| 362 | |
| 363 The `"Height"` value affects the height of symbologies which do not have a fixed | |
| 364 width-to-height ratio, i.e. those other than matrix symbologies. For such | |
| 365 symbologies the `"Automatic Height"` checkbox will be enabled - uncheck this to | |
| 366 manually adjust the height. The `"Compliant Height"` checkbox applies to | |
| 367 symbologies that define a standard height - see [4.4 Adjusting Height]. | |
| 368 | |
| 369 Boundary bars can be added with the `"Border Type"` drop-down and their size | |
| 370 adjusted with `"Border Width"`, and whitespace can be adjusted both horizontally | |
| 371 (first spinbox) and vertically (second spinbox), and also through the | |
| 372 `"Quiet Zones"` checkbox if standard quiet zones are defined for the symbology. | |
| 373 | |
| 374 The size of the saved image can be specified with `"Printing Scale"`, and also | |
| 375 by clicking the {.btn} icon to invoke the Set | |
| 376 Printing Scale Dialog - see [4.9 Adjusting Image Size (X-dimension)] for further | |
| 377 details. | |
| 378 | |
| 379 {.pop} | |
| 380 | |
| 381 The foreground and background colours can be set either using the text boxes | |
| 382 which accept `"RRGGBBAA"` hexadecimal values and `"C,M,Y,K"` decimal percentage | |
| 383 values, or by clicking the foreground eye {.btn} | |
| 384 and background eye {.btn} buttons which invoke a | |
| 385 colour picker. | |
| 386 | |
| 387 {.pop} | |
| 388 | |
| 389 (Note that to change the colours visually, the luminence slider, the long narrow | |
| 390 column on the right, must be adjusted.) The color picker only deals in RGB(A), | |
| 391 and will overwrite any CMYK values with RGB(A) values once `"OK"` is selected. | |
| 392 | |
| 393 Back in the Appearance tab, the colours can be reset to black-on-white using the | |
| 394 `"Reset"` button, and exchanged one for the other using the swap | |
| 395 {.btn} button next to it. | |
| 396 | |
| 397 ## 3.7 Data Dialog | |
| 398 | |
| 399 {.pop} | |
| 400 | |
| 401 Clicking on the ellipsis `"..."` button next to the `"Data to Encode"` text box | |
| 402 in the Data tab opens a larger window which can be used to enter longer strings | |
| 403 of text. You can also use this window to load data from a file. | |
| 404 | |
| 405 The dialog is also available for additional ECI/Data segments by clicking the | |
| 406 ellipsis button to the right of their data text boxes. | |
| 407 | |
| 408 Note that if your data contains line feeds (`LF`) then the data will be split | |
| 409 into separate lines in the dialog box. On saving the data back to the main text | |
| 410 box any separate lines in the data will be escaped as `'\n'` and the | |
| 411 `"Parse Escapes"` checkbox will be set. This only affects line feeds, not | |
| 412 carriage returns (`CR`) or `CR+LF` pairs, and behaves the same on both Windows | |
| 413 and Unix. (For details on escape sequences, see [4.1 Inputting Data].) | |
| 414 | |
| 415 ## 3.8 Sequence Dialog | |
| 416 | |
| 417 {.pop} | |
| 418 | |
| 419 Clicking on the sequence button (labelled `"1234.."`) in the Data tab opens the | |
| 420 Sequence Dialog. This allows you to create multiple barcode images by entering a | |
| 421 sequence of data inputs in the right hand panel. Sequences can also be | |
| 422 automatically generated by entering parameters on the left hand side or by | |
| 423 importing the data from a file. Zint will generate a separate barcode image for | |
| 424 each line of text in the right hand panel. The format field determines the | |
| 425 format of the automatically generated sequence where characters have the | |
| 426 meanings as given below: | |
| 427 | |
| 428 | Character | Effect | | |
| 429 |:-------------------|:------------------------| | |
| 430 |`$` | Insert leading zeroes | | |
| 431 |`#` | Insert leading spaces | | |
| 432 |`*` | Insert leading asterisks| | |
| 433 |Any other character | Interpreted literally | | |
| 434 | |
| 435 Table: {#tbl:sequence_format_characters tag=": Sequence Format Characters"} | |
| 436 | |
| 437 Once you're happy with the Sequence Data, click the `"Export..."` button to | |
| 438 bring up the Export Dialog, discussed next. | |
| 439 | |
| 440 ## 3.9 Export Dialog | |
| 441 | |
| 442 {.pop} | |
| 444 | |
| 445 The Export Dialog invoked by pressing the `"Export..."` button in the Sequence | |
| 446 Dialog sets the parameters for exporting the sequence of barcode images. Here | |
| 447 you can set the output directory, the format of the output filenames and what | |
| 448 their image type will be. Note that the symbology, colour and other formatting | |
| 449 information are taken from the main window. | |
| 450 | |
| 451 ## 3.10 CLI Equivalent Dialog | |
| 452 | |
| 453 {.pop} | |
| 454 | |
| 455 The CLI Equivalent Dialog can be invoked from the main menu or the context menu | |
| 456 and displays the CLI command that will reproduce the barcode as currently | |
| 457 configured in the GUI. Press the `"Copy"` button to copy the command to the | |
| 458 clipboard, which can then be pasted into the command line. | |
| 459 | |
| 460 | |
| 461 # 4. Using the Command Line | |
| 462 | |
| 463 This section describes how to encode data using the command line frontend (CLI) | |
| 464 program. The examples given are for the Unix platform, but the same options are | |
| 465 available for Windows - just remember to include the executable file extension | |
| 466 if `".EXE"` is not in your `PATHEXT` environment variable, i.e.: | |
| 467 | |
| 468 ```bash | |
| 469 zint.exe -d "This Text" | |
| 470 ``` | |
| 471 | |
| 472 For compatibility with Windows the examples use double quotes to delimit data, | |
| 473 though on Unix single quotes are generally preferable as they stop the shell | |
| 474 from processing any characters such as backslash or dollar. A single quote | |
| 475 itself is dealt with by terminating the single-quoted text, backslashing the | |
| 476 single quote, and then continuing: | |
| 477 | |
| 478 ```bash | |
| 479 zint -d 'Text containing a single quote '\'' in the middle' | |
| 480 ``` | |
| 481 | |
| 482 Some examples use backslash (`\`) to continue commands onto the next line. For | |
| 483 Windows, use caret (`^`) instead. | |
| 484 | |
| 485 Certain options that take values have short names as well as long ones, namely | |
| 486 `-b` (`--barcode`), `-d` (`--data`), `-i` (`--input`), `-o` (`--output`) and | |
| 487 `-w` (`--whitesp`). For these a space should be used to separate the short name | |
| 488 from its value, to avoid ambiguity. For long names a space or an equals sign may | |
| 489 be used. For instance: | |
| 490 | |
| 491 ```bash | |
| 492 zint -d "This Text" | |
| 493 zint --data="This Text" | |
| 494 zint --data "This Text" | |
| 495 ``` | |
| 496 | |
| 497 The examples use a space separator for short option names, and an equals sign | |
| 498 for long option names. | |
| 499 | |
| 500 ## 4.1 Inputting Data | |
| 501 | |
| 502 The data to encode can be entered at the command line using the `-d` or `--data` | |
| 503 option, for example | |
| 504 | |
| 505 ```bash | |
| 506 zint -d "This Text" | |
| 507 ``` | |
| 508 | |
| 509 This will encode the text `"This Text"`. Zint will use the default symbology, | |
| 510 Code 128, and output to the default file `"out.png"` in the current directory. | |
| 511 Alternatively, if `libpng` was not present when Zint was built, the default | |
| 512 output file will be `"out.gif"`. | |
| 513 | |
| 514 The data input to the Zint CLI is assumed to be encoded in UTF-8 (Unicode) | |
| 515 format (Zint will correctly handle UTF-8 data on Windows). If you are encoding | |
| 516 characters beyond the 7-bit ASCII set using a scheme other than UTF-8 then you | |
| 517 will need to set the appropriate input options as shown in [4.11 Input Modes] | |
| 518 below. | |
| 519 | |
| 520 Non-printing characters can be entered on the command line using backslash (`\`) | |
| 521 as an escape character in combination with the `--esc` switch. Permissible | |
| 522 sequences are shown in the table below. | |
| 523 | |
| 524 --------------------------------------------------------------------------- | |
| 525 Escape ASCII Name Interpretation | |
| 526 Sequence Equivalent | |
| 527 ---------- ---------- ----- ------------------------------------------- | |
| 528 `\0` 0x00 `NUL` Null character | |
| 529 | |
| 530 `\E` 0x04 `EOT` End of Transmission | |
| 531 | |
| 532 `\a` 0x07 `BEL` Bell | |
| 533 | |
| 534 `\b` 0x08 `BS` Backspace | |
| 535 | |
| 536 `\t` 0x09 `HT` Horizontal Tab | |
| 537 | |
| 538 `\n` 0x0A `LF` Line Feed | |
| 539 | |
| 540 `\v` 0x0B `VT` Vertical Tab | |
| 541 | |
| 542 `\f` 0x0C `FF` Form Feed | |
| 543 | |
| 544 `\r` 0x0D `CR` Carriage Return | |
| 545 | |
| 546 `\e` 0x1B `ESC` Escape | |
| 547 | |
| 548 `\G` 0x1D `GS` Group Separator | |
| 549 | |
| 550 `\R` 0x1E `RS` Record Separator | |
| 551 | |
| 552 `\\` 0x5C `\` Backslash | |
| 553 | |
| 554 `\dNNN` NNN Any 8-bit character where NNN is decimal | |
| 555 (000-255) | |
| 556 | |
| 557 `\oNNN` 0oNNN Any 8-bit character where NNN is octal | |
| 558 (000-377) | |
| 559 | |
| 560 `\xNN` 0xNN Any 8-bit character where NN is hexadecimal | |
| 561 (00-FF) | |
| 562 | |
| 563 `\uNNNN` Any 16-bit Unicode BMP[^2] character where | |
| 564 NNNN is hexadecimal (0000-FFFF) | |
| 565 | |
| 566 `\UNNNNNN` Any 21-bit Unicode character where NNNNNN | |
| 567 is hexadecimal (000000-10FFFF) | |
| 568 --------------------------------------------------------------------------- | |
| 569 | |
| 570 Table: {#tbl:escape_sequences tag=": Escape Sequences"} | |
| 571 | |
| 572 [^2]: In Unicode contexts, BMP stands for Basic Multilingual Plane, the plane 0 | |
| 573 codeset from U+0000 to U+D7FF and U+E000 to U+FFFF (i.e. excluding surrogates). | |
| 574 Not to be confused with the Windows Bitmap file format BMP! | |
| 575 | |
| 576 (Special escape sequences are available for Code 128 only to manually switch | |
| 577 Code Sets and insert special FNC1 characters - see [6.1.10.1 Standard Code 128 | |
| 578 (ISO 15417)] for details.) | |
| 579 | |
| 580 Input data can be read directly from file using the `-i` or `--input` switch as | |
| 581 shown below. The input file is assumed to be UTF-8 formatted unless an | |
| 582 alternative mode is selected. This option replaces the use of the `-d` switch. | |
| 583 | |
| 584 ```bash | |
| 585 zint -i somefile.txt | |
| 586 ``` | |
| 587 | |
| 588 To read from stdin specify a single hyphen `"-"` as the input file. | |
| 589 | |
| 590 Note that except when batch processing (see [4.12 Batch Processing] below), the | |
| 591 file (or stdin) should not end with a newline (`LF` on Unix, `CR+LF` on Windows) | |
| 592 unless you want the newline to be encoded in the symbol. | |
| 593 | |
| 594 ## 4.2 Directing Output | |
| 595 | |
| 596 Output can be directed to a file other than the default using the `-o` or | |
| 597 `--output` switch. For example: | |
| 598 | |
| 599 ```bash | |
| 600 zint -o here.png -d "This Text" | |
| 601 ``` | |
| 602 | |
| 603 This draws a Code 128 barcode in the file `"here.png"`. If an Encapsulated | |
| 604 PostScript file is needed simply append the filename with `".eps"`, and so on | |
| 605 for the other supported file types: | |
| 606 | |
| 607 ```bash | |
| 608 zint -o there.eps -d "This Text" | |
| 609 ``` | |
| 610 | |
| 611 The currently supported output file formats are shown in the following table. | |
| 612 | |
| 613 Extension File format | |
| 614 --------- ------------------------------------ | |
| 615 bmp Windows Bitmap | |
| 616 emf Enhanced Metafile Format | |
| 617 eps Encapsulated PostScript | |
| 618 gif Graphics Interchange Format | |
| 619 pcx ZSoft Paintbrush image | |
| 620 png Portable Network Graphic | |
| 621 svg Scalable Vector Graphic | |
| 622 tif Tagged Image File Format | |
| 623 txt Text file (see [4.19 Other Options]) | |
| 624 | |
| 625 Table: {#tbl:output_file_formats tag=": Output File Formats"} | |
| 626 | |
| 627 The filename can contain directories and sub-directories also, which will be | |
| 628 created if they don't already exist: | |
| 629 | |
| 630 ```bash | |
| 631 zint -o "dir/subdir/filename.eps" -d "This Text" | |
| 632 ``` | |
| 633 | |
| 634 Note that on Windows, filenames are assumed to be UTF-8 encoded. | |
| 635 | |
| 636 ## 4.3 Selecting Barcode Type | |
| 637 | |
| 638 Selecting which type of barcode you wish to produce (i.e. which symbology to | |
| 639 use) can be done at the command line using the `-b` or `--barcode` switch | |
| 640 followed by the appropriate integer value or name in the following table. For | |
| 641 example to create a Data Matrix symbol you could use: | |
| 642 | |
| 643 ```bash | |
| 644 zint -b 71 -o datamatrix.png -d "Data to encode" | |
| 645 ``` | |
| 646 | |
| 647 or | |
| 648 | |
| 649 ```bash | |
| 650 zint -b DATAMATRIX -o datamatrix.png -d "Data to encode" | |
| 651 ``` | |
| 652 | |
| 653 Names are treated case-insensitively by the CLI, and the `BARCODE_` prefix and | |
| 654 any underscores are optional. | |
| 655 | |
| 656 ----------------------------------------------------------------------------- | |
| 657 Numeric Name[^3] Barcode Name | |
| 658 Value | |
| 659 ------- ------------------------ ------------------------------------------ | |
| 660 1 `BARCODE_CODE11` Code 11 | |
| 661 | |
| 662 2`*` `BARCODE_C25STANDARD` Standard Code 2 of 5 | |
| 663 | |
| 664 3 `BARCODE_C25INTER` Interleaved 2 of 5 | |
| 665 | |
| 666 4 `BARCODE_C25IATA` Code 2 of 5 IATA | |
| 667 | |
| 668 6 `BARCODE_C25LOGIC` Code 2 of 5 Data Logic | |
| 669 | |
| 670 7 `BARCODE_C25IND` Code 2 of 5 Industrial | |
| 671 | |
| 672 8 `BARCODE_CODE39` Code 3 of 9 (Code 39) | |
| 673 | |
| 674 9 `BARCODE_EXCODE39` Extended Code 3 of 9 (Code 39+) | |
| 675 | |
| 676 13 `BARCODE_EANX` EAN (EAN-2, EAN-5, EAN-8 and EAN-13) | |
| 677 | |
| 678 14 `BARCODE_EANX_CHK` EAN + Check Digit | |
| 679 | |
| 680 16`*` `BARCODE_GS1_128` GS1-128 (UCC.EAN-128) | |
| 681 | |
| 682 18 `BARCODE_CODABAR` Codabar | |
| 683 | |
| 684 20 `BARCODE_CODE128` Code 128 (automatic Code Set switching) | |
| 685 | |
| 686 21 `BARCODE_DPLEIT` Deutsche Post Leitcode | |
| 687 | |
| 688 22 `BARCODE_DPIDENT` Deutsche Post Identcode | |
| 689 | |
| 690 23 `BARCODE_CODE16K` Code 16K | |
| 691 | |
| 692 24 `BARCODE_CODE49` Code 49 | |
| 693 | |
| 694 25 `BARCODE_CODE93` Code 93 | |
| 695 | |
| 696 28 `BARCODE_FLAT` Flattermarken | |
| 697 | |
| 698 29`*` `BARCODE_DBAR_OMN` GS1 DataBar Omnidirectional (including GS1 | |
| 699 DataBar Truncated) | |
| 700 | |
| 701 30`*` `BARCODE_DBAR_LTD` GS1 DataBar Limited | |
| 702 | |
| 703 31`*` `BARCODE_DBAR_EXP` GS1 DataBar Expanded | |
| 704 | |
| 705 32 `BARCODE_TELEPEN` Telepen Alpha | |
| 706 | |
| 707 34 `BARCODE_UPCA` UPC-A | |
| 708 | |
| 709 35 `BARCODE_UPCA_CHK` UPC-A + Check Digit | |
| 710 | |
| 711 37 `BARCODE_UPCE` UPC-E | |
| 712 | |
| 713 38 `BARCODE_UPCE_CHK` UPC-E + Check Digit | |
| 714 | |
| 715 40 `BARCODE_POSTNET` POSTNET | |
| 716 | |
| 717 47 `BARCODE_MSI_PLESSEY` MSI Plessey | |
| 718 | |
| 719 49 `BARCODE_FIM` FIM | |
| 720 | |
| 721 50 `BARCODE_LOGMARS` LOGMARS | |
| 722 | |
| 723 51 `BARCODE_PHARMA` Pharmacode One-Track | |
| 724 | |
| 725 52 `BARCODE_PZN` PZN | |
| 726 | |
| 727 53 `BARCODE_PHARMA_TWO` Pharmacode Two-Track | |
| 728 | |
| 729 54 `BARCODE_CEPNET` Brazilian CEPNet | |
| 730 | |
| 731 55 `BARCODE_PDF417` PDF417 | |
| 732 | |
| 733 56`*` `BARCODE_PDF417COMP` Compact PDF417 (Truncated PDF417) | |
| 734 | |
| 735 57 `BARCODE_MAXICODE` MaxiCode | |
| 736 | |
| 737 58 `BARCODE_QRCODE` QR Code | |
| 738 | |
| 739 60 `BARCODE_CODE128AB` Code 128 (Suppress Code Set C) | |
| 740 | |
| 741 63 `BARCODE_AUSPOST` Australia Post Standard Customer | |
| 742 | |
| 743 66 `BARCODE_AUSREPLY` Australia Post Reply Paid | |
| 744 | |
| 745 67 `BARCODE_AUSROUTE` Australia Post Routing | |
| 746 | |
| 747 68 `BARCODE_AUSDIRECT` Australia Post Redirection | |
| 748 | |
| 749 69 `BARCODE_ISBNX` ISBN (EAN-13 with verification stage) | |
| 750 | |
| 751 70 `BARCODE_RM4SCC` Royal Mail 4-State Customer Code (RM4SCC) | |
| 752 | |
| 753 71 `BARCODE_DATAMATRIX` Data Matrix (ECC200) | |
| 754 | |
| 755 72 `BARCODE_EAN14` EAN-14 | |
| 756 | |
| 757 73 `BARCODE_VIN` Vehicle Identification Number | |
| 758 | |
| 759 74 `BARCODE_CODABLOCKF` Codablock-F | |
| 760 | |
| 761 75 `BARCODE_NVE18` NVE-18 (SSCC-18) | |
| 762 | |
| 763 76 `BARCODE_JAPANPOST` Japanese Postal Code | |
| 764 | |
| 765 77 `BARCODE_KOREAPOST` Korea Post | |
| 766 | |
| 767 79`*` `BARCODE_DBAR_STK` GS1 DataBar Stacked | |
| 768 | |
| 769 80`*` `BARCODE_DBAR_OMNSTK` GS1 DataBar Stacked Omnidirectional | |
| 770 | |
| 771 81`*` `BARCODE_DBAR_EXPSTK` GS1 DataBar Expanded Stacked | |
| 772 | |
| 773 82 `BARCODE_PLANET` PLANET | |
| 774 | |
| 775 84 `BARCODE_MICROPDF417` MicroPDF417 | |
| 776 | |
| 777 85`*` `BARCODE_USPS_IMAIL` USPS Intelligent Mail (OneCode) | |
| 778 | |
| 779 86 `BARCODE_PLESSEY` UK Plessey | |
| 780 | |
| 781 87 `BARCODE_TELEPEN_NUM` Telepen Numeric | |
| 782 | |
| 783 89 `BARCODE_ITF14` ITF-14 | |
| 784 | |
| 785 90 `BARCODE_KIX` Dutch Post KIX Code | |
| 786 | |
| 787 92 `BARCODE_AZTEC` Aztec Code | |
| 788 | |
| 789 93 `BARCODE_DAFT` DAFT Code | |
| 790 | |
| 791 96 `BARCODE_DPD` DPD Code | |
| 792 | |
| 793 97 `BARCODE_MICROQR` Micro QR Code | |
| 794 | |
| 795 98 `BARCODE_HIBC_128` HIBC Code 128 | |
| 796 | |
| 797 99 `BARCODE_HIBC_39` HIBC Code 39 | |
| 798 | |
| 799 102 `BARCODE_HIBC_DM` HIBC Data Matrix ECC200 | |
| 800 | |
| 801 104 `BARCODE_HIBC_QR` HIBC QR Code | |
| 802 | |
| 803 106 `BARCODE_HIBC_PDF` HIBC PDF417 | |
| 804 | |
| 805 108 `BARCODE_HIBC_MICPDF` HIBC MicroPDF417 | |
| 806 | |
| 807 110 `BARCODE_HIBC_BLOCKF` HIBC Codablock-F | |
| 808 | |
| 809 112 `BARCODE_HIBC_AZTEC` HIBC Aztec Code | |
| 810 | |
| 811 115 `BARCODE_DOTCODE` DotCode | |
| 812 | |
| 813 116 `BARCODE_HANXIN` Han Xin (Chinese Sensible) Code | |
| 814 | |
| 815 119 `BARCODE_MAILMARK_2D` Royal Mail 2D Mailmark (CMDM) (Data | |
| 816 Matrix) | |
| 817 | |
| 818 121 `BARCODE_MAILMARK_4S` Royal Mail 4-State Mailmark | |
| 819 | |
| 820 128 `BARCODE_AZRUNE` Aztec Runes | |
| 821 | |
| 822 129 `BARCODE_CODE32` Code 32 | |
| 823 | |
| 824 130 `BARCODE_EANX_CC` GS1 Composite Symbol with EAN linear | |
| 825 component | |
| 826 | |
| 827 131`*` `BARCODE_GS1_128_CC` GS1 Composite Symbol with GS1-128 linear | |
| 828 component | |
| 829 | |
| 830 132`*` `BARCODE_DBAR_OMN_CC` GS1 Composite Symbol with GS1 DataBar | |
| 831 Omnidirectional linear component | |
| 832 | |
| 833 133`*` `BARCODE_DBAR_LTD_CC` GS1 Composite Symbol with GS1 DataBar | |
| 834 Limited linear component | |
| 835 | |
| 836 134`*` `BARCODE_DBAR_EXP_CC` GS1 Composite Symbol with GS1 DataBar | |
| 837 Expanded linear component | |
| 838 | |
| 839 135 `BARCODE_UPCA_CC` GS1 Composite Symbol with UPC-A linear | |
| 840 component | |
| 841 | |
| 842 136 `BARCODE_UPCE_CC` GS1 Composite Symbol with UPC-E linear | |
| 843 component | |
| 844 | |
| 845 137`*` `BARCODE_DBAR_STK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 846 Stacked component | |
| 847 | |
| 848 138`*` `BARCODE_DBAR_OMNSTK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 849 Stacked Omnidirectional component | |
| 850 | |
| 851 139`*` `BARCODE_DBAR_EXPSTK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 852 Expanded Stacked component | |
| 853 | |
| 854 140 `BARCODE_CHANNEL` Channel Code | |
| 855 | |
| 856 141 `BARCODE_CODEONE` Code One | |
| 857 | |
| 858 142 `BARCODE_GRIDMATRIX` Grid Matrix | |
| 859 | |
| 860 143 `BARCODE_UPNQR` UPNQR (Univerzalnega Plačilnega Naloga QR) | |
| 861 | |
| 862 144 `BARCODE_ULTRA` Ultracode | |
| 863 | |
| 864 145 `BARCODE_RMQR` Rectangular Micro QR Code (rMQR) | |
| 865 | |
| 866 146 `BARCODE_BC412` IBM BC412 (SEMI T1-95) | |
| 867 | |
| 868 147 `BARCODE_DXFILMEDGE` DX Film Edge Barcode | |
| 869 ----------------------------------------------------------------------------- | |
| 870 | |
| 871 Table: {#tbl:barcode_types tag=": Barcode Types (Symbologies)"} | |
| 872 | |
| 873 [^3]: The symbologies marked with an asterisk (`*`) in Table | |
| 874 {@tbl:barcode_types} above used different names in Zint before version 2.9.0. | |
| 875 For example, symbology 29 used the name `BARCODE_RSS14`. These names are now | |
| 876 deprecated but are still recognised by Zint and will continue to be supported in | |
| 877 future versions. | |
| 878 | |
| 879 ## 4.4 Adjusting Height | |
| 880 | |
| 881 The height of a symbol (except those with a fixed width-to-height ratio) can be | |
| 882 adjusted using the `--height` switch. For example: | |
| 883 | |
| 884 ```bash | |
| 885 zint --height=100 -d "This Text" | |
| 886 ``` | |
| 887 | |
| 888 This specifies a symbol height of 100 times the X-dimension of the symbol. | |
| 889 | |
| 890 The default height of most linear barcodes is 50.0X, but this can be changed for | |
| 891 barcodes whose specifications give a standard height by using the switch | |
| 892 `--compliantheight`. For instance | |
| 893 | |
| 894 ```bash | |
| 895 zint -b LOGMARS -d "This Text" --compliantheight | |
| 896 ``` | |
| 897 | |
| 898 will produce a barcode of height 45.455X instead of the normal default of 50.0X. | |
| 899 The flag also causes Zint to return a warning if a non-compliant height is | |
| 900 given: | |
| 901 | |
| 902 ```bash | |
| 903 zint -b LOGMARS -d "This Text" --compliantheight --height=6.2 | |
| 904 Warning 247: Height not compliant with standards | |
| 905 ``` | |
| 906 | |
| 907 Another switch is `--heightperrow`, which can be useful for symbologies that | |
| 908 have a variable number of linear rows, namely Codablock-F, Code 16K, Code 49, | |
| 909 GS1 DataBar Expanded Stacked, MicroPDF417 and PDF417, as it changes the | |
| 910 treatment of the height value from overall height to per-row height, allowing | |
| 911 you to specify a consistent height for each linear row without having to know | |
| 912 how many there are. For instance | |
| 913 | |
| 914 ```bash | |
| 915 zint -b PDF417 -d "This Text" --height=4 --heightperrow | |
| 916 ``` | |
| 917 | |
| 918 {.lin} | |
| 920 | |
| 921 will produce a barcode of height 32X, with each of the 8 rows 4X high. | |
| 922 | |
| 923 ## 4.5 Adjusting Whitespace | |
| 924 | |
| 925 The amount of horizontal whitespace to the left and right of the generated | |
| 926 barcode can be altered using the `-w` or `--whitesp` switch, in integral | |
| 927 multiples of the X-dimension. For example: | |
| 928 | |
| 929 ```bash | |
| 930 zint -w 10 -d "This Text" | |
| 931 ``` | |
| 932 | |
| 933 This specifies a whitespace width of 10 times the X-dimension of the symbol both | |
| 934 to the left and to the right of the barcode. | |
| 935 | |
| 936 The amount of vertical whitespace above and below the barcode can be altered | |
| 937 using the `--vwhitesp` switch, in integral multiples of the X-dimension. For | |
| 938 example for 3 times the X-dimension: | |
| 939 | |
| 940 ```bash | |
| 941 zint --vwhitesp=3 -d "This Text" | |
| 942 ``` | |
| 943 | |
| 944 Note that the whitespace at the bottom appears below the text, if any. | |
| 945 | |
| 946 Horizontal and vertical whitespace can of course be used together: | |
| 947 | |
| 948 ```bash | |
| 949 zint -b DATAMATRIX --whitesp=1 --vwhitesp=1 -d "This Text" | |
| 950 ``` | |
| 951 | |
| 952 A `--quietzones` option is also available which adds quiet zones compliant with | |
| 953 the symbology's specification. This is in addition to any whitespace specified | |
| 954 with the `--whitesp` or `--vwhitesp` switches. | |
| 955 | |
| 956 Note that Codablock-F, Code 16K, Code 49, ITF-14, EAN-2 to EAN-13, ISBN, UPC-A | |
| 957 and UPC-E have compliant quiet zones added by default. This can be disabled with | |
| 958 the option `--noquietzones`. | |
| 959 | |
| 960 ## 4.6 Adding Boundary Bars and Boxes | |
| 961 | |
| 962 Zint allows the symbol to be bound with 'boundary bars' (also known as 'bearer | |
| 963 bars') using the option `--bind`. These bars help to prevent misreading of the | |
| 964 symbol by corrupting a scan if the scanning beam strays off the top or bottom of | |
| 965 the symbol. Zint can also put a border right around the symbol and its | |
| 966 horizontal whitespace with the `--box` option. | |
| 967 | |
| 968 The width of the boundary bars or box borders, in integral multiples of the | |
| 969 X-dimension, must be specified using the `--border` switch. For example: | |
| 970 | |
| 971 ```bash | |
| 972 zint --box --border=10 -w 10 -d "This Text" | |
| 973 ``` | |
| 974 | |
| 975 {.lin} | |
| 976 | |
| 977 gives a box with a width 10 times the X-dimension of the symbol. Note that when | |
| 978 specifying a box, horizontal whitespace is usually required in order to create a | |
| 979 quiet zone between the barcode and the sides of the box. To add a boundary bar | |
| 980 to the top only use `--bindtop`. | |
| 981 | |
| 982 For linear symbols, horizontal boundary bars appear tight against the barcode, | |
| 983 inside any vertical whitespace (or text). For matrix symbols, however, where | |
| 984 they are decorative rather than functional, boundary bars appear outside any | |
| 985 whitespace. | |
| 986 | |
| 987 {.i2d} | |
| 989 | |
| 990 Codablock-F, Code 16K and Code 49 always have boundary bars, and default to | |
| 991 particular horizontal whitespace values. Special considerations apply to ITF-14 | |
| 992 and DPD - see [6.1.2.6 ITF-14] and [6.1.10.7 DPD Code] for those symbologies. | |
| 993 | |
| 994 ## 4.7 Using Colour | |
| 995 | |
| 996 The default colours of a symbol are a black symbol on a white background. Zint | |
| 997 allows you to change this. The `-r` or `--reverse` switch allows the default | |
| 998 colours to be inverted so that a white symbol is shown on a black background | |
| 999 (known as "reflectance reversal" or "reversed reflectance"). For example the | |
| 1000 command | |
| 1001 | |
| 1002 ```bash | |
| 1003 zint -r -d "This Text" | |
| 1004 ``` | |
| 1005 | |
| 1006 gives an inverted Code 128 symbol. This is not practical for most symbologies | |
| 1007 but white-on-black is allowed by the Aztec Code, Data Matrix, DotCode, Han Xin | |
| 1008 Code, Grid Matrix and QR Code symbology specifications. | |
| 1009 | |
| 1010 For more specific needs the foreground (ink) and background (paper) colours can | |
| 1011 be specified using the `--fg` and `--bg` options followed by a number in | |
| 1012 `"RRGGBB"` hexadecimal notation (the same system used in HTML) or in `"C,M,Y,K"` | |
| 1013 decimal percentages format (the latter normally used with the `--cmyk` option - | |
| 1014 see below). For example the command | |
| 1015 | |
| 1016 ```bash | |
| 1017 zint --fg=00FF00 -d "This Text" | |
| 1018 ``` | |
| 1019 | |
| 1020 alters the symbol to a bright green. | |
| 1021 | |
| 1022 {.lin} | |
| 1023 | |
| 1024 Zint also supports RGBA colour information for those output file formats which | |
| 1025 support alpha channels (currently only GIF, PCX, PNG, SVG and TIF, with GIF | |
| 1026 supporting either a background or foreground alpha but not both) in a | |
| 1027 `"RRGGBBAA"` format. For example: | |
| 1028 | |
| 1029 ```bash | |
| 1030 zint --fg=00ff0055 -d "This Text" | |
| 1031 ``` | |
| 1032 | |
| 1033 {.lin} | |
| 1034 | |
| 1035 will produce a semi-transparent green foreground with a standard (white) | |
| 1036 background. Note that transparency is treated differently by raster and vector | |
| 1037 (SVG) output formats, as for vector output the background will "shine through" a | |
| 1038 transparent foreground. For instance | |
| 1039 | |
| 1040 ```bash | |
| 1041 zint --bg=ff0000 --fg=ffffff00 ... | |
| 1042 ``` | |
| 1043 | |
| 1044 will give different results for PNG and SVG. Experimentation is advised! | |
| 1045 | |
| 1046 In addition the `--nobackground` option will remove the background from all | |
| 1047 output formats except BMP.[^4] | |
| 1048 | |
| 1049 The `--cmyk` option is specific to output in Encapsulated PostScript (EPS) and | |
| 1050 TIF, and selects the CMYK colour space. Custom colours should then usually be | |
| 1051 given in the comma-separated `"C,M,Y,K"` format, where `C`, `M`, `Y` and `K` are | |
| 1052 expressed as decimal percentage values from 0 to 100. RGB values may still be | |
| 1053 used, in which case they will be converted formulaically to CMYK approximations. | |
| 1054 | |
| 1055 [^4]: The background is omitted for vector outputs EMF, EPS and SVG when | |
| 1056 `--nobackground` is given. For raster outputs GIF, PCX, PNG and TIF, the | |
| 1057 background's alpha channel is set to zero (fully transparent). | |
| 1058 | |
| 1059 ## 4.8 Rotating the Symbol | |
| 1060 | |
| 1061 The symbol can be rotated through four orientations using the `--rotate` option | |
| 1062 followed by the angle of rotation as shown below. | |
| 1063 | |
| 1064 ``` | |
| 1065 --rotate=0 (default) | |
| 1066 --rotate=90 | |
| 1067 --rotate=180 | |
| 1068 --rotate=270 | |
| 1069 ``` | |
| 1070 | |
| 1071 {.lin} | |
| 1072 | |
| 1073 \clearpage | |
| 1074 | |
| 1075 ## 4.9 Adjusting Image Size (X-dimension) | |
| 1076 | |
| 1077 The size of the image can be altered using the `--scale` option, which sets the | |
| 1078 X-dimension. The default scale is 1.0. | |
| 1079 | |
| 1080 The scale is multiplied by 2 (with the exception of MaxiCode) before being | |
| 1081 applied to the X-dimension. For MaxiCode, it is multiplied by 10 for raster | |
| 1082 output, by 40 for EMF vector output, and by 2 otherwise (non-EMF vector output). | |
| 1083 | |
| 1084 For non-MaxiCode raster output, the default scale of 1 results in an X-dimension | |
| 1085 of 2 pixels. For example for non-MaxiCode PNG images a scale of 5 will increase | |
| 1086 the X-dimension to 10 pixels. For MaxiCode, see [4.9.3 MaxiCode Raster Scaling] | |
| 1087 below. | |
| 1088 | |
| 1089 Scales for non-MaxiCode raster output should be given in increments of 0.5, i.e. | |
| 1090 0.5, 1, 1.5, 2, 2.5, 3, 3.5, etc., to avoid the X-dimension varying across the | |
| 1091 symbol due to interpolation. 0.5 increments are also faster to render. | |
| 1092 | |
| 1093 The minimum scale for non-MaxiCode raster output in non-dotty mode is 0.5, | |
| 1094 giving a minimum X-dimension of 1 pixel. For MaxiCode, it is 0.2. The minimum | |
| 1095 scale for raster output in dotty mode is 1 (see [4.15 Working with Dots]). For | |
| 1096 raster output, text will not be printed for scales less than 1. | |
| 1097 | |
| 1098 The minimum scale for vector output is 0.1, giving a minimum X-dimension of 0.2 | |
| 1099 (or for MaxiCode EMF output, 4). The maximum scale for both raster and vector is | |
| 1100 200. | |
| 1101 | |
| 1102 To summarize the more intricate details: | |
| 1103 | |
| 1104 ----------------------------------------------------------------- | |
| 1105 MaxiCode? Output Multiplier Min. Scale Min. Scale | |
| 1106 (non-dotty) (dotty) | |
| 1107 --------- ---------------- ---------- ------------ ---------- | |
| 1108 No Raster 2 0.5 1 | |
| 1109 | |
| 1110 No Vector 2 0.1 0.1 | |
| 1111 | |
| 1112 Yes Raster 10 0.2 N/A | |
| 1113 | |
| 1114 Yes Vector (non-EMF) 2 0.1 N/A | |
| 1115 | |
| 1116 Yes EMF 40 0.1 N/A | |
| 1117 ----------------------------------------------------------------- | |
| 1118 | |
| 1119 Table: {#tbl:scaling_multiplers tag=": Scaling Multipliers and Minima"} | |
| 1120 | |
| 1121 ### 4.9.1 Scaling by X-dimension and Resolution | |
| 1122 | |
| 1123 An alternative way to specify the scale, which takes the above details into | |
| 1124 account, is to specify measurable units using the `--scalexdimdp` option, which | |
| 1125 has the format | |
| 1126 | |
| 1127 ``` | |
| 1128 --scalexdimdp=X[,R] | |
| 1129 ``` | |
| 1130 | |
| 1131 where `X` is the X-dimension (in mm by default) and `R` is the resolution (in | |
| 1132 dpmm, dots per mm, by default). `R` is optional, and defaults to 12 dpmm, and | |
| 1133 `X` may be zero, in which case it uses a symbology-specific default. The units | |
| 1134 may be given in inches for `X` by appending `"in"`, and in dpi (dots per inch) | |
| 1135 for `R` by appending `"dpi"`. For example | |
| 1136 | |
| 1137 ```bash | |
| 1138 zint -d "1234" --scalexdimdp=0.013in,300dpi | |
| 1139 ``` | |
| 1140 | |
| 1141 Explicit metric units may also be given by appending `"mm"` and `"dpmm"` as | |
| 1142 appropriate, and may be mixed with U.S. units: | |
| 1143 | |
| 1144 ```bash | |
| 1145 zint -d "1234" --scalexdimdp=0.33mm,300dpi | |
| 1146 ``` | |
| 1147 | |
| 1148 ### 4.9.2 Scaling Example | |
| 1149 | |
| 1150 The GS1 General Specifications Section 5.2.6.6 'Symbol dimensions at nominal | |
| 1151 size' gives an example of an EAN-13 barcode using the X-dimension of 0.33mm. To | |
| 1152 print that example as a PNG at 12 dpmm, the approximate equivalent of 300 dpi | |
| 1153 (`dpi = dpmm * 25.4`), specify a scale of 2, since `0.33 * 12 = 3.96` pixels, or | |
| 1154 4 pixels rounding to the nearest pixel: | |
| 1155 | |
| 1156 ```bash | |
| 1157 zint -b EANX -d "501234567890" --compliantheight --scale=2 | |
| 1158 ``` | |
| 1159 | |
| 1160 This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same | |
| 1161 result can be achieved using the `--scalexdimdp` option with | |
| 1162 | |
| 1163 ```bash | |
| 1164 zint -b EANX -d "501234567890" --compliantheight --scalexdimdp=0 | |
| 1165 ``` | |
| 1166 | |
| 1167 as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default | |
| 1168 resolution. | |
| 1169 | |
| 1170 ### 4.9.3 MaxiCode Raster Scaling | |
| 1171 | |
| 1172 For MaxiCode symbols, which use hexagons, the scale for raster output is | |
| 1173 multiplied by 10 before being applied. The 0.5 increment recommended for normal | |
| 1174 raster output does not apply. | |
| 1175 | |
| 1176 The minimum scale is 0.2, so the minimum X-dimension is 2 pixels. However scales | |
| 1177 below 0.5 are not recommended and may produce symbols that are not within the | |
| 1178 following size ranges. | |
| 1179 | |
| 1180 MaxiCode symbols have fixed size ranges of 24.82mm to 27.93mm in width, and | |
| 1181 23.71mm to 26.69mm in height, excluding quiet zones. The default X-dimension is | |
| 1182 0.88mm. For example, to output at the default X-dimension at 600 dpi specify: | |
| 1183 | |
| 1184 ```bash | |
| 1185 zint -b MAXICODE -d "MaxiCode (19 chars)" --scalexdimdp=0,600dpi | |
| 1186 ``` | |
| 1187 | |
| 1188 ## 4.10 Human Readable Text (HRT) Options | |
| 1189 | |
| 1190 For linear barcodes the text present in the output image can be removed by using | |
| 1191 the `--notext` option. Note also that for raster output text will not be printed | |
| 1192 for scales less than 1 (see [4.9 Adjusting Image Size (X-dimension)]). | |
| 1193 | |
| 1194 Text can be set to bold using the `--bold` option, or a smaller font can be | |
| 1195 substituted using the `--small` option. The `--bold` and `--small` options can | |
| 1196 be used together if required, but only for vector output. | |
| 1197 | |
| 1198 {.lin} | |
| 1199 | |
| 1200 The gap between the barcode and the text can be adjusted using the `--textgap` | |
| 1201 option, where the gap is given in X-dimensions, and may be negative (minimum | |
| 1202 -5.0X, maximum 10.0X). The default gap is 1X. Note that a very small gap may | |
| 1203 cause accented texts to overlap with the barcode: | |
| 1204 | |
| 1205 {.lin} | |
| 1206 | |
| 1207 For SVG output, the font preferred by Zint (monospaced "OCR-B" for EAN/UPC, | |
| 1208 "Arimo" - a proportional sans-serif font metrically compatible with "Arial" - | |
| 1209 for all others) can be embedded in the file for portability using the | |
| 1210 `--embedfont` option: | |
| 1211 | |
| 1212 {.lin} | |
| 1213 | |
| 1214 ## 4.11 Input Modes | |
| 1215 | |
| 1216 ### 4.11.1 Unicode, Data, and GS1 Modes | |
| 1217 | |
| 1218 By default all CLI input data is assumed to be encoded in UTF-8 format. Many | |
| 1219 barcode symbologies encode data using the Latin-1 (ISO/IEC 8859-1 plus ASCII) | |
| 1220 character set, so input is converted from UTF-8 to Latin-1 before being put in | |
| 1221 the symbol. In addition QR Code and its variants and Han Xin Code can by default | |
| 1222 encode Japanese (Kanji) or Chinese (Hanzi) characters which are also converted | |
| 1223 from UTF-8. | |
| 1224 | |
| 1225 There are two exceptions to the Latin-1 default: Grid Matrix, whose default | |
| 1226 character set is GB 2312 (Chinese); and UPNQR, whose default character set is | |
| 1227 Latin-2 (ISO/IEC 8859-2 plus ASCII). | |
| 1228 | |
| 1229 Symbology Default character sets Alternate if input not Latin-1 | |
| 1230 ------------- ------------------------ ------------------------------ | |
| 1231 Aztec Code Latin-1 None | |
| 1232 Codablock-F Latin-1 None | |
| 1233 Code 128 Latin-1 None | |
| 1234 Code 16K Latin-1 None | |
| 1235 Code One Latin-1 None | |
| 1236 Data Matrix Latin-1 None | |
| 1237 DotCode Latin-1 None | |
| 1238 Grid Matrix GB 2312 (includes ASCII) N/A | |
| 1239 Han Xin Latin-1 GB 18030 (includes ASCII) | |
| 1240 MaxiCode Latin-1 None | |
| 1241 MicroPDF417 Latin-1 None | |
| 1242 Micro QR Code Latin-1 Shift JIS (includes ASCII[^5]) | |
| 1243 PDF417 Latin-1 None | |
| 1244 QR Code Latin-1 Shift JIS (see above) | |
| 1245 rMQR Latin-1 Shift JIS (see above) | |
| 1246 Ultracode Latin-1 None | |
| 1247 UPNQR Latin-2 N/A | |
| 1248 All others ASCII N/A | |
| 1249 | |
| 1250 Table: {#tbl:default_character_sets tag=": Default Character Sets"} | |
| 1251 | |
| 1252 [^5]: Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (`\`) | |
| 1253 to the yen sign (¥), and tilde (`~`) to overline (U+203E). | |
| 1254 | |
| 1255 If Zint encounters characters which can not be encoded using the default | |
| 1256 character encoding then it will take advantage of the ECI (Extended Channel | |
| 1257 Interpretations) mechanism to encode the data if the symbology supports it - see | |
| 1258 [4.11.2 Input Modes and ECI] below. | |
| 1259 | |
| 1260 GS1 data can be encoded in a number of symbologies. Application Identifiers | |
| 1261 (AIs) should be enclosed in `[square brackets]` followed by the data to be | |
| 1262 encoded (see [6.1.10.3 GS1-128]). To encode GS1 data use the `--gs1` option. | |
| 1263 GS1 mode is assumed (and doesn't need to be set) for GS1-128, EAN-14, GS1 | |
| 1264 DataBar and GS1 Composite symbologies but is also available for Aztec Code, Code | |
| 1265 16K, Code 49, Code One, Data Matrix, DotCode, QR Code and Ultracode. | |
| 1266 | |
| 1267 Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec | |
| 1268 Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR | |
| 1269 Code. Within this mode, the leading `'+'` and the check character are | |
| 1270 automatically added by Zint, conforming to HIBC Labeler Identification Code | |
| 1271 (HIBC LIC). For HIBC Provider Applications Standard (HIBC PAS), preface the data | |
| 1272 with a slash `'/'`. | |
| 1273 | |
| 1274 The `--binary` option encodes the input data as given. Automatic code page | |
| 1275 translation to an ECI page is disabled, and no validation of the data's encoding | |
| 1276 takes place. This may be used for raw binary or binary encrypted data. This | |
| 1277 switch plays together with the built-in ECI logic and examples may be found | |
| 1278 below. | |
| 1279 | |
| 1280 The `--fullmultibyte` option uses the multibyte modes of QR Code, Micro QR Code, | |
| 1281 Rectangular Micro QR Code, Han Xin Code and Grid Matrix for non-ASCII data, | |
| 1282 maximizing density. This is achieved by using compression designed for | |
| 1283 Kanji/Hanzi characters; however some decoders take blocks which are encoded this | |
| 1284 way and interpret them as Kanji/Hanzi characters, thus causing data corruption. | |
| 1285 Symbols encoded with this option should be checked against decoders before they | |
| 1286 are used. The popular open-source ZXing decoder is known to exhibit this | |
| 1287 behaviour. | |
| 1288 | |
| 1289 ### 4.11.2 Input Modes and ECI | |
| 1290 | |
| 1291 If your data contains characters that are not in the default character set, you | |
| 1292 may encode it using an ECI-aware symbology and an ECI value from Table | |
| 1293 {@tbl:eci_codes} below. The ECI information is added to your code symbol as | |
| 1294 prefix data. The symbologies that support ECI are | |
| 1295 | |
| 1296 ------------ ------------ ------------ | |
| 1297 Aztec Code Grid Matrix PDF417 | |
| 1298 Code One Han Xin Code QR Code | |
| 1299 Data Matrix MaxiCode rMQR | |
| 1300 DotCode MicroPDF417 Ultracode | |
| 1301 ------------ ------------ ------------ | |
| 1302 | |
| 1303 Table: {#tbl:eci_aware_symbologies tag=": ECI-Aware Symbologies"} | |
| 1304 | |
| 1305 Be aware that not all barcode readers support ECI mode, so this can sometimes | |
| 1306 lead to unreadable barcodes. If you are using characters beyond those supported | |
| 1307 by the default character set then you should check that the resulting barcode | |
| 1308 can be understood by your target barcode reader. | |
| 1309 | |
| 1310 The ECI value may be specified with the `--eci` switch, followed by the value in | |
| 1311 the column `"ECI Code"` in the table below. The input data should be UTF-8 | |
| 1312 formatted. Zint automatically translates the data into the target encoding. | |
| 1313 | |
| 1314 ECI Code Character Encoding Scheme (ISO/IEC 8859 schemes include ASCII) | |
| 1315 -------- -------------------------------------------------------------- | |
| 1316 3 ISO/IEC 8859-1 - Latin alphabet No. 1 | |
| 1317 4 ISO/IEC 8859-2 - Latin alphabet No. 2 | |
| 1318 5 ISO/IEC 8859-3 - Latin alphabet No. 3 | |
| 1319 6 ISO/IEC 8859-4 - Latin alphabet No. 4 | |
| 1320 7 ISO/IEC 8859-5 - Latin/Cyrillic alphabet | |
| 1321 8 ISO/IEC 8859-6 - Latin/Arabic alphabet | |
| 1322 9 ISO/IEC 8859-7 - Latin/Greek alphabet | |
| 1323 10 ISO/IEC 8859-8 - Latin/Hebrew alphabet | |
| 1324 11 ISO/IEC 8859-9 - Latin alphabet No. 5 (Turkish) | |
| 1325 12 ISO/IEC 8859-10 - Latin alphabet No. 6 (Nordic) | |
| 1326 13 ISO/IEC 8859-11 - Latin/Thai alphabet | |
| 1327 15 ISO/IEC 8859-13 - Latin alphabet No. 7 (Baltic) | |
| 1328 16 ISO/IEC 8859-14 - Latin alphabet No. 8 (Celtic) | |
| 1329 17 ISO/IEC 8859-15 - Latin alphabet No. 9 | |
| 1330 18 ISO/IEC 8859-16 - Latin alphabet No. 10 | |
| 1331 20 Shift JIS (JIS X 0208 and JIS X 0201) | |
| 1332 21 Windows 1250 - Latin 2 (Central Europe) | |
| 1333 22 Windows 1251 - Cyrillic | |
| 1334 23 Windows 1252 - Latin 1 | |
| 1335 24 Windows 1256 - Arabic | |
| 1336 25 UTF-16BE (High order byte first) | |
| 1337 26 UTF-8 | |
| 1338 27 ASCII (ISO/IEC 646 IRV) | |
| 1339 28 Big5 (Taiwan) Chinese Character Set | |
| 1340 29 GB 2312 (PRC) Chinese Character Set | |
| 1341 30 Korean Character Set EUC-KR (KS X 1001:2002) | |
| 1342 31 GBK Chinese Character Set | |
| 1343 32 GB 18030 Chinese Character Set | |
| 1344 33 UTF-16LE (Low order byte first) | |
| 1345 34 UTF-32BE (High order bytes first) | |
| 1346 35 UTF-32LE (Low order bytes first) | |
| 1347 170 ISO/IEC 646 Invariant[^6] | |
| 1348 899 8-bit binary data | |
| 1349 | |
| 1350 Table: {#tbl:eci_codes tag=": ECI Codes"} | |
| 1351 | |
| 1352 [^6]: ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined: | |
| 1353 `#`, `$`, `@`, `[`, `\`, `]`, `^`, `` ` ``, `{`, `|`, `}`, `~`. | |
| 1354 | |
| 1355 An ECI value of 0 does not encode any ECI information in the code symbol (unless | |
| 1356 the data contains non-default character set characters). In this case, the | |
| 1357 default character set applies (see Table @tbl:default_character_sets above). | |
| 1358 | |
| 1359 If no ECI is specified or a value of 0 is given, and the data does contain | |
| 1360 characters other than in the default character set, then Zint will automatically | |
| 1361 insert the appropriate single-byte ECI if possible (ECIs 3 to 24, excluding ECI | |
| 1362 20), or failing that ECI 26 (UTF-8). A warning will be generated. This mechanism | |
| 1363 is not applied if the `--binary` option is given. | |
| 1364 | |
| 1365 Multiple ECIs can be specified using the `--segN` options - see [4.16 Multiple | |
| 1366 Segments]. | |
| 1367 | |
| 1368 Note: the `--eci=3` specification should only be used for special purposes. | |
| 1369 Using this parameter, the ECI information is explicitly added to the symbol. | |
| 1370 Nevertheless, for ECI Code 3, this is not usually required, as this is the | |
| 1371 default encoding for most barcodes, which is also active without any ECI | |
| 1372 information. | |
| 1373 | |
| 1374 #### 4.11.2.1 Input Modes and ECI Example 1 | |
| 1375 | |
| 1376 The Euro sign U+20AC can be encoded in ISO/IEC 8859-15. The Euro sign has the | |
| 1377 ISO/IEC 8859-15 codepoint hex `"A4"`. It is encoded in UTF-8 as the hex | |
| 1378 sequence: `"E2 82 AC"`. Those 3 bytes are contained in the file | |
| 1379 `"utf8euro.txt"`. This command will generate the corresponding code: | |
| 1380 | |
| 1381 ```bash | |
| 1382 zint -b 71 --scale=10 --eci=17 -i utf8euro.txt | |
| 1383 ``` | |
| 1384 | |
| 1385 This is equivalent to the commands (using the `--esc` switch): | |
| 1386 | |
| 1387 ```bash | |
| 1388 zint -b 71 --scale=10 --eci=17 --esc -d "\xE2\x82\xAC" | |
| 1389 | |
| 1390 zint -b 71 --scale=10 --eci=17 --esc -d "\u20AC" | |
| 1391 ``` | |
| 1392 | |
| 1393 and to the command: | |
| 1394 | |
| 1395 ```bash | |
| 1396 zint -b 71 --scale=10 --eci=17 -d "€" | |
| 1397 ``` | |
| 1398 | |
| 1399 {.i2d} | |
| 1400 | |
| 1401 #### 4.11.2.2 Input Modes and ECI Example 2 | |
| 1402 | |
| 1403 The Chinese character with the Unicode codepoint U+5E38 can be encoded in Big5 | |
| 1404 encoding. The Big5 representation of this character is the two hex bytes: | |
| 1405 `"B1 60"` (contained in the file `"big5char.txt"`). The generation command for | |
| 1406 Data Matrix is: | |
| 1407 | |
| 1408 ```bash | |
| 1409 zint -b 71 --scale=10 --eci=28 --binary -i big5char.txt | |
| 1410 ``` | |
| 1411 | |
| 1412 This is equivalent to the command (using the `--esc` switch): | |
| 1413 | |
| 1414 ```bash | |
| 1415 zint -b 71 --scale=10 --eci=28 --binary --esc -d "\xB1\x60" | |
| 1416 ``` | |
| 1417 | |
| 1418 and to the commands (no `--binary` switch so conversion occurs): | |
| 1419 | |
| 1420 ```bash | |
| 1421 zint -b 71 --scale=10 --eci=28 --esc -d "\xE5\xB8\xB8" | |
| 1422 | |
| 1423 zint -b 71 --scale=10 --eci=28 --esc -d "\u5E38" | |
| 1424 | |
| 1425 zint -b 71 --scale=10 --eci=28 -d "常" | |
| 1426 ``` | |
| 1427 | |
| 1428 {.i2d} | |
| 1430 | |
| 1431 #### 4.11.2.3 Input Modes and ECI Example 3 | |
| 1432 | |
| 1433 Some decoders (in particular mobile app ones) for QR Code assume UTF-8 encoding | |
| 1434 by default and do not support ECI. In this case supply UTF-8 data and use the | |
| 1435 `--binary` switch so that the data will be encoded as UTF-8 without conversion: | |
| 1436 | |
| 1437 ```bash | |
| 1438 zint -b 58 --binary -d "UTF-8 data" | |
| 1439 ``` | |
| 1440 | |
| 1441 {.i2d} | |
| 1443 | |
| 1444 ## 4.12 Batch Processing | |
| 1445 | |
| 1446 Data can be batch processed by reading from a text file and producing a | |
| 1447 separate barcode image for each line of text in that file. To do this use the | |
| 1448 `--batch` switch together with `-i` to select the input file from which to read | |
| 1449 data. For example | |
| 1450 | |
| 1451 ```bash | |
| 1452 zint -b EANX --batch -i ean13nos.txt | |
| 1453 ``` | |
| 1454 | |
| 1455 where `"ean13nos.txt"` contains a list of EAN-13 numbers (GTINs), each on its | |
| 1456 own line. Zint will automatically detect the end of a line of text (in either | |
| 1457 Unix or Windows formatted text files) and produce a symbol each time it finds | |
| 1458 this. | |
| 1459 | |
| 1460 Input files should end with a line feed character - if this is not present then | |
| 1461 Zint will not encode the last line of text, and will warn you that there is a | |
| 1462 problem. | |
| 1463 | |
| 1464 By default Zint will output numbered filenames starting with `00001.png`, | |
| 1465 `00002.png` etc. To change this behaviour specify the `-o` option using special | |
| 1466 characters in the output filename as shown in the table below: | |
| 1467 | |
| 1468 Input Character Interpretation | |
| 1469 --------------- ------------------------------------------ | |
| 1470 `~` Insert a number or 0 | |
| 1471 `#` Insert a number or space | |
| 1472 `@` Insert a number or `*` (or `+` on Windows) | |
| 1473 Any other Insert literally | |
| 1474 | |
| 1475 Table: {#tbl:batch_filename_formatting tag=": Batch Filename Formatting"} | |
| 1476 | |
| 1477 For instance | |
| 1478 | |
| 1479 ```bash | |
| 1480 zint -b EANX --batch -i ean13nos.txt -o file~~~.svg | |
| 1481 ``` | |
| 1482 | |
| 1483 The following table shows some examples to clarify this method: | |
| 1484 | |
| 1485 Input Filenames Generated | |
| 1486 ----------------- --------------------------------------------------------- | |
| 1487 `-o file~~~.svg` `"file001.svg"`, `"file002.svg"`, `"file003.svg"` | |
| 1488 `-o @@@@bar.png` `"***1.png"`, `"***2.png"`, `"***3.png"` (except Windows) | |
| 1489 `-o @@@@bar.png` `"+++1.png"`, `"+++2.png"`, `"+++3.png"` (on Windows) | |
| 1490 `-o my~~~bar.eps` `"my001bar.eps"`, `"my002bar.eps"`, `"my003bar.eps"` | |
| 1491 `-o t#es~t~.png` `"t es0t1.png"`, `"t es0t2.png"`, `"t es0t3.png"` | |
| 1492 | |
| 1493 Table: {#tbl:batch_filename_examples tag=": Batch Filename Examples"} | |
| 1494 | |
| 1495 The special characters can span directories also, which is useful when creating | |
| 1496 a large number of barcodes: | |
| 1497 | |
| 1498 Input Filenames Generated | |
| 1499 -------------------- ------------------------------------------------------ | |
| 1500 `-o dir~/file~~~.svg` `"dir0/file001.svg"`, `"dir0/file002.svg"`, ... | |
| 1501 , `"dir0/file999.svg"`, `"dir1/file000.svg"`, ... | |
| 1502 | |
| 1503 Table: {#tbl:batch_dir_examples tag=": Batch Directory Examples"} | |
| 1504 | |
| 1505 For an alternative method of naming output files see the `--mirror` option in | |
| 1506 [4.14 Automatic Filenames] below. | |
| 1507 | |
| 1508 ## 4.13 Direct Output to stdout | |
| 1509 | |
| 1510 The finished image files can be output directly to stdout for use as part of a | |
| 1511 pipe by using the `--direct` option. By default `--direct` will output data as a | |
| 1512 PNG image (or GIF image if `libpng` is not present), but this can be altered by | |
| 1513 supplementing the `--direct` option with a `--filetype` option followed by the | |
| 1514 suffix of the file type required. For example: | |
| 1515 | |
| 1516 ```bash | |
| 1517 zint -b 84 --direct --filetype=pcx -d "Data to encode" | |
| 1518 ``` | |
| 1519 | |
| 1520 This command will output the symbol as a PCX file to stdout. For the supported | |
| 1521 output file formats see Table {@tbl:output_file_formats}. | |
| 1522 | |
| 1523 * * * | |
| 1524 CAUTION: Outputting binary files to the command shell without catching that data | |
| 1525 in a pipe can have unpredictable results. Use with care! | |
| 1526 | |
| 1527 * * * | |
| 1528 | |
| 1529 ## 4.14 Automatic Filenames | |
| 1530 | |
| 1531 The `--mirror` option instructs Zint to use the data to be encoded as an | |
| 1532 indicator of the filename to be used. This is particularly useful if you are | |
| 1533 processing batch data. For example the input data `"1234567"` will result in a | |
| 1534 file named `"1234567.png"`. | |
| 1535 | |
| 1536 There are restrictions, however, on what characters can be stored in a filename, | |
| 1537 so the filename may vary from the data if the data includes non-printable | |
| 1538 characters, for example, and may be shortened if the data input is long. | |
| 1539 | |
| 1540 To set the output file format use the `--filetype` option as detailed above in | |
| 1541 [4.13 Direct Output to stdout]. To output to a specific directory use the `-o` | |
| 1542 option giving the name of the directory (any filename will be ignored, unless | |
| 1543 `--filetype` is not specified, in which case the filename's extension will be | |
| 1544 used). | |
| 1545 | |
| 1546 ## 4.15 Working with Dots | |
| 1547 | |
| 1548 Matrix codes can be rendered as a series of dots or circles rather than the | |
| 1549 normal squares by using the `--dotty` option. This option is only available for | |
| 1550 matrix symbologies, and is automatically selected for DotCode. The size of the | |
| 1551 dots can be adjusted using the `--dotsize` option followed by the diameter of | |
| 1552 the dot, where that diameter is in X-dimensions. The minimum dot size is 0.01, | |
| 1553 the maximum is 20. The default size is 0.8. | |
| 1554 | |
| 1555 The default and minimum scale for raster output in dotty mode is 1. | |
| 1556 | |
| 1557 {.dotty} | |
| 1559 | |
| 1560 ## 4.16 Multiple Segments | |
| 1561 | |
| 1562 If you need to specify different ECIs for different sections of the input data, | |
| 1563 the `--seg1` to `--seg9` options can be used. Each option is of the form | |
| 1564 `--segN=ECI,data` where `ECI` is the ECI code (see Table {@tbl:eci_codes}) and | |
| 1565 `data` is the data to which this applies. This is in addition to the ECI and | |
| 1566 data specified using the `--eci` and `-d` options which must still be present | |
| 1567 and which in effect constitute segment 0. For instance | |
| 1568 | |
| 1569 ```bash | |
| 1570 zint -b AZTEC_CODE --eci=9 -d "Κείμενο" --seg1=7,"Текст" --seg2=20,"文章" | |
| 1571 ``` | |
| 1572 | |
| 1573 specifies 3 segments: segment 0 with ECI 9 (Greek), segment 1 with ECI 7 | |
| 1574 (Cyrillic), and segment 2 with ECI 20 (Shift JIS). Segments must be consecutive. | |
| 1575 | |
| 1576 Naturally the symbology must be ECI-aware (see Table | |
| 1577 {@tbl:eci_aware_symbologies}). | |
| 1578 | |
| 1579 {.i2d} | |
| 1581 | |
| 1582 ECIs of zero may be given, in which case Zint will automatically determine an | |
| 1583 ECI if necessary, as described in section [4.11.2 Input Modes and ECI]. | |
| 1584 | |
| 1585 Multiple segments are not currently supported for use with GS1 data. | |
| 1586 | |
| 1587 ## 4.17 Structured Append | |
| 1588 | |
| 1589 Structured Append is a method of splitting data among several symbols so that | |
| 1590 they form a sequence that can be scanned and re-assembled in the correct order | |
| 1591 on reading, and is available for Aztec Code, Code One, Data Matrix, DotCode, | |
| 1592 Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. | |
| 1593 | |
| 1594 The `--structapp` option marks a symbol as part of a Structured Append sequence, | |
| 1595 and has the format | |
| 1596 | |
| 1597 ``` | |
| 1598 --structapp=I,C[,ID] | |
| 1599 ``` | |
| 1600 | |
| 1601 {.i2d} | |
| 1603 | |
| 1604 where `I` is the index (position) of the symbol in the Structured Append | |
| 1605 sequence, `C` is the count or total number of symbols in the sequence, and `ID` | |
| 1606 is an optional identifier (not available for Code One, DotCode or MaxiCode) that | |
| 1607 is the same for all symbols belonging to the same sequence. The index is 1-based | |
| 1608 and goes from 1 to count. Count must be 2 or more. See the individual | |
| 1609 symbologies for further details. | |
| 1610 | |
| 1611 ## 4.18 Help Options | |
| 1612 | |
| 1613 There are three help options which give information about how to use the command | |
| 1614 line. The `-h` or `--help` option will display a list of all of the valid | |
| 1615 options available, and also gives the exact version of the software (the version | |
| 1616 by itself can be displayed with `-v` or `--version`). | |
| 1617 | |
| 1618 The `-t` or `--types` option gives the table of symbologies along with the | |
| 1619 symbol ID numbers and names. | |
| 1620 | |
| 1621 The `-e` or `--ecinos` option gives a list of the ECI codes. | |
| 1622 | |
| 1623 ## 4.19 Other Options | |
| 1624 | |
| 1625 Zint can output a representation of the symbol data as a set of hexadecimal | |
| 1626 values if asked to output to a text file (`"*.txt"`) or if given the option | |
| 1627 `--filetype=txt`. This can be used for test and diagnostic purposes. | |
| 1628 | |
| 1629 Additional options are available which are specific to certain symbologies. | |
| 1630 These may, for example, control the amount of error correction data or the size | |
| 1631 of the symbol. These options are discussed in section [6. Types of Symbology] of | |
| 1632 this guide. | |
| 1633 | |
| 1634 | |
| 1635 # 5. Using the API | |
| 1636 | |
| 1637 Zint has been written using the C language and has an API for use with C/C++ | |
| 1638 language programs. A Qt interface (see [Annex B. Qt Backend QZint]) is available | |
| 1639 in the `"backend_qt"` sub-directory, and a Tcl interface is available in the | |
| 1640 `"backend_tcl"` sub-directory (see [Annex C. Tcl Backend Binding]). | |
| 1641 | |
| 1642 The `libzint` API has been designed to be very similar to that used by the GNU | |
| 1643 Barcode package. This allows easy migration from GNU Barcode to Zint. Zint, | |
| 1644 however, uses none of the same function names or option names as GNU Barcode. | |
| 1645 This allows you to use both packages in your application without conflict if you | |
| 1646 wish. | |
| 1647 | |
| 1648 ## 5.1 Creating and Deleting Symbols | |
| 1649 | |
| 1650 The symbols manipulated by Zint are held in a `zint_symbol` structure defined in | |
| 1651 `"zint.h"`. These symbol structures are created with the `ZBarcode_Create()` | |
| 1652 function and deleted using the `ZBarcode_Delete()` function. For example the | |
| 1653 following code creates and then deletes a symbol: | |
| 1654 | |
| 1655 ```c | |
| 1656 #include <zint.h> | |
| 1657 #include <stdio.h> | |
| 1658 int main() | |
| 1659 { | |
| 1660 struct zint_symbol *my_symbol; | |
| 1661 my_symbol = ZBarcode_Create(); | |
| 1662 if (my_symbol != NULL) { | |
| 1663 printf("Symbol successfully created!\n"); | |
| 1664 ZBarcode_Delete(my_symbol); | |
| 1665 } | |
| 1666 return 0; | |
| 1667 } | |
| 1668 ``` | |
| 1669 | |
| 1670 When compiling this code it will need to be linked with the `libzint` library | |
| 1671 using the `-lzint` option: | |
| 1672 | |
| 1673 ```bash | |
| 1674 gcc -o simple simple.c -lzint | |
| 1675 ``` | |
| 1676 | |
| 1677 ## 5.2 Encoding and Saving to File | |
| 1678 | |
| 1679 To encode data in a barcode use the `ZBarcode_Encode()` function. To write the | |
| 1680 symbol to a file use the `ZBarcode_Print()` function. For example the following | |
| 1681 code takes a string from the command line and outputs a Code 128 symbol to a PNG | |
| 1682 file named `"out.png"` (or a GIF file `"out.gif"` if `libpng` is not present) in | |
| 1683 the current working directory: | |
| 1684 | |
| 1685 ```c | |
| 1686 #include <zint.h> | |
| 1687 int main(int argc, char **argv) | |
| 1688 { | |
| 1689 struct zint_symbol *my_symbol; | |
| 1690 my_symbol = ZBarcode_Create(); | |
| 1691 ZBarcode_Encode(my_symbol, argv[1], 0); | |
| 1692 ZBarcode_Print(my_symbol, 0); | |
| 1693 ZBarcode_Delete(my_symbol); | |
| 1694 return 0; | |
| 1695 } | |
| 1696 ``` | |
| 1697 | |
| 1698 This can also be done in one stage using the `ZBarcode_Encode_and_Print()` | |
| 1699 function as shown in the next example: | |
| 1700 | |
| 1701 ```c | |
| 1702 #include <zint.h> | |
| 1703 int main(int argc, char **argv) | |
| 1704 { | |
| 1705 struct zint_symbol *my_symbol; | |
| 1706 my_symbol = ZBarcode_Create(); | |
| 1707 ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); | |
| 1708 ZBarcode_Delete(my_symbol); | |
| 1709 return 0; | |
| 1710 } | |
| 1711 ``` | |
| 1712 | |
| 1713 Note that when using the API, the input data is assumed to be 8-bit binary | |
| 1714 unless the `input_mode` member of the `zint_symbol` structure is set - see [5.11 | |
| 1715 Setting the Input Mode] for details. | |
| 1716 | |
| 1717 ## 5.3 Encoding and Printing Functions in Depth | |
| 1718 | |
| 1719 The functions for encoding and printing barcodes are defined as: | |
| 1720 | |
| 1721 ```c | |
| 1722 int ZBarcode_Encode(struct zint_symbol *symbol, | |
| 1723 const unsigned char *source, int length); | |
| 1724 | |
| 1725 int ZBarcode_Encode_File(struct zint_symbol *symbol, | |
| 1726 const char *filename); | |
| 1727 | |
| 1728 int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); | |
| 1729 | |
| 1730 int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, | |
| 1731 const unsigned char *source, int length, int rotate_angle); | |
| 1732 | |
| 1733 int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, | |
| 1734 const char *filename, int rotate_angle); | |
| 1735 ``` | |
| 1736 | |
| 1737 In these definitions `length` can be used to set the length of the input string. | |
| 1738 This allows the encoding of `NUL` (ASCII 0) characters in those symbologies | |
| 1739 which allow this. A value of 0 (or less than 0) will disable this usage and Zint | |
| 1740 will encode data up to the first `NUL` character in the input string, which must | |
| 1741 be present. | |
| 1742 | |
| 1743 The `rotate_angle` value can be used to rotate the image when outputting. Valid | |
| 1744 values are 0, 90, 180 and 270. | |
| 1745 | |
| 1746 The `ZBarcode_Encode_File()` and `ZBarcode_Encode_File_and_Print()` functions | |
| 1747 can be used to encode data read directly from a text file where the filename is | |
| 1748 given in the `NUL`-terminated `filename` string. The special filename `"-"` | |
| 1749 (single hyphen) can be used to read from stdin. Note that on Windows, filenames | |
| 1750 are assumed to be UTF-8 encoded. | |
| 1751 | |
| 1752 If printing more than one barcode, the `zint_symbol` structure may be re-used by | |
| 1753 calling the `ZBarcode_Clear()` function after each barcode to free any output | |
| 1754 buffers allocated. The `zint_symbol` input members must be reset. To fully | |
| 1755 restore `zint_symbol` to its default state, call `ZBarcode_Reset()` instead. | |
| 1756 | |
| 1757 ## 5.4 Buffering Symbols in Memory (raster) | |
| 1758 | |
| 1759 In addition to saving barcode images to file Zint allows you to access a | |
| 1760 representation of the resulting bitmap image in memory. The following functions | |
| 1761 allow you to do this: | |
| 1762 | |
| 1763 ```c | |
| 1764 int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); | |
| 1765 | |
| 1766 int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, | |
| 1767 const unsigned char *source, int length, int rotate_angle); | |
| 1768 | |
| 1769 int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, | |
| 1770 const char *filename, int rotate_angle); | |
| 1771 ``` | |
| 1772 | |
| 1773 The arguments here are the same as above, and rotation and colour options can be | |
| 1774 used with the buffer functions in the same way as when saving to a file. The | |
| 1775 difference is that instead of saving the image to a file it is placed in a byte | |
| 1776 (`unsigned char`) array pointed to by the `bitmap` member, with `bitmap_width` | |
| 1777 set to the number of columns and `bitmap_height` set to the number of rows. | |
| 1778 | |
| 1779 The RGB channels are split into 3 consecutive red, green, blue bytes per pixel, | |
| 1780 and there are `bitmap_width` pixels per row and `bitmap_height` rows, so the | |
| 1781 total size of the `bitmap` array is `3 * bitmap_width * bitmap_height`. | |
| 1782 | |
| 1783 If the background and/or foreground are RGBA then the byte array `alphamap` will | |
| 1784 also be set, with a single alpha value for each pixel. Its total size will be | |
| 1785 `bitmap_width * bitmap_height`. | |
| 1786 | |
| 1787 The pixel data can be extracted from the array (or arrays) by the method shown | |
| 1788 in the example below, where `render_rgb()` and `render_rgba()` are assumed to be | |
| 1789 functions for drawing an RGB and RGBA pixel on the screen implemented by the | |
| 1790 client application: | |
| 1791 | |
| 1792 ```c | |
| 1793 int row, col, i = 0, j = 0; | |
| 1794 int red, blue, green, alpha; | |
| 1795 | |
| 1796 for (row = 0; row < my_symbol->bitmap_height; row++) { | |
| 1797 for (col = 0; col < my_symbol->bitmap_width; col++) { | |
| 1798 red = (int) my_symbol->bitmap[i]; | |
| 1799 green = (int) my_symbol->bitmap[i + 1]; | |
| 1800 blue = (int) my_symbol->bitmap[i + 2]; | |
| 1801 if (my_symbol->alphamap) { | |
| 1802 alpha = (int) my_symbol->alphamap[j]; | |
| 1803 render_rgba(row, col, red, green, blue, alpha); | |
| 1804 j++; | |
| 1805 } else { | |
| 1806 render_rgb(row, col, red, green, blue); | |
| 1807 } | |
| 1808 i += 3; | |
| 1809 } | |
| 1810 } | |
| 1811 ``` | |
| 1812 | |
| 1813 Where speed is important, the buffer can be returned instead in a more compact | |
| 1814 intermediate form using the output option `OUT_BUFFER_INTERMEDIATE`. Here each | |
| 1815 byte is an ASCII value: `'1'` for foreground colour and `'0'` for background | |
| 1816 colour, except for Ultracode, which also uses colour codes: `'W'` for white, | |
| 1817 `'C'` for cyan, `'B'` for blue, `'M'` for magenta, `'R'` for red, `'Y'` for | |
| 1818 yellow, `'G'` for green, and `'K'` for black. Alpha values are not reported | |
| 1819 (`alphamap` will always be `NULL`). The loop for accessing the data is then: | |
| 1820 | |
| 1821 ```c | |
| 1822 int row, col, i = 0; | |
| 1823 | |
| 1824 for (row = 0; row < my_symbol->bitmap_height; row++) { | |
| 1825 for (col = 0; col < my_symbol->bitmap_width; col++) { | |
| 1826 render_pixel(row, col, my_symbol->bitmap[i]); | |
| 1827 i++; | |
| 1828 } | |
| 1829 } | |
| 1830 ``` | |
| 1831 | |
| 1832 ## 5.5 Buffering Symbols in Memory (vector) | |
| 1833 | |
| 1834 Symbols can also be saved to memory in a vector representation as well as a | |
| 1835 bitmap one. The following functions, exactly analogous to the ones above, allow | |
| 1836 you to do this: | |
| 1837 | |
| 1838 ```c | |
| 1839 int ZBarcode_Buffer_Vector(struct zint_symbol *symbol, int rotate_angle); | |
| 1840 | |
| 1841 int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, | |
| 1842 const unsigned char *source, int length, int rotate_angle); | |
| 1843 | |
| 1844 int ZBarcode_Encode_File_and_Buffer_Vector(struct zint_symbol *symbol, | |
| 1845 const char *filename, int rotate_angle); | |
| 1846 ``` | |
| 1847 | |
| 1848 Here the `vector` member is set to point to a `zint_vector` header structure | |
| 1849 which contains pointers to lists of structures representing the various elements | |
| 1850 of the barcode: rectangles, hexagons, strings and circles. To draw the barcode, | |
| 1851 each of the element types is iterated in turn, and using the information stored | |
| 1852 is drawn by a rendering system. For instance, to draw a barcode using a | |
| 1853 rendering system with `prepare_canvas()`, `draw_rect()`, `draw_hexagon()`, | |
| 1854 `draw_string()`, and `draw_circle()` routines available: | |
| 1855 | |
| 1856 ```c | |
| 1857 struct zint_vector_rect *rect; | |
| 1858 struct zint_vector_hexagon *hex; | |
| 1859 struct zint_vector_string *string; | |
| 1860 struct zint_vector_circle *circle; | |
| 1861 | |
| 1862 prepare_canvas(my_symbol->vector->width, my_symbol->vector->height, | |
| 1863 my_symbol->scale, my_symbol->fgcolour, my_symbol->bgcolour, | |
| 1864 rotate_angle); | |
| 1865 | |
| 1866 for (rect = my_symbol->vector->rectangles; rect; rect = rect->next) { | |
| 1867 draw_rect(rect->x, rect->y, rect->width, rect->height, | |
| 1868 rect->colour); | |
| 1869 } | |
| 1870 for (hex = my_symbol->vector->hexagons; hex; hex = hex->next) { | |
| 1871 draw_hexagon(hex->x, hex->y, hex->diameter, hex->rotation); | |
| 1872 } | |
| 1873 for (string = my_symbol->vector->strings; string; string = string->next) { | |
| 1874 draw_string(string->x, string->y, string->fsize, | |
| 1875 string->rotation, string->halign, | |
| 1876 string->text, string->length); | |
| 1877 } | |
| 1878 for (circle = my_symbol->vector->circles; circle; circle = circle->next) { | |
| 1879 draw_circle(circle->x, circle->y, circle->diameter, circle->width); | |
| 1880 } | |
| 1881 ``` | |
| 1882 | |
| 1883 ## 5.6 Buffering Symbols in Memory (memfile) | |
| 1884 | |
| 1885 Symbols can also be stored as "in-memory" file buffers by giving the | |
| 1886 `BARCODE_MEMORY_FILE` option to the `output_options` member, which saves the | |
| 1887 print output to member `memfile` instead of to the output file `outfile`. The | |
| 1888 length of the buffer is given in `memfile_size`. For instance: | |
| 1889 | |
| 1890 ```c | |
| 1891 #include <zint.h> | |
| 1892 #include <stdio.h> | |
| 1893 #include <string.h> | |
| 1894 int main(int argc, char **argv) | |
| 1895 { | |
| 1896 struct zint_symbol *my_symbol; | |
| 1897 my_symbol = ZBarcode_Create(); | |
| 1898 my_symbol->output_options |= BARCODE_MEMORY_FILE; | |
| 1899 /* Only the extension is used, to determine output format */ | |
| 1900 strcpy(my_symbol->outfile, "mem.svg"); | |
| 1901 ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); | |
| 1902 /* `my_symbol->memfile` now contains the SVG output */ | |
| 1903 fwrite(my_symbol->memfile, 1, my_symbol->memfile_size, stdout); | |
| 1904 ZBarcode_Delete(my_symbol); | |
| 1905 return 0; | |
| 1906 } | |
| 1907 | |
| 1908 ``` | |
| 1909 | |
| 1910 will print the SVG output to `stdout` (the file "mem.svg" is not created). This | |
| 1911 is particularly useful for the textual formats EPS and SVG,[^7] allowing the | |
| 1912 output to be manipulated and processed by the client. | |
| 1913 | |
| 1914 [^7]: BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines | |
| 1915 (LF) on both Windows and Unix, i.e. not CR+LF on Windows. | |
| 1916 | |
| 1917 ## 5.7 Setting Options | |
| 1918 | |
| 1919 So far our application is not very useful unless we plan to only make Code 128 | |
| 1920 symbols and we don't mind that they only save to `"out.png"` (or to memory, as | |
| 1921 above). As with the CLI program, of course, these options can be altered. The | |
| 1922 way this is done is by altering the contents of the `zint_symbol` structure | |
| 1923 between the creation and encoding stages. The `zint_symbol` structure consists | |
| 1924 of the following members: | |
| 1925 | |
| 1926 ----------------------------------------------------------------------------- | |
| 1927 Member Name Type Meaning Default Value | |
| 1928 ------------------- ---------- ------------------------- ----------------- | |
| 1929 `symbology` integer Symbol to use - see [5.9 `BARCODE_CODE128` | |
| 1930 Specifying a Symbology]. | |
| 1931 | |
| 1932 `height` float Symbol height in Symbol dependent | |
| 1933 X-dimensions, excluding | |
| 1934 fixed width-to-height | |
| 1935 symbols.[^8] | |
| 1936 | |
| 1937 `scale` float Scale factor for 1.0 | |
| 1938 adjusting size of image | |
| 1939 (sets X-dimension). | |
| 1940 | |
| 1941 `whitespace_width` integer Horizontal whitespace 0 | |
| 1942 width in X-dimensions. | |
| 1943 | |
| 1944 `whitespace_height` integer Vertical whitespace 0 | |
| 1945 height in X-dimensions. | |
| 1946 | |
| 1947 `border_width` integer Border width in 0 | |
| 1948 X-dimensions. | |
| 1949 | |
| 1950 `output_options` integer Set various output 0 (none) | |
| 1951 parameters - see [5.10 | |
| 1952 Adjusting Output | |
| 1953 Options]. | |
| 1954 | |
| 1955 `fgcolour` character Foreground (ink) `"000000"` | |
| 1956 string colour as RGB/RGBA | |
| 1957 hexadecimal string or | |
| 1958 `"C,M,Y,K"` decimal | |
| 1959 percentages string, with | |
| 1960 a terminating `NUL`. | |
| 1961 | |
| 1962 `bgcolour` character Background (paper) `"ffffff"` | |
| 1963 string colour as RGB/RGBA | |
| 1964 hexadecimal string or | |
| 1965 `"C,M,Y,K"` decimal | |
| 1966 percentages string, with | |
| 1967 a terminating `NUL`. | |
| 1968 | |
| 1969 `fgcolor` pointer Points to fgcolour | |
| 1970 allowing alternate | |
| 1971 spelling. | |
| 1972 | |
| 1973 `bgcolor` pointer Points to bgcolour | |
| 1974 allowing alternate | |
| 1975 spelling. | |
| 1976 | |
| 1977 `outfile` character Contains the name of the `"out.png"` | |
| 1978 string file to output a | |
| 1979 resulting barcode symbol | |
| 1980 to. Must end in `.png`, | |
| 1981 `.gif`, `.bmp`, `.emf`, | |
| 1982 `.eps`, `.pcx`, `.svg`, | |
| 1983 `.tif` or `.txt` followed | |
| 1984 by a terminating | |
| 1985 `NUL`.[^9] | |
| 1986 | |
| 1987 `primary` character Primary message data for `""` (empty) | |
| 1988 string more complex symbols, | |
| 1989 with a terminating `NUL`. | |
| 1990 | |
| 1991 `option_1` integer Symbol specific options. -1 | |
| 1992 | |
| 1993 `option_2` integer Symbol specific options. 0 | |
| 1994 | |
| 1995 `option_3` integer Symbol specific options. 0 | |
| 1996 | |
| 1997 `show_hrt` integer Set to 0 to hide Human 1 | |
| 1998 Readable Text (HRT). | |
| 1999 | |
| 2000 `input_mode` integer Set encoding of input `DATA_MODE` | |
| 2001 data - see [5.11 Setting | |
| 2002 the Input Mode]. | |
| 2003 | |
| 2004 `eci` integer Extended Channel 0 (none) | |
| 2005 Interpretation code. | |
| 2006 | |
| 2007 `dpmm` float Resolution of output in 0 (none) | |
| 2008 dots per mm (BMP, EMF, | |
| 2009 PCX, PNG and TIF only). | |
| 2010 | |
| 2011 `dot_size` float Diameter of dots used in 0.8 | |
| 2012 dotty mode (in | |
| 2013 X-dimensions). | |
| 2014 | |
| 2015 `text_gap` float Gap between barcode and 1.0 | |
| 2016 text (HRT) in | |
| 2017 X-dimensions. | |
| 2018 | |
| 2019 `guard_descent` float Height of guard bar 5.0 | |
| 2020 descent (EAN/UPC only) in | |
| 2021 X-dimensions. | |
| 2022 | |
| 2023 `structapp` Structured Mark a symbol as part of count 0 | |
| 2024 Append a sequence of symbols. (disabled) | |
| 2025 structure | |
| 2026 | |
| 2027 `debug` integer Debugging flags. 0 | |
| 2028 | |
| 2029 `warn_level` integer Affects error/warning `WARN_DEFAULT` | |
| 2030 value returned by Zint | |
| 2031 API - see [5.8 Handling | |
| 2032 Errors]. | |
| 2033 | |
| 2034 `text` unsigned Human Readable Text, `""` (empty) | |
| 2035 character which usually consists of (output only) | |
| 2036 string input data plus one more | |
| 2037 check digit. Uses UTF-8 | |
| 2038 formatting, with a | |
| 2039 terminating `NUL`. | |
| 2040 | |
| 2041 `rows` integer Number of rows used by (output only) | |
| 2042 the symbol. | |
| 2043 | |
| 2044 `width` integer Width of the generated (output only) | |
| 2045 symbol. | |
| 2046 | |
| 2047 `encoded_data` array of Representation of the (output only) | |
| 2048 unsigned encoded data. | |
| 2049 character | |
| 2050 arrays | |
| 2051 | |
| 2052 `row_height` array of Heights of each row. (output only) | |
| 2053 floats | |
| 2054 | |
| 2055 `errtxt` character Error message in the (output only) | |
| 2056 string event that an error | |
| 2057 occurred, with a | |
| 2058 terminating `NUL` - see | |
| 2059 [5.8 Handling Errors]. | |
| 2060 | |
| 2061 `bitmap` pointer to Pointer to stored bitmap (output only) | |
| 2062 unsigned image - see [5.4 | |
| 2063 character Buffering Symbols in | |
| 2064 array Memory (raster)]. | |
| 2065 | |
| 2066 `bitmap_width` integer Width of stored bitmap (output only) | |
| 2067 image (in pixels) - see | |
| 2068 `bitmap` member. | |
| 2069 | |
| 2070 `bitmap_height` integer Height of stored bitmap (output only) | |
| 2071 image (in pixels) - see | |
| 2072 `bitmap` member. | |
| 2073 | |
| 2074 `alphamap` pointer to Pointer to array (output only) | |
| 2075 unsigned representing alpha | |
| 2076 character channel of stored bitmap | |
| 2077 array image (or `NULL` if no | |
| 2078 alpha channel used) - see | |
| 2079 `bitmap` member. | |
| 2080 | |
| 2081 `vector` pointer to Pointer to vector header (output only) | |
| 2082 vector containing pointers to | |
| 2083 structure vector elements - see | |
| 2084 [5.5 Buffering Symbols | |
| 2085 in Memory (vector)]. | |
| 2086 | |
| 2087 `memfile` pointer to Pointer to in-memory (output only) | |
| 2088 unsigned file buffer if | |
| 2089 character `BARCODE_MEMORY_FILE` | |
| 2090 array set in `output_options` | |
| 2091 - see [5.6 Buffering | |
| 2092 Symbols in Memory | |
| 2093 (memfile)]. | |
| 2094 | |
| 2095 `memfile_size` integer Length of in-memory file (output only) | |
| 2096 buffer. | |
| 2097 ----------------------------------------------------------------------------- | |
| 2098 | |
| 2099 Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol tag="$ $"} | |
| 2100 | |
| 2101 [^8]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune), | |
| 2102 Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, | |
| 2103 QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which | |
| 2104 have a fixed width-to-height ratio (or, in the case of Code One, a fixed | |
| 2105 height). | |
| 2106 | |
| 2107 [^9]: For Windows, `outfile` is assumed to be UTF-8 encoded. | |
| 2108 | |
| 2109 To alter these values use the syntax shown in the example below. This code has | |
| 2110 the same result as the previous example except the output is now taller and | |
| 2111 plotted in green. | |
| 2112 | |
| 2113 ```c | |
| 2114 #include <zint.h> | |
| 2115 #include <string.h> | |
| 2116 int main(int argc, char **argv) | |
| 2117 { | |
| 2118 struct zint_symbol *my_symbol; | |
| 2119 my_symbol = ZBarcode_Create(); | |
| 2120 strcpy(my_symbol->fgcolour, "00ff00"); | |
| 2121 my_symbol->height = 400.0f; | |
| 2122 ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); | |
| 2123 ZBarcode_Delete(my_symbol); | |
| 2124 return 0; | |
| 2125 } | |
| 2126 ``` | |
| 2127 | |
| 2128 Note that background removal for all outputs except BMP can be achieved by | |
| 2129 setting the background alpha to `"00"` where the values for R, G and B will be | |
| 2130 ignored: | |
| 2131 | |
| 2132 ```c | |
| 2133 strcpy(my_symbol->bgcolour, "55555500"); | |
| 2134 ``` | |
| 2135 | |
| 2136 This is what the CLI option `--nobackground` does - see [4.7 Using Colour]. | |
| 2137 | |
| 2138 ## 5.8 Handling Errors | |
| 2139 | |
| 2140 If errors occur during encoding a non-zero integer value is passed back to the | |
| 2141 calling application. In addition the `errtxt` member is set to a message | |
| 2142 detailing the nature of the error. The errors generated by Zint are: | |
| 2143 | |
| 2144 ------------------------------------------------------------------------------ | |
| 2145 Return Value Meaning | |
| 2146 ----------------------------- ----------------------------------------------- | |
| 2147 `ZINT_WARN_HRT_TRUNCATED` The Human Readable Text returned in `text` was | |
| 2148 truncated (maximum 255 bytes). | |
| 2149 | |
| 2150 `ZINT_WARN_INVALID_OPTION` One of the values in `zint_struct` was set | |
| 2151 incorrectly but Zint has made a guess at what | |
| 2152 it should have been and generated a barcode | |
| 2153 accordingly. | |
| 2154 | |
| 2155 `ZINT_WARN_USES_ECI` Zint has automatically inserted an ECI | |
| 2156 character. The symbol may not be readable with | |
| 2157 some readers. | |
| 2158 | |
| 2159 `ZINT_WARN_NONCOMPLIANT` The symbol was created but is not compliant | |
| 2160 with certain standards set in its specification | |
| 2161 (e.g. height, GS1 AI data lengths). | |
| 2162 | |
| 2163 `ZINT_ERROR` Marks the divide between warnings and errors. | |
| 2164 For return values greater than or equal to this | |
| 2165 no symbol (or only an incomplete symbol) is | |
| 2166 generated. | |
| 2167 | |
| 2168 `ZINT_ERROR_TOO_LONG` The input data is too long or too short for the | |
| 2169 selected symbology. No symbol has been | |
| 2170 generated. | |
| 2171 | |
| 2172 `ZINT_ERROR_INVALID_DATA` The data to be encoded includes characters | |
| 2173 which are not permitted by the selected | |
| 2174 symbology (e.g. alphabetic characters in an EAN | |
| 2175 symbol). No symbol has been generated. | |
| 2176 | |
| 2177 `ZINT_ERROR_INVALID_CHECK` Data with an incorrect check digit has been | |
| 2178 entered. No symbol has been generated. | |
| 2179 | |
| 2180 `ZINT_ERROR_INVALID_OPTION` One of the values in `zint_struct` was set | |
| 2181 incorrectly and Zint was unable (or unwilling) | |
| 2182 to guess what it should have been. No symbol | |
| 2183 has been generated. | |
| 2184 | |
| 2185 `ZINT_ERROR_ENCODING_PROBLEM` A problem has occurred during encoding of the | |
| 2186 data. This should never happen. Please contact | |
| 2187 the developer if you encounter this error. | |
| 2188 | |
| 2189 `ZINT_ERROR_FILE_ACCESS` Zint was unable to open the requested output | |
| 2190 file. This is usually a file permissions | |
| 2191 problem. | |
| 2192 | |
| 2193 `ZINT_ERROR_MEMORY` Zint ran out of memory. This should only be a | |
| 2194 problem with legacy systems. | |
| 2195 | |
| 2196 `ZINT_ERROR_FILE_WRITE` Zint failed to write all contents to the | |
| 2197 requested output file. This should only occur | |
| 2198 if the output device becomes full. | |
| 2199 | |
| 2200 `ZINT_ERROR_USES_ECI` Returned if `warn_level` set to `WARN_FAIL_ALL` | |
| 2201 and `ZINT_WARN_USES_ECI` occurs. | |
| 2202 | |
| 2203 `ZINT_ERROR_NONCOMPLIANT` Returned if `warn_level` set to `WARN_FAIL_ALL` | |
| 2204 and `ZINT_WARN_NONCOMPLIANT` occurs. | |
| 2205 | |
| 2206 `ZINT_ERROR_HRT_TRUNCATED` Returned if `warn_level` set to `WARN_FAIL_ALL` | |
| 2207 and `ZINT_WARN_HRT_TRUNCATED` occurs. | |
| 2208 ------------------------------------------------------------------------------ | |
| 2209 | |
| 2210 Table: {#tbl:api_warnings_errors tag=": API Warning and Error Return Values"} | |
| 2211 | |
| 2212 To catch errors use an integer variable as shown in the code below: | |
| 2213 | |
| 2214 ```c | |
| 2215 #include <zint.h> | |
| 2216 #include <stdio.h> | |
| 2217 #include <string.h> | |
| 2218 int main(int argc, char **argv) | |
| 2219 { | |
| 2220 struct zint_symbol *my_symbol; | |
| 2221 int error; | |
| 2222 my_symbol = ZBarcode_Create(); | |
| 2223 /* Set invalid foreground colour */ | |
| 2224 strcpy(my_symbol->fgcolour, "nonsense"); | |
| 2225 error = ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); | |
| 2226 if (error != 0) { | |
| 2227 /* Some warning or error occurred */ | |
| 2228 printf("%s\n", my_symbol->errtxt); | |
| 2229 if (error >= ZINT_ERROR) { | |
| 2230 /* Stop now */ | |
| 2231 ZBarcode_Delete(my_symbol); | |
| 2232 return 1; | |
| 2233 } | |
| 2234 } | |
| 2235 /* Otherwise carry on with the rest of the application */ | |
| 2236 ZBarcode_Delete(my_symbol); | |
| 2237 return 0; | |
| 2238 } | |
| 2239 ``` | |
| 2240 | |
| 2241 This code will exit with the appropriate message: | |
| 2242 | |
| 2243 ``` | |
| 2244 Error 881: Malformed foreground RGB colour 'nonsense' (hexadecimal only) | |
| 2245 ``` | |
| 2246 | |
| 2247 To treat all warnings as errors, set `symbol->warn_level` to `WARN_FAIL_ALL`. | |
| 2248 | |
| 2249 ## 5.9 Specifying a Symbology | |
| 2250 | |
| 2251 Symbologies can be specified by number or by name as shown in the Table | |
| 2252 {@tbl:barcode_types}. For example | |
| 2253 | |
| 2254 ```c | |
| 2255 symbol->symbology = BARCODE_LOGMARS; | |
| 2256 ``` | |
| 2257 | |
| 2258 means the same as | |
| 2259 | |
| 2260 ```c | |
| 2261 symbol->symbology = 50; | |
| 2262 ``` | |
| 2263 | |
| 2264 ## 5.10 Adjusting Output Options | |
| 2265 | |
| 2266 The `output_options` member can be used to adjust various aspects of the output | |
| 2267 file. To select more than one option from the table below simply `OR` them | |
| 2268 together when adjusting this value: | |
| 2269 | |
| 2270 ```c | |
| 2271 my_symbol->output_options |= BARCODE_BIND | READER_INIT; | |
| 2272 ``` | |
| 2273 | |
| 2274 ------------------------------------------------------------------------------ | |
| 2275 Value Effect | |
| 2276 ------------------------- --------------------------------------------------- | |
| 2277 0 No options selected. | |
| 2278 | |
| 2279 `BARCODE_BIND_TOP` Boundary bar above the symbol only.[^10] | |
| 2280 | |
| 2281 `BARCODE_BIND` Boundary bars above and below the symbol and | |
| 2282 between rows if stacking multiple symbols.[^11] | |
| 2283 | |
| 2284 `BARCODE_BOX` Add a box surrounding the symbol and whitespace. | |
| 2285 | |
| 2286 `BARCODE_STDOUT` Output the file to stdout. | |
| 2287 | |
| 2288 `READER_INIT` Create as a Reader Initialisation (Programming) | |
| 2289 symbol. | |
| 2290 | |
| 2291 `SMALL_TEXT` Use a smaller font for the Human Readable Text. | |
| 2292 | |
| 2293 `BOLD_TEXT` Embolden the Human Readable Text. | |
| 2294 | |
| 2295 `CMYK_COLOUR` Select the CMYK colour space option for | |
| 2296 Encapsulated PostScript and TIF files. | |
| 2297 | |
| 2298 `BARCODE_DOTTY_MODE` Plot a matrix symbol using dots rather than | |
| 2299 squares. | |
| 2300 | |
| 2301 `GS1_GS_SEPARATOR` Use GS (Group Separator) instead of FNC1 as GS1 | |
| 2302 separator (Data Matrix only). | |
| 2303 | |
| 2304 `OUT_BUFFER_INTERMEDIATE` Return the bitmap buffer as ASCII values instead of | |
| 2305 separate colour channels - see [5.4 Buffering | |
| 2306 Symbols in Memory (raster)]. | |
| 2307 | |
| 2308 `BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any | |
| 2309 specified whitespace).[^12] | |
| 2310 | |
| 2311 `BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults. | |
| 2312 | |
| 2313 `COMPLIANT_HEIGHT` Warn if height specified not compliant, or use | |
| 2314 standard height (if any) as default. | |
| 2315 | |
| 2316 `EANUPC_GUARD_WHITESPACE` Add quiet zone indicators ("<" and/or ">") to HRT | |
| 2317 whitespace (EAN/UPC). | |
| 2318 | |
| 2319 `EMBED_VECTOR_FONT` Embed font in vector output - currently available | |
| 2320 for SVG output only. | |
| 2321 | |
| 2322 `BARCODE_MEMORY_FILE` Write output to in-memory buffer `symbol->memfile` | |
| 2323 instead of to `outfile` file. | |
| 2324 ------------------------------------------------------------------------------ | |
| 2325 | |
| 2326 Table: API `output_options` Values {#tbl:api_output_options tag="$ $"} | |
| 2327 | |
| 2328 [^10]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD | |
| 2329 Code]. | |
| 2330 | |
| 2331 [^11]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code | |
| 2332 49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14]. | |
| 2333 | |
| 2334 [^12]: Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and | |
| 2335 UPC-E have compliant quiet zones added by default. | |
| 2336 | |
| 2337 ## 5.11 Setting the Input Mode | |
| 2338 | |
| 2339 The way in which the input data is encoded can be set using the `input_mode` | |
| 2340 member. Valid values are shown in the table below. | |
| 2341 | |
| 2342 ------------------------------------------------------------------------------ | |
| 2343 Value Effect | |
| 2344 ------------------ ---------------------------------------------------------- | |
| 2345 `DATA_MODE` Uses full 8-bit range interpreted as binary data. | |
| 2346 | |
| 2347 `UNICODE_MODE` Uses UTF-8 input. | |
| 2348 | |
| 2349 `GS1_MODE` Encodes GS1 data using FNC1 characters. | |
| 2350 | |
| 2351 _The above are exclusive, the following optional and | |
| 2352 OR-ed._ | |
| 2353 | |
| 2354 `ESCAPE_MODE` Process input data for escape sequences. | |
| 2355 | |
| 2356 `GS1PARENS_MODE` Parentheses (round brackets) used in GS1 data instead of | |
| 2357 square brackets to delimit Application Identifiers | |
| 2358 (parentheses must not otherwise occur in the data). | |
| 2359 | |
| 2360 `GS1NOCHECK_MODE` Do not check GS1 data for validity, i.e. suppress checks | |
| 2361 for valid AIs and data lengths. Invalid characters (e.g. | |
| 2362 control characters, extended ASCII characters) are still | |
| 2363 checked for. | |
| 2364 | |
| 2365 `HEIGHTPERROW_MODE` Interpret the `height` member as per-row rather than as | |
| 2366 overall height. | |
| 2367 | |
| 2368 `FAST_MODE` Use faster if less optimal encodation or other shortcuts | |
| 2369 if available (affects `DATAMATRIX`, `MICROPDF417`, | |
| 2370 `PDF417`, `QRCODE` and `UPNQR` only). | |
| 2371 | |
| 2372 `EXTRA_ESCAPE_MODE` Process special symbology-specific escape sequences | |
| 2373 (`CODE128` only). | |
| 2374 | |
| 2375 ------------------------------------------------------------------------------ | |
| 2376 | |
| 2377 Table: API `input_mode` Values {#tbl:api_input_mode tag="$ $"} | |
| 2378 | |
| 2379 The default mode is `DATA_MODE`. (Note that this differs from the default for | |
| 2380 the CLI and GUI, which is `UNICODE_MODE`.) | |
| 2381 | |
| 2382 `DATA_MODE`, `UNICODE_MODE` and `GS1_MODE` are mutually exclusive, whereas | |
| 2383 `ESCAPE_MODE`, `GS1PARENS_MODE`, `GS1NOCHECK_MODE`, `HEIGHTPERROW_MODE`, | |
| 2384 `FAST_MODE` and `EXTRA_ESCAPE_MODE` are optional. So, for example, you can set | |
| 2385 | |
| 2386 ```c | |
| 2387 my_symbol->input_mode = UNICODE_MODE | ESCAPE_MODE; | |
| 2388 ``` | |
| 2389 | |
| 2390 or | |
| 2391 | |
| 2392 ```c | |
| 2393 my_symbol->input_mode = GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE; | |
| 2394 ``` | |
| 2395 | |
| 2396 whereas | |
| 2397 | |
| 2398 ```c | |
| 2399 my_symbol->input_mode = DATA_MODE | GS1_MODE; | |
| 2400 ``` | |
| 2401 | |
| 2402 is not valid. | |
| 2403 | |
| 2404 Permissible escape sequences (`ESCAPE_MODE`) are listed in Table | |
| 2405 {@tbl:escape_sequences}, and the special Code 128-only `EXTRA_ESCAPE_MODE` | |
| 2406 escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)]. An | |
| 2407 example of `GS1PARENS_MODE` usage is given in section [6.1.10.3 GS1-128]. | |
| 2408 | |
| 2409 `GS1NOCHECK_MODE` is for use with legacy systems that have data that does not | |
| 2410 conform to the current GS1 standard. Printable ASCII input is still checked for, | |
| 2411 as is the validity of GS1 data specified without AIs (e.g. linear data for GS1 | |
| 2412 DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and | |
| 2413 GS1 Composite input that is not in the GS1 encodable character set 82 (see GS1 | |
| 2414 General Specifications Figure 7.11.1 'GS1 AI encodable character set 82'), | |
| 2415 otherwise encodation would fail. | |
| 2416 | |
| 2417 For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height]. | |
| 2418 The `height` member should be set to the desired per-row value on input (it will | |
| 2419 be set to the overall height on output). | |
| 2420 | |
| 2421 `FAST_MODE` causes a less optimal encodation scheme to be used for Data Matrix, | |
| 2422 MicroPDF417 and PDF417. For QR Code and UPNQR, it affects Zint's automatic mask | |
| 2423 selection - see [6.6.3 QR Code (ISO 18004)] for details. | |
| 2424 | |
| 2425 ## 5.12 Multiple Segments | |
| 2426 | |
| 2427 For input data requiring multiple ECIs, the following functions may be used: | |
| 2428 | |
| 2429 ```c | |
| 2430 int ZBarcode_Encode_Segs(struct zint_symbol *symbol, | |
| 2431 const struct zint_seg segs[], const int seg_count); | |
| 2432 | |
| 2433 int ZBarcode_Encode_Segs_and_Print(struct zint_symbol *symbol, | |
| 2434 const struct zint_seg segs[], const int seg_count, int rotate_angle); | |
| 2435 | |
| 2436 int ZBarcode_Encode_Segs_and_Buffer(struct zint_symbol *symbol, | |
| 2437 const struct zint_seg segs[], const int seg_count, int rotate_angle); | |
| 2438 | |
| 2439 int ZBarcode_Encode_Segs_and_Buffer_Vector(struct zint_symbol *symbol, | |
| 2440 const struct zint_seg segs[], const int seg_count, int rotate_angle); | |
| 2441 ``` | |
| 2442 | |
| 2443 These are direct analogues of the previously mentioned `ZBarcode_Encode()`, | |
| 2444 `ZBarcode_Encode_and_Print()`, `ZBarcode_Encode_and_Buffer()` and | |
| 2445 `ZBarcode_Encode_and_Buffer_Vector()` respectively, where instead of a pair | |
| 2446 consisting of `"source, length"`, a pair consisting of `"segs, seg_count"` is | |
| 2447 given, with `segs` being an array of `struct zint_seg` segments and `seg_count` | |
| 2448 being the number of elements it contains. The zint_seg structure is of the form: | |
| 2449 | |
| 2450 ```c | |
| 2451 struct zint_seg { | |
| 2452 unsigned char *source; /* Data to encode */ | |
| 2453 int length; /* Length of `source`. If 0, `source` must be | |
| 2454 NUL-terminated */ | |
| 2455 int eci; /* Extended Channel Interpretation */ | |
| 2456 }; | |
| 2457 ``` | |
| 2458 | |
| 2459 The symbology must support ECIs (see Table {@tbl:eci_aware_symbologies}). For | |
| 2460 example: | |
| 2461 | |
| 2462 ```c | |
| 2463 #include <zint.h> | |
| 2464 int main(int argc, char **argv) | |
| 2465 { | |
| 2466 struct zint_seg segs[] = { | |
| 2467 { "Κείμενο", 0, 9 }, | |
| 2468 { "Текст", 0, 7 }, | |
| 2469 { "文章", 0, 20 } | |
| 2470 }; | |
| 2471 struct zint_symbol *my_symbol; | |
| 2472 my_symbol = ZBarcode_Create(); | |
| 2473 my_symbol->symbology = BARCODE_AZTEC; | |
| 2474 my_symbol->input_mode = UNICODE_MODE; | |
| 2475 ZBarcode_Encode_Segs(my_symbol, segs, 3); | |
| 2476 ZBarcode_Print(my_symbol, 0); | |
| 2477 ZBarcode_Delete(my_symbol); | |
| 2478 return 0; | |
| 2479 } | |
| 2480 ``` | |
| 2481 | |
| 2482 A maximum of 256 segments may be specified. Use of multiple segments with GS1 | |
| 2483 data is not currently supported. | |
| 2484 | |
| 2485 ## 5.13 Scaling Helpers | |
| 2486 | |
| 2487 To help with scaling the output, the following three function are available: | |
| 2488 | |
| 2489 ```c | |
| 2490 float ZBarcode_Default_Xdim(int symbol_id); | |
| 2491 | |
| 2492 float ZBarcode_Scale_From_XdimDp(int symbol_id, float x_dim_mm, float dpmm, | |
| 2493 const char *filetype) { | |
| 2494 | |
| 2495 float ZBarcode_XdimDP_From_Scale(int symbol_id, float scale, | |
| 2496 float x_dim_mm_or_dpmm, const char *filetype); | |
| 2497 ``` | |
| 2498 | |
| 2499 The first `ZBarcode_Default_Xdim()` returns the default X-dimension suggested by | |
| 2500 Zint for symbology `symbol_id`. | |
| 2501 | |
| 2502 The second `ZBarcode_Scale_From_XdimDp()` returns the scale to use to output to | |
| 2503 a file of type `filetype` with X-dimension `x_dim_mm` at `dpmm` dots per mm. The | |
| 2504 given X-dimension must be non-zero and less than or equal to 10mm, however | |
| 2505 `dpmm` may be zero and defaults to 12 dpmm, and `filetype` may be NULL or empty | |
| 2506 in which case a GIF filetype is assumed. For raster output (BMP/GIF/PCX/PNG/TIF) | |
| 2507 the scale is rounded to half-integer increments. | |
| 2508 | |
| 2509 For example: | |
| 2510 | |
| 2511 ```c | |
| 2512 /* Royal Mail 4-State Customer Code */ | |
| 2513 my_symbol->symbology = BARCODE_RM4SCC; | |
| 2514 my_symbol->dpmm = 600.0f / 25.4f; /* 600 dpi */ | |
| 2515 my_symbol->scale = ZBarcode_Scale_From_XdimDp( | |
| 2516 my_symbol->symbology, | |
| 2517 ZBarcode_Default_Xdim(my_symbol->symbology), | |
| 2518 my_symbol->dpmm, "PNG"); /* Returns 7.5 */ | |
| 2519 ``` | |
| 2520 | |
| 2521 The third function `ZBarcode_XdimDP_From_Scale()` is the "reverse" of | |
| 2522 `ZBarcode_Scale_From_XdimDp()`, returning the X-dimension (in mm) or the dot | |
| 2523 density (in dpmm) given a scale `scale`. Both `scale` and `x_dim_mm_or_dpmm` | |
| 2524 must be non-zero. The returned value is bound to the maximum value of dpmm | |
| 2525 (1000), so must be further bound to 10 on return if the X-dimension is sought. | |
| 2526 | |
| 2527 Note that the X-dimension to use is application dependent, and varies not only | |
| 2528 due to the symbology, resolution and filetype but also due to the type of | |
| 2529 scanner used, the intended scanning distance, and what media ("substrates") the | |
| 2530 barcode appears on. | |
| 2531 | |
| 2532 ## 5.14 Verifying Symbology Availability | |
| 2533 | |
| 2534 An additional function available in the API is: | |
| 2535 | |
| 2536 ```c | |
| 2537 int ZBarcode_ValidID(int symbol_id); | |
| 2538 ``` | |
| 2539 | |
| 2540 which allows you to check whether a given symbology is available, returning a | |
| 2541 non-zero value if so. For example: | |
| 2542 | |
| 2543 ```c | |
| 2544 if (ZBarcode_ValidID(BARCODE_PDF417) != 0) { | |
| 2545 printf("PDF417 available\n"); | |
| 2546 } else { | |
| 2547 printf("PDF417 not available\n"); | |
| 2548 } | |
| 2549 ``` | |
| 2550 | |
| 2551 Another function that may be useful is: | |
| 2552 | |
| 2553 ```c | |
| 2554 int ZBarcode_BarcodeName(int symbol_id, char name[32]); | |
| 2555 ``` | |
| 2556 | |
| 2557 which copies the name of a symbology into the supplied `name` buffer, which | |
| 2558 should be 32 characters in length. The name is `NUL`-terminated, and zero is | |
| 2559 returned on success. For instance: | |
| 2560 | |
| 2561 ```c | |
| 2562 char name[32]; | |
| 2563 if (ZBarcode_BarcodeName(BARCODE_PDF417, name) == 0) { | |
| 2564 printf("%s\n", name); | |
| 2565 } | |
| 2566 ``` | |
| 2567 | |
| 2568 will print `BARCODE_PDF417`. | |
| 2569 | |
| 2570 ## 5.15 Checking Symbology Capabilities | |
| 2571 | |
| 2572 It can be useful for frontend programs to know the capabilities of a symbology. | |
| 2573 This can be determined using another additional function: | |
| 2574 | |
| 2575 ```c | |
| 2576 unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag); | |
| 2577 ``` | |
| 2578 | |
| 2579 by `OR`-ing the flags below in the `cap_flag` argument and checking the return | |
| 2580 to see which are set. | |
| 2581 | |
| 2582 ------------------------------------------------------------------------------ | |
| 2583 Value Meaning | |
| 2584 ------------------------- -------------------------------------------------- | |
| 2585 `ZINT_CAP_HRT` Can the symbology print Human Readable Text? | |
| 2586 | |
| 2587 `ZINT_CAP_STACKABLE` Is the symbology stackable? | |
| 2588 | |
| 2589 `ZINT_CAP_EANUPC`[^13] Is the symbology EAN/UPC? | |
| 2590 | |
| 2591 `ZINT_CAP_COMPOSITE` Does the symbology support composite data? (see | |
| 2592 [6.3 GS1 Composite Symbols (ISO 24723)] below) | |
| 2593 | |
| 2594 `ZINT_CAP_ECI` Does the symbology support Extended Channel | |
| 2595 Interpretations? | |
| 2596 | |
| 2597 `ZINT_CAP_GS1` Does the symbology support GS1 data? | |
| 2598 | |
| 2599 `ZINT_CAP_DOTTY` Can the symbology be outputted as dots? | |
| 2600 | |
| 2601 `ZINT_CAP_QUIET_ZONES` Does the symbology have default quiet zones? | |
| 2602 | |
| 2603 `ZINT_CAP_FIXED_RATIO` Does the symbology have a fixed width-to-height | |
| 2604 (aspect) ratio? | |
| 2605 | |
| 2606 `ZINT_CAP_READER_INIT` Does the symbology support Reader Initialisation? | |
| 2607 | |
| 2608 `ZINT_CAP_FULL_MULTIBYTE` Is the `ZINT_FULL_MULTIBYTE` option applicable? | |
| 2609 | |
| 2610 `ZINT_CAP_MASK` Is mask selection applicable? | |
| 2611 | |
| 2612 `ZINT_CAP_STRUCTAPP` Does the symbology support Structured Append? | |
| 2613 | |
| 2614 `ZINT_CAP_COMPLIANT_HEIGHT` Does the symbology have a compliant height | |
| 2615 defined? | |
| 2616 ------------------------------------------------------------------------------ | |
| 2617 | |
| 2618 Table: {#tbl:api_cap tag=": API Capability Flags"} | |
| 2619 | |
| 2620 [^13]: `ZINT_CAP_EANUPC` was previously named `ZINT_CAP_EXTENDABLE`, which is | |
| 2621 still recognised. | |
| 2622 | |
| 2623 For example: | |
| 2624 | |
| 2625 ```c | |
| 2626 unsigned int cap; | |
| 2627 cap = ZBarcode_Cap(BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI); | |
| 2628 if (cap & ZINT_CAP_HRT) { | |
| 2629 printf("PDF417 supports HRT\n"); | |
| 2630 } else { | |
| 2631 printf("PDF417 does not support HRT\n"); | |
| 2632 } | |
| 2633 if (cap & ZINT_CAP_ECI) { | |
| 2634 printf("PDF417 supports ECI\n"); | |
| 2635 } else { | |
| 2636 printf("PDF417 does not support ECI\n"); | |
| 2637 } | |
| 2638 ``` | |
| 2639 | |
| 2640 ## 5.16 Zint Version | |
| 2641 | |
| 2642 Whether the Zint library linked to was built with PNG support may be determined | |
| 2643 with: | |
| 2644 | |
| 2645 ```c | |
| 2646 int ZBarcode_NoPng(); | |
| 2647 ``` | |
| 2648 | |
| 2649 which returns 1 if no PNG support is available, else zero. | |
| 2650 | |
| 2651 Lastly, the version of the Zint library linked to is returned by: | |
| 2652 | |
| 2653 ```c | |
| 2654 int ZBarcode_Version(); | |
| 2655 ``` | |
| 2656 | |
| 2657 The version parts are separated by hundreds. For instance, version `"2.9.1"` is | |
| 2658 returned as `"20901"`. | |
| 2659 | |
| 2660 | |
| 2661 # 6. Types of Symbology | |
| 2662 | |
| 2663 ## 6.1 One-Dimensional Symbols | |
| 2664 | |
| 2665 One-dimensional or linear symbols are what most people associate with the term | |
| 2666 barcode. They consist of a number of bars and a number of spaces of differing | |
| 2667 widths. | |
| 2668 | |
| 2669 ### 6.1.1 Code 11 | |
| 2670 | |
| 2671 {.lin} | |
| 2672 | |
| 2673 Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5 Matrix and is | |
| 2674 primarily used in telecommunications. The symbol can encode data consisting of | |
| 2675 the digits 0-9 and the dash character (`-`) up to a maximum of 140 characters. | |
| 2676 Two modulo-11 check digits are added by default. To add just one check digit, | |
| 2677 set `--vers=1` (API `option_2 = 1`). To add no check digits, set `--vers=2` | |
| 2678 (API `option_2 = 2`). | |
| 2679 | |
| 2680 ### 6.1.2 Code 2 of 5 | |
| 2681 | |
| 2682 Code 2 of 5 is a family of one-dimensional symbols, 8 of which are supported by | |
| 2683 Zint. Note that the names given to these standards alters from one source to | |
| 2684 another so you should take care to ensure that you have the right barcode type | |
| 2685 before using these standards. | |
| 2686 | |
| 2687 #### 6.1.2.1 Standard Code 2 of 5 | |
| 2688 | |
| 2689 {.lin} | |
| 2690 | |
| 2691 Also known as Code 2 of 5 Matrix, this is a self-checking code used in | |
| 2692 industrial applications and photo development. Standard Code 2 of 5 will encode | |
| 2693 numeric input (digits 0-9) up to a maximum of 112 digits. No check digit is | |
| 2694 added by default. To add a check digit, set `--vers=1` (API `option_2 = 1`). To | |
| 2695 add a check digit but not show it in the Human Readable Text, set `--vers=2` | |
| 2696 (API `option_2 = 2`). | |
| 2697 | |
| 2698 #### 6.1.2.2 IATA Code 2 of 5 | |
| 2699 | |
| 2700 {.lin} | |
| 2701 | |
| 2702 Used for baggage handling in the air-transport industry by the International Air | |
| 2703 Transport Agency, this self-checking code will encode numeric input (digits 0-9) | |
| 2704 up to a maximum of 80 digits. No check digit is added by default, but can be set | |
| 2705 the same as for [6.1.2.1 Standard Code 2 of 5]. | |
| 2706 | |
| 2707 #### 6.1.2.3 Industrial Code 2 of 5 | |
| 2708 | |
| 2709 {.lin} | |
| 2710 | |
| 2711 Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a maximum of | |
| 2712 79 digits. No check digit is added by default, but can be set the same as for | |
| 2713 [6.1.2.1 Standard Code 2 of 5]. | |
| 2714 | |
| 2715 #### 6.1.2.4 Interleaved Code 2 of 5 (ISO 16390) | |
| 2716 | |
| 2717 {.lin} | |
| 2719 | |
| 2720 This self-checking symbology encodes pairs of numbers, and so can only encode an | |
| 2721 even number of digits (0-9). If an odd number of digits is entered a leading | |
| 2722 zero is added by Zint. A maximum of 62 pairs (124 digits) can be encoded. No | |
| 2723 check digit is added by default, but can be set the same as for [6.1.2.1 | |
| 2724 Standard Code 2 of 5]. | |
| 2725 | |
| 2726 #### 6.1.2.5 Code 2 of 5 Data Logic | |
| 2727 | |
| 2728 {.lin} | |
| 2729 | |
| 2730 Data Logic does not include a check digit by default and can encode numeric | |
| 2731 input (digits 0-9) up to a maximum of 113 digits. Check digit options are the | |
| 2732 same as for [6.1.2.1 Standard Code 2 of 5]. | |
| 2733 | |
| 2734 #### 6.1.2.6 ITF-14 | |
| 2735 | |
| 2736 {.lin} | |
| 2737 | |
| 2738 ITF-14, also known as UPC Shipping Container Symbol or Case Code, is based on | |
| 2739 Interleaved Code 2 of 5 and requires a 13-digit numeric input (digits 0-9). One | |
| 2740 modulo-10 check digit is added by Zint. | |
| 2741 | |
| 2742 If no border option is specified Zint defaults to adding a bounding box with a | |
| 2743 border width of 5. This behaviour can be overridden by using the `--bind` option | |
| 2744 (API `output_options |= BARCODE_BIND`). Similarly the border width can be | |
| 2745 overridden using `--border` (API `border_width`). If a symbol with no border is | |
| 2746 required this can be achieved by explicitly setting the border type to box (or | |
| 2747 bind or bindtop) and leaving the border width 0. | |
| 2748 | |
| 2749 {.lin} | |
| 2751 | |
| 2752 #### 6.1.2.7 Deutsche Post Leitcode | |
| 2753 | |
| 2754 {.lin} | |
| 2755 | |
| 2756 Leitcode is based on Interleaved Code 2 of 5 and is used by Deutsche Post for | |
| 2757 routing purposes. Leitcode requires a 13-digit numerical input to which Zint | |
| 2758 adds a check digit. | |
| 2759 | |
| 2760 #### 6.1.2.8 Deutsche Post Identcode | |
| 2761 | |
| 2762 {.lin} | |
| 2763 | |
| 2764 Identcode is based on Interleaved Code 2 of 5 and is used by Deutsche Post for | |
| 2765 identification purposes. Identcode requires an 11-digit numerical input to which | |
| 2766 Zint adds a check digit. | |
| 2767 | |
| 2768 \clearpage | |
| 2769 | |
| 2770 ### 6.1.3 UPC (Universal Product Code) (ISO 15420) | |
| 2771 | |
| 2772 #### 6.1.3.1 UPC Version A | |
| 2773 | |
| 2774 {.upcean} | |
| 2775 | |
| 2776 UPC-A is used in the United States for retail applications. The symbol requires | |
| 2777 an 11-digit article number. The check digit is calculated by Zint. In addition | |
| 2778 EAN-2 and EAN-5 add-on symbols can be added using the + character. For example, | |
| 2779 to draw a UPC-A symbol with the data 72527270270 with an EAN-5 add-on showing | |
| 2780 the data 12345 use the command: | |
| 2781 | |
| 2782 ```bash | |
| 2783 zint -b UPCA -d "72527270270+12345" | |
| 2784 ``` | |
| 2785 | |
| 2786 or using the API encode a data string with the + character included: | |
| 2787 | |
| 2788 ```c | |
| 2789 my_symbol->symbology = BARCODE_UPCA; | |
| 2790 error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0); | |
| 2791 ``` | |
| 2792 | |
| 2793 {.upcean} | |
| 2795 | |
| 2796 If your input data already includes the check digit symbology `BARCODE_UPCA_CHK` | |
| 2797 (35) can be used which takes a 12-digit input and validates the check digit | |
| 2798 before encoding. | |
| 2799 | |
| 2800 A quiet zone indicator can be added to the HRT by setting `--guardwhitespace` | |
| 2801 (API `output_options |= EANUPC_GUARD_WHITESPACE`). For UPC, this is only | |
| 2802 relevant when there is add-on: | |
| 2803 | |
| 2804 ```bash | |
| 2805 zint -b UPCA -d "72527270270+12345" --guardwhitespace | |
| 2806 ``` | |
| 2807 | |
| 2808 or using the API: | |
| 2809 | |
| 2810 ```c | |
| 2811 my_symbol->symbology = BARCODE_UPCA; | |
| 2812 my_symbol->output_options |= EANUPC_GUARD_WHITESPACE; | |
| 2813 error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0); | |
| 2814 ``` | |
| 2815 | |
| 2816 {.upcean} | |
| 2818 | |
| 2819 You can adjust the gap between the main symbol and an add-on in integral | |
| 2820 multiples of the X-dimension by setting `--addongap` (API `option_2`) to a value | |
| 2821 between 9 (default) and 12. The height in X-dimensions that the guard bars | |
| 2822 descend below the main bars can be adjusted by setting `--guarddescent` (API | |
| 2823 `guard_descent`) to a value between 0.0 and 20.0 (default 5.0). | |
| 2824 | |
| 2825 #### 6.1.3.2 UPC Version E | |
| 2826 | |
| 2827 {.upcean} | |
| 2828 | |
| 2829 UPC-E is a zero-compressed version of UPC-A developed for smaller packages. The | |
| 2830 code requires a 6-digit article number (digits 0-9). The check digit is | |
| 2831 calculated by Zint. EAN-2 and EAN-5 add-on symbols can be added using the + | |
| 2832 character as with UPC-A. In addition Zint also supports Number System 1 encoding | |
| 2833 by entering a 7-digit article number starting with the digit 1. For example: | |
| 2834 | |
| 2835 ```bash | |
| 2836 zint -b UPCE -d "1123456" | |
| 2837 ``` | |
| 2838 | |
| 2839 or | |
| 2840 | |
| 2841 ```c | |
| 2842 my_symbol->symbology = BARCODE_UPCE; | |
| 2843 error = ZBarcode_Encode_and_Print(my_symbol, "1123456", 0, 0); | |
| 2844 ``` | |
| 2845 | |
| 2846 If your input data already includes the check digit symbology `BARCODE_UPCE_CHK` | |
| 2847 (38) can be used which takes a 7 or 8-digit input and validates the check digit | |
| 2848 before encoding. | |
| 2849 | |
| 2850 As with UPC-A, a quiet zone indicator can be added when there is an add-on by | |
| 2851 setting `--guardwhitespace` (API `output_options |= EANUPC_GUARD_WHITESPACE`): | |
| 2852 | |
| 2853 ```bash | |
| 2854 zint -b UPCE -d "1123456+12" --guardwhitespace | |
| 2855 ``` | |
| 2856 | |
| 2857 {.upcean} | |
| 2859 | |
| 2860 You can adjust the gap between the main symbol and an add-on in integral | |
| 2861 multiples of the X-dimension by setting `--addongap` (API `option_2`) to a value | |
| 2862 between 7 (default) and 12. The height in X-dimensions that the guard bars | |
| 2863 descend below the main bars can be adjusted by setting `--guarddescent` (API | |
| 2864 `guard_descent`) to a value between 0.0 and 20.0 (default 5.0). | |
| 2865 | |
| 2866 ### 6.1.4 EAN (European Article Number) (ISO 15420) | |
| 2867 | |
| 2868 #### 6.1.4.1 EAN-2, EAN-5, EAN-8 and EAN-13 | |
| 2869 | |
| 2870 {.upcean} | |
| 2872 | |
| 2873 The EAN system is used in retail across Europe and includes standards for EAN-2, | |
| 2874 EAN-5, EAN-8 and EAN-13 which encode 2, 5, 7 or 12-digit numbers respectively. | |
| 2875 Zint will decide which symbology to use depending on the length of the input | |
| 2876 data. In addition EAN-2 and EAN-5 add-on symbols can be added to EAN-8 and | |
| 2877 EAN-13 symbols using the + character as with UPC symbols. For example: | |
| 2878 | |
| 2879 ```bash | |
| 2880 zint -b EANX -d "54321" | |
| 2881 ``` | |
| 2882 | |
| 2883 {.upcean} | |
| 2884 | |
| 2885 will encode a stand-alone EAN-5, whereas | |
| 2886 | |
| 2887 ```bash | |
| 2888 zint -b EANX -d "7432365+54321" | |
| 2889 ``` | |
| 2890 | |
| 2891 will encode an EAN-8 symbol with an EAN-5 add-on. As before these results can be | |
| 2892 achieved using the API: | |
| 2893 | |
| 2894 ```c | |
| 2895 my_symbol->symbology = BARCODE_EANX; | |
| 2896 | |
| 2897 error = ZBarcode_Encode_and_Print(my_symbol, "54321", 0, 0); | |
| 2898 | |
| 2899 error = ZBarcode_Encode_and_Print(my_symbol, "7432365+54321", 0, 0); | |
| 2900 ``` | |
| 2901 | |
| 2902 {.upcean} | |
| 2904 | |
| 2905 All of the EAN symbols include check digits which are added by Zint. | |
| 2906 | |
| 2907 If you are encoding an EAN-8 or EAN-13 symbol and your data already includes the | |
| 2908 check digit then you can use symbology `BARCODE_EANX_CHK` (14) which takes an 8 | |
| 2909 or 13-digit input and validates the check digit before encoding. | |
| 2910 | |
| 2911 Options to add quiet zone indicators and to adjust the add-on gap and the guard | |
| 2912 bar descent height are the same as for [6.1.3.2 UPC Version E]. For instance: | |
| 2913 | |
| 2914 ```bash | |
| 2915 zint -b EANX_CHK -d "74323654" --guardwhitespace | |
| 2916 ``` | |
| 2917 | |
| 2918 {.upcean} | |
| 2920 | |
| 2921 #### 6.1.4.2 SBN, ISBN and ISBN-13 | |
| 2922 | |
| 2923 {.upcean} | |
| 2925 | |
| 2926 EAN-13 symbols (also known as Bookland EAN-13) can also be produced from 9-digit | |
| 2927 SBN, 10-digit ISBN or 13-digit ISBN-13 data. The relevant check digit needs to | |
| 2928 be present in the input data and will be verified before the symbol is | |
| 2929 generated. | |
| 2930 | |
| 2931 As with EAN-13, a quiet zone indicator can be added using `--guardwhitespace`: | |
| 2932 | |
| 2933 {.upcean} | |
| 2935 | |
| 2936 EAN-2 and EAN-5 add-on symbols can be added using the + character, and there are | |
| 2937 options to adjust the add-on gap and the guard bar descent height - see [6.1.3.2 | |
| 2938 UPC Version E]. | |
| 2939 | |
| 2940 ### 6.1.5 Plessey | |
| 2941 | |
| 2942 #### 6.1.5.1 UK Plessey | |
| 2943 | |
| 2944 {.lin} | |
| 2945 | |
| 2946 Also known as Plessey Code, this symbology was developed by the Plessey Company | |
| 2947 Ltd. in the UK. The symbol can encode data consisting of digits (0-9) or letters | |
| 2948 A-F up to a maximum of 67 characters and includes a hidden CRC check digit. | |
| 2949 | |
| 2950 #### 6.1.5.2 MSI Plessey | |
| 2951 | |
| 2952 {.lin} | |
| 2953 | |
| 2954 Based on Plessey and developed by MSI Data Corporation, MSI Plessey can encode | |
| 2955 numeric (digits 0-9) input of up to 92 digits. It has a range of check digit | |
| 2956 options that are selectable by setting `--vers` (API `option_2`), shown in the | |
| 2957 table below: | |
| 2958 | |
| 2959 Value Check Digits | |
| 2960 ----- --------------------------- | |
| 2961 0 None | |
| 2962 1 Modulo-10 (Luhn) | |
| 2963 2 Modulo-10 & Modulo-10 | |
| 2964 3 Modulo-11 (IBM) | |
| 2965 4 Modulo-11 (IBM) & Modulo-10 | |
| 2966 5 Modulo-11 (NCR) | |
| 2967 6 Modulo-11 (NCR) & Modulo-10 | |
| 2968 | |
| 2969 Table: {#tbl:msi_plessey_check_digits tag=": MSI Plessey Check Digit Options"} | |
| 2970 | |
| 2971 To not show the check digit or digits in the Human Readable Text, add 10 to the | |
| 2972 `--vers` value. For example `--vers=12` (API `option_2 = 12`) will add two | |
| 2973 hidden modulo-10 check digits. | |
| 2974 | |
| 2975 ### 6.1.6 Telepen | |
| 2976 | |
| 2977 #### 6.1.6.1 Telepen Alpha | |
| 2978 | |
| 2979 {.lin} | |
| 2980 | |
| 2981 Telepen Alpha was developed by SB Electronic Systems Limited and can encode | |
| 2982 ASCII text input, up to a maximum of 69 characters. Telepen includes a | |
| 2983 hidden modulo-127 check digit, added by Zint. | |
| 2984 | |
| 2985 #### 6.1.6.2 Telepen Numeric | |
| 2986 | |
| 2987 {.lin} | |
| 2989 | |
| 2990 Telepen Numeric allows compression of numeric data into a Telepen symbol. Data | |
| 2991 can consist of pairs of numbers or pairs consisting of a numerical digit | |
| 2992 followed an X character. For example: 466333 and 466X33 are valid codes whereas | |
| 2993 46X333 is not (the digit pair `"X3"` is not valid). Up to 136 digits can be | |
| 2994 encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added | |
| 2995 by Zint. | |
| 2996 | |
| 2997 ### 6.1.7 Code 39 | |
| 2998 | |
| 2999 #### 6.1.7.1 Standard Code 39 (ISO 16388) | |
| 3000 | |
| 3001 {.lin} | |
| 3002 | |
| 3003 Standard Code 39 was developed in 1974 by Intermec. Input data can be up to 86 | |
| 3004 characters in length and can include the characters 0-9, A-Z, dash (`-`), full | |
| 3005 stop (`.`), space, asterisk (`*`), dollar (`$`), slash (`/`), plus (`+`) and | |
| 3006 percent (`%`). The standard does not require a check digit but a modulo-43 check | |
| 3007 digit can be added if desired by setting `--vers=1` (API `option_2 = 1`). To add | |
| 3008 a check digit but not show it in the Human Readable Text, set `--vers=2` (API | |
| 3009 `option_2 = 2`). | |
| 3010 | |
| 3011 \clearpage | |
| 3012 | |
| 3013 #### 6.1.7.2 Extended Code 39 | |
| 3014 | |
| 3015 {.lin} | |
| 3017 | |
| 3018 Also known as Code 39e and Code39+, this symbology expands on Standard Code 39 | |
| 3019 to provide support for the full 7-bit ASCII character set. The check digit | |
| 3020 options are the same as for [6.1.7.1 Standard Code 39 (ISO 16388)]. | |
| 3021 | |
| 3022 #### 6.1.7.3 Code 93 | |
| 3023 | |
| 3024 {.lin} | |
| 3025 | |
| 3026 A variation of Extended Code 39, Code 93 also supports full ASCII text, | |
| 3027 accepting up to 123 characters. Two check characters are added by Zint. By | |
| 3028 default these check characters are not shown in the Human Readable Text, but may | |
| 3029 be shown by setting `--vers=1` (API `option_2 = 1`). | |
| 3030 | |
| 3031 #### 6.1.7.4 PZN (Pharmazentralnummer) | |
| 3032 | |
| 3033 {.lin} | |
| 3034 | |
| 3035 PZN is a Code 39 based symbology used by the pharmaceutical industry in Germany. | |
| 3036 PZN encodes a 7-digit number to which Zint will add a modulo-11 check digit | |
| 3037 (PZN8). Input less than 7 digits will be zero-filled. An 8-digit input can be | |
| 3038 supplied in which case Zint will validate the check digit. | |
| 3039 | |
| 3040 To encode a PZN7 (obsolete since 2013) instead set `--vers=1` (API | |
| 3041 `option_2 = 1`) and supply up to 7 digits. As with PZN8, a modulo-11 check digit | |
| 3042 will be added or if 7 digits supplied the check digit validated. | |
| 3043 | |
| 3044 #### 6.1.7.5 LOGMARS | |
| 3045 | |
| 3046 {.lin} | |
| 3048 | |
| 3049 LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a | |
| 3050 variation of the Code 39 symbology used by the U.S. Department of Defense. | |
| 3051 LOGMARS encodes the same character set as [6.1.7.1 Standard Code 39 (ISO | |
| 3052 16388)], and the check digit options are also the same. Input is restricted to | |
| 3053 a maximum of 30 characters. | |
| 3054 | |
| 3055 #### 6.1.7.6 Code 32 | |
| 3056 | |
| 3057 {.lin} | |
| 3058 | |
| 3059 A variation of Code 39 used by the Italian Ministry of Health ("Ministero della | |
| 3060 Sanità") for encoding identifiers on pharmaceutical products. This symbology | |
| 3061 requires a numeric input up to 8 digits in length. A check digit is added by | |
| 3062 Zint. | |
| 3063 | |
| 3064 #### 6.1.7.7 HIBC Code 39 | |
| 3065 | |
| 3066 {.lin} | |
| 3067 | |
| 3068 This variant adds a leading `'+'` character and a trailing modulo-49 check digit | |
| 3069 to a standard Code 39 symbol as required by the Health Industry Barcode | |
| 3070 standards. | |
| 3071 | |
| 3072 #### 6.1.7.8 Vehicle Identification Number (VIN) | |
| 3073 | |
| 3074 {.lin} | |
| 3075 | |
| 3076 A variation of Code 39 that for vehicle identification numbers used in North | |
| 3077 America (first character `'1'` to `'5'`) has a check character verification | |
| 3078 stage. A 17 character input (0-9, and A-Z excluding `'I'`, `'O'` and `'Q'`) is | |
| 3079 required. An invisible Import character prefix `'I'` can be added by setting | |
| 3080 `--vers=1` (API `option_2 = 1`). | |
| 3081 | |
| 3082 ### 6.1.8 Codabar (EN 798) | |
| 3083 | |
| 3084 {.lin} | |
| 3085 | |
| 3086 Also known as NW-7, Monarch, ABC Codabar, USD-4, Ames Code and Code 27, this | |
| 3087 symbology was developed in 1972 by Monarch Marketing Systems for retail | |
| 3088 purposes. The American Blood Commission adopted Codabar in 1977 as the standard | |
| 3089 symbology for blood identification. Codabar can encode up to 103 characters | |
| 3090 starting and ending with the letters A-D and containing between these letters | |
| 3091 the numbers 0-9, dash (`-`), dollar (`$`), colon (`:`), slash (`/`), full stop | |
| 3092 (`.`) or plus (`+`). No check character is generated by default, but a modulo-16 | |
| 3093 one can be added by setting `--vers=1` (API `option_2 = 1`). To have the check | |
| 3094 character appear in the Human Readable Text, set `--vers=2` (API | |
| 3095 `option_2 = 2`). | |
| 3096 | |
| 3097 ### 6.1.9 Pharmacode | |
| 3098 | |
| 3099 {.lin} | |
| 3100 | |
| 3101 Developed by Laetus, Pharmacode is used for the identification of | |
| 3102 pharmaceuticals. The symbology is able to encode whole numbers between 3 and | |
| 3103 131070. | |
| 3104 | |
| 3105 ### 6.1.10 Code 128 | |
| 3106 | |
| 3107 #### 6.1.10.1 Standard Code 128 (ISO 15417) | |
| 3108 | |
| 3109 {.lin} | |
| 3110 | |
| 3111 One of the most ubiquitous one-dimensional barcode symbologies, Code 128 was | |
| 3112 developed in 1981 by Computer Identics. This symbology supports full ASCII text | |
| 3113 and uses a three-Code Set system to compress the data into a smaller symbol. | |
| 3114 Zint automatically switches between Code Sets A, B and C (but see below) and | |
| 3115 adds a hidden modulo-103 check digit. | |
| 3116 | |
| 3117 Code 128 is the default barcode symbology used by Zint. In addition Zint | |
| 3118 supports the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128 | |
| 3119 symbols. The ISO/IEC 8859-1 character set is shown in Annex [A.2 Latin Alphabet | |
| 3120 No. 1 (ISO/IEC 8859-1)]. | |
| 3121 | |
| 3122 Manual switching of Code Sets is possible using the `--extraesc` option (API | |
| 3123 `input_mode |= EXTRA_ESCAPE_MODE`), which apart from processing normal escape | |
| 3124 sequences also processes the Code 128-specific escapes `\^A`, `\^B`, `\^C` and | |
| 3125 `\^@` (the latter turns off manual Code Set selection). For instance the | |
| 3126 following will force switching to Code Set B for the data `"5678"` (normally | |
| 3127 Code Set C would be used throughout): | |
| 3128 | |
| 3129 ```bash | |
| 3130 zint -b CODE128 -d "1234\^B5678" --extraesc | |
| 3131 ``` | |
| 3132 | |
| 3133 The manually selected Code Set will apply until the next Code Set escape | |
| 3134 sequence or until a `\^@`, with the exception that data that cannot be | |
| 3135 represented in that Code Set will be switched as appropriate. If the data | |
| 3136 contains an extra escape sequence, it can be escaped by doubling the caret | |
| 3137 (`^`). For instance | |
| 3138 | |
| 3139 ```bash | |
| 3140 zint -b CODE128 -d "\^AABC\^^BDEF" --extraesc | |
| 3141 ``` | |
| 3142 | |
| 3143 will encode the data `"ABC\^BDEF"` in Code Set A. | |
| 3144 | |
| 3145 There is also the extra escape `\^1`, which will encode a special Function Code | |
| 3146 1 character (FNC1) anywhere you chose in the data, for instance | |
| 3147 | |
| 3148 ```bash | |
| 3149 zint -b CODE128 -d "A\^1BC\^1DEF" --extraesc | |
| 3150 ``` | |
| 3151 | |
| 3152 Zint can encode a maximum of 102 symbol characters, which allows for e.g. 202 | |
| 3153 all-numeric or 101 all-uppercase characters. Sizes above 120 digits (60 | |
| 3154 alphanumerics) are not recommended. | |
| 3155 | |
| 3156 #### 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only) | |
| 3157 | |
| 3158 {.lin} | |
| 3159 | |
| 3160 It is sometimes advantageous to stop Code 128 from using Code Set C which | |
| 3161 compresses numerical data. The `BARCODE_CODE128AB`[^14] variant (symbology 60) | |
| 3162 suppresses Code Set C in favour of Code Sets A and B. | |
| 3163 | |
| 3164 Note that the special extra escapes mentioned above are not available for this | |
| 3165 variant (nor for any other). | |
| 3166 | |
| 3167 [^14]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is | |
| 3168 still recognised. | |
| 3169 | |
| 3170 #### 6.1.10.3 GS1-128 | |
| 3171 | |
| 3172 ![`zint -b GS1_128 --compliantheight -d | |
| 3173 "[01]98898765432106[3202]012345[15]991231"`](images/gs1_128.svg){.lin} | |
| 3174 | |
| 3175 A variation of Code 128 previously known as UCC/EAN-128, this symbology is | |
| 3176 defined by the GS1 General Specifications. Application Identifiers (AIs) should | |
| 3177 be entered using [square bracket] notation. These will be converted to | |
| 3178 parentheses (round brackets) for the Human Readable Text. This will allow round | |
| 3179 brackets to be used in the data strings to be encoded. | |
| 3180 | |
| 3181 For compatibility with data entry in other systems, if the data does not include | |
| 3182 round brackets, the option `--gs1parens` (API `input_mode |= GS1PARENS_MODE`) | |
| 3183 may be used to signal that AIs are encased in round brackets instead of square | |
| 3184 ones. | |
| 3185 | |
| 3186 Fixed length data should be entered at the appropriate length for correct | |
| 3187 encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. | |
| 3188 Check digits for GTIN data AI (01) are not generated and need to be included in | |
| 3189 the input data. The following is an example of a valid GS1-128 input: | |
| 3190 | |
| 3191 ```bash | |
| 3192 zint -b 16 -d "[01]98898765432106[3202]012345[15]991231" | |
| 3193 ``` | |
| 3194 | |
| 3195 or using the `--gs1parens` option: | |
| 3196 | |
| 3197 ```bash | |
| 3198 zint -b 16 --gs1parens -d "(01)98898765432106(3202)012345(15)991231" | |
| 3199 ``` | |
| 3200 | |
| 3201 #### 6.1.10.4 EAN-14 | |
| 3202 | |
| 3203 {.lin} | |
| 3204 | |
| 3205 A shorter version of GS1-128 which encodes GTIN data only. A 13-digit number is | |
| 3206 required. The GTIN check digit and HRT-only AI "(01)" are added by Zint. | |
| 3207 | |
| 3208 #### 6.1.10.5 NVE-18 (SSCC-18) | |
| 3209 | |
| 3210 {.lin} | |
| 3212 | |
| 3213 A variation of Code 128 the 'Nummer der Versandeinheit' standard, also known as | |
| 3214 SSCC-18 (Serial Shipping Container Code), includes both a visible modulo-10 and | |
| 3215 a hidden modulo-103 check digit. NVE-18 requires a 17-digit numerical input. | |
| 3216 Check digits and HRT-only AI "(00)" are added by Zint. | |
| 3217 | |
| 3218 #### 6.1.10.6 HIBC Code 128 | |
| 3219 | |
| 3220 {.lin} | |
| 3221 | |
| 3222 This option adds a leading `'+'` character and a trailing modulo-49 check digit | |
| 3223 to a standard Code 128 symbol as required by the Health Industry Barcode | |
| 3224 standards. | |
| 3225 | |
| 3226 #### 6.1.10.7 DPD Code | |
| 3227 | |
| 3228 {.lin} | |
| 3230 | |
| 3231 Another variation of Code 128 as used by DPD (Deutscher Paketdienst). Requires a | |
| 3232 27 or 28 character input. For 28 character input, the first character is an | |
| 3233 identification tag (Barcode ID), which should usually be `"%"` (ASCII 37). If 27 | |
| 3234 characters are supplied, `"%"` will be prefixed by Zint (except if marked as a | |
| 3235 "relabel", see below). The rest of the 27-character input must be alphanumeric, | |
| 3236 and is of the form: | |
| 3237 | |
| 3238 ----------------------------------------------------------------------- | |
| 3239 Destination Post Tracking Number Service Destination Country | |
| 3240 Code Code Code | |
| 3241 ----------------- ------------------ ---------- -------------------- | |
| 3242 PPPPPPP TTTTTTTTTTTTTT SSS CCC | |
| 3243 (7 alphanumerics) (14 alphanumerics) (3 digits) (3-digit ISO 3166-1) | |
| 3244 ----------------------------------------------------------------------- | |
| 3245 | |
| 3246 Table: {#tbl:dpd_input_fields tag=": DPD Input Fields"} | |
| 3247 | |
| 3248 A warning will be generated if the Service Code, the Destination Country Code, | |
| 3249 or the last 10 characters of the Tracking Number are non-numeric. | |
| 3250 | |
| 3251 Zint formats the Human Readable Text as specified by DPD, leaving out the | |
| 3252 identication tag, and adds a modulo-36 check character to the text (not to the | |
| 3253 barcode itself), thus: | |
| 3254 | |
| 3255 `PPPP PPP TTTT TTTT TTTT TT SSS CCC D` | |
| 3256 | |
| 3257 By default a top boundary bar is added, with default width 3X. The width can be | |
| 3258 overridden using `--border` (API `border_width`). For a symbol with no top | |
| 3259 boundary bar, explicitly set the border type to bindtop (or bind or box) and | |
| 3260 leave the border width 0. | |
| 3261 | |
| 3262 A DPD Code can be marked as a "relabel" by specifying `--vers=1` (API | |
| 3263 `option_2 = 1`), which omits the identification tag and prints the barcode at | |
| 3264 half height. In this case, an input of 27 alphanumeric characters is required. | |
| 3265 | |
| 3266 \clearpage | |
| 3267 | |
| 3268 #### 6.1.10.8 UPU S10 | |
| 3269 | |
| 3270 {.lin} | |
| 3272 | |
| 3273 The Universal Postal Union S10 variant of Code 128 encodes 13 characters in the | |
| 3274 format `"SSNNNNNNNNXCC"`, where `"SS"` is a two-character alphabetic service | |
| 3275 indicator, `"NNNNNNNN"` is an 8-digit serial number, `"X"` is a modulo-11 check | |
| 3276 digit, and `"CC"` is a two-character ISO 3166-1 country code. | |
| 3277 | |
| 3278 The check digit may be omitted in which case Zint will add it. Warnings will be | |
| 3279 generated if the service indicator is non-standard or the country code is not | |
| 3280 ISO 3361-1. | |
| 3281 | |
| 3282 ### 6.1.11 GS1 DataBar (ISO 24724) | |
| 3283 | |
| 3284 Previously known as RSS (Reduced Spaced Symbology), these symbols are due to | |
| 3285 replace GS1-128 symbols in accordance with the GS1 General Specifications. If a | |
| 3286 GS1 DataBar symbol is to be printed with a 2D component as specified in ISO/IEC | |
| 3287 24723 set `--mode=2` (API `option_1 = 2`). See [6.3 GS1 Composite Symbols (ISO | |
| 3288 24723)] to find out how to generate DataBar symbols with 2D components. | |
| 3289 | |
| 3290 #### 6.1.11.1 GS1 DataBar Omnidirectional and GS1 DataBar Truncated | |
| 3291 | |
| 3292 {.lin} | |
| 3294 | |
| 3295 Previously known as RSS-14 this standard encodes a 13-digit item code. A check | |
| 3296 digit and HRT-only Application Identifier of "(01)" are added by Zint. (A | |
| 3297 14-digit code that appends the check digit may be given, in which case the check | |
| 3298 digit will be verified.) | |
| 3299 | |
| 3300 GS1 DataBar Omnidirectional symbols should have a height of 33 or greater. To | |
| 3301 produce a GS1 DataBar Truncated symbol set the symbol height to a value between | |
| 3302 13 and 32. Truncated symbols may not be scannable by omnidirectional scanners. | |
| 3303 | |
| 3304 {.lin} | |
| 3306 | |
| 3307 #### 6.1.11.2 GS1 DataBar Limited | |
| 3308 | |
| 3309 {.lin} | |
| 3311 | |
| 3312 Previously known as RSS Limited this standard encodes a 13-digit item code and | |
| 3313 can be used in the same way as GS1 DataBar Omnidirectional above. GS1 DataBar | |
| 3314 Limited, however, is limited to data starting with digits 0 and 1 (i.e. numbers | |
| 3315 in the range 0 to 1999999999999). As with GS1 DataBar Omnidirectional a check | |
| 3316 digit and HRT-only Application Identifier of "(01)" are added by Zint, and a | |
| 3317 14-digit code may be given in which case the check digit will be verified. | |
| 3318 | |
| 3319 #### 6.1.11.3 GS1 DataBar Expanded | |
| 3320 | |
| 3321 ![`zint -b DBAR_EXP --compliantheight -d | |
| 3322 "[01]98898765432106[3202]012345[15]991231"`](images/dbar_exp.svg){.lin} | |
| 3323 | |
| 3324 Previously known as RSS Expanded this is a variable length symbology capable of | |
| 3325 encoding data from a number of AIs in a single symbol. AIs should be encased in | |
| 3326 [square brackets] in the input data, which will be converted to parentheses | |
| 3327 (round brackets) before being included in the Human Readable Text attached to | |
| 3328 the symbol. This method allows the inclusion of parentheses in the data to be | |
| 3329 encoded. If the data does not include parentheses, the AIs may alternatively be | |
| 3330 encased in parentheses using the `--gs1parens` switch. See [6.1.10.3 GS1-128]. | |
| 3331 | |
| 3332 GTIN data AI (01) should also include the check digit data as this is not | |
| 3333 calculated by Zint when this symbology is encoded. Fixed length data should be | |
| 3334 entered at the appropriate length for correct encoding. The following is an | |
| 3335 example of a valid GS1 DataBar Expanded input: | |
| 3336 | |
| 3337 ```bash | |
| 3338 zint -b 31 -d "[01]98898765432106[3202]012345[15]991231" | |
| 3339 ``` | |
| 3340 | |
| 3341 ### 6.1.12 Korea Post Barcode | |
| 3342 | |
| 3343 {.lin} | |
| 3344 | |
| 3345 The Korean Postal Barcode is used to encode a 6-digit number and includes one | |
| 3346 check digit. | |
| 3347 | |
| 3348 ### 6.1.13 Channel Code | |
| 3349 | |
| 3350 {.lin} | |
| 3351 | |
| 3352 A highly compressed symbol for numeric data. The number of channels in the | |
| 3353 symbol can be between 3 and 8 and this can be specified by setting the value of | |
| 3354 the `--vers` option (API `option_2`). It can also be determined by the length of | |
| 3355 the input data: e.g. a three character input string generates a 4 channel code | |
| 3356 by default. | |
| 3357 | |
| 3358 The maximum values permitted depend on the number of channels used as shown in | |
| 3359 the table below: | |
| 3360 | |
| 3361 | Channels | Minimum Value | Maximum Value | |
| 3362 |:---------|:--------------|:------------- | |
| 3363 | 3 | 00 | 26 | |
| 3364 | 4 | 000 | 292 | |
| 3365 | 5 | 0000 | 3493 | |
| 3366 | 6 | 00000 | 44072 | |
| 3367 | 7 | 000000 | 576688 | |
| 3368 | 8 | 0000000 | 7742862 | |
| 3369 | |
| 3370 Table: {#tbl:channel_maxima tag=": Channel Value Ranges"} | |
| 3371 | |
| 3372 ### 6.1.14 BC412 (SEMI T1-95) | |
| 3373 | |
| 3374 {.lin} | |
| 3375 | |
| 3376 Designed by IBM for marking silicon wafers, each BC412 character is represented | |
| 3377 by 4 bars of a single size, interleaved with 4 spaces of varying sizes that | |
| 3378 total 8 (hence 4 bars in 12). Zint implements the SEMI T1-95 standard, where | |
| 3379 input must be alphanumeric, excluding the letter `O`, and must be from 7 to 18 | |
| 3380 characters in length. A single check character is added by Zint, appearing in | |
| 3381 the 2nd character position. Lowercase input is automatically made uppercase. | |
| 3382 | |
| 3383 \clearpage | |
| 3384 | |
| 3385 ## 6.2 Stacked Symbologies | |
| 3386 | |
| 3387 ### 6.2.1 Basic Symbol Stacking | |
| 3388 | |
| 3389 An early innovation to get more information into a symbol, used primarily in the | |
| 3390 vehicle industry, is to simply stack one-dimensional codes on top of each other. | |
| 3391 This can be achieved at the command prompt by giving more than one set of input | |
| 3392 data. For example | |
| 3393 | |
| 3394 ```bash | |
| 3395 zint -d "This" -d "That" | |
| 3396 ``` | |
| 3397 | |
| 3398 will draw two Code 128 symbols, one on top of the other. The same result can be | |
| 3399 achieved using the API by executing the `ZBarcode_Encode()` function more than | |
| 3400 once on a symbol. For example: | |
| 3401 | |
| 3402 ```c | |
| 3403 my_symbol->symbology = BARCODE_CODE128; | |
| 3404 | |
| 3405 error = ZBarcode_Encode(my_symbol, "This", 0); | |
| 3406 | |
| 3407 error = ZBarcode_Encode(my_symbol, "That", 0); | |
| 3408 | |
| 3409 error = ZBarcode_Print(my_symbol); | |
| 3410 ``` | |
| 3411 | |
| 3412 {.lin} | |
| 3413 | |
| 3414 Note that the Human Readable Text will be that of the last data, so it's best to | |
| 3415 use the option `--notext` (API `show_hrt = 0`). | |
| 3416 | |
| 3417 The stacked barcode rows can be separated by row separator bars by specifying | |
| 3418 `--bind` (API `output_options |= BARCODE_BIND`). The height of the row separator | |
| 3419 bars in integral multiples of the X-dimension (minimum and default 1, maximum 4) | |
| 3420 can be set by `--separator` (API `option_3`): | |
| 3421 | |
| 3422 ```bash | |
| 3423 zint --bind --notext --separator=2 -d "This" -d "That" | |
| 3424 ``` | |
| 3425 | |
| 3426 {.lin} | |
| 3428 | |
| 3429 A more sophisticated method is to use some type of line indexing which indicates | |
| 3430 to the barcode reader which order the stacked symbols should be read in. This is | |
| 3431 demonstrated by the symbologies below. | |
| 3432 | |
| 3433 ### 6.2.2 Codablock-F | |
| 3434 | |
| 3435 {.lin} | |
| 3437 | |
| 3438 This is a stacked symbology based on Code 128 which can encode Latin-1 data up | |
| 3439 to a maximum length of 2726 symbol characters, meaning for instance up to 2726 | |
| 3440 all ASCII characters, or 5452 all numeric, or up to 1363 all extended ASCII | |
| 3441 (ISO/IEC 8859-1). | |
| 3442 | |
| 3443 The width of the Codablock-F symbol can be set using the `--cols` option (API | |
| 3444 `option_2`), to a value between 9 and 67. The height (number of rows) can be set | |
| 3445 using the `--rows` option (API `option_1`), with a maximum of 44. Zint does not | |
| 3446 currently support encoding of GS1 data in Codablock-F symbols. | |
| 3447 | |
| 3448 A separate symbology ID (`BARCODE_HIBC_BLOCKF`) can be used to encode Health | |
| 3449 Industry Barcode (HIBC) data which adds a leading `'+'` character and a | |
| 3450 modulo-49 check digit to the encoded data. | |
| 3451 | |
| 3452 ### 6.2.3 Code 16K (EN 12323) | |
| 3453 | |
| 3454 {.lin} | |
| 3456 | |
| 3457 Code 16K uses a Code 128 based system which can stack up to 16 rows in a block. | |
| 3458 This gives a maximum data capacity of 77 characters or 154 numerical digits and | |
| 3459 includes two modulo-107 check digits. Code 16K also supports ISO/IEC 8859-1 | |
| 3460 character encoding in the same manner as Code 128. GS1 data encoding is also | |
| 3461 supported. The minimum number of rows to use can be set using the `--rows` | |
| 3462 option (API `option_1`), with values from 2 to 16. | |
| 3463 | |
| 3464 ### 6.2.4 PDF417 (ISO 15438) | |
| 3465 | |
| 3466 {.lin} | |
| 3467 | |
| 3468 Heavily used in the parcel industry, the PDF417 symbology can encode a vast | |
| 3469 amount of data into a small space. Zint supports encoding up to the ISO standard | |
| 3470 maximum symbol size of 925 codewords which (at error correction level 0) allows | |
| 3471 a maximum data size of 1850 text characters, or 2710 digits. | |
| 3472 | |
| 3473 The width of the generated PDF417 symbol can be specified at the command line | |
| 3474 using the `--cols` switch (API `option_2`) followed by a number between 1 and | |
| 3475 30, the number of rows using the `--rows` switch (API `option_3`) followed by a | |
| 3476 number between 3 and 90, and the amount of error correction information can be | |
| 3477 specified by using the `--secure` switch (API `option_1`) followed by a number | |
| 3478 between 0 and 8 where the number of codewords used for error correction is | |
| 3479 determined by `2^(value + 1)`. The default level of error correction is | |
| 3480 determined by the amount of data being encoded. | |
| 3481 | |
| 3482 This symbology uses Latin-1 character encoding by default but also supports the | |
| 3483 ECI encoding mechanism. A separate symbology ID (`BARCODE_HIBC_PDF`) can be used | |
| 3484 to encode Health Industry Barcode (HIBC) data. | |
| 3485 | |
| 3486 For a faster but less optimal encoding, the `--fast` option (API `input_mode |= | |
| 3487 FAST_MODE`) may be used. | |
| 3488 | |
| 3489 PDF417 supports Structured Append of up to 99,999 symbols and an optional | |
| 3490 numeric ID of up to 30 digits, which can be set by using the `--structapp` | |
| 3491 option (see [4.17 Structured Append]) (API `structapp`). The ID consists of up | |
| 3492 to 10 triplets, each ranging from `"000"` to `"899"`. For instance `"123456789"` | |
| 3493 would be a valid ID of 3 triplets. However `"123456900"` would not, as the last | |
| 3494 triplet `"900"` exceeds `"899"`. The triplets are 0-filled, for instance | |
| 3495 `"1234"` becomes `"123004"`. If an ID is not given, no ID is encoded. | |
| 3496 | |
| 3497 ### 6.2.5 Compact PDF417 (ISO 15438) | |
| 3498 | |
| 3499 {.lin} | |
| 3500 | |
| 3501 Previously known as Truncated PDF417, Compact PDF417 omits some per-row overhead | |
| 3502 to produce a narrower but less robust symbol. Options are the same as for PDF417 | |
| 3503 above. | |
| 3504 | |
| 3505 ### 6.2.6 MicroPDF417 (ISO 24728) | |
| 3506 | |
| 3507 {.lin} | |
| 3508 | |
| 3509 A variation of the PDF417 standard, MicroPDF417 is intended for applications | |
| 3510 where symbol size needs to be kept to a minimum. 34 predefined symbol sizes are | |
| 3511 available with 1 - 4 columns and 4 - 44 rows. The maximum amount a MicroPDF417 | |
| 3512 symbol can hold is 250 alphanumeric characters or 366 digits. The amount of | |
| 3513 error correction used is dependent on symbol size. The number of columns used | |
| 3514 can be determined using the `--cols` switch (API `option_2`) as with PDF417. | |
| 3515 | |
| 3516 This symbology uses Latin-1 character encoding by default but also supports the | |
| 3517 ECI encoding mechanism. A separate symbology ID (`BARCODE_HIBC_MICPDF`) can be | |
| 3518 used to encode Health Industry Barcode (HIBC) data. MicroPDF417 supports | |
| 3519 `FAST_MODE` and Structured Append the same as PDF417, for which see details. | |
| 3520 | |
| 3521 ### 6.2.7 GS1 DataBar Stacked (ISO 24724) | |
| 3522 | |
| 3523 #### 6.2.7.1 GS1 DataBar Stacked | |
| 3524 | |
| 3525 {.lin} | |
| 3527 | |
| 3528 A stacked variation of the GS1 DataBar Truncated symbol requiring the same input | |
| 3529 (see [6.1.11.1 GS1 DataBar Omnidirectional and GS1 DataBar Truncated]), this | |
| 3530 symbol is the same as the following GS1 DataBar Stacked Omnidirectional symbol | |
| 3531 except that its height is reduced and its central separator is a single row, | |
| 3532 making it suitable for small items when omnidirectional scanning is not | |
| 3533 required. It can be generated with a two-dimensional component to make a | |
| 3534 composite symbol. | |
| 3535 | |
| 3536 #### 6.2.7.2 GS1 DataBar Stacked Omnidirectional | |
| 3537 | |
| 3538 {.lin} | |
| 3540 | |
| 3541 A stacked variation of the GS1 DataBar Omnidirectional symbol requiring the same | |
| 3542 input (see [6.1.11.1 GS1 DataBar Omnidirectional and GS1 DataBar Truncated]). | |
| 3543 The data is encoded in two rows of bars with a central 3-row separator. This | |
| 3544 symbol can be generated with a two-dimensional component to make a composite | |
| 3545 symbol. | |
| 3546 | |
| 3547 #### 6.2.7.3 GS1 DataBar Expanded Stacked | |
| 3548 | |
| 3549 ![`zint -b DBAR_EXPSTK --compliantheight -d | |
| 3550 "[01]98898765432106[3202]012345[15]991231"`](images/dbar_expstk.svg){.lin} | |
| 3551 | |
| 3552 A stacked variation of the GS1 DataBar Expanded symbol for smaller packages. | |
| 3553 Input is the same as for GS1 DataBar Expanded (see [6.1.11.3 GS1 DataBar | |
| 3554 Expanded]). In addition the width of the symbol can be altered using the | |
| 3555 `--cols` switch (API `option_2`). In this case the number of columns (values 1 | |
| 3556 to 11) relates to the number of character pairs on each row of the symbol. | |
| 3557 Alternatively the `--rows` switch (API `option_3`) can be used to specify the | |
| 3558 maximum number of rows (values 2 to 11), and the number of columns will be | |
| 3559 adjusted accordingly. This symbol can be generated with a two-dimensional | |
| 3560 component to make a composite symbol. For symbols with a 2D component the number | |
| 3561 of columns must be at least 2. | |
| 3562 | |
| 3563 ### 6.2.8 Code 49 | |
| 3564 | |
| 3565 {.lin} | |
| 3567 | |
| 3568 Developed in 1987 at Intermec, Code 49 is a cross between UPC and Code 39. It is | |
| 3569 one of the earliest stacked symbologies and influenced the design of Code 16K a | |
| 3570 few years later. It supports full 7-bit ASCII input up to a maximum of 49 | |
| 3571 characters or 81 numeric digits. GS1 data encoding is also supported. The | |
| 3572 minimum number of rows to use can be set using the `--rows` option (API | |
| 3573 `option_1`), with values from 2 to 8. | |
| 3574 | |
| 3575 \clearpage | |
| 3576 | |
| 3577 ## 6.3 GS1 Composite Symbols (ISO 24723) | |
| 3578 | |
| 3579 GS1 Composite symbols employ a mixture of components to give more comprehensive | |
| 3580 information about a product. The permissible contents of a composite symbol is | |
| 3581 determined by the terms of the GS1 General Specifications. Composite symbols | |
| 3582 consist of a linear component which can be an EAN, UPC, GS1-128 or GS1 DataBar | |
| 3583 symbol, a two-dimensional (2D) component which is based on PDF417 or | |
| 3584 MicroPDF417, and a separator pattern. The type of linear component to be used is | |
| 3585 determined using the `-b` or `--barcode` switch (API `symbology`) as with other | |
| 3586 encoding methods. Valid values are shown below. | |
| 3587 | |
| 3588 --------------------------------------------------------------------------- | |
| 3589 Numeric Name Barcode Name | |
| 3590 Value | |
| 3591 ------- ------------------------ ---------------------------------------- | |
| 3592 130 `BARCODE_EANX_CC` GS1 Composite Symbol with EAN linear | |
| 3593 component | |
| 3594 | |
| 3595 131 `BARCODE_GS1_128_CC` GS1 Composite Symbol with GS1-128 linear | |
| 3596 component | |
| 3597 | |
| 3598 132 `BARCODE_DBAR_OMN_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3599 Omnidirectional linear component | |
| 3600 | |
| 3601 133 `BARCODE_DBAR_LTD_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3602 Limited linear component | |
| 3603 | |
| 3604 134 `BARCODE_DBAR_EXP_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3605 Expanded linear component | |
| 3606 | |
| 3607 135 `BARCODE_UPCA_CC` GS1 Composite Symbol with UPC-A linear | |
| 3608 component | |
| 3609 | |
| 3610 136 `BARCODE_UPCE_CC` GS1 Composite Symbol with UPC-E linear | |
| 3611 component | |
| 3612 | |
| 3613 137 `BARCODE_DBAR_STK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3614 Stacked component | |
| 3615 | |
| 3616 138 `BARCODE_DBAR_OMNSTK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3617 Stacked Omnidirectional component | |
| 3618 | |
| 3619 139 `BARCODE_DBAR_EXPSTK_CC` GS1 Composite Symbol with GS1 DataBar | |
| 3620 Expanded Stacked component | |
| 3621 --------------------------------------------------------------------------- | |
| 3622 | |
| 3623 Table: {#tbl:composite_symbologies tag=": GS1 Composite Symbology Values"} | |
| 3624 | |
| 3625 The data to be encoded in the linear component of a composite symbol should be | |
| 3626 entered into a primary string with the data for the 2D component being entered | |
| 3627 in the normal way. To do this at the command prompt use the `--primary` switch | |
| 3628 (API `primary`). For example: | |
| 3629 | |
| 3630 ```bash | |
| 3631 zint -b EANX_CC --mode=1 --primary=331234567890 -d "[99]1234-abcd" | |
| 3632 ``` | |
| 3633 | |
| 3634 This creates an EAN-13 linear component with the data `"331234567890"` and a 2D | |
| 3635 CC-A (see [below][6.3.1 CC-A]) component with the data `"(99)1234-abcd"`. The | |
| 3636 same results can be achieved using the API as shown below: | |
| 3637 | |
| 3638 ```c | |
| 3639 my_symbol->symbology = BARCODE_EANX_CC; | |
| 3640 | |
| 3641 my_symbol->option_1 = 1; | |
| 3642 | |
| 3643 strcpy(my_symbol->primary, "331234567890"); | |
| 3644 | |
| 3645 ZBarcode_Encode_and_Print(my_symbol, "[99]1234-abcd", 0, 0); | |
| 3646 ``` | |
| 3647 | |
| 3648 EAN-2 and EAN-5 add-on data can be used with EAN and UPC symbols using the + | |
| 3649 symbol as described in sections [6.1.3 UPC (Universal Product Code) (ISO 15420)] | |
| 3650 and [6.1.4 EAN (European Article Number) (ISO 15420)]. | |
| 3651 | |
| 3652 The 2D component of a composite symbol can use one of three systems: CC-A, CC-B | |
| 3653 and CC-C, as described below. The 2D component type can be selected | |
| 3654 automatically by Zint dependent on the length of the input string. Alternatively | |
| 3655 the three methods can be accessed using the `--mode` prompt (API `option_1`) | |
| 3656 followed by 1, 2 or 3 for CC-A, CC-B or CC-C respectively. | |
| 3657 | |
| 3658 ### 6.3.1 CC-A | |
| 3659 | |
| 3660 ![`zint -b EANX_CC --compliantheight -d "[99]1234-abcd" --mode=1 | |
| 3661 --primary=331234567890`](images/eanx_cc_a.svg){.upcean} | |
| 3662 | |
| 3663 This system uses a variation of MicroPDF417 which is optimised to fit into a | |
| 3664 small space. The size of the 2D component and the amount of error correction is | |
| 3665 determined by the amount of data to be encoded and the type of linear component | |
| 3666 which is being used. CC-A can encode up to 56 numeric digits or an alphanumeric | |
| 3667 string of shorter length. To select CC-A use `--mode=1` (API `option_1 = 1`). | |
| 3668 | |
| 3669 ### 6.3.2 CC-B | |
| 3670 | |
| 3671 ![`zint -b EANX_CC --compliantheight -d "[99]1234-abcd" --mode=2 | |
| 3672 --primary=331234567890`](images/eanx_cc_b.svg){.upcean} | |
| 3673 | |
| 3674 This system uses MicroPDF417 to encode the 2D component. The size of the 2D | |
| 3675 component and the amount of error correction is determined by the amount of data | |
| 3676 to be encoded and the type of linear component which is being used. CC-B can | |
| 3677 encode up to 338 numeric digits or an alphanumeric string of shorter length. To | |
| 3678 select CC-B use `--mode=2` (API `option_1 = 2`). | |
| 3679 | |
| 3680 ### 6.3.3 CC-C | |
| 3681 | |
| 3682 ![`zint -b GS1_128_CC --compliantheight -d "[99]1234-abcd" --mode=3 | |
| 3683 --primary="[01]03312345678903"`](images/gs1_128_cc_c.svg){.upcean} | |
| 3684 | |
| 3685 This system uses PDF417 and can only be used in conjunction with a GS1-128 | |
| 3686 linear component. CC-C can encode up to 2361 numeric digits or an alphanumeric | |
| 3687 string of shorter length. To select CC-C use `--mode=3` (API `option_1 = 3`). | |
| 3688 | |
| 3689 \clearpage | |
| 3690 | |
| 3691 ## 6.4 Two-Track Symbols | |
| 3692 | |
| 3693 ### 6.4.1 Two-Track Pharmacode | |
| 3694 | |
| 3695 {.trk} | |
| 3697 | |
| 3698 Developed by Laetus, Pharmacode Two-Track is an alternative system to Pharmacode | |
| 3699 One-Track (see [6.1.9 Pharmacode]) used for the identification of | |
| 3700 pharmaceuticals. The symbology is able to encode whole numbers between 4 and | |
| 3701 64570080. | |
| 3702 | |
| 3703 ### 6.4.2 POSTNET | |
| 3704 | |
| 3705 {.trk} | |
| 3707 | |
| 3708 Used by the United States Postal Service until 2009, the POSTNET barcode was | |
| 3709 used for encoding zip-codes on mail items. POSTNET uses numerical input data and | |
| 3710 includes a modulo-10 check digit. While Zint will encode POSTNET symbols of up | |
| 3711 to 38 digits in length, standard lengths as used by USPS were `PostNet6` | |
| 3712 (5-digit ZIP input), `PostNet10` (5-digit ZIP + 4-digit user data) and | |
| 3713 `PostNet12` (5-digit ZIP + 6-digit user data), and a warning will be issued if | |
| 3714 the input length is not one of these. | |
| 3715 | |
| 3716 ### 6.4.3 PLANET | |
| 3717 | |
| 3718 {.trk} | |
| 3720 | |
| 3721 Used by the United States Postal Service until 2009, the PLANET (Postal Alpha | |
| 3722 Numeric Encoding Technique) barcode was used for encoding routing data on mail | |
| 3723 items. PLANET uses numerical input data and includes a modulo-10 check digit. | |
| 3724 While Zint will encode PLANET symbols of up to 38 digits in length, standard | |
| 3725 lengths used by USPS were `Planet12` (11-digit input) and `Planet14` (13-digit | |
| 3726 input), and as with POSTNET a warning will be issued if the length is not one of | |
| 3727 these. | |
| 3728 | |
| 3729 ### 6.4.4 Brazilian CEPNet | |
| 3730 | |
| 3731 {.trk} | |
| 3732 | |
| 3733 Based on POSTNET, the CEPNet symbol is used by Correios, the Brazilian postal | |
| 3734 service, to encode CEP (Código de Endereçamento Postal) numbers on mail items. | |
| 3735 Input should consist of eight digits with the check digit being automatically | |
| 3736 added by Zint. | |
| 3737 | |
| 3738 ### 6.4.5 DX Film Edge Barcode | |
| 3739 | |
| 3740 {.trk} | |
| 3742 | |
| 3743 Introduced by Kodak in the 1980s, the DX (Digital Index) barcode is printed on | |
| 3744 the bottom edge of 35mm film to aid in the reordering and post-processing of | |
| 3745 prints. | |
| 3746 | |
| 3747 The data can be in two parts. The first part (required) is the "DX number", | |
| 3748 identifying the manufacturer and film type - the National Association of | |
| 3749 Photographic Manufacturers (NAPM) number. The second part, which is | |
| 3750 optional and if present is separated from the first by a slash (`/`), gives the | |
| 3751 frame number. | |
| 3752 | |
| 3753 The DX number is in either of two formats. The first format is a number of 1 to | |
| 3754 4 digits ("DX Extract") or 6 digits ("DX Full"), but for the 6-digit version the | |
| 3755 first and last digit are ignored, leaving a 4-digit DX Extract number in any | |
| 3756 case, which must be in the range 16 to 2047. The second format "NNN-NN" | |
| 3757 represents the DX Extract as two numbers separated by a dash (`-`), the first | |
| 3758 number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range | |
| 3759 0 to 15).[^15] | |
| 3760 | |
| 3761 The optional frame number is a number in the range 0 to 63, and may have a half | |
| 3762 frame indicator "A" appended. Special character sequences (with or without a | |
| 3763 half frame indicator appended) may also be used: "S" or "X" means frame number | |
| 3764 62, "K" or "00" means frame number 63, and "F" means frame number 0. | |
| 3765 | |
| 3766 A parity bit is automatically added by Zint. | |
| 3767 | |
| 3768 [^15]: The DX Number may be looked up in The (Modified) Big Film Database at | |
| 3769 [https://thebigfilmdatabase.merinorus.com]( | |
| 3770 https://thebigfilmdatabase.merinorus.com). | |
| 3771 | |
| 3772 \clearpage | |
| 3773 | |
| 3774 ## 6.5 4-State Postal Codes | |
| 3775 | |
| 3776 ### 6.5.1 Australia Post 4-State Symbols | |
| 3777 | |
| 3778 #### 6.5.1.1 Customer Barcodes | |
| 3779 | |
| 3780 {.trk} | |
| 3781 | |
| 3782 Australia Post Standard Customer Barcode, Customer Barcode 2 and Customer | |
| 3783 Barcode 3 are 37-bar, 52-bar and 67-bar specifications respectively, developed | |
| 3784 by Australia Post for printing Delivery Point ID (DPID) and customer information | |
| 3785 on mail items. Valid data characters are 0-9, A-Z, a-z, space and hash (#). A | |
| 3786 Format Control Code (FCC) is added by Zint and should not be included in the | |
| 3787 input data. Reed-Solomon error correction data is generated by Zint. Encoding | |
| 3788 behaviour is determined by the length of the input data according to the formula | |
| 3789 shown in the following table. | |
| 3790 | |
| 3791 ------------------------------------------------------------- | |
| 3792 Input Required Input Format Symbol FCC Encoding | |
| 3793 Length Length Table | |
| 3794 ------ ------------------------- ------ --- -------- | |
| 3795 8 `99999999` 37-bar 11 None | |
| 3796 | |
| 3797 13 `99999999AAAAA` 52-bar 59 C | |
| 3798 | |
| 3799 16 `9999999999999999` 52-bar 59 N | |
| 3800 | |
| 3801 18 `99999999AAAAAAAAAA` 67-bar 62 C | |
| 3802 | |
| 3803 23 `99999999999999999999999` 67-bar 62 N | |
| 3804 ------------------------------------------------------------- | |
| 3805 | |
| 3806 Table: {#tbl:auspost_input_formats tag=": Australia Post Input Formats"} | |
| 3807 | |
| 3808 #### 6.5.1.2 Reply Paid Barcode | |
| 3809 | |
| 3810 {.trk} | |
| 3811 | |
| 3812 A Reply Paid version of the Australia Post 4-State Barcode (FCC 45) which | |
| 3813 requires an 8-digit DPID input. | |
| 3814 | |
| 3815 #### 6.5.1.3 Routing Barcode | |
| 3816 | |
| 3817 {.trk} | |
| 3818 | |
| 3819 A Routing version of the Australia Post 4-State Barcode (FCC 87) which requires | |
| 3820 an 8-digit DPID input. | |
| 3821 | |
| 3822 #### 6.5.1.4 Redirect Barcode | |
| 3823 | |
| 3824 {.trk} | |
| 3826 | |
| 3827 A Redirection version of the Australia Post 4-State Barcode (FCC 92) which | |
| 3828 requires an 8-digit DPID input. | |
| 3829 | |
| 3830 ### 6.5.2 Dutch Post KIX Code | |
| 3831 | |
| 3832 {.trk} | |
| 3833 | |
| 3834 This symbology is used by Royal Dutch TPG Post (Netherlands) for Postal code and | |
| 3835 automatic mail sorting. Data input can consist of numbers 0-9 and letters A-Z | |
| 3836 and needs to be 11 characters in length. No check digit is included. | |
| 3837 | |
| 3838 ### 6.5.3 Royal Mail 4-State Customer Code (RM4SCC) | |
| 3839 | |
| 3840 {.trk} | |
| 3841 | |
| 3842 The RM4SCC standard is used by the Royal Mail in the UK to encode postcode and | |
| 3843 customer data on mail items. Data input can consist of numbers 0-9 and letters | |
| 3844 A-Z and usually includes delivery postcode followed by house number. For example | |
| 3845 `"W1J0TR01"` for 1 Piccadilly Circus in London. Check digit data is generated by | |
| 3846 Zint. | |
| 3847 | |
| 3848 ### 6.5.4 Royal Mail 4-State Mailmark | |
| 3849 | |
| 3850 {.trk} | |
| 3852 | |
| 3853 Developed in 2014 as a replacement for RM4SCC this 4-state symbol includes Reed- | |
| 3854 Solomon error correction. Input is a pre-formatted alphanumeric string of 22 | |
| 3855 (for Barcode C) or 26 (for Barcode L) characters, producing a symbol with 66 or | |
| 3856 78 bars respectively. The rules for the input data are complex, as summarized in | |
| 3857 the following table. | |
| 3858 | |
| 3859 --------------------------------------------------------------------------- | |
| 3860 Format Version Class Supply Chain ID Item ID Destination+DPS | |
| 3861 ID | |
| 3862 ------- ------- ----------- --------------- -------- ----------------- | |
| 3863 1 digit 1 digit 1 alphanum. 2 digits (C) or 8 digits 9 alphanumerics | |
| 3864 (0-4) (0-3) (0-9A-E) 6 digits (L) (1 of 6 patterns) | |
| 3865 --------------------------------------------------------------------------- | |
| 3866 | |
| 3867 Table: {#tbl:mailmark_4s_input_fields | |
| 3868 tag=": Royal Mail 4-State Mailmark Input Fields"} | |
| 3869 | |
| 3870 The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix) | |
| 3871 patterns are: | |
| 3872 | |
| 3873 ----------- ----------- ----------- | |
| 3874 `FNFNLLNLS` `FFNNLLNLS` `FFNNNLLNL` | |
| 3875 `FFNFNLLNL` `FNNLLNLSS` `FNNNLLNLS` | |
| 3876 ----------- ----------- ----------- | |
| 3877 | |
| 3878 Table: {#tbl:mailmark_destination_dps | |
| 3879 tag=": Royal Mail Mailmark Destination+DPS Patterns"} | |
| 3880 | |
| 3881 where `'F'` stands for full alphabetic (A-Z), `'L'` for limited alphabetic (A-Z | |
| 3882 less `'CIKMOV'`), `'N'` for numeric (0-9), and `'S'` for space. | |
| 3883 | |
| 3884 Four of the permitted patterns include a number of trailing space characters - | |
| 3885 these will be appended by Zint if not included in the input data. | |
| 3886 | |
| 3887 For the two-dimensional Data Matrix-based version, see [6.6.2 Royal Mail 2D | |
| 3888 Mailmark (CMDM) (Data Matrix)]. | |
| 3889 | |
| 3890 ### 6.5.5 USPS Intelligent Mail | |
| 3891 | |
| 3892 {.trk} | |
| 3894 | |
| 3895 Also known as the OneCode barcode and used in the U.S. by the United States | |
| 3896 Postal Service (USPS), the Intelligent Mail system replaced the POSTNET and | |
| 3897 PLANET symbologies in 2009. Intelligent Mail is a fixed length (65-bar) symbol | |
| 3898 which combines routing and customer information in a single symbol. Input data | |
| 3899 consists of a 20-digit tracking code, followed by a dash (`-`), followed by a | |
| 3900 delivery point zip-code which can be 0, 5, 9 or 11 digits in length. For example | |
| 3901 all of the following inputs are valid data entries: | |
| 3902 | |
| 3903 - `"01234567094987654321"` | |
| 3904 - `"01234567094987654321-01234"` | |
| 3905 - `"01234567094987654321-012345678"` | |
| 3906 - `"01234567094987654321-01234567891"` | |
| 3907 | |
| 3908 ### 6.5.6 Japanese Postal Code | |
| 3909 | |
| 3910 {.trk} | |
| 3912 | |
| 3913 Used for address data on mail items for Japan Post. Accepted values are 0-9, | |
| 3914 A-Z and dash (`-`). A modulo 19 check digit is added by Zint. | |
| 3915 | |
| 3916 ### 6.5.7 DAFT Code | |
| 3917 | |
| 3918 {.trk} | |
| 3920 | |
| 3921 This is a method for creating 4-state codes where the data encoding is provided | |
| 3922 by an external program. Input data should consist of the letters `'D'`, `'A'`, | |
| 3923 `'F'` and `'T'` where these refer to descender, ascender, full (ascender and | |
| 3924 descender) and tracker (neither ascender nor descender) respectively. All other | |
| 3925 characters are invalid. The ratio of the tracker size to full height can be | |
| 3926 given in thousandths (permille) using the `--vers` option (API `option_2`). The | |
| 3927 default value is 250 (25%). | |
| 3928 | |
| 3929 For example the following | |
| 3930 | |
| 3931 ```bash | |
| 3932 zint -b DAFT -d AAFDTTDAFADTFTTFFFDATFTADTTFFTDAFAFDTF --height=8.494 --vers=256 | |
| 3933 ``` | |
| 3934 | |
| 3935 produces the same barcode (see [6.5.3 Royal Mail 4-State Customer Code | |
| 3936 (RM4SCC)]) as | |
| 3937 | |
| 3938 ```bash | |
| 3939 zint -b RM4SCC --compliantheight -d "W1J0TR01" | |
| 3940 ``` | |
| 3941 | |
| 3942 \clearpage | |
| 3943 | |
| 3944 ## 6.6 Matrix Symbols | |
| 3945 | |
| 3946 ### 6.6.1 Data Matrix (ISO 16022) | |
| 3947 | |
| 3948 {.i2dbig} | |
| 3950 | |
| 3951 Also known as Semacode this symbology was developed in 1989 by Acuity CiMatrix | |
| 3952 in partnership with the U.S. DoD and NASA. The symbol can encode a large amount | |
| 3953 of data in a small area. Data Matrix encodes characters in the Latin-1 set by | |
| 3954 default but also supports encoding in other character sets using the ECI | |
| 3955 mechanism. It can also encode GS1 data. The size of the generated symbol can be | |
| 3956 adjusted using the `--vers` option (API `option_2`) as shown in the table below. | |
| 3957 A separate symbology ID (`BARCODE_HIBC_DM`) can be used to encode Health | |
| 3958 Industry Barcode (HIBC) data. Note that only ECC200 encoding is supported, the | |
| 3959 older standards have now been removed from Zint. | |
| 3960 | |
| 3961 Input Symbol Size Input Symbol Size Input Symbol Size | |
| 3962 ----- ----------- -- ----- ----------- -- ----- ----------- | |
| 3963 1 10 x 10 11 36 x 36 21 104 x 104 | |
| 3964 2 12 x 12 12 40 x 40 22 120 x 120 | |
| 3965 3 14 x 14 13 44 x 44 23 132 x 132 | |
| 3966 4 16 x 16 14 48 x 48 24 144 x 144 | |
| 3967 5 18 x 18 15 52 x 52 25 8 x 18 | |
| 3968 6 20 x 20 16 64 x 64 26 8 x 32 | |
| 3969 7 22 x 22 17 72 x 72 28 12 x 26 | |
| 3970 8 24 x 24 18 80 x 80 28 12 x 36 | |
| 3971 9 26 x 26 19 88 x 88 29 16 x 36 | |
| 3972 10 32 x 32 20 96 x 96 30 16 x 48 | |
| 3973 | |
| 3974 Table: {#tbl:datamatrix_sizes tag=": Data Matrix Sizes"} | |
| 3975 | |
| 3976 The largest version 24 (144 x 144) can encode 3116 digits, around 2335 | |
| 3977 alphanumeric characters, or 1555 bytes of data. | |
| 3978 | |
| 3979 When using automatic symbol sizes you can force Zint to use square symbols | |
| 3980 (versions 1-24) at the command line by using the option `--square` (API | |
| 3981 `option_3 = DM_SQUARE`). | |
| 3982 | |
| 3983 Data Matrix Rectangular Extension (ISO/IEC 21471) codes may be generated with | |
| 3984 the following values as before: | |
| 3985 | |
| 3986 Input Symbol Size Input Symbol Size | |
| 3987 ----- ----------- -- ----- ----------- | |
| 3988 31 8 x 48 40 20 x 36 | |
| 3989 32 8 x 64 41 20 x 44 | |
| 3990 33 8 x 80 42 20 x 64 | |
| 3991 34 8 x 96 43 22 x 48 | |
| 3992 35 8 x 120 44 24 x 48 | |
| 3993 36 8 x 144 45 24 x 64 | |
| 3994 37 12 x 64 46 26 x 40 | |
| 3995 38 12 x 88 47 26 x 48 | |
| 3996 39 16 x 64 48 26 x 64 | |
| 3997 | |
| 3998 Table: {#tbl:dmre_sizes tag=": DMRE Sizes"} | |
| 3999 | |
| 4000 DMRE symbol sizes may be activated in automatic size mode using the option | |
| 4001 `--dmre` (API `option_3 = DM_DMRE`). | |
| 4002 | |
| 4003 GS1 data may be encoded using FNC1 (default) or GS (Group Separator, ASCII 29) | |
| 4004 as separator. Use the option `--gssep` to change to GS (API `output_options |= | |
| 4005 GS1_GS_SEPARATOR`). | |
| 4006 | |
| 4007 By default Zint uses a "de facto" codeword placement for symbols of size 144 x | |
| 4008 144 (version 24). To override this and use the now clarified ISO/IEC standard | |
| 4009 placement, use option `--dmiso144` (API `option_3 |= DM_ISO_144`). | |
| 4010 | |
| 4011 For a faster but less optimal encoding, the `--fast` option (API `input_mode |= | |
| 4012 FAST_MODE`) may be used. | |
| 4013 | |
| 4014 Data Matrix supports Structured Append of up to 16 symbols and a numeric ID | |
| 4015 (file identifications), which can be set by using the `--structapp` option (see | |
| 4016 [4.17 Structured Append]) (API `structapp`). The ID consists of 2 numbers `ID1` | |
| 4017 and `ID2`, each of which can range from 1 to 254, and is specified as the single | |
| 4018 number `ID1 * 1000 + ID2`, so for instance `ID1` `"123"` and `ID2` `"234"` would | |
| 4019 be given as `"123234"`. Note that both `ID1` and `ID2` must be non-zero, so e.g. | |
| 4020 `"123000"` or `"000123"` would be invalid IDs. If an ID is not given it defaults | |
| 4021 to `"001001"`. | |
| 4022 | |
| 4023 ### 6.6.2 Royal Mail 2D Mailmark (CMDM) (Data Matrix) | |
| 4024 | |
| 4025 {.i2dbig} | |
| 4027 | |
| 4028 This variant of Data Matrix, also known as "Complex Mail Data Mark" (CMDM), was | |
| 4029 introduced by Royal Mail along with [6.5.4 Royal Mail 4-State Mailmark], and | |
| 4030 offers space for customer data following an initial pre-formatted 45 character | |
| 4031 section, as summarized below. | |
| 4032 | |
| 4033 Field Name Length Values | |
| 4034 ---------------- ----------- ------------------------------ | |
| 4035 UPU Country ID 4 `"JGB "` | |
| 4036 Information Type 1 Alphanumeric | |
| 4037 Version ID 1 `"1"` | |
| 4038 Class 1 Alphanumeric | |
| 4039 Supply Chain ID 7 Numeric | |
| 4040 Item ID 8 Numeric | |
| 4041 Destination+DPS 9 Alphanumeric (1 of 6 patterns) | |
| 4042 Service Type 1 Numeric | |
| 4043 RTS Post Code 7 Alphanumeric (1 of 6 patterns) | |
| 4044 Reserved 6 Spaces | |
| 4045 Customer Data 6, 45 or 29 Anything (Latin-1) | |
| 4046 | |
| 4047 Table: {#tbl:mailmark_2d_input_fields | |
| 4048 tag=": Royal Mail 2D Mailmark Input Fields"} | |
| 4049 | |
| 4050 The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix) | |
| 4051 patterns are the same as for the 4-state - see Table | |
| 4052 {@tbl:mailmark_destination_dps}. The 6 RTS (Return to Sender) Post Code patterns | |
| 4053 are the same also except without the additional DPS `'NL'`, i.e. | |
| 4054 | |
| 4055 --------- --------- --------- | |
| 4056 `FNFNLLS` `FFNNLLS` `FFNNNLL` | |
| 4057 `FFNFNLL` `FNNLLSS` `FNNNLLS` | |
| 4058 --------- --------- --------- | |
| 4059 | |
| 4060 Table: {#tbl:mailmark_2d_rts | |
| 4061 tag=": Royal Mail 2D Mailmark RTS Patterns"} | |
| 4062 | |
| 4063 where `'F'` is full alphabetic (A-Z), `'L'` limited alphabetic (A-Z less | |
| 4064 `'CIKMOV'`), `'N'` numeric (0-9), and `'S'` space. | |
| 4065 | |
| 4066 Three sizes are defined, one rectangular, with varying maximum amounts of | |
| 4067 optional customer data: | |
| 4068 | |
| 4069 Name Size Customer Data Zint Version | |
| 4070 ------- ------- ------------- ------------ | |
| 4071 Type 7 24 x 24 6 characters 8 | |
| 4072 Type 9 32 x 32 45 characters 10 | |
| 4073 Type 29 16 x 48 29 characters 30 | |
| 4074 | |
| 4075 Table: {#tbl:mailmark_2d_sizes tag=": Royal Mail 2D Mailmark Sizes"} | |
| 4076 | |
| 4077 Zint will automatically select a size based on the amount of customer data, or | |
| 4078 it can be specified using the `--vers` option (API `option_2`), which takes the | |
| 4079 Zint version number (one more than the Royal Mail Type number). Zint will prefix | |
| 4080 the input data with `"JGB "` if it's missing, and also space-pad the input if | |
| 4081 the customer data is absent or falls short. As with Data Matrix, the rectangular | |
| 4082 symbol Type 29 can be excluded from automatic size selection by using the option | |
| 4083 `--square` (API `option_3 = DM_SQUARE`). | |
| 4084 | |
| 4085 GS1 data, the ECI mechanism, and Structured Append are not supported. | |
| 4086 | |
| 4087 ### 6.6.3 QR Code (ISO 18004) | |
| 4088 | |
| 4089 {.i2dbig} | |
| 4090 | |
| 4091 Also known as Quick Response Code this symbology was developed by Denso. Four | |
| 4092 levels of error correction are available using the `--secure` option (API | |
| 4093 `option_1`) as shown in the following table. | |
| 4094 | |
| 4095 Input ECC Level Error Correction Capacity Recovery Capacity | |
| 4096 ----- --------- ------------------------- ----------------- | |
| 4097 1 L Approx 20% of symbol Approx 7% | |
| 4098 2 M Approx 37% of symbol Approx 15% | |
| 4099 3 Q Approx 55% of symbol Approx 25% | |
| 4100 4 H Approx 65% of symbol Approx 30% | |
| 4101 | |
| 4102 Table: {#tbl:qrcode_eccs tag=": QR Code ECC Levels"} | |
| 4103 | |
| 4104 The size of the symbol can be specified by setting the `--vers` option (API | |
| 4105 `option_2`) to the QR Code version required (1-40). The size of symbol generated | |
| 4106 is shown in the table below. | |
| 4107 | |
| 4108 Input Symbol Size Input Symbol Size Input Symbol Size | |
| 4109 ----- ----------- -- ----- ----------- -- ----- ----------- | |
| 4110 1 21 x 21 15 77 x 77 29 133 x 133 | |
| 4111 2 25 x 25 16 81 x 81 30 137 x 137 | |
| 4112 3 29 x 29 17 85 x 85 31 141 x 141 | |
| 4113 4 33 x 33 18 89 x 89 32 145 x 145 | |
| 4114 5 37 x 37 19 93 x 93 33 149 x 149 | |
| 4115 6 41 x 41 20 97 x 97 34 153 x 153 | |
| 4116 7 45 x 45 21 101 x 101 35 157 x 157 | |
| 4117 8 49 x 49 22 105 x 105 36 161 x 161 | |
| 4118 9 53 x 53 23 109 x 109 37 165 x 165 | |
| 4119 10 57 x 57 24 113 x 113 38 169 x 169 | |
| 4120 11 61 x 61 25 117 x 117 39 173 x 173 | |
| 4121 12 65 x 65 26 121 x 121 40 177 x 177 | |
| 4122 13 69 x 69 27 125 x 125 | |
| 4123 14 73 x 73 28 129 x 129 | |
| 4124 | |
| 4125 Table: {#tbl:qrcode_sizes tag=": QR Code Sizes"} | |
| 4126 | |
| 4127 The maximum capacity of a QR Code symbol (version 40) is 7089 numeric digits, | |
| 4128 4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be | |
| 4129 used to encode GS1 data. QR Code symbols can by default encode either characters | |
| 4130 in the Latin-1 set or Kanji, Katakana and ASCII characters which are members of | |
| 4131 the Shift JIS encoding scheme. In addition QR Code supports other character sets | |
| 4132 using the ECI mechanism. Input should usually be entered as UTF-8 with | |
| 4133 conversion to Latin-1 or Shift JIS being carried out by Zint. A separate | |
| 4134 symbology ID (`BARCODE_HIBC_QR`) can be used to encode Health Industry Barcode | |
| 4135 (HIBC) data. | |
| 4136 | |
| 4137 Non-ASCII data density may be maximized by using the `--fullmultibyte` switch | |
| 4138 (API `option_3 = ZINT_FULL_MULTIBYTE`), but check that your barcode reader | |
| 4139 supports this before using. | |
| 4140 | |
| 4141 QR Code has eight different masks designed to minimize unwanted patterns. The | |
| 4142 best mask to use is selected automatically by Zint but may be manually specified | |
| 4143 by using the `--mask` switch with values 0-7, or in the API by setting | |
| 4144 `option_3 = (N + 1) << 8` where N is 0-7. To use with `ZINT_FULL_MULTIBYTE` set | |
| 4145 ```c | |
| 4146 option_3 = ZINT_FULL_MULTIBYTE | (N + 1) << 8 | |
| 4147 ``` | |
| 4148 | |
| 4149 The `--fast` option (API `input_mode |= FAST_MODE`) may be used when leaving | |
| 4150 Zint to automatically select a mask to reduce the number of masks to try to four | |
| 4151 (0, 2, 4, 7). | |
| 4152 | |
| 4153 QR Code supports Structured Append of up to 16 symbols and a numeric ID | |
| 4154 (parity), which can be set by using the `--structapp` option (see [4.17 | |
| 4155 Structured Append]) (API `structapp`). The parity ID ranges from 0 (default) to | |
| 4156 255, and for full compliance should be set to the value obtained by `XOR`-ing | |
| 4157 together each byte of the complete data forming the sequence. Currently this | |
| 4158 calculation must be done outside of Zint. | |
| 4159 | |
| 4160 ### 6.6.4 Micro QR Code (ISO 18004) | |
| 4161 | |
| 4162 {.i2dbig} | |
| 4163 | |
| 4164 A miniature version of the QR Code symbol for short messages, Micro QR Code | |
| 4165 symbols can encode either Latin-1 characters or Shift JIS characters. Input | |
| 4166 should be entered as a UTF-8 stream with conversion to Latin-1 or Shift JIS | |
| 4167 being carried out automatically by Zint. A preferred symbol size can be selected | |
| 4168 by using the `--vers` option (API `option_2`), as shown in the table below. Note | |
| 4169 that versions M1 and M2 have restrictions on what characters can be encoded. | |
| 4170 | |
| 4171 ------------------------------------------------------------------ | |
| 4172 Input Version Symbol Size Allowed Characters | |
| 4173 ----- ------- ----------- ---------------------------------- | |
| 4174 1 M1 11 x 11 Numeric only | |
| 4175 | |
| 4176 2 M2 13 x 13 Numeric, uppercase letters, space, | |
| 4177 and the characters `"$%*+-./:"` | |
| 4178 | |
| 4179 3 M3 15 x 15 Latin-1 and Shift JIS | |
| 4180 | |
| 4181 4 M4 17 x 17 Latin-1 and Shift JIS | |
| 4182 ------------------------------------------------------------------ | |
| 4183 | |
| 4184 Table: {#tbl:micrqr_sizes tag=": Micro QR Code Sizes"} | |
| 4185 | |
| 4186 Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or 9 Kanji | |
| 4187 characters. | |
| 4188 | |
| 4189 Except for version M1, which is always ECC level L, the amount of ECC codewords | |
| 4190 can be adjusted using the `--secure` option (API `option_1`); however ECC level | |
| 4191 H is not available for any version, and ECC level Q is only available for | |
| 4192 version M4: | |
| 4193 | |
| 4194 ---------------------------------------------------------------------- | |
| 4195 Input ECC Error Correction Recovery Available for | |
| 4196 Level Capacity Capacity Versions | |
| 4197 ----- ----- -------------------- ---------- -------------- | |
| 4198 1 L Approx 20% of symbol Approx 7% M1, M2, M3, M4 | |
| 4199 | |
| 4200 2 M Approx 37% of symbol Approx 15% M2, M3, M4 | |
| 4201 | |
| 4202 3 Q Approx 55% of symbol Approx 25% M4 | |
| 4203 ---------------------------------------------------------------------- | |
| 4204 | |
| 4205 Table: {#tbl:micrqr_eccs tag=": Micro QR ECC Levels"} | |
| 4206 | |
| 4207 The defaults for symbol size and ECC level depend on the input and whether | |
| 4208 either of them is specified. | |
| 4209 | |
| 4210 For barcode readers that support it, non-ASCII data density may be maximized by | |
| 4211 using the `--fullmultibyte` switch (API `option_3 = ZINT_FULL_MULTIBYTE`). | |
| 4212 | |
| 4213 Micro QR Code has four different masks designed to minimize unwanted patterns. | |
| 4214 The best mask to use is selected automatically by Zint but may be manually | |
| 4215 specified by using the `--mask` switch with values 0-3, or in the API by setting | |
| 4216 `option_3 = (N + 1) << 8` where N is 0-3. To use with `ZINT_FULL_MULTIBYTE` set | |
| 4217 ```c | |
| 4218 option_3 = ZINT_FULL_MULTIBYTE | (N + 1) << 8 | |
| 4219 ``` | |
| 4220 | |
| 4221 ### 6.6.5 Rectangular Micro QR Code (rMQR) (ISO 23941) | |
| 4222 | |
| 4223 {.i2dbig} | |
| 4224 | |
| 4225 A rectangular version of QR Code, rMQR supports encoding of GS1 data, and either | |
| 4226 Latin-1 characters or Shift JIS characters, and other encodings using the ECI | |
| 4227 mechanism. As with other symbologies data should be entered as UTF-8 with | |
| 4228 conversion being handled by Zint. The amount of ECC codewords can be adjusted | |
| 4229 using the `--secure` option (API `option_1`), however only ECC levels M and H | |
| 4230 are valid for this type of symbol. | |
| 4231 | |
| 4232 Input ECC Level Error Correction Capacity Recovery Capacity | |
| 4233 ----- --------- ------------------------- ----------------- | |
| 4234 2 M Approx 37% of symbol Approx 15% | |
| 4235 4 H Approx 65% of symbol Approx 30% | |
| 4236 | |
| 4237 Table: {#tbl:rmqr_eccs tag=": rMQR ECC Levels"} | |
| 4238 | |
| 4239 The preferred symbol sizes can be selected using the `--vers` option (API | |
| 4240 `option_2`) as shown in the table below. Input values between 33 and 38 fix the | |
| 4241 height of the symbol while allowing Zint to determine the minimum symbol width. | |
| 4242 | |
| 4243 -------------------------------------------------------------------------- | |
| 4244 Input Version Symbol Size (HxW) Input Version Symbol Size (HxW) | |
| 4245 ----- ------- ----------------- - ----- ------- -------------------- | |
| 4246 1 R7x43 7 x 43 20 R13x77 13 x 77 | |
| 4247 | |
| 4248 2 R7x59 7 x 59 21 R13x99 13 x 99 | |
| 4249 | |
| 4250 3 R7x77 7 x 77 22 R13x139 13 x 139 | |
| 4251 | |
| 4252 4 R7x99 7 x 99 23 R15x43 15 x 43 | |
| 4253 | |
| 4254 5 R7x139 7 x 139 24 R15x59 15 x 59 | |
| 4255 | |
| 4256 6 R9x43 9 x 43 25 R15x77 15 x 77 | |
| 4257 | |
| 4258 7 R9x59 9 x 59 26 R15x99 15 x 99 | |
| 4259 | |
| 4260 8 R9x77 9 x 77 27 R15x139 15 x 139 | |
| 4261 | |
| 4262 9 R9x99 9 x 99 28 R17x43 17 x 43 | |
| 4263 | |
| 4264 10 R9x139 9 x 139 29 R17x59 17 x 59 | |
| 4265 | |
| 4266 11 R11x27 11 x 27 30 R17x77 17 x 77 | |
| 4267 | |
| 4268 12 R11x43 11 x 43 31 R17x99 17 x 99 | |
| 4269 | |
| 4270 13 R11x59 11 x 59 32 R17x139 17 x 139 | |
| 4271 | |
| 4272 14 R11x77 11 x 77 33 R7xW 7 x automatic width | |
| 4273 | |
| 4274 15 R11x99 11 x 99 34 R9xW 9 x automatic width | |
| 4275 | |
| 4276 16 R11x139 11 x 139 35 R11xW 11 x automatic width | |
| 4277 | |
| 4278 17 R13x27 13 x 27 36 R13xW 13 x automatic width | |
| 4279 | |
| 4280 18 R13x43 13 x 43 37 R15xW 15 x automatic width | |
| 4281 | |
| 4282 19 R13x59 13 x 59 38 R17xW 17 x automatic width | |
| 4283 -------------------------------------------------------------------------- | |
| 4284 | |
| 4285 Table: {#tbl:rmqr_sizes tag=": rMQR Sizes"} | |
| 4286 | |
| 4287 The largest version R17x139 (32) can encode up to 361 digits, 219 alphanumerics, | |
| 4288 150 bytes, or 92 Kanji characters. | |
| 4289 | |
| 4290 For barcode readers that support it, non-ASCII data density may be maximized by | |
| 4291 using the `--fullmultibyte` switch or in the API by setting | |
| 4292 `option_3 = ZINT_FULL_MULTIBYTE`. | |
| 4293 | |
| 4294 ### 6.6.6 UPNQR (Univerzalnega Plačilnega Naloga QR) | |
| 4295 | |
| 4296 {.i2d} | |
| 4297 | |
| 4298 A variation of QR Code used by Združenje Bank Slovenije (Bank Association of | |
| 4299 Slovenia). The size, error correction level and ECI are set by Zint and do not | |
| 4300 need to be specified. UPNQR is unusual in that it uses Latin-2 (ISO/IEC 8859-2 | |
| 4301 plus ASCII) formatted data. Zint will accept UTF-8 data and convert it to | |
| 4302 Latin-2, or if your data is already Latin-2 formatted use the `--binary` switch | |
| 4303 (API `input_mode = DATA_MODE`). | |
| 4304 | |
| 4305 The following example creates a symbol from data saved as a Latin-2 file: | |
| 4306 | |
| 4307 ```bash | |
| 4308 zint -o upnqr.png -b 143 --scale=3 --binary -i upn.txt | |
| 4309 ``` | |
| 4310 | |
| 4311 A mask may be manually specified or the `--fast` option used as with QRCODE. | |
| 4312 | |
| 4313 ### 6.6.7 MaxiCode (ISO 16023) | |
| 4314 | |
| 4315 {.i2d} | |
| 4318 | |
| 4319 Developed by UPS the MaxiCode symbology employs a grid of hexagons surrounding a | |
| 4320 bullseye finder pattern. This symbology is designed for the identification of | |
| 4321 parcels. MaxiCode symbols can be encoded in one of five modes. In modes 2 and 3 | |
| 4322 MaxiCode symbols are composed of two parts named the primary and secondary | |
| 4323 messages. The primary message consists of a Structured Carrier Message which | |
| 4324 includes various data about the package being sent and the secondary message | |
| 4325 usually consists of address data in a data structure. The format of the primary | |
| 4326 message required by Zint is given in the following table. | |
| 4327 | |
| 4328 Characters Meaning | |
| 4329 ---------- --------------------------------------------------------------- | |
| 4330 1 - 9 Postcode data which can consist of up to 9 digits (for mode 2) | |
| 4331 or up to 6 alphanumeric characters (for mode 3). Remaining | |
| 4332 unused characters for mode 3 can be filled with the SPACE | |
| 4333 character (ASCII 32) or omitted. | |
| 4334 (adjust the following character positions according to postcode | |
| 4335 length) | |
| 4336 10 - 12 Three-digit country code according to ISO 3166-1. | |
| 4337 13 - 15 Three-digit service code. This depends on your parcel courier. | |
| 4338 | |
| 4339 Table: {#tbl:maxicode_scm tag=": MaxiCode Structured Carrier Message Format"} | |
| 4340 | |
| 4341 The primary message can be set at the command prompt using the `--primary` | |
| 4342 switch (API `primary`). The secondary message uses the normal data entry method. | |
| 4343 For example: | |
| 4344 | |
| 4345 ```bash | |
| 4346 zint -o test.eps -b 57 --primary="999999999840012" \ | |
| 4347 -d "Secondary Message Here" | |
| 4348 ``` | |
| 4349 | |
| 4350 When using the API the primary message must be placed in the `primary` string. | |
| 4351 The secondary is entered in the same way as described in [5.2 Encoding and | |
| 4352 Saving to File]. When either of these modes is selected Zint will analyse the | |
| 4353 primary message and select either mode 2 or mode 3 as appropriate. | |
| 4354 | |
| 4355 As a convenience the secondary message for modes 2 and 3 can be set to be | |
| 4356 prefixed by the ISO/IEC 15434 Format `"01"` (transportation) sequence | |
| 4357 `"[)>\R01\Gvv"`, where `vv` is a 2-digit version, by using the `--scmvv` switch | |
| 4358 (API `option_2 = vv + 1`). For example to use the common version `"96"` (ASC | |
| 4359 MH10/SC 8): | |
| 4360 | |
| 4361 ```bash | |
| 4362 zint -b 57 --primary="152382802840001" --scmvv=96 --esc -d \ | |
| 4363 "1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E" | |
| 4364 ``` | |
| 4365 | |
| 4366 will prefix `"[)>\R01\G96"` to the secondary message. (`\R`, `\G` and `\E` are | |
| 4367 the escape sequences for Record Separator, Group Separator and End of | |
| 4368 Transmission respectively - see Table {@tbl:escape_sequences}.) | |
| 4369 | |
| 4370 Modes 4 to 6 can be accessed using the `--mode` switch (API `option_1`). Modes 4 | |
| 4371 to 6 do not have a primary message. For example: | |
| 4372 | |
| 4373 ```bash | |
| 4374 zint -o test.eps -b 57 --mode=4 -d "A MaxiCode Message in Mode 4" | |
| 4375 ``` | |
| 4376 | |
| 4377 Mode 6 is reserved for the maintenance of scanner hardware and should not be | |
| 4378 used to encode user data. | |
| 4379 | |
| 4380 This symbology uses Latin-1 character encoding by default but also supports the | |
| 4381 ECI encoding mechanism. The maximum length of text which can be placed in a | |
| 4382 MaxiCode symbol depends on the type of characters used in the text. | |
| 4383 | |
| 4384 Example maximum data lengths are given in the table below: | |
| 4385 | |
| 4386 ----------------------------------------------------------------------- | |
| 4387 Mode Maximum Data Length Maximum Data Length Number of Error | |
| 4388 for Capital Letters for Numeric Digits Correction Codewords | |
| 4389 ---- ------------------- ------------------- -------------------- | |
| 4390 2`*` 84 126 50 | |
| 4391 | |
| 4392 3`*` 84 126 50 | |
| 4393 | |
| 4394 4 93 138 50 | |
| 4395 | |
| 4396 5 77 113 66 | |
| 4397 | |
| 4398 6 93 138 50 | |
| 4399 ----------------------------------------------------------------------- | |
| 4400 | |
| 4401 Table: {#tbl:maxicode_data_length_maxima tag=": MaxiCode Data Length Maxima"} | |
| 4402 | |
| 4403 `*` - secondary only | |
| 4404 | |
| 4405 MaxiCode supports Structured Append of up to 8 symbols, which can be set by | |
| 4406 using the `--structapp` option (see [4.17 Structured Append]) (API `structapp`). | |
| 4407 It does not support specifying an ID. | |
| 4408 | |
| 4409 MaxiCode uses a different scaling than other symbols for raster output, see | |
| 4410 [4.9.3 MaxiCode Raster Scaling], and also for EMF vector output, when the scale | |
| 4411 is multiplied by 20 instead of 2. | |
| 4412 | |
| 4413 ### 6.6.8 Aztec Code (ISO 24778) | |
| 4414 | |
| 4415 {.i2d} | |
| 4416 | |
| 4417 Invented by Andrew Longacre at Welch Allyn Inc in 1995 the Aztec Code symbol is | |
| 4418 a matrix symbol with a distinctive bullseye finder pattern. Zint can generate | |
| 4419 Compact Aztec Code (sometimes called Small Aztec Code) as well as 'full-range' | |
| 4420 Aztec Code symbols and by default will automatically select symbol type and size | |
| 4421 dependent on the length of the data to be encoded. Error correction codewords | |
| 4422 will normally be generated to fill at least 23% of the symbol. Two options are | |
| 4423 available to change this behaviour: | |
| 4424 | |
| 4425 The size of the symbol can be specified using the `--vers` option (API | |
| 4426 `option_2`) to a value between 1 and 36 according to the following table. The | |
| 4427 symbols marked with an asterisk (`*`) in the table below are 'compact' symbols, | |
| 4428 meaning they have a smaller bullseye pattern at the centre of the symbol. | |
| 4429 | |
| 4430 Input Symbol Size Input Symbol Size Input Symbol Size | |
| 4431 ----- ----------- -- ----- ----------- -- ----- ----------- | |
| 4432 1 15 x 15`*` 13 53 x 53 25 105 x 105 | |
| 4433 2 19 x 19`*` 14 57 x 57 26 109 x 109 | |
| 4434 3 23 x 23`*` 15 61 x 61 27 113 x 113 | |
| 4435 4 27 x 27`*` 16 67 x 67 28 117 x 117 | |
| 4436 5 19 x 19 17 71 x 71 29 121 x 121 | |
| 4437 6 23 x 23 18 75 x 75 30 125 x 125 | |
| 4438 7 27 x 27 19 79 x 79 31 131 x 131 | |
| 4439 8 31 x 31 20 83 x 83 32 135 x 135 | |
| 4440 9 37 x 37 21 87 x 87 33 139 x 139 | |
| 4441 10 41 x 41 22 91 x 91 34 143 x 143 | |
| 4442 11 45 x 45 23 95 x 95 35 147 x 147 | |
| 4443 12 49 x 49 24 101 x 101 36 151 x 151 | |
| 4444 | |
| 4445 Table: {#tbl:aztec_sizes tag=": Aztec Code Sizes"} | |
| 4446 | |
| 4447 Note that in symbols which have a specified size the amount of error correction | |
| 4448 is dependent on the length of the data input and Zint will allow error | |
| 4449 correction capacities as low as 3 codewords. | |
| 4450 | |
| 4451 Alternatively the amount of error correction data can be specified by setting | |
| 4452 the `--secure` option (API `option_1`) to a value from the following table. | |
| 4453 | |
| 4454 Mode Error Correction Capacity | |
| 4455 ---- ------------------------- | |
| 4456 1 >10% + 3 codewords | |
| 4457 2 >23% + 3 codewords | |
| 4458 3 >36% + 3 codewords | |
| 4459 4 >50% + 3 codewords | |
| 4460 | |
| 4461 Table: {#tbl:aztec_eccs tag=": Aztec Code Error Correction Modes"} | |
| 4462 | |
| 4463 It is not possible to select both symbol size and error correction capacity for | |
| 4464 the same symbol. If both options are selected then the error correction capacity | |
| 4465 selection will be ignored. | |
| 4466 | |
| 4467 Aztec Code supports ECI encoding and can encode up to a maximum length of | |
| 4468 approximately 3823 numeric or 3067 alphabetic characters or 1914 bytes of data. | |
| 4469 A separate symbology ID (`BARCODE_HIBC_AZTEC`) can be used to encode Health | |
| 4470 Industry Barcode (HIBC) data. | |
| 4471 | |
| 4472 Aztec Code supports Structured Append of up to 26 symbols and an optional | |
| 4473 alphanumeric ID of up to 32 characters, which can be set by using the | |
| 4474 `--structapp` option (see [4.17 Structured Append]) (API `structapp`). The ID | |
| 4475 cannot contain spaces. If an ID is not given, no ID is encoded. | |
| 4476 | |
| 4477 ### 6.6.9 Aztec Runes (ISO 24778) | |
| 4478 | |
| 4479 {.i2d} | |
| 4480 | |
| 4481 A truncated version of compact Aztec Code for encoding whole integers between 0 | |
| 4482 and 255, as defined in ISO/IEC 24778 Annex A. Includes Reed-Solomon error | |
| 4483 correction. It does not support Structured Append. | |
| 4484 | |
| 4485 ### 6.6.10 Code One | |
| 4486 | |
| 4487 {.i2d} | |
| 4488 | |
| 4489 A matrix symbology developed by Ted Williams in 1992 which encodes data in a way | |
| 4490 similar to Data Matrix, Code One is able to encode the Latin-1 character set or | |
| 4491 GS1 data, and also supports the ECI mechanism. There are two types of Code One | |
| 4492 symbol - fixed-ratio symbols which are roughly square (versions A through to H) | |
| 4493 and variable-width versions (versions S and T). These can be selected by using | |
| 4494 `--vers` (API `option_2`) as shown in the table below: | |
| 4495 | |
| 4496 ------------------------------------------------------------ | |
| 4497 Input Version Size Numeric Alphanumeric | |
| 4498 (W x H) Data Capacity Data Capacity | |
| 4499 ----- ------- ---------- ------------- ------------- | |
| 4500 1 A 16 x 18 22 13 | |
| 4501 | |
| 4502 2 B 22 x 22 44 27 | |
| 4503 | |
| 4504 3 C 28 x 28 104 64 | |
| 4505 | |
| 4506 4 D 40 x 42 217 135 | |
| 4507 | |
| 4508 5 E 52 x 54 435 271 | |
| 4509 | |
| 4510 6 F 70 x 76 886 553 | |
| 4511 | |
| 4512 7 G 104 x 98 1755 1096 | |
| 4513 | |
| 4514 8 H 148 x 134 3550 2218 | |
| 4515 | |
| 4516 9 S width x 8 18 N/A | |
| 4517 | |
| 4518 10 T width x 16 90 55 | |
| 4519 ------------------------------------------------------------ | |
| 4520 | |
| 4521 Table: {#tbl:codeone_sizes tag=": Code One Sizes"} | |
| 4522 | |
| 4523 Version S symbols can only encode numeric data. The width of version S and | |
| 4524 version T symbols is determined by the length of the input data. | |
| 4525 | |
| 4526 Code One supports Structured Append of up to 128 symbols, which can be set by | |
| 4527 using the `--structapp` option (see [4.17 Structured Append]) (API `structapp`). | |
| 4528 It does not support specifying an ID. Structured Append is not supported with | |
| 4529 GS1 data nor for Version S symbols. | |
| 4530 | |
| 4531 ### 6.6.11 Grid Matrix | |
| 4532 | |
| 4533 {.i2d} | |
| 4535 | |
| 4536 Grid Matrix groups modules in a chequerboard pattern, and by default supports | |
| 4537 the GB 2312 standard set, which includes Hanzi, ASCII and a small number of | |
| 4538 ISO/IEC 8859-1 characters. Input should be entered as UTF-8 with conversion to | |
| 4539 GB 2312 being carried out automatically by Zint. Up to around 1529 alphanumeric | |
| 4540 characters or 2751 digits may be encoded. The symbology also supports the ECI | |
| 4541 mechanism. Support for GS1 data has not yet been implemented. | |
| 4542 | |
| 4543 The size of the symbol and the error correction capacity can be specified. If | |
| 4544 you specify both of these values then Zint will make a 'best-fit' attempt to | |
| 4545 satisfy both conditions. The symbol size can be specified using the `--vers` | |
| 4546 option (API `option_2`), and the error correction capacity can be specified by | |
| 4547 using the `--secure` option (API `option_1`), according to the following tables. | |
| 4548 | |
| 4549 Input Symbol Size Input Symbol Size | |
| 4550 ----- ----------- - ----- ----------- | |
| 4551 1 18 x 18 8 102 x 102 | |
| 4552 2 30 x 30 9 114 x 114 | |
| 4553 3 42 x 42 10 126 x 126 | |
| 4554 4 54 x 54 11 138 x 138 | |
| 4555 5 66 x 66 12 150 x 150 | |
| 4556 6 78 x 78 13 162 x 162 | |
| 4557 7 90 x 90 | |
| 4558 | |
| 4559 Table: {#tbl:gridmatrix_sizes tag=": Grid Matrix Sizes"} | |
| 4560 | |
| 4561 Mode Error Correction Capacity | |
| 4562 ---- ------------------------- | |
| 4563 1 Approximately 10% | |
| 4564 2 Approximately 20% | |
| 4565 3 Approximately 30% | |
| 4566 4 Approximately 40% | |
| 4567 5 Approximately 50% | |
| 4568 | |
| 4569 Table: {#tbl:gridmatrix_eccs tag=": Grid Matrix Error Correction Modes"} | |
| 4570 | |
| 4571 Non-ASCII data density may be maximized by using the `--fullmultibyte` switch | |
| 4572 (API `option_3 = ZINT_FULL_MULTIBYTE`), but check that your barcode reader | |
| 4573 supports this before using. | |
| 4574 | |
| 4575 Grid Matrix supports Structured Append of up to 16 symbols and a numeric ID | |
| 4576 (file signature), which can be set by using the `--structapp` option (see [4.17 | |
| 4577 Structured Append]) (API `structapp`). The ID ranges from 0 (default) to 255. | |
| 4578 | |
| 4579 ### 6.6.12 DotCode | |
| 4580 | |
| 4581 ![`zint -b DOTCODE -d "[01]00012345678905[17]201231[10]ABC123456" | |
| 4582 --gs1`](images/dotcode.svg){.i2d} | |
| 4583 | |
| 4584 DotCode uses a grid of dots in a rectangular formation to encode characters up | |
| 4585 to a maximum of approximately 450 characters (or 900 numeric digits). The | |
| 4586 symbology supports ECI encoding and GS1 data encoding. By default Zint will | |
| 4587 produce a symbol which is approximately square, however the width of the symbol | |
| 4588 can be adjusted by using the `--cols` option (API `option_2`) (maximum 200). | |
| 4589 Outputting DotCode to raster images (BMP, GIF, PCX, PNG, TIF) will require | |
| 4590 setting the scale of the image to a larger value than the default (e.g. | |
| 4591 approximately 10) for the dots to be plotted correctly. Approximately 33% of the | |
| 4592 resulting symbol is comprised of error correction codewords. | |
| 4593 | |
| 4594 DotCode has two sets of 4 masks, designated 0-3 and 0'-3', the second `"prime"` | |
| 4595 set being the same as the first with corners lit. The best mask to use is | |
| 4596 selected automatically by Zint but may be manually specified by using the | |
| 4597 `--mask` switch with values 0-7, where 4-7 denote 0'-3', or in the API by | |
| 4598 setting `option_3 = (N + 1) << 8` where N is 0-7. | |
| 4599 | |
| 4600 DotCode supports Structured Append of up to 35 symbols, which can be set by | |
| 4601 using the `--structapp` option (see [4.17 Structured Append]) (API `structapp`). | |
| 4602 It does not support specifying an ID. | |
| 4603 | |
| 4604 ### 6.6.13 Han Xin Code (ISO 20830) | |
| 4605 | |
| 4606 {.i2d} | |
| 4607 | |
| 4608 Also known as Chinese Sensible Code, Han Xin is capable of encoding characters | |
| 4609 in either the Latin-1 character set or the GB 18030 character set (which is a | |
| 4610 UTF, i.e. includes all Unicode characters, optimized for Chinese characters) and | |
| 4611 is also able to support the ECI mechanism. Support for the encoding of GS1 data | |
| 4612 has not yet been implemented. | |
| 4613 | |
| 4614 The size of the symbol can be specified using the `--vers` option (API | |
| 4615 `option_2`) to a value between 1 and 84 according to the following table. | |
| 4616 | |
| 4617 Input Symbol Size Input Symbol Size Input Symbol Size | |
| 4618 ----- ----------- -- ----- ----------- -- ----- ----------- | |
| 4619 1 23 x 23 29 79 x 79 57 135 x 135 | |
| 4620 2 25 x 25 30 81 x 81 58 137 x 137 | |
| 4621 3 27 x 27 31 83 x 83 59 139 x 139 | |
| 4622 4 29 x 29 32 85 x 85 60 141 x 141 | |
| 4623 5 31 x 31 33 87 x 87 61 143 x 143 | |
| 4624 6 33 x 33 34 89 x 89 62 145 x 145 | |
| 4625 7 35 x 35 35 91 x 91 63 147 x 147 | |
| 4626 8 37 x 37 36 93 x 93 64 149 x 149 | |
| 4627 9 39 x 39 37 95 x 95 65 151 x 151 | |
| 4628 10 41 x 41 38 97 x 97 66 153 x 153 | |
| 4629 11 43 x 43 39 99 x 99 67 155 x 155 | |
| 4630 12 45 x 45 40 101 x 101 68 157 x 157 | |
| 4631 13 47 x 47 41 103 x 103 69 159 x 159 | |
| 4632 14 49 x 49 42 105 x 105 70 161 x 161 | |
| 4633 15 51 x 51 43 107 x 107 71 163 x 163 | |
| 4634 16 53 x 53 44 109 x 109 72 165 x 165 | |
| 4635 17 55 x 55 45 111 x 111 73 167 x 167 | |
| 4636 18 57 x 57 46 113 x 113 74 169 x 169 | |
| 4637 19 59 x 59 47 115 x 115 75 171 x 171 | |
| 4638 20 61 x 61 48 117 x 117 76 173 x 173 | |
| 4639 21 63 x 63 49 119 x 119 77 175 x 175 | |
| 4640 22 65 x 65 50 121 x 121 78 177 x 177 | |
| 4641 23 67 x 67 51 123 x 123 79 179 x 179 | |
| 4642 24 69 x 69 52 125 x 125 80 181 x 181 | |
| 4643 25 71 x 71 53 127 x 127 81 183 x 183 | |
| 4644 26 73 x 73 54 129 x 129 82 185 x 185 | |
| 4645 27 75 x 75 55 131 x 131 83 187 x 187 | |
| 4646 28 77 x 77 56 133 x 133 84 189 x 189 | |
| 4647 | |
| 4648 Table: {#tbl:hanxin_sizes tag=": Han Xin Sizes"} | |
| 4649 | |
| 4650 The largest version (84) can encode 7827 digits, 4350 ASCII characters, up to | |
| 4651 2175 Chinese characters, or 3261 bytes, making it the most capacious of all the | |
| 4652 barcodes supported by Zint. | |
| 4653 | |
| 4654 There are four levels of error correction capacity available for Han Xin Code | |
| 4655 which can be set by using the `--secure` option (API `option_1`) to a value from | |
| 4656 the following table. | |
| 4657 | |
| 4658 Mode Recovery Capacity | |
| 4659 ---- ----------------- | |
| 4660 1 Approx 8% | |
| 4661 2 Approx 15% | |
| 4662 3 Approx 23% | |
| 4663 4 Approx 30% | |
| 4664 | |
| 4665 Table: {#tbl:hanxin_eccs tag=": Han Xin Error Correction Modes"} | |
| 4666 | |
| 4667 Non-ASCII data density may be maximized by using the `--fullmultibyte` switch | |
| 4668 (API `option_3 = ZINT_FULL_MULTIBYTE`), but check that your barcode reader | |
| 4669 supports this before using. | |
| 4670 | |
| 4671 Han Xin has four different masks designed to minimize unwanted patterns. The | |
| 4672 best mask to use is selected automatically by Zint but may be manually specified | |
| 4673 by using the `--mask` switch with values 0-3, or in the API by setting | |
| 4674 `option_3 = (N + 1) << 8` where N is 0-3. To use with `ZINT_FULL_MULTIBYTE` set | |
| 4675 ```c | |
| 4676 option_3 = ZINT_FULL_MULTIBYTE | (N + 1) << 8 | |
| 4677 ``` | |
| 4678 | |
| 4679 ### 6.6.14 Ultracode | |
| 4680 | |
| 4681 {.ultra} | |
| 4683 | |
| 4684 This symbology uses a grid of coloured elements to encode data. ECI and GS1 | |
| 4685 modes are supported. The amount of error correction can be set using the | |
| 4686 `--secure` option (API `option_1`) to a value as shown in the following table. | |
| 4687 | |
| 4688 Value EC Level Amount of symbol holding error correction data | |
| 4689 ----- -------- ---------------------------------------------- | |
| 4690 1 EC0 0% - Error detection only | |
| 4691 2 EC1 Approx 5% | |
| 4692 3 EC2 Approx 9% - Default value | |
| 4693 4 EC3 Approx 17% | |
| 4694 5 EC4 Approx 25% | |
| 4695 6 EC5 Approx 33% | |
| 4696 | |
| 4697 Table: {#tbl:ultra_eccs tag=": Ultracode Error Correction Values"} | |
| 4698 | |
| 4699 Zint does not currently implement data compression by default, but this can be | |
| 4700 initiated through the API by setting | |
| 4701 | |
| 4702 ```c | |
| 4703 symbol->option_3 = ULTRA_COMPRESSION; | |
| 4704 ``` | |
| 4705 | |
| 4706 With compression, up to 504 digits, 375 alphanumerics or 252 bytes can be | |
| 4707 encoded. | |
| 4708 | |
| 4709 Revision 2 of Ultracode (2023) may be specified using `--vers=2` (API | |
| 4710 `option_2 = 2`). | |
| 4711 | |
| 4712 * * * | |
| 4713 WARNING: Revision 2 of Ultracode was only finalized December 2023 and Zint has | |
| 4714 not yet been updated to support it. Do not use. | |
| 4715 | |
| 4716 * * * | |
| 4717 | |
| 4718 Ultracode supports Structured Append of up to 8 symbols and an optional numeric | |
| 4719 ID (File Number), which can be set by using the `--structapp` option (see [4.17 | |
| 4720 Structured Append]) (API `structapp`). The ID ranges from 1 to 80088. If an ID | |
| 4721 is not given, no ID is encoded. | |
| 4722 | |
| 4723 \clearpage | |
| 4724 | |
| 4725 ## 6.7 Other Barcode-Like Markings | |
| 4726 | |
| 4727 ### 6.7.1 Facing Identification Mark (FIM) | |
| 4728 | |
| 4729 {.trk} | |
| 4730 | |
| 4731 Used by the United States Postal Service (USPS), the FIM symbology is used to | |
| 4732 assist automated mail processing. There are only 5 valid symbols which can be | |
| 4733 generated using the characters A-E as shown in the table below. | |
| 4734 | |
| 4735 Code Letter Usage | |
| 4736 ----------- -------------------------------------------------------------- | |
| 4737 A Used for courtesy reply mail and metered reply mail with a | |
| 4738 pre-printed POSTNET symbol. | |
| 4739 B Used for business reply mail without a pre-printed zip code. | |
| 4740 C Used for business reply mail with a pre-printed zip code. | |
| 4741 D Used for Information Based Indicia (IBI) postage. | |
| 4742 E Used for customized mail with a USPS Intelligent Mail barcode. | |
| 4743 | |
| 4744 Table: {#tbl:fim_characters tag=": Valid FIM Characters"} | |
| 4745 | |
| 4746 ### 6.7.2 Flattermarken | |
| 4747 | |
| 4748 {.lin} | |
| 4749 | |
| 4750 Used for the recognition of page sequences in print-shops, the Flattermarken is | |
| 4751 not a true barcode symbol and requires precise knowledge of the position of the | |
| 4752 mark on the page. The Flattermarken system can encode numeric data up to a | |
| 4753 maximum of 128 digits and does not include a check digit. | |
| 4754 | |
| 4755 | |
| 4756 # 7. Legal and Version Information | |
| 4757 | |
| 4758 ## 7.1 License | |
| 4759 | |
| 4760 Zint, libzint and Zint Barcode Studio are Copyright © 2024 Robin Stuart. All | |
| 4761 historical versions are distributed under the GNU General Public License version | |
| 4762 3 or later. Versions 2.5 and later are released under a dual license: the | |
| 4763 encoding library is released under the BSD (3 clause) license whereas the GUI, | |
| 4764 Zint Barcode Studio, and the CLI are released under the GNU General Public | |
| 4765 License version 3 or later. | |
| 4766 | |
| 4767 Telepen is a trademark of SB Electronic Systems Ltd. | |
| 4768 | |
| 4769 QR Code is a registered trademark of Denso Wave Incorporated. | |
| 4770 | |
| 4771 Mailmark is a registered trademark of Royal Mail Group Ltd. | |
| 4772 | |
| 4773 Microsoft, Windows and the Windows logo are either registered trademarks or | |
| 4774 trademarks of Microsoft Corporation in the United States and/or other countries. | |
| 4775 | |
| 4776 Linux is the registered trademark of Linus Torvalds in the U.S. and other | |
| 4777 countries. | |
| 4778 | |
| 4779 Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other | |
| 4780 countries. | |
| 4781 | |
| 4782 The Zint logo is derived from "SF Planetary Orbiter" font by ShyFoundary. | |
| 4783 | |
| 4784 Zint.org.uk website design and hosting provided by Robert Elliott. | |
| 4785 | |
| 4786 ## 7.2 Patent Issues | |
| 4787 | |
| 4788 All of the code in Zint is developed using information in the public domain, | |
| 4789 usually freely available on the Internet. Some of the techniques used may be | |
| 4790 subject to patents and other intellectual property legislation. It is my belief | |
| 4791 that any patents involved in the technology underlying symbologies utilised by | |
| 4792 Zint are 'unadopted', that is the holder does not object to their methods being | |
| 4793 used. | |
| 4794 | |
| 4795 Any methods patented or owned by third parties or trademarks or registered | |
| 4796 trademarks used within Zint or in this document are and remain the property of | |
| 4797 their respective owners and do not indicate endorsement or affiliation with | |
| 4798 those owners, companies or organisations. | |
| 4799 | |
| 4800 ## 7.3 Version Information | |
| 4801 | |
| 4802 The current stable version of Zint is 2.13.0, released on 18th December 2023. | |
| 4803 | |
| 4804 See `"ChangeLog"` in the project root directory for information on all releases. | |
| 4805 | |
| 4806 ## 7.4 Sources of Information | |
| 4807 | |
| 4808 Below is a list of some of the sources used in rough chronological order: | |
| 4809 | |
| 4810 - Nick Johnson's Barcode Specifications | |
| 4811 - Bar Code 1 Specification Source Page | |
| 4812 - SB Electronic Systems Telepen website | |
| 4813 - Pharmacode specifications from Laetus | |
| 4814 - Morovia RM4SCC specification | |
| 4815 - Australia Post's 'A Guide to Printing the 4-State Barcode' and bcsample source | |
| 4816 code | |
| 4817 - Plessey algorithm from GNU-Barcode v0.98 by Leonid A. Broukhis | |
| 4818 - GS1 General Specifications v 8.0 Issue 2 | |
| 4819 - PNG: The Definitive Guide and wpng source code by Greg Reolofs | |
| 4820 - PDF417 specification and pdf417 source code by Grand Zebu | |
| 4821 - Barcode Reference, TBarCode/X User Documentation and TBarCode/X demonstration | |
| 4822 program from Tec-It | |
| 4823 - IEC16022 source code by Stefan Schmidt et al | |
| 4824 - United States Postal Service Specification USPS-B-3200 | |
| 4825 - Adobe Systems Incorporated Encapsulated PostScript File Format Specification | |
| 4826 - BSI Online Library | |
| 4827 - Libdmtx Data Matrix ECC200 decoding library | |
| 4828 | |
| 4829 ## 7.5 Standards Compliance | |
| 4830 | |
| 4831 Zint was developed to provide compliance with the following British and | |
| 4832 international standards: | |
| 4833 | |
| 4834 ### 7.5.1 Symbology Standards | |
| 4835 | |
| 4836 - ISO/IEC 24778:2008 Information technology - Automatic identification and data | |
| 4837 capture techniques - Aztec Code bar code symbology specification | |
| 4838 - SEMI T1-95 Specification for Back Surface Bar Code Marking of Silicon Wafers | |
| 4839 (BC412) (1996) | |
| 4840 - ANSI/AIM BC12-1998 - Uniform Symbology Specification Channel Code | |
| 4841 - BS EN 798:1996 Bar coding - Symbology specifications - 'Codabar' | |
| 4842 - AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock-F (1995) | |
| 4843 - ISO/IEC 15417:2007 Information technology - Automatic identification and data | |
| 4844 capture techniques - Code 128 bar code symbology specification | |
| 4845 - BS EN 12323:2005 AIDC technologies - Symbology specifications - Code 16K | |
| 4846 - ISO/IEC 16388:2007 Information technology - Automatic identification and data | |
| 4847 capture techniques - Code 39 bar code symbology specification | |
| 4848 - ANSI/AIM BC6-2000 - Uniform Symbology Specification Code 49 | |
| 4849 - ANSI/AIM BC5-1995 - Uniform Symbology Specification Code 93 | |
| 4850 - AIM Uniform Symbology Specification Code One (1994) | |
| 4851 - ISO/IEC 16022:2006 Information technology - Automatic identification and data | |
| 4852 capture techniques - Data Matrix ECC200 bar code symbology specification | |
| 4853 - ISO/IEC 21471:2020 Information technology - Automatic identification and data | |
| 4854 capture techniques - Extended rectangular data matrix (DMRE) bar code | |
| 4855 symbology specification | |
| 4856 - AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic | |
| 4857 identification and data capture techniques - Bar code symbology | |
| 4858 specification - DotCode (Revised 28th May 2019) | |
| 4859 - ISO/IEC 15420:2009 Information technology - Automatic identification and data | |
| 4860 capture techniques - EAN/UPC bar code symbology specification | |
| 4861 - AIMD014 (v 1.63) - Information technology, Automatic identification and data | |
| 4862 capture techniques - Bar code symbology specification - Grid Matrix | |
| 4863 (Released 9th Dec 2008) | |
| 4864 - ISO/IEC 24723:2010 Information technology - Automatic identification and data | |
| 4865 capture techniques - GS1 Composite bar code symbology specification | |
| 4866 - ISO/IEC 24724:2011 Information technology - Automatic identification and data | |
| 4867 capture techniques - GS1 DataBar bar code symbology specification | |
| 4868 - ISO/IEC 20830:2021 Information technology - Automatic identification and data | |
| 4869 capture techniques - Han Xin Code bar code symbology specification | |
| 4870 - ISO/IEC 16390:2007 Information technology - Automatic identification and data | |
| 4871 capture techniques - Interleaved 2 of 5 bar code symbology specification | |
| 4872 - ISO/IEC 16023:2000 Information technology - International symbology | |
| 4873 specification - MaxiCode | |
| 4874 - ISO/IEC 24728:2006 Information technology - Automatic identification and data | |
| 4875 capture techniques - MicroPDF417 bar code symbology specification | |
| 4876 - ISO/IEC 15438:2015 Information technology - Automatic identification and data | |
| 4877 capture techniques - PDF417 bar code symbology specification | |
| 4878 - ISO/IEC 18004:2015 Information technology - Automatic identification and data | |
| 4879 capture techniques - QR Code bar code symbology specification | |
| 4880 - ISO/IEC 23941:2022 Information technology - Automatic identification and data | |
| 4881 capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology | |
| 4882 specification | |
| 4883 - AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode | |
| 4884 Symbology (Draft) (Released 4th Nov 2015) | |
| 4885 | |
| 4886 A number of other specification documents have also been referenced, such as | |
| 4887 MIL-STD-1189 Rev. B (1989) (LOGMARS), USPS DMM 300 2006 (2011) (POSTNET, PLANET, | |
| 4888 FIM) and USPS-B-3200 (2015) (IMAIL). Those not named include postal and delivery | |
| 4889 company references in particular. | |
| 4890 | |
| 4891 ### 7.5.2 General Standards | |
| 4892 | |
| 4893 - AIM ITS/04-001 International Technical Standard - Extended Channel | |
| 4894 Interpretations Part 1: Identification Schemes and Protocol (Released 24th | |
| 4895 May 2004) | |
| 4896 - AIM ITS/04-023 International Technical Standard - Extended Channel | |
| 4897 Interpretations Part 3: Register (Version 2, February 2022) | |
| 4898 - GS1 General Specifications Release 24.0 (Jan 2024) | |
| 4899 - ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling | |
| 4900 Standard | |
| 4901 | |
| 4902 | |
| 4903 # Annex A. Character Encoding | |
| 4904 | |
| 4905 This section is intended as a quick reference to the character sets used by | |
| 4906 Zint. All symbologies use standard ASCII input as shown in section A.1, but some | |
| 4907 support extended characters as shown in the subsequent section [A.2 Latin | |
| 4908 Alphabet No. 1 (ISO/IEC 8859-1)]. | |
| 4909 | |
| 4910 ## A.1 ASCII Standard | |
| 4911 | |
| 4912 The ubiquitous ASCII standard is well known to most computer users. It's | |
| 4913 reproduced here for reference. | |
| 4914 | |
| 4915 Hex 0 1 2 3 4 5 6 7 | |
| 4916 --- ------ ------ ------ ------ ------ ------ ------ ------ | |
| 4917 0 `NUL` `DLE` `SPACE` `0` `@` `P` `` ` `` `p` | |
| 4918 1 `SOH` `DC1` `!` `1` `A` `Q` `a` `q` | |
| 4919 2 `STX` `DC2` `"` `2` `B` `R` `b` `r` | |
| 4920 3 `ETX` `DC3` `#` `3` `C` `S` `c` `s` | |
| 4921 4 `EOT` `DC4` `$` `4` `D` `T` `d` `t` | |
| 4922 5 `ENQ` `NAK` `%` `5` `E` `U` `e` `u` | |
| 4923 6 `ACK` `SYN` `&` `6` `F` `V` `f` `v` | |
| 4924 7 `BEL` `ETB` `'` `7` `G` `W` `g` `w` | |
| 4925 8 `BS` `CAN` `(` `8` `H` `X` `h` `x` | |
| 4926 9 `TAB` `EM` `)` `9` `I` `Y` `i` `y` | |
| 4927 A `LF` `SUB` `*` `:` `J` `Z` `j` `z` | |
| 4928 B `VT` `ESC` `+` `;` `K` `[` `k` `{` | |
| 4929 C `FF` `FS` `,` `<` `L` `\` `l` `|` | |
| 4930 D `CR` `GS` `-` `=` `M` `]` `m` `}` | |
| 4931 E `SO` `RS` `.` `>` `N` `^` `n` `~` | |
| 4932 F `SI` `US` `/` `?` `O` `_` `o` `DEL` | |
| 4933 | |
| 4934 Table: {#tbl:ascii tag=": ASCII"} | |
| 4935 | |
| 4936 ## A.2 Latin Alphabet No. 1 (ISO/IEC 8859-1) | |
| 4937 | |
| 4938 ISO/IEC 8859-1 defines additional characters common in western European | |
| 4939 languages like French, German, Italian and Spanish. This extension is the | |
| 4940 default encoding of many barcodes (see Table @tbl:default_character_sets) when a | |
| 4941 codepoint above hex 9F is encoded. Note that codepoints hex 80 to 9F are not | |
| 4942 defined. | |
| 4943 | |
| 4944 Hex 8 9 A B C D E F | |
| 4945 --- ------ ------ ------ ------ ------ ------ ------ ------ | |
| 4946 0 `NBSP` `°` `À` `Ð` `à` `ð` | |
| 4947 1 `¡` `±` `Á` `Ñ` `á` `ñ` | |
| 4948 2 `¢` `²` `Â` `Ò` `â` `ò` | |
| 4949 3 `£` `³` `Ã` `Ó` `ã` `ó` | |
| 4950 4 `¤` `´` `Ä` `Ô` `ä` `ô` | |
| 4951 5 `¥` `μ` `Å` `Õ` `å` `õ` | |
| 4952 6 `¦` `¶` `Æ` `Ö` `æ` `ö` | |
| 4953 7 `§` `·` `Ç` `×` `ç` `÷` | |
| 4954 8 `¨` `¸` `È` `Ø` `è` `ø` | |
| 4955 9 `©` `¹` `É` `Ù` `é` `ù` | |
| 4956 A `ª` `º` `Ê` `Ú` `ê` `ú` | |
| 4957 B `«` `»` `Ë` `Û` `ë` `û` | |
| 4958 C `¬` `¼` `Ì` `Ü` `ì` `ü` | |
| 4959 D `SHY` `½` `Í` `Ý` `í` `ý` | |
| 4960 E `®` `¾` `Î` `Þ` `î` `þ` | |
| 4961 F `¯` `¿` `Ï` `ß` `ï` `ÿ` | |
| 4962 | |
| 4963 Table: {#tbl:iso_iec_8869_1 tag=": ISO/IEC 8859-1"} | |
| 4964 | |
| 4965 | |
| 4966 # Annex B. Qt Backend QZint | |
| 4967 | |
| 4968 Used internally by Zint Barcode Studio to display the preview, the Qt Backend | |
| 4969 `QZint` renders a barcode by drawing the vector representation (see [5.5 | |
| 4970 Buffering Symbols in Memory (vector)]) provided by the Zint library `libzint`. | |
| 4971 | |
| 4972 The main class is `Zint::QZint`, which has getter/setter properties that | |
| 4973 correspond to the `zint_symbol` structure (see [5.7 Setting Options]), and a | |
| 4974 main method `render()` which takes a Qt `QPainter` to paint with, and a `QRectF` | |
| 4975 rectangular area specifying where to paint into: | |
| 4976 | |
| 4977 ```c++ | |
| 4978 /* Encode and display barcode in `paintRect` using `painter`. | |
| 4979 Note: legacy argument `mode` is not used */ | |
| 4980 void render(QPainter& painter, const QRectF& paintRect, | |
| 4981 AspectRatioMode mode = IgnoreAspectRatio); | |
| 4982 ``` | |
| 4983 | |
| 4984 `render()` will emit one of two Qt signals - `encoded` on successful encoding | |
| 4985 and drawing, or `errored` on failure. The client can connect and act | |
| 4986 appropriately, for instance: | |
| 4987 | |
| 4988 ```c++ | |
| 4989 connect(qzint, SIGNAL(encoded()), SLOT(on_encoded())); | |
| 4990 connect(qzint, SIGNAL(errored()), SLOT(on_errored())); | |
| 4991 ``` | |
| 4992 | |
| 4993 where `qzint` is an instance of `Zint::QZint` and `on_encoded()` and | |
| 4994 `on_error()` are Qt slot methods provided by the caller. On error, the error | |
| 4995 value and message can be retrieved by the methods `getError()` and `lastError()` | |
| 4996 respectively. | |
| 4997 | |
| 4998 The other main method is `save_to_file()`: | |
| 4999 | |
| 5000 ```c++ | |
| 5001 /* Encode and print barcode to file `filename`. | |
| 5002 Only sets `getError()` on error, not on warning */ | |
| 5003 bool save_to_file(const QString& filename); // `ZBarcode_Print()` | |
| 5004 ``` | |
| 5005 | |
| 5006 which takes a `filename` to output to. It too will emit an `errored` signal on | |
| 5007 failure, returning `false` (but nothing on success, which just returns `true`). | |
| 5008 Note that rotation is achieved through the setter method `setRotateAngleValue()` | |
| 5009 (as opposed to the `rotate_angle` argument used by `ZBarcode_Print()`). | |
| 5010 | |
| 5011 Various other methods are available, for instance methods for testing symbology | |
| 5012 capabilities, and utility methods such as `defaultXdim()` and `getAsCLI()`. | |
| 5013 | |
| 5014 For full details, see `"backend_qt/qzint.h"`. | |
| 5015 | |
| 5016 | |
| 5017 # Annex C. Tcl Backend Binding | |
| 5018 | |
| 5019 A Tcl binding is available in the `"backend_tcl`" sub-directory. To make on | |
| 5020 Unix: | |
| 5021 | |
| 5022 ```bash | |
| 5023 cd backend_tcl | |
| 5024 autoconf | |
| 5025 ./configure | |
| 5026 make | |
| 5027 sudo make install | |
| 5028 ``` | |
| 5029 | |
| 5030 For Windows, a Visual Studio 6.0 project file is available at | |
| 5031 `"backend_tcl\zint_tcl.dsp"`. This can also be opened (and converted) by more | |
| 5032 modern Visual Studio versions, though some fixing up of the project | |
| 5033 configuration will likely be required. | |
| 5034 | |
| 5035 Once built and installed, invoke the Tcl/Tk CLI `"wish"`: | |
| 5036 | |
| 5037 ```bash | |
| 5038 wish | |
| 5039 ``` | |
| 5040 | |
| 5041 and ignoring the Tk window click back to the command prompt `"%"` and type: | |
| 5042 | |
| 5043 ```bash | |
| 5044 require package zint | |
| 5045 zint help | |
| 5046 ``` | |
| 5047 | |
| 5048 which will show the usage message, with options very similiar to the Zint CLI. | |
| 5049 (One notable difference is that boolean options such as `-bold` take a `1` or | |
| 5050 `0` as an argument.) | |
| 5051 | |
| 5052 A demonstration Tcl/Tk program which is also useful in itself is available at | |
| 5053 `"backend_tcl/demo/demo.tcl"`. To run type: | |
| 5054 | |
| 5055 ```bash | |
| 5056 wish demo/demo.tcl | |
| 5057 ``` | |
| 5058 which will display the following window. | |
| 5059 | |
| 5060 {.pop} | |
| 5061 | |
| 5062 You can select the symbology, enter the data to encode, and set options (which | |
| 5063 are the same as those given in the usage message). A raster preview of the | |
| 5064 configured barcode is displayed once the `"Generate"` button is pressed. | |
| 5065 | |
| 5066 | |
| 5067 # Annex D. Man Page ZINT(1) |
