Barcodes with Zint for Delphi

<< Click to display table of contents >>

Barcodes with Zint for Delphi

This extension adds two new data field types: barcode and qrcode.

Input: text or integer value.

Output: image containing barcode.

Field types barcode and qrcode are almost identical, except for the default barcode type: EANX for barcode, QRCODE for qrcode.

How to use

1.Download Zint Barcode Generator for Delphi, free open source barcode generator for Delphi and Lazarus.

2.Delphi: add path to Zint Barcode Generator's PAS-files to Delphi library. Lazarus: include Zint Barcode Generator's PAS-files to your project (all PAS-files except for zint_render_svg, zint_qr_epc, zint_render_wmf, zint_render_fmx_canvas, zint_render_fmx_bmp)

3.VCL and Lazarus: Include RVReportZintBarcode.pas in your project
FireMonkey:  Include fmxRVReportZintBarcode.pas in your project

4.Lazarus: add the path <TRichView Dir>\TRichView\Source\Include to "Compiler Options | Paths | Include files" in your project's options.

5.VCL and Lazarus: Add RVReportZintBarcode to "uses" of the main form unit. This unit is in <TRichView Dir>\ThirdParty\Barcode\Zint\Source\ folder.
FireMonkey: Add fmxRVReportZintBarcode to "uses" of the main form unit. This unit is in <TRichView Dir>\ThirdParty\Barcode\Zint.FMX\Source\ folder.

Example syntax

{VALUE qrcode}

{VALUE qrcode "ecc=H color=darkred"}

{VALUE  barcode "type=upca width=300 height=50 showtext=no"}

Format string

The format string is a combination of properties, separated by spaces. Each property has the form:

<property name>='<property value>' |<property name>=<property value>

<property name> is one of: color, backcolor, size, width, height, type, imageformat, ecc, fontname, fontsize, fontcolor, showtext, padding, borderwidth, vspace, hspace, bordercolor, align.

<property value> may be enclosed in single quotes. It is necessary for values containing space characters (such as font names).

Properties are processed from left to right, so earlier values can be overridden.

The most important property is "type". It defines the type of generated barcode.

Common properties

Property

Meaning

Default value

color

color of barcode symbol

black

backcolor

background color

 

white

size

width and height of the resulting image, pixels

200

width

width of the resulting image, pixels

200

height

height of the resulting image, pixels

200

imageformat

format of the resulting image (wmf, bmp, png, etc.)

wmf for VCL

png for Lazarus and FireMonkey

fontname

font name for text

RVDefaultLoadProperties.DefaultFontName

fontsize

font size for text, points

8

textcolor

color of text

black

showtext

turn text displaying on/off

(

text is shown for values: y, yes, t, true, 1;

text is hidden for values: n, no, f, false, 0

)

 

true

type

barcode type, see Types of Barcodes.

EANX for barcode type

QRCODE for qrcode type

Note: if size of only one side (width or height) is defined, the same size is assigned to another side.

Additionally, the following properties of format strings for images are supported:

padding

borderwidth

vspace

hspace

bordercolor

align

Properties for specific types of barcodes

Property

Meaning

Default value

ecc

Error correction level for QR codes

Possible values:

0 or L

1 or M

2 or Q

3 or H

auto