KA.Barcode for .NET Suite
How to Generate EAN-8 in C# Application
How to generate, print linear EAN-8 barcode images in C#, ASP.NET web applications, and windows forms

C# barcode generator control: how to generate, print EAN-8 barcode to zebra printer with free C# sample code



  • Easy to integrate dynamic EAN-8 barcode images in MS .NET Framework
  • Compatible with Microsoft Visual Studio 2005/2008/2010
  • Generate high-quality EAN-8 bar codes in C#.NET class, ASP.NET webform, winforms
  • Create, insert EAN-8 images in Crystal Reports and SQL server Reporting Services
  • Encode extra informtion into a 2-digit or 5-digit addon symbol for an EAN-8+2 or EAN-8+5
  • Automatic checksum digit calculation for EAN-8 barcodes
  • Compatible with latest GS1 specification for valid EAN-8 output
  • Adjust various EAN-8 parameters like size, resolution, orientation with C# programming
KA.Barcode Generator for ASP.NET is a mature and easy-to-use component SDK software which allows developers to add EAN-8 barcode generating & printing features into Visual C#.NET class library, console and windows applications, ASP.NET web site, Crystal Reports, SSRS, etc. This page is a detailed guide to create EAN-8 and customize settings in Visual C#.NET with sample code provided.
EAN-8 Barcode Introduction
EAN-8 is a GS1 specified linear barcode symbology, which is also named European Article Number 8, EAN/UCC-8, GS1-8, with variants EAN 8+2, EAN-8 Supplement 2 (a two-digit Add-On), EAN-8 +5, EAN-8 Supplement 5(a five-digit add-on).
  • EAN-8 Encodable Character Set: Numeric digits 0-9
  • EAN-8 Data Length: 7 digits (excluding check digit, which will be automatically added by software)
EAN-8 Barcode Generation in C#.NET

How to Install EAN-8 Barcode Encoder Control into .NET Projects

  1. 1.
  2. 2.
    Add "KeepAutomation.Barcode.Windows.dll" or "KeepAutomation.Barcode.Web.dll" to project reference
  3. 3.
    Add the above two barcode control dlls to Visual Studio .NET ToolBox
How to Create Barcodes in Crystal Reports Using C#. How to generate 1D, matrix barcode in Crystal Reports using Visual C#.NET class. ....
Dynamically printing, generating QR Code matrix bar codes in ASP.NET and Winforms; ....
Draw and save QR Code bar codes in gif, jpeg, png, tiff ....
more>

How to Generate EAN-8 in .NET Applications with C#.NET Demo Code

Below is some detailed Visual C#.NET sample codings for EAN-8 generation in .NET. You can easily adjust multiple barcode properties like bar width, image width, height, quiet zone, resolution, rotation, human-readable-text font/style, etc. Furthermore, several methods are provided to make EAN-8 in stream objects, graphics objects as well as image formats.
using KeepAutomation.Barcode.Bean;

BarCode ean8= new BarCode();
// Set barcode symbology type to EAN8, EAN8Sup2, EAN8Sup5
ean8. Symbology = KeepAutomation.Barcode.Symbology. EAN8;

// Set EAN 8 encoding code value. Valid data: 7 digits numeric digits without checksum.
ean8.CodeToEncode = "0123456";
// Apply checksum for EAN 8 barcode.
ean8.ChecksumEnabled = true;

//Set EAN 8 image size

// Unit of measure, Pixel, Cm and Inch supported.
ean8.BarcodeUnit = BarcodeUnit.Pixel;
// EAN 8 image resolution in DPI.
ean8.DPI = 72;
// EAN 8 bar module width (X dimention)
ean8.X = 2;
// EAN 8 bar module height (Y dimention)
ean8.Y = 60;
// EAN 8 image left margin size, minimum is 10X.
ean8.LeftMargin = 0;
// EAN 8 image right margin size, minimum is 10X.
ean8.RightMargin = 0;
// EAN 8 image top margin size
ean8.TopMargin = 0;
// EAN 8 image bottom margin size
ean8.BottomMargin = 0;
// Orientation, 90, 180, 270 degrees supported
ean8.Orientation = Orientation.Degree0;
// EAN8 supplement code: 2 or 5 digits
ean8.SupplementCode = "02";
// Supplement bar height vs bar height ratio.
ean8.SupplementHeight = 0.8f;
// Space between barcode and supplement barcode
ean8.SupplementSpace = 15;

//Set EAN 8 human readable text style

// Display human readable text
ean8.DisplayText = true;
ean8.TextFont = new Font ("Arial", 10f, FontStyle. Regular);
// Space between barcode and text
ean8.TextMargin = 6;
// Display checksum in the EAN 8 barcode text
ean8. Displaychecksum = true;

// Generate EAN 8 barcodes in image GIF format
ean8.generateBarcodeToImageFile("barcode-ean8-csharp.gif");

// Create EAN 8 barcodes in Stream object
ean8.generateBarcodeToStream(".NET System.IO.Stream Object");

// Draw & Print EAN 8 barcodes to Graphics object
ean8.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");

// Generate EAN 8 barcodes & write to byte[]
byte[] barcodeInBytes = ean8.generateBarcodeToByteArray();

// Generate EAN 8 barcodes & encode to System.Drawing.Bitmap object
Bitmap barcodeInBitmap = ean8.generateBarcodeToBitmap();

Other image formats including Png, Bmp, Tiff and Jpeg are also available to suit your needs.