struct zint_seg {unsignedchar*source;/* Data to encode */
-int length;/* Length of `source`. If 0, `source` must be
- NUL-terminated */
+int length;/* Length of `source`. If 0 or negative, `source`
+ must be NUL-terminated */int eci;/* Extended Channel Interpretation */};
The symbology must support ECIs (see Table }else{ printf("PDF417 does not support ECI\n");}
-
5.16 Zint Version
+
5.16 UTF-8 to ECI
+convenience functions
+
As a convenience the conversion done by Zint from UTF-8 to ECIs is
+exposed in two helper functions (compatible with the
+libzueci18 functions
+zueci_utf8_to_eci() and
+zueci_dest_len_eci()):
Call ZBarcode_Dest_Len_ECI() to get the size of buffer
+sufficient to accommodate the conversion, then call
+ZBarcode_UTF8_To_ECI() with an appropriately sized buffer
+to do the conversion. The final destination length, returned in
+p_dest_length, may be smaller than the estimate given by
+ZBarcode_Dest_Len_ECI(). If length is zero or
+less, source must be NUL-terminated. The destination buffer
+is not NUL-terminated. The obsolete ECIs 0, 1 and 2 are supported.
+
5.17 Zint Version
Whether the Zint library linked to was built with PNG support may be
determined with:
-
int ZBarcode_NoPng();
+
int ZBarcode_NoPng();
which returns 1 if no PNG support is available, else zero.
Lastly, the version of the Zint library linked to is returned by:
-
int ZBarcode_Version();
+
int ZBarcode_Version();
The version parts are separated by hundreds. For instance, version
"2.9.1" is returned as "20901".
6. Types of Symbology
@@ -4453,12 +4477,12 @@ calculated by Zint. In addition EAN-2 and EAN-5 add-on symbols can be
added using the + character. For example, to draw a UPC-A
symbol with the data 72527270270 with an EAN-5 add-on showing the data
12345 use the command:
-
zint-b UPCA -d"72527270270+12345"
+
zint-b UPCA -d"72527270270+12345"
or using the API encode a data string with the +
character included:
@@ -4472,12 +4496,12 @@ input and validates the check digit before encoding.
--guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE). For UPC, this
is only relevant when there is add-on:
-
@@ -4504,19 +4528,19 @@ check digit is calculated by Zint. EAN-2 and EAN-5 add-on symbols can be
added using the + character as with UPC-A. In addition Zint also
supports Number System 1 encoding by entering a 7-digit article number
starting with the digit 1. For example:
-
If your input data already includes the check digit symbology
BARCODE_UPCE_CHK (38) can be used which takes a 7 or
8-digit input and validates the check digit before encoding.
As with UPC-A, a quiet zone indicator can be added when there is an
add-on by setting --guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE):
-
zint-b UPCE -d"1123456+12"--guardwhitespace
+
zint-b UPCE -d"1123456+12"--guardwhitespace
@@ -4546,8 +4570,8 @@ numbers respectively. Zint will decide which symbology to use depending
on the length of the input data. In addition EAN-2 and EAN-5 add-on
symbols can be added to EAN-8 and EAN-13 symbols using the
+ character as with UPC symbols. For example:
-
@@ -4579,8 +4603,8 @@ and validates the check digit before encoding.
Options to add quiet zone indicators and to adjust the add-on gap and
the guard bar descent height are the same as for 6.1.3.2 UPC Version E. For instance:
-
zint-b EANX_CHK -d"74323654"--guardwhitespace
+
zint-b EANX_CHK -d"74323654"--guardwhitespace
@@ -4872,21 +4896,21 @@ escapes \^A, \^B, \^C and
\^@ (the latter turns off manual Code Set selection). For
instance the following will force switching to Code Set B for the data
"5678" (normally Code Set C would be used throughout):
-
zint-b CODE128 -d"1234\^B5678"--extraesc
+
zint-b CODE128 -d"1234\^B5678"--extraesc
The manually selected Code Set will apply until the next Code Set
escape sequence or until a \^@, with the exception that
data that cannot be represented in that Code Set will be switched as
appropriate. If the data contains an extra escape sequence, it can be
escaped by doubling the caret (^). For instance
-
zint-b CODE128 -d"\^AABC\^^BDEF"--extraesc
+
zint-b CODE128 -d"\^AABC\^^BDEF"--extraesc
will encode the data "ABC\^BDEF" in Code Set A.
There is also the extra escape \^1, which will encode a
special Function Code 1 character (FNC1) anywhere you chose
in the data, for instance
-
zint-b CODE128 -d"A\^1BC\^1DEF"--extraesc
+
zint-b CODE128 -d"A\^1BC\^1DEF"--extraesc
Zint can encode a maximum of 102 symbol characters, which allows for
e.g. 202 all-numeric or 101 all-uppercase characters. Sizes above 120
digits (60 alphanumerics) are not recommended.
It is sometimes advantageous to stop Code 128 from using Code Set C
which compresses numerical data. The BARCODE_CODE128AB18 variant (symbology 60) suppresses
+href="#fn19" class="footnote-ref" id="fnref19"
+role="doc-noteref">19 variant (symbology 60) suppresses
Code Set C in favour of Code Sets A and B.
Note that the special extra escapes mentioned above are not available
for this variant (nor for any other).
@@ -4927,11 +4951,11 @@ correct encoding. GS1-128 does not support extended ASCII (ISO/IEC
8859-1) characters. Check digits for GTIN data AI (01) are not generated
and need to be included in the input data. The following is an example
of a valid GS1-128 input:
-
6.1.10.3 GS1-128.
not calculated by Zint when this symbology is encoded. Fixed length data
should be entered at the appropriate length for correct encoding. The
following is an example of a valid GS1 DataBar Expanded input:
-
primarily in the vehicle industry, is to simply stack one-dimensional
codes on top of each other. This can be achieved at the command prompt
by giving more than one set of input data. For example
-
zint-d"This"-d"That"
+
zint-d"This"-d"That"
will draw two Code 128 symbols, one on top of the other. The same
result can be achieved using the API by executing the
ZBarcode_Encode() function more than once on a symbol. For
example:
@@ -5222,8 +5246,8 @@ specifying --bind (API
separator bars in integral multiples of the X-dimension (minimum and
default 1, maximum 4) can be set by --separator (API
option_3):
-
zint--bind--notext--separator=2 -d"This"-d"That"
+
zint--bind--notext--separator=2 -d"This"-d"That"
@@ -5501,21 +5525,21 @@ should be entered into a primary string with the data for the 2D
component being entered in the normal way. To do this at the command
prompt use the --primary switch (API primary).
For example:
-
This creates an EAN-13 linear component with the data
"331234567890" and a 2D CC-A (see below) component with the data
"(99)1234-abcd". The same results can be achieved using the
API as shown below:
The optional frame number is a number in the range 0 to 63, and may
have a half frame indicator "A" appended. Special character
sequences (with or without a half frame indicator appended) may also be
@@ -5907,13 +5931,13 @@ size to full height can be given in thousandths (permille) using the
--vers option (API option_2). The default
value is 250 (25%).
@@ -6554,8 +6578,8 @@ be manually specified by using the --mask switch with
values 0-7, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-7. To use with
ZINT_FULL_MULTIBYTE set
-
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
+
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
The --fast option (API
input_mode |= FAST_MODE) may be used when leaving Zint to
automatically select a mask to reduce the number of masks to try to four
@@ -6691,8 +6715,8 @@ be manually specified by using the --mask switch with
values 0-3, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-3. To use with
ZINT_FULL_MULTIBYTE set
-
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
+
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
6.6.5 Rectangular
Micro QR Code (rMQR) (ISO 23941)
@@ -6959,8 +6983,8 @@ Latin-2 formatted use the --binary switch (API
input_mode = DATA_MODE).
The following example creates a symbol from data saved as a Latin-2
file:
A mask may be manually specified or the --fast option
used as with QRCODE.
6.6.7 MaxiCode (ISO 16023)
@@ -7019,9 +7043,9 @@ your parcel courier.
The primary message can be set at the command prompt using the
--primary switch (API primary). The secondary
message uses the normal data entry method. For example:
zint-b 57 --primary="152382802840001"--scmvv=96 --esc-d\
-"1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E"
+
zint-b 57 --primary="152382802840001"--scmvv=96 --esc-d\
+"1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E"
will prefix "[)>\R01\G96" to the secondary message.
(\R, \G and \E are the escape
sequences for Record Separator, Group Separator and End of Transmission
@@ -7045,8 +7069,8 @@ Sequences.)
Modes 4 to 6 can be accessed using the --mode switch
(API option_1). Modes 4 to 6 do not have a primary message.
For example:
Mode 6 is reserved for the maintenance of scanner hardware and should
not be used to encode user data.
This symbology uses Latin-1 character encoding by default but also
@@ -7970,8 +7994,8 @@ be manually specified by using the --mask switch with
values 0-3, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-3. To use with
ZINT_FULL_MULTIBYTE set
-
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
+
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
6.6.14 Ultracode
Zint does not currently implement data compression by default, but
this can be initiated through the API by setting
-
symbol->option_3 = ULTRA_COMPRESSION;
+
symbol->option_3 = ULTRA_COMPRESSION;
With compression, up to 504 digits, 375 alphanumerics or 252 bytes
can be encoded.
Revision 2 of Ultracode (2023) may be specified using
@@ -8117,12 +8141,13 @@ not include a check digit.
Telepen is a trademark of SB Electronic Systems Ltd.
QR Code is a registered trademark of Denso Wave Incorporated.
Mailmark is a registered trademark of Royal Mail Group Ltd.
@@ -8685,28 +8710,28 @@ properties that correspond to the zint_symbol structure
method render() which takes a Qt QPainter to
paint with, and a QRectF rectangular area specifying where
to paint into:
-
/* Encode and display barcode in `paintRect` using `painter`.
- Note: legacy argument `mode` is not used */
-void render(QPainter& painter,constQRectF& paintRect,
- AspectRatioMode mode = IgnoreAspectRatio);
+
/* Encode and display barcode in `paintRect` using `painter`.
+ Note: legacy argument `mode` is not used */
+void render(QPainter& painter,constQRectF& paintRect,
+ AspectRatioMode mode = IgnoreAspectRatio);
render() will emit one of two Qt signals -
encoded on successful encoding and drawing, or
errored on failure. The client can connect and act
appropriately, for instance:
where qzint is an instance of Zint::QZint
and on_encoded() and on_error() are Qt slot
methods provided by the caller. On error, the error value and message
can be retrieved by the methods getError() and
lastError() respectively.
The other main method is save_to_file():
-
/* Encode and print barcode to file `filename`.
- Only sets `getError()` on error, not on warning */
-bool save_to_file(constQString& filename);// `ZBarcode_Print()`
+
/* Encode and print barcode to file `filename`.
+ Only sets `getError()` on error, not on warning */
+bool save_to_file(constQString& filename);// `ZBarcode_Print()`
which takes a filename to output to. It too will emit an
errored signal on failure, returning false
(but nothing on success, which just returns true). Note
@@ -8721,12 +8746,12 @@ symbology capabilities, and utility methods such as
Annex C. Tcl Backend Binding
A Tcl binding is available in the "backend_tcl”
sub-directory. To make on Unix:
-
cd backend_tcl
-autoconf
-./configure
-make
-sudo make install
+
cd backend_tcl
+autoconf
+./configure
+make
+sudo make install
For Windows, a Microsoft Visual C++ project file is available at
"backend_tcl\zint_tcl.vcxproj". Note that this assumes that
Tcl/Tk is available in "C:\Tcl" and that the libraries are
@@ -8737,21 +8762,21 @@ to match your setup. There is also a Visual Studio makefile available at
"backend_tcl\win\README.txt".
Once built and installed, invoke the Tcl/Tk CLI
"wish":
-
wish
+
wish
and ignoring the Tk window click back to the command prompt
"%" and type:
-
package require zint
-zint help
+
package require zint
+zint help
which will show the usage message, with options very similiar to the
Zint CLI. (One notable difference is that boolean options such as
-bold take a 1 or 0 as an
argument.)
A demonstration Tcl/Tk program which is also useful in itself is
available at "backend_tcl/demo/demo.tcl". To run type:
-
wish demo/demo.tcl
+
wish demo/demo.tcl
which will display the following window.
--werror given
EXAMPLES
Create “out.png” (or “out.gif” if zint built without PNG support) in
the current directory, as a Code 128 symbol.
-
zint-d'This Text'
-
Create “qr.svg” in the current directory, as a QR Code symbol.
zint-b QRCode -d'This Text'-o'qr.svg'
+class="sourceCode bash">zint-d'This Text'
+
Create “qr.svg” in the current directory, as a QR Code symbol.
+
zint-b QRCode -d'This Text'-o'qr.svg'
Use batch mode to read from an input file “ean13nos.txt” containing a
list of 13-digit GTINs, each on a separate line, to create a series of
EAN-13 barcodes, formatting the output filenames to “ean001.gif”,
“ean002.gif” etc. using the special character “~”.
-
zint-b EANX --batch-i'ean13nos.txt'-o'ean~~~.gif'
+
zint-b EANX --batch-i'ean13nos.txt'-o'ean~~~.gif'
BUGS
Please send bug reports to
https://sourceforge.net/p/zint/tickets/.