C#. EAN-13 Generator Size Setting Tutorial
sample source code to generate linear EAN-13 images and adjust barcode size in C# .NET
- Generate EAN-13 barcodes in C#.NET Winforms, ASP.NET web forms, Crystal Reports and SSRS for C#.NET
- Create EAN-13 barcodes in C#.NET class & console applications
- Support GS1 system compatible EAN-13 barcodes
- Automatically add checksum digit for EAN-13 barcodes
- Support EAN-13 supplemental 2-digit and 5-digit to add on
- Highly customizable EAN-13 barcode size with barcode width & height, bar width & height, barcode margins, and height and space of supplemental data
- Mature EAN-13 barcode generating dll with royalty-free and perpetual developer license
- Tutorial for EAN-13 Image Setting in Visual C#.NET
- Tutorial for EAN-13 Data Encoding in Visual C#.NET
EAN-13, also known as European Article Number 13, UPC-13, GTIN-13, GS1-13, EAN/UCC-13, is the standard barcode version of European Article Number.
EAN-13 Image Width Related Settings
W: the width of EAN-13 barcode image, including quiet zones. Please see BarCodeWidth.
EAN-13 Image Height Related Settings
X: the width of a module bar. Please see X.
Supplement Space: the space between the barcode and the supplement. Please see Supplement Space
C: the number of EAN-13 encoded data characters, including the check digit; C = 6.
Q: the width of the quiet zone. Please see Left & Right Margin.
H: the barcode height of EAN-13. Please see BarCodeHeight.
Y: the height of a module bar. Please see Y.
Supplement Height: the height of the bar module. Please see Supplement Height.
Top & Bottom Margin: the height of the top & bottom margin. Please see Top & Bottom Margin.
Text Margin: the space between image bar and text. Please see Text Margin.
Text Font: the font style of human-readable text. Please see Text Font.
Setting EAN-13 Barcode Size in C#
C# EAN-13 barcode provides a set of barcode size settings to specify you EAN-13 barcodes. Please download C# barcode component and install, copy those following code to your Visual Studio:
Linear barcode = new Linear();
barcode.Type = BarcodeType.EAN13;
barcode.Data = "123456789012";
Modify your EAN-13 barcodes by setting those following properties:
UOM is short for Unit of Measure, which is the unit of measure for all size related settings in the library. C# EAN-13 barcode provides 3 options: Pixel, Cm, and Inch. The default is Pixel.
barcode.UOM = UnitOfMeasure.PIXEL;
SupplementSpace is the space between the EAN-13 barcodes and supplemental data. The default is 15 (float).
barcode.SupplementSpace = 19;
SupplementHeight is the height of the supplement data bar module. It is the N percent of Y(module height of EAN-13 barcode bar). The default is 0.8f (float).
barcode.SupplementSpace = 0.5f;
Barcode Width & Height
BarcodeWidth is the EAN-13 barcode image width. The default in C# EAN-13 barcode is 0 (float).
BarcodeHeight is the EAN-13 barcode image height. The default in C# EAN-13 barcode is 0 (float).
barcode.BarcodeWidth = 0;
barcode.BarcodeHeight = 0;
Notice: if your setting is smaller than the barcode required minimum width and height, the library will automatically reset to barcode minimum width. Or you may enable AutoResize to automatically resize your EAN-13 barcode image.
BarcodeMargin is the white zone around the EAN-13 symbol. C# EAN-13 barcode provides 4 options: Left Margin, Right Margin, Top Margin and Bottom Margin. The default of these four margins are 0 (float).
barcode.TopMargin = 3;
barcode.BottomMargin = 3;
barcode.LeftMargin = 1;
barcode.RightMargin = 1;
X & Y
X is the width of barcode bar module (narrow bar). The default in C# EAN-13 barcode is 1 (float).
Y is the height of barcode bar module. The default in C# EAN-13 barcode is 60 (float).
barcode.X = 2;
barcode.Y = 80;
Text Margin & Font
TextMargin is the space between barcode and barcode data text. The default in C# EAN-13 barcode is 6 (float).
TextFont is the font style of human-readable text. The default in C# EAN-13 barcode is new Font ("Arial", 9f, FontStyle.Regular).
barcode.TextMargin = 9;
barcode.TextFont = new Font("Arial", 20f, FontStyle.Regular);