KA.Barcode Generator for .NET Suite
How to Print EAN-13 in C# with Valid Data
Complete C#.NET source code to generate EAN-13 images using Barcode Generator for .NET Control
  • Simple to generate, create EAN-13, EAN-13+2, EAN-13+5 barcodes in C#.NET class library
  • Compatible with .NET development environments like Visual Studio 2005, 2010, etc
  • Other barcode solutions provided - .NET WinForms barcode, barcode Java, barcode .NET, etc.
  • Printing EAN-13 in WinForms,inserting images in ASP.NET web pages, and create in C# programming
  • Latest GS1 EAN-13 barcode specifications pre-configured to ensure valid image output
  • Resolution adjustable to create 1D EAN-13 images for all printers and readers
  • Generating EAN-13 barcode images with checksum digit automatically calculated and added
  • UPC-E C#, EAN-8 .NET, Code 39 .NET WinForms, C# Code 128 & ITF-14 C# can be created as well
  • Quiet zones (left & right margins) automatically added as required in standard
  • Print and save 1d EAN-13 linear bar codes in different image formats like png, jpeg, gif, tiff, bmp
KA.Barcode Generator for .NET Suite is a mature and easy-to-use barcode generation component addin SDK which enables developers to add EAN-13 barcoding & printing function into your .NET development platforms. This page is a demo code tutorial to help you encode valid numeric data for EAN-13 barcode images. In addition, you can get more information on how to resize and save EAN-13 in various image formats.
EAN-13 Introduction
EAN-13, aka 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).

Valid Data

  • Numeric digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Numeric digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

  • EAN-13 barcode can encode 13 digits, including the last checksum digit, which will be automatically added by KA.
EAN-13 Data Encoding in KA.Barcode Generator for .NET Suite

KA.Barcode Generator for .NET Suite Integration

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your .NET WinForms project reference.
  3. 3.
    Add to Toolbox: Add BarCodeControl to your .NET Visual Studio toolbox.

Numeric Data for EAN-13 Barcoding

As the name suggests, EAN-13 encodable string includes 13 numeric digits. However, KA.Barcode Generator for .NET Suite will automatically calculate and add the last checksum digit as specified in the GS1 barcode standard, so you can simply input 12 numeric digits as data. Below is a sample program to convert string into EAN-13 and create image in C#.
using KeepAutomation.Barcode.Bean;

BarCode ean13= new BarCode();
ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13;
ean13.CodeToEncode = "112233445566";
ean13.X = 3;
ean13.generateBarcodeToImageFile("C:/ean13_csharp.png");

Numeric Data for EAN-13+2 Barcoding

If you want to encode some extra information for in EAN-13 image, you might want to add a two-digit add-on symbol for an EAN-13 barcodes. Follow the sample code below to print an EAN-13+2 bar code.
using KeepAutomation.Barcode.Bean;

BarCode ean13= new BarCode();
ean13. Symbology = Symbology. EAN13Sup2;
ean13.CodeToEncode = "112233445566";
ean13.SupplementCode = "22";
ean13.X = 2;
ean13.generateBarcodeToImageFile("C:/ean13_add2.png");

Numeric Data for EAN-13+5 Barcoding

To encode some more information like price, date, etc, you can add a five-digit add-on symbol for an EAN-13 barcodes. Follow the sample code below to transform stream to image and print an EAN-13+5 bar code.
using KeepAutomation.Barcode.Bean;

BarCode ean13= new BarCode();
ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13Sup5;
ean13.CodeToEncode = "112233445566";
ean13.SupplementCode = "55555";
ean13.X = 2;
ean13.generateBarcodeToImageFile("C:/ean13_add5.png");