KA.Barcode for .NET Suite
How to Generate EAN-13 in C# Application
How to Generate Linear EAN-13 Barcode Images in C#, ASP.NET, WinForms, Crystal & RDLC

C# EAN 13 Barcode Generator
How to generate ean-13, gtin 13 barcode with check digit calculate, validate









  • High-quality EAN-13 encoder written in C#.NET with full integration into Microsoft .NET Framework
  • Mature barcoding control suitable for producing and printing 1D EAN-13 barcode images in C#.NET applications
  • Support EAN-13 generation in ASP.NET websites, IIS, WinForms, Crystal Reports, RDLC Reports, etc
  • Support multiple linear and bi-dimensional barcode types in C#.NET, such as Code 39, EAN-13, QR Code etc
  • Simple to draw and save EAN-13 1D barcodes in Png, Jpeg, Gif, Tiff and Bmp image formats
  • Adjust various barcode settings for the generated EAN-13 barcode image, like bar width, bar height, color, etc
C# EAN-13 Barcode Generator Introduction
KA.Barcode Generator for .NET Suite is one of the best all-in-one barcode generating components for efficient EAN-13 barcoding in ASP.NET websites, Windows Forms & C# programming. This control is extremely user-friendly with easy-to-use interface and multiple settings for the generated EAN-13, EAN-13+2 and EAN-13+5 barcode images.
What Is A EAN-13 Barcode
EAN-13 is a linear barcode which encodes numeric-only data with a fixed length of 13 digits. It is also named as European Article Number 13, EAN/UCC-13, GS1-13, GTIN-13, with variants EAN-13 Supplement 2 (a two-digit Add-On), EAN-13 Supplement 5 (a five-digit add-on).
EAN-13 Valid Data Sets
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Generate Barcode Image in Specified Width and Height
  • Set property AutoSizeAdjust to true

  • Set property DPI to be the same or higher as your printer's resolution

  • Set property BarcodeUnit to inch or cm

  • Set property BarCodeWidth and BarCodeHeight to your required image width and height
Generate EAN-13 in ASP.NET Using C#
This .NET generator package includes an ASP.NET server component which enables developers to stream EAN-13, EAN-13+2, EAN-13+5 linear GS1 barcodes in ASP.NET websites. You can create EAN-13 in three ways: drag-and-drop control for direct barcode generation, Microsoft IIS dynamic barcode streaming, and Visual C# class library programming. For details, refer to How to print barcode in Visual C# with ASP.NET web control.
Paint EAN-13 in .NET Windows Forms Using C#
.NET developers can use this powerful barcode generator control to paint dynamic EAN-13 barcode (supplement barcode supported) in .NET WinForms applications. Try for yourself and you will find it quite easy to create EAN-13 with simple steps. All you need is to drag and drop or add reference and copy sample code. See: How to create barcode in .NET WinForms with Visual C#.
Print EAN-13 in Crystal Reports Using C#
You can use this lightweight .NET barcode encoder software library SDK to print and add EAN-13 linear barcodes in Crystal Reports as well. Multiple barcodes generation will be achieved easily and various image formats are supported. Please view the detailed guide with sample code to try for yourself: How to create barcode in Crystal Reports with Visual C#.
Add EAN-13 in RDLC Reports Using C#
Multiple EAN-13 barcodes generation are also available for ReportViewer RDLC Local Report 2005/2008/2010. You just need to download the free trial version and follow the detailed generation guide to easily embed & print batch EAN-13 barcode images in RDLC Reports. You may make necessary adjustments to the EAN-13 barcode demonstrated in the Visual C# sample code below. This is the detailed generation guide: How to create barcode in RDLC Reports with C# code.
EAN-13 Property Settings
Generate EAN-13 in .NET Applications with C#
Creating EAN-13 barcode images through .NET class library is the simplest way for barcode generation. All you need to do is to add this barcode generating control library to reference, and then copy the Visual C# sample code here to your barcode project. Debug and there you go! Please note that you may make necessary changes to the EAN-13 barcode parameters demonstrated below.
C# Sample code
     BarCode ean13 = new BarCode();

//Set barcode symbology type to EAN13, EAN13Sup2, EAN13Sup5
ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13Sup2;

//Set EAN 13 encoding valid data: 12 numeric digits (the 13th checksum will be automatically added).
ean13.CodeToEncode = "012345678912";

// Apply checksum for EAN 13 barcode.
ean13.ChecksumEnabled = true;
// Display checksum in the EAN 13 barcode text
ean13.DisplayChecksum = true;

// Set EAN-13 image formats in Png, Jpeg, Gif, Tiff ,Bmp, etc.
ean13.ImageFormat = ImageFormat.Png;

// Set EAN 13 image size

// EAN-13 unit of measure, Pixel, Cm and Inch supported.
ean13.BarcodeUnit = BarcodeUnit.Pixel;
// EAN 13 image resolution in DPI.
ean13.DPI = 72;
// EAN 13 bar module width (X dimention)
ean13.X = 2;
// EAN 13 bar module height (Y dimention)
ean13.Y = 60;

// Image left margin size. KA. will automatically add a 10X left margin to go with standard..
ean13.LeftMargin = 0;
// Image right margin. K.A. will automatically add a 10X right margin to go with standard..
ean13.RightMargin = 0;
// EAN 13 image top margin size
ean13.TopMargin = 0;
// EAN 13 image bottom margin size
ean13.BottomMargin = 0;

// EAN-13 orientation, 90, 180, 270 degrees supported
ean13.Orientation = KeepAutomation.Barcode.Orientation.Degree0;

// Supplement code. It should be 2 or 5 digits
ean13.SupplementCode = "02";
// Supplement bar height vs primary bar height ratio.
ean13.SupplementHeight = 0.8f;
// Space between barcode and supplement barcode
ean13.SupplementSpace = 15;

// Set EAN 13 human readable text

// Display human readable text
ean13.DisplayText = true;
// Customize human-readable text font.
ean13.TextFont = new Font("Arial", 10f, FontStyle.Regular);
// Space between barcode and text
ean13.TextMargin = 6;

// Generate EAN 13 barcodes in image format TIFF
ean13.generateBarcodeToImageFile("C://barcode-ean13-csharp.tiff");

/* Create EAN-13 barcodes in Stream object
ean13.generateBarcodeToStream(".NET System.IO.Stream Object");

Draw & Print EAN-13 barcodes to Graphics object
ean13.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");

Generate EAN-13 barcodes & write to byte[]
byte[] barcodeInBytes = ean13.generateBarcodeToByteArray();

Generate EAN-13 barcodes & encode to System.Drawing.Bitmap object
Bitmap barcodeInBitmap = ean13.generateBarcodeToBitmap();
*/