Manual Page
package require tzint ?1.0? tzint::Encode version tzint::Encode symbologies tzint::Encode bits | eps | svg | xbm varName data ?-option value ...? tzint::Encode file filename.png | filename.svg | filename.eps data ?-option value ...? tzint::RcsId
Performs one of several barcode encoding operations, depending on option. The legal commands and options (which may be abbreviated) are:
version | command returns the version of underlaying libzint. |
symbologies | command returns a list of symbology names that can be encoded. |
bits | eps | svg | xbm | command encodes a barcode into varName. |
tzint::Encode will return 0 if no error occurs. More infomation can be obtainted by option -stat.
Selecting which type of barcode you wish to produce (i.e. which symbology to use) can be done using the -symbology symbolName.
The height of a 1d symbol can be adjusted using the -height integer
The amount of whitespace to the left and right of the generated barcode can be altered using -whitespace integer
tzint allows the symbol to be bound with 'boundary bars' using the option -bind boolean. These bars help to prevent misreading of the symbol by corrupting a scan if the scanning beam strays off the top or bottom of the symbol. tzint can also put a border right around the symbol and its whitespace with the -box boolean option. This option is automatically selected for ITF-14 symbols.
The width of the boundary or box can be specified using the -border integer switch.
The default colours of a symbol are a black symbol on a white background. tzint allows you to change this. For more specific needs the foreground and background colours can be specified using the -foreground or -fg or -background or -bg options followed by a number in RGB hexadecimal notation (the same system used in HTML).
The symbol can be rotated through four orientations using the -rotate option followed by the angle 0 | 90 | 180 | 270 of rotation.
The scale of the image can be altered using the -scale integer option followed by a multiple of the default x-dimension.
Input modes
GS1 data can be encoded in a number of symbologies. Application identifiers are enclosed in [square brackets] followed by the data to be encoded. To encode GS1 data use -format gs1. GS1 mode is assumed (and doesn't need to be set) for EAN-128, DataBar and Composite symbologies but is also available for Code 16k, Data Matrix (ECC 200 only), Aztec Code and QR Code.
QR Code, Micro QR Code and Grid Matrix standards can encode Kanji characters. These can be given in Unicode -format unicode (default) format as part of the input data string. Conversion from Unicode to Shift- JIS or GB 2312 as appropriate is handled by tzint.
If the input data is not Unicode encoded or should be interpreted as an 8-bit data stream then the -format binary option can be used to achieve this.
Barcode specific options:
-cols | integer | number of columns PDF417 (same as -opt2) |
-vers | integer | option QR Code and Plessy (same as -opt2) |
-security | integer | error correction level PDF417 and QR Code (same as -opt1) |
-mode | integer | tructured primary data mode Maxicode and Composite (same as -opt1) |
-primary | text | structured primary data Maxicode and Composite |
-notext | boolean | no interpretation line |
-square | boolean | force DataMatrix symbols to be square (same as -opt3) |
-init | boolean | create reader initialisation symbol Code128 and DataMatrix |
-smalltext | boolean | tiny interpretation line font |
-opt1 | integer | see zint manual |
-opt2 | integer | see zint manual |
-opt3 | integer | see zint manual |
Changing the '0'/'1' character when using the bits command then the -onchar and/or -offchar char option can be used.
MSI Plessey
Based on Plessey and developed by MSE Data Corporation, MSI Plessey is available with a range of check digit options available by using the -vers integer' option. Any length numeric (digits 0-9) input can be encoded. The table below shows the options available:
Value | Check Digits |
---|---|
0 | None |
1 | Modulo-10 |
2 | Modulo-10 & Modulo-10 |
3 | Modulo-11 |
4 | Modulo-11 & Modulo-10 |
Standard Code 39 (ISO 16388)
Standard Code 39 was developed in 1974 by Intermec. Input data can be of any length and supports the characters 0-9, A- Z, dash (-), full stop (.), space, asterisk (*), dollar ($), slash (/), plus (+) and percent (%). The standard does not require a check digit but a modulo-43 check digit can be added if required by using -vers 1.
Extended Code 39
Also known as Code 39e and Code39+, this symbology expands on Standard Code 39 to provide support to the full ASCII character set. The standard does not require a check digit but a modulo-43 check digit can be added if required by using -vers 1.GS1 DataBar (ISO 24724)
Also known as RSS (Reduced Spaced Symbology) these symbols are due to replace GS1-128 symbols starting in 2010 in accordance with the GS1 General Specification. If a GS1 DataBar symbol is to be printed with a 2D component as specified in ISO 24723 set option -mode 2 at the command prompt.
PDF417 (ISO 15438)
Heavily used in the parcel industry, the PDF417 symbology can encode a vast amount of data into a small space. tzint supports encoding up to the ISO standard maximum symbol size of 925 codewords which (at error correction level 0) allows a maximum data size of 1850 text characters, or 2710 digits. The width of the generated PDF417 symbol can be specified at the command line using the -cols switch followed by a number between 1 and 30, and the amount of check digit information can be specified by using the '-security switch followed by a number between 0 and 8 where the number of codewords used for check information is determined by 2(value + 1). The default level of check information is determined by the amount of data being encoded. International text support is provided using the Latin-1 character set as described in Appendix A. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data.
Channel Code
A highly compressed symbol for numeric data. The number of channels in the symbol can be between 3 and 8 and this can be specified by setting the value of -vers. It can also be determined by the length of the input data e.g. a three character input string generates a 4 channel code by default.
The maximum values permitted depend on the number of channels used as shown in the table below:
Channels | Minimum Value | Maximum Value |
---|---|---|
3 | 00 | 26 |
4 | 000 | 292 |
5 | 0000 | 3493 |
6 | 00000 | 44072 |
7 | 000000 | 576688 |
8 | 0000000 | 7742862 |
Note that 7 and 8 channel codes require a processor intensive algorithm to generate and so response times when generating these codes will be relatively slow.
QR Code (ISO 18004)
Also known as Quick Response Code this symbology was developed by Denso. Four levels of error correction are available using the -security option as shown in the following table.
Input | ECC Level Error | Correction Capacity | Recovery Capacity |
---|---|---|---|
1 | L (default) | Approx 20% of symbol | Approx 7% |
2 | M | Approx 37% of symbol | Approx 15% |
3 | Q | Approx 55% of symbol | Approx 25% |
4 | H | Approx 65% of symbol | Approx 30% |
The size of the symbol can be set by using the -vers option to the QR Code version required (1-40). 1 = 21 x 21 and 40 = 177 x 177. The maximum capacity for a (version 40) QR Code symbol is 7089 numeric digits, 4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be used to encode GS1 data. QR Code symbols can encode characters in the Latin-1 set and Kanji characters which are members of the Shift-JIS encoding scheme. Input should be entered as a UTF-8 stream with conversion to Shift-JIS being carried out automatically by tzint. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data.
GS1 DataBar Expanded Stacked (ISO 24724)
A stacked variation of the GS1 DataBar Expanded symbol for smaller packages. In addition the width of the symbol can be altered using the -cols option. In this case the number of columns relates to the number of character pairs on each row of the symbol. For symbols with a 2D component the number of columns must be at least 2. This symbol can be generated with a two-dimensional component to make a composite symbol.
Composite Symbols (ISO 24723)
Composite symbols employ a mixture of components to give more comprehensive information about a product. The permissible contents of a composite symbol is determined by the terms of the GS1 General Specification. Composite symbols consist of a linear component which can be an EAN, UPC, GS1-128 or GS1 DataBar symbol, a 2D component which is based on PDF417 or MicroPDF417, and a separator pattern. The type of linear component to be used is determined using the -symbology option as with other encoding methods.
Valid values are: eanx_cc, ean128_cc, rss14_cc, rss_ltd_cc, rss_exp_cc, upca_cc, upce_cc, rss14stack_cc, rss14_omni_cc and rss_expstack_cc.
The data to be encoded in the linear component of a composite symbol should be entered into a primary string with the data for the 2D component being entered in the normal way (see exmpample below).