Zint Barcode Generator

Prev

Next


3. Using the Front End

Zint can be used to generate barcodes as PNG images, encapsulated Post Script (EPS) or Scalable Vector Graphics (SVG) files. This page describes how to encode data using the command line front end program.

3.1 Inputting data

The data to encode can be entered at the command line using the -d option, for example:

zint -d 'This Text'

This will encode the text This Text. Zint will use the default symbology, Code 128, and output to the default file out.png in the current directory.

3.2 Directing Output

Output can be directed to a file other than the default using the -o switch. For example:

zint -o here.png -d 'This Text'

draws a Code 128 barcode in the file here.png. If an encapsulated Post Script file is needed simply append the file name with .eps:

zint -o there.eps -d 'This Text'

Scalable Vector Graphics representations of symbols can be generated with the suffix ".svg". Output can also be directed to stdout using the --directeps, --directpng and --directsvg switches for EPS, PNG and SVG output respectively.

3.3 Selecting barcode type

Selecting which type of barcode you wish to produce (i.e. which symbology to use) can be done at the command line using the -b or --barcode= switch followed by the appropriate integer value in the following table.

Numeric Value

Barcode Name

1

Code 11

2

Standard Code 2 of 5

3

Interleaved 2 of 5

4

Code 2 of 5 IATA

6

Code 2 of 5 Data Logic

7

Code 2 of 5 Industrial

8

Code 3 of 9 (Code 39)

9

Extended Code 3 of 9 (Code 39+)

13

EAN

16

GS1-128 (UCC.EAN-128)

18

Codabar

20

Code 128 (automatic subset switching)

21

Deutshe Post Leitcode

22

Deutshe Post Identcode

23

Code 16K

25

Code 93

28

Flattermarken

29

GS1 DataBar-14

30

GS1 DataBar Limited

31

GS1 DataBar Extended

32

Telepen Alpha

34

UPC A

37

UPC E

40

PostNet

47

MSI Plessey

49

FIM

50

LOGMARS

51

Pharmacode One-Track

52

PZN

53

Pharmacode Two-Track

55

PDF417

56

PDF417 Truncated

57

Maxicode

58

QR Code

60

Code 128 (Subset B)

63

Australia Post Standard Customer

66

Australia Post Reply Paid

67

Australia Post Routing

68

Australia Post Redirection

69

ISBN (EAN-13 with verification stage)

70

Royal Mail 4 State (RM4SCC)

71

Data Matrix

72

EAN-14

74

Codablock-F

75

NVE-18

76

Japanese Postal Code

77

Korea Post

79

GS1 DataBar-14 Stacked

80

GS1 DataBar-14 Stacked Omnidirectional

81

GS1 DataBar Expanded Stacked

82

PLANET

84

MicroPDF417

85

USPS OneCode

86

Plessey Code

87

Telepen Numeric

89

ITF-14

90

Dutch Post KIX Code

92

Aztec Code

93

DAFT Code

97

Micro QR Code

98

HIBC Code 128

99

HIBC Code 39

102

HIBC Data Matrix

104

HIBC QR Code

106

HIBC PDF417

108

HIBC MicroPDF417

110

HIBC Codablock-F

128

Aztec Runes

129

Code 32

130

Composite Symbol with EAN linear component

131

Composite Symbol with GS1-128 linear component

132

Composite Symbol with GS1 DataBar-14 linear component

133

Composite Symbol with GS1 DataBar Limited component

134

Composite Symbol with GS1 DataBar Extended component

135

Composite Symbol with UPC A linear component

136

Composite Symbol with UPC E linear component

137

Composite Symbol with GS1 DataBar-14 Stacked component

138

Composite Symbol with GS1 DataBar-14 Stacked Omnidirectional component

139

Composite Symbol with GS1 DataBar Expanded Stacked component

3.4 Adjusting height

The height of the symbol can be adjusted using the --height switch. For example:

zint --height=100 -d 'This Text'

specifies a symbol height of 100 times the x-resolution of the symbol.

3.5 Adjusting whitespace

The amount of whitespace to the left and right of the generated barcode can be altered using the -w switch. For example:

zint -w 10 -d 'This Text'

specifies a whitespace width of 10 times the x-resolution of the symbol.

3.6 Adding boundary bars and boxes

Zint allows the symbol to be bound with 'boundary bars' using the option --bind. 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. Zint can also put a border right around the symbol and its whitespace with the --box option. This option is automatically chosen for ITF-14 symbols.

The width of the boundary or box can be specified using the --border switch. For example:

zint --box --border=10 -d 'This'

gives a box with a width 10 times the x-resolution of the symbol.

bound symbol

boxed symbol

3.7 Using colour

The default colours of a symbol are a black symbol on a white background. Zint allows you to change this. The -r switch allows the default colours to be inverted so that a white symbol is shown on a black background. For example the command

zint -r -d 'This'

gives an inverted Code 128 symbol. This is not practical for most symbologies but white-on-black is allowed by the Data Matrix and Aztec Code symbology specifications.

For more specific needs the foreground and background colours can be specified using the --fg= and --bg= options followed by a number in RGB hexadecimal notation (the same system used in HTML). For example the command

zint --fg=004700 -d 'This'

alters the symbol to a dark green as shown below.

symbol with green ink

symbol with pink paper

3.8 Rotating the Symbol

The symbol can be rotated through four orientations using the --rotate= option followed by the angle of rotation as shown below. This option is only available with PNG output.


--rotate=0 (default)


--rotate=180


--rotate=270


--rotate=90

3.9 Adjusting image size

The scale of the image can be altered using the --scale= option followed by a multiple of the default x-dimension. For example for PNG images a scale of 5 will increase the x-dimension to 10 pixels. Note that Maxicode symbols output as PNG images cannot be scaled in this way and that text added to a barcode in PNG images does not change size.

3.10 Handling NULL Characters

Some symbologies support encoding of the NULL character (ASCII 0) normally used to indicate the end of a character string. To support this functionality the --null= option allows you to substitute another character for NULL. Enter the decimal number for the character you wish to substitute. For example --null=21 instructs Zint to treat the NAK control character as a NULL character. Values between 1 and 128 are valid. This applies to Codablock-F, Code 128, Code 16k, Extended Code 39, Code 93, Maxicode, PDF417, MicroPDF417, Data Matrix (ECC 200 only) and Telepen.

3.11 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 (see 5.1.12.3). To encode GS1 data use --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, Codablock-F, Data Matrix (ECC 200 only), and Aztec Code.

The QR Code and MicroQR Code standards have a "Kanji mode" for encoding Japanese chacters. The standards assume that the input is encoded using the Shift-JIS system. To access this functionality directly use the --sjis option. Note that only double-byte characters are supported. The presence of single byte characters will cause the data to become corrupted. This functionality can also be accessed from environments which use Unicode encoding by using the --kanji option. When this option is invoked Zint attempts to convert Unicode data to Shift-JIS before encoding in a barcode symbol. If a Unicode character is not supported then the error message is output.[1]

3.12 Other options

Additional options are available which are specific to certain symbologies. These may, for example, control the quantity of error correction data or the size of the symbol. These options are discussed in section 5 of this guide.

[1] Only Unicode and Shift-JIS inputs can be encoded by Zint directly. Apple Macintosh Japanese, EUC-JP, ISO-2022-JP and Windows-932 standards are not supported.


Prev

Home

Next

Installation

 

Using the API