How ITF-14 barcode works in Delphi / Lazarus and how to fine-tune it

ITF-14

A new ITF-14 barcode has been added in FastReport VCL 2021.2. Let me remind you that ITF-14 (Interleaved Two of Five) is a two-band numeric code, or a high-density code that can encode an even number of digits only. Each such barcode encodes an odd digit with a bar and an even digit with a space between the odd ones. To encode an odd number of digits, you need to pad the leftmost (most significant) digit with a zero. You can read more theoretical information about ITF-14 in another article.

Not long ago, our users found some non-critical errors. Nevertheless, sometimes they interfered with the use of the barcode. The fixes are already in the public domain. This article is intended to help those users who have not noticed the errors yet, and it will also introduce the implementation features.

It was noticed that under some conditions, incorrect digits could be displayed under the barcode. Also, the strokes went beyond the borders of the frame at the bottom.

Corrected barcode

These errors have already been fixed and if you use ITF-14 barcode in your projects, then we highly recommend you updating FastReport to the latest version.

Now let’s move on to the features.

The frame is mandatory for this barcode, since it is spelled out in the specification. So, there will be no way to completely disable the frame or make a lot of change. But you can still change it.

First, you can turn off sidelines by turning on the TestLine property.

ITF-14 without sidelines

Secondly, you can change the thickness of the inline by changing Frame->Width. This property will work even if the outer border is disabled. 

Changing the thickness of the inline

Optionally, you can enable and configure an outer frame using the Frame property. The principle is exactly the same as for any other object in the report; the barcode will have 2 frames at once, and the outer one will be richer in design possibilities. 

Example of two frames on one barcode

Generating the ITF-14 barcode using Delphi / Lazarus code

procedure TForm1.Button1Click(Sender: TObject);
 var bc: TfrxBarcodeView;
begin
 bc := TfrxBarcodeView(frxReport1.FindObject('BarCode1'));
 {Set the type of the barcode}
 bc.BarType := bcCode_ITF_14;
 {Set a fixed barcode value}
 bc.Text := '12345678912345';
 {Set the scale at which the barcode will be displayed}
 bc.Zoom := 2;
 {Set the rotation angle of the barcode. Can take values 0, 90, 180, 270}
 bc.Rotation := 0;
 {Set whether to change the width of the barcode depending on its content}
 {If set to False, Zoom property will be set to keep the barcode width fixed}
 bc.AutoSize := True;
 {Set background of the barcode}
 bc.Color := clNone;
 {Set the color of bars}
 bc.ColorBar := clBlack;
 {Set whether to display text at the bottom of the barcode}
 bc.ShowText := True;
 {Set the width of the inner frame}
 bc.Frame.Width := 3;
 {Set the outer frame}
 {Set how external frames from all sides are displayed}
 bc.Frame.Typ := [ftLeft, ftRight, ftTop, ftBottom];
 {Set the width of the left frame line}
 bc.Frame.LeftLine.Width := 5;
 {Set the color of the left frame line}
 bc.Frame.LeftLine.Color := clRed;
 {Set the style of the left frame line}
 bc.Frame.LeftLine.Style := fsDashDotDot;
 {Copy the settings of the left frame line to the right one}
 bc.Frame.RightLine.Assign(bc.Frame.LeftLine);
 {Copy the settings of the left frame line to the top one}
 bc.Frame.TopLine.Assign(bc.Frame.LeftLine);
 {Copy the settings of the left frame line to the bottom one}
 bc.Frame.BottomLine.Assign(bc.Frame.LeftLine);
 frxReport1.ShowReport();
end;

ITF-14 is undoubtedly one of the most commonly used barcodes. If you notice any errors or have any questions, please write in our Support

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot