KA.Barcode for .NET Suite
Guide for Resizing Interleaved 2 of 5 Barcodes in C#.NET
Complete C# source code to generate, print Interleaved 2 of 5 images and change barcode size with .NET Control

  • Create high quality Interleaved 2 of 5 Png, Gif, Jpeg, Tiff, or Bmp files in .NET projects using C#

  • Provide properties X and Y to set the width and height of the module bar

  • Present property WideNarrowRatio to set the width of the wide bar in Interleaved 2 of 5

  • Support the width setting of surrounding margins

  • Support the width and height setting of the whole Interleaved 2 of 5 image

  • Provide cm, inch, and pixel as the unit of measure

  • Compatible with ISO / IEC 16390 (2nd edition 2007-06-15)

  • Capable of printing Interleaved 2 of 5 with minimum X

  • Also be capable of drawing maximum X in a fixed Interleaved 2 of 5 image width

Interleaved 2 of 5, is also named as ANSI/AIM ITF 25, USS ITF 2/5, 2 of 5 Interleaved, 2/5 Interleaved.

KeepAutomation Interleaved 2 of 5 (linear) barcode library (KA.Barcode Generator for C#.NET) is able to:

Interleaved 2 of 5 C#.NET Generator Related Product Software

VB.NET Interleaved 2 of 5 Generator

Java Interleaved 2 of 5 Generator

.NET Interleaved 2 of 5 Winforms Generator

ASP.NET Interleaved 2 of 5 Generator


Interleaved 2 of 5 Size Setting Introduction

Width Setting

The following table explains the essential parameters of Interleaved 2 of 5 size setting in Interleaved 2 of 5 C#.NET Generator.

Parameter Parameter Description Range Related Property
Image Width(W) The width of the Interleaved 2 of 5 image - BarCodeWidth
Module Bar Width (X) The width of the module bar in Interleaved 2 of 5 X ≥ 1 pixel X
Wider Bar Width (NX) The width of the wider bar in Interleaved 2 of 5 2.0 ≤ N ≤ 3.0 WideNarrowRatio
Left Quiet Zone Width (Q1) The space between the left edge of the image and the leftmost bar; Q1= 10 X + Left Margin Width Q1 ≥ 10X LeftMargin
Right Quiet Zone Width (Q2) The space between the right edge of the image and the rightmost bar; Q2= 10 X + Right Margin Width Q2 ≥ 10X RightMargin


Supplement note: the quantity of data characters also has an influence over the width of the barcode. See C# Interleaved 2 of 5 Size Setting - Image Width Setting.

Height Setting

The height of Interleaved 2 of 5 barcode image is made up by Top Margin width, Bottom Margin width, Bar Height, space between barcode and text, and the height of Text.

Parameter Parameter Description Range Related Property
Image Height (H) The height of the image H ≥ 5mm or 15%W H
Bar Height (Y) The height of the bar - Y
Top Margin Width The height of the top margin ≥ 0 TopMargin
Bottom Margin Width The height of the bottom margin ≥ 0 BottomMargin
Text Height The height of the human readable text font - Text Font
Text Margin The space between symbol and text ≥ 0 TextMargin


In the following section, you will see how to make changes to these parameters in .NET projects using C#.NET.


How to Use C#.NET Interleaved 2 of 5 Generator Size Setting Properties

C#.NET Interleaved 2 of 5 Generator provides C#.NET developers with a full set of properties for Interleaved 2 of 5 size setting.

Before starting size setting, please install C#.NET Interleaved 2 of 5 Generator and add the following code as namespace reference.

using KeepAutomation.Barcode.Bean;

using KeepAutomation.Barcode;

using System.Drawing.Imaging;

Input the following C# Code to use C#.NET Interleaved 2 of 5 Generator where Interleaved 2 of 5 bar code image is needed.

BarCode interleaved2of5 = new BarCode();

interleaved2of5.Symbology = Symbology.Interleaved2of5;

Input a string value for CodeToEncode, which will be encoded as data in your Interleaved 2 of 5. Pay attention to the data encoding instruction for Interleaved 2 of 5.

interleaved2of5.CodeToEncode = "123456789";

BarcodeUnit

Property BarcodeUnit is in control of unit of measure. Before setting the bar width and image size, you should know for sure all the properties in the coming passages are based on the unit of measure. BarcodeUnit defaults as Pixel, and you can change it to cm or inch.

interleaved2of5.BarcodeUnit = BarcodeUnit.Pixel;

X

Property X (Float; Default: 1) is used in setting Interleaved 2 of 5 module width. Try to set X using C# code as follows:

interleaved2of5.X = 2;

Now, the width of narrower bars in Interleaved 2 of 5 has been changed from 1 pixel (as default) to 2 pixel. You can make it even greater if wider bars are in need.

WideNarrowRatio

C#.NET Interleaved 2 of 5 Generator uses Property WideNarrowRatio (Float; Default: 2) to set the wider bars in Interleaved 2 of 5. N is often used to represent the ratio of wider bars to narrower bars. For example, when you set X to be 2 pixel and WideNarrowRatio to be 3, the width of the wider bars is 6 pixel.

interleaved2of5.X = 2;

interleaved2of5. WideNarrowRatio = 3;

Y

Property Y (Float; Default: 50) sets the bar height of the Interleaved 2 of 5.

interleaved2of5.Y = 40;

The width of bars in Interleaved 2 of 5 has been changed from 50 pixels (as default) to 40 pixels. You can make it even greater or smaller.

BarCodeHeight and BarCodeWidth

C#.NET Interleaved 2 of 5 Generator is also equipped with functional properties BarCodeHeight (Float; Default: 0) and BarCodeWidth (Float; Default: 0) to set the size of the whole Interleaved 2 of 5 bar code image.

interleaved2of5.BarCodeHeight = 70;

interleaved2of5.BarCodeWidth = 175;

Note: If the setting of image size conflict with the settings in bar width or bar height, you can enable AutoResize(bool; Default: false) to make the generated Interleaved 2 of 5 compatible with Interleaved 2 of 5 barcode specification and ISO / IEC 16390.

TopMargin, BottomMargin, LeftMargin, and RightMargin

Interleaved 2 of 5 C#.NET Generator will generate a quiet zone at each end of the Interleaved 2 of 5 symbol automatically. The auto-generated quiet zone is 10X width. You can increase width of quiet zone by increasing the value of properties LeftMargin (Float; Default: 0) and RightMargin (Float; Default: 0). Also, the height of the image can be increased using TopMargin (Float; Default: 0) and BottomMargin (Float; Default: 0).

interleaved2of5.TopMargin = 10;

interleaved2of5.BottomMargin = 10;

interleaved2of5.LeftMargin = 10;

interleaved2of5.RightMargin = 10;

TextMargin

Property TextMargin (Float; Default: 6 pixel) controls the width of space between Interleaved 2 of 5 bar code and the human readable text below the barcode.

interleaved2of5.TextMargin = 10;