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