.NET EAN 13 Barcode Generator
How to generate, print EAN-13 barcode labels in asp.net, vb.net.


Free C#, VB.NET example source code to create, print EAN 13 barcodes in asp.net mvc, windows, crystal reports.



  • Fully compatible with EAN-13 barcoding specification in GS1 Barcode Standards
  • Add EAN-13 barcode printing capability into .NET development environment
  • Support printing EAN-13 barcode in ASP.NET, WinForms, .NET console application, and more .NET projects
  • Draw EAN-13 images in C#.NET & VB.NET in Microsoft Visual Studio 2005, 2008 & 2010
  • Generate and embed EAN-13 in SQL Server Reporting Services, RDLC and Crystal Reports
  • Allow the customization of EAN-13 size, font, color, resolution, and orientation etc
  • Print and save .NET EAN-13 barcode pictures in Png, Jpeg/Jpg, Gif, Tiff, and Bmp
KA.Barcode Generator for .NET Suite Description
EAN-13 Barcode Maker Component SDK is a barcode function of KA.Barcode Generator for .NET Suite which enables developers to simply integrate and create EAN-13, EAN-13+2, EAN-13+5 images and other 1D & 2D barcode symbologies in .NET projects. This guide will help you draw an EAN-13 image with best quality.

data matrix barcode reader c#, barcode scanner c# mvc, rdlc barcode image, vb.net data matrix generator vb.net, crystal reports barcode generator free, code 39 generator c#
EAN-13 Barcode Introduction
EAN-13 is the standard version of International Article Number (EAN) barcodes which is used globally in shipping and retailing industries.
EAN-13 Encodable Data
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
EAN-13 Data Capacity
  • 13 numeric digits (Please input only 12 digits, for K.A.Barcode automatically add the last check digit for you)
Download EAN-13 Barcode Creator for .NET Suite
Download KA.Barcode for .NET Suite and you can use it to generate standard EAN-13 barcode images in .NET projects. The unzipped trial version contains the following dlls and you can use them to generate barcodes in various projects.
  • KeepAutomation.Barcode.Crystal.dll
  • KeepAutomation.Barcode.RDLC.dll
  • KeepAutomation.Barcode.SSRS2005.dll
  • KeepAutomation.Barcode.SSRS2005CRI.dll
  • KeepAutomation.Barcode.SSRS2008.dll
  • KeepAutomation.Barcode.SSRS2008CRI.dll
  • KeepAutomation.Barcode.Web.dll
  • KeepAutomation.Barcode.Windows.dll
Generate EAN-13 Barcode Using C# or VB.NET Class
Copy C# or VB sample code below to generate EAN-13 barcode image in .NET projects. Before that, "KeepAutomation.Barcode.Windows.dll" or "KeepAutomation.Barcode.Web.dll" should be added to your project reference.
C# Sample code
     BarCode ean13 = new BarCode();
ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13;
ean13.CodeToEncode = "012345678901";
ean13.generateBarcodeToImageFile("c://ean13-csharp.jpeg");

VB Sample code
     Dim ean13 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13
ean13.CodeToEncode = "012345678901"
ean13.generateBarcodeToImageFile("c:/ean13-vbnet.jpeg")

Generate EAN-13 Barcode in ASP.NET Project
  1. Open your Visual Studio and create a new ASP.NET project.
  2. Copy "barcode.aspx" and "barcode.aspx.cs" in "barcode" folder to your project folder.
  3. Add "KeepAutomation.Barcode.Web.dll" to your project reference.
  4. Drag and drop "BarCodeControl" in Toolbox to the aspx page where your EAN-13 barcode image is to be generated.
  5. Go to the Properties panel, choose EAN13 barcode type.
  6. Run the project to view your EAN-13 barcode image.
Free to generate EAN-13 in Microsoft Internet Information Services
  1. Switch to the "barcode" folder in the unzipped package and copy it to IIS web application folder.
  2. Newly create a virtual directory (named as "barcode").
  3. Restart your IIS and navigate to "http://YourDomain:port/barcode/barcode.aspx?symbology=15&code-to-encode=012345678901"(symboloy: EAN13=15, EAN13Sup2=16, EAN13Sup5=17).
  4. Use the following image tag to insert barcodes in html or aspx pages:
    <img src="http://YourDomain:port/barcode/barcode.aspx?symbology=15&code-to-encode=012345678901"(symboloy: EAN13=15, EAN13Sup2=16, EAN13Sup5=17)/>
  5. In the above url, you are able to change property settings of the generated EAN-13 barcode image.
Generate EAN-13 Barcode in .NET WinForms
  1. Download the trial package of this barcode generator online and unzip it.
  2. Open your Visual Studio and add KeepAutomation.Barcode.Windows.dll to the Toolbox.
  3. Simply drag and drop the BarCodeControl from the Toolbox into the form.
  4. Change "Symbology" to "EAN13" in Properties window.
  5. An EAN-13 barcode image is generated and you can change its other properties through the Properties window.
Generate EAN-13 Barcode in .NET Reports

A Simple Way to Generate EAN-13 Barcode Image in Crystal Reports
This EAN-13 Barcode Maker SDK also supports generating EAN-13 barcode image in Crystal Reports.
A Simple Way to Generate EAN-13 Barcode Image in RDLC Reports
This EAN-13 Barcode Maker SDK also supports generating EAN-13 barcode image in RDLC Reports.
A Simple Way to Generate EAN-13 Barcode Image in Reporting Services
This EAN-13 Barcode Maker SDK also supports generating EAN-13 barcode image in Reporting Services.
EAN-13 Property Settings
Class Attribute HTTP Attribute Default Value Note
Basic
Symbology symbology Code128Auto Barcode symoblogy type
CodeToEncode code-to-encode "128" Barcode value to encode.

Please provide 12 digits only, and DO NOT include last digit checksum character.

  • Valid Data Scope: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

  • Valid Data Format: 12 digits.

    There are totally 13 digits in EAN-13 barcode, first 12 digits are barcode value, and last digit is the checksum digit, which is generated by barcode library automatically.

    Sample: barcode.CodeToEncode = "123456789012"
ChecksumEnabled checksum-enabled false This property is not applied here. Barcode SDK will always add a check character in the last digit (modulo 10).
ImageFormat image-format ImageFormat.Png Barcode encoded image format.
Barcode Size
AutoSizeAdjust auto-size-adjust false If true, barcode X, Y module will be auto-adjusted.
BarcodeUnit barcode-unit BarcodeUnit.Pixel Unit of measure for all size related settings. 0: pixel; 1: inch; 2: cm.
X x 1 Barcode module width (narrow bar).
Y y 50 Linear barcode bar height / 2D barcode module height.
LeftMargin left-margin 0 Barcode image left margin.
RightMargin right-margin 0 Barcode image right margin.
TopMargin top-margin 0 Barcode image top margin.
BottomMargin bottom-margin 0 Barcode image bottom margin.
DPI dpi 72 Barcode image resolution in dpi.
Orientation orientation Orientation.Degree0 Barcode rotation angle.
BarCodeWidth barcode-width 0 Whole barcode width.
BarCodeHeight barcode-height 0 Whole barcode height.
Barcode Text Style
DisplayText display-text true Set to true, displaying barcode value text, otherwise do not display.
DisplayChecksum displace-checksum true Set to true, displaying barcode checksum digit, otherwise do not display.
TextFont text-font new Font(" Arial", 10 f, FontStyle.Regular) Barcode text font style.
TextMargin text-margin 6 Margin between barcode and text.
EAN-13 Specific Settings
SupplementCode supplement-code - EAN, UPC, ISBN, or ISSN supplement barcode value to encode.
SupplementHeight supplement-height 0.8f EAN, UPC, ISBN, or ISSN supplement barcode height.
SupplementSpace supplement-space 15 EAN, UPC, ISBN, or ISSN supplement barcode space.
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();
*/
Generate EAN-13 Using VB.NET Sample Code
With the VB sample code provided below, you can easily create EAN-13 barcode image in VB.NET. Before that, you may download our VB.NET Barcode Generator Trial and add related reference to your project. You can also change parameters of the generated EAN-13 barcode based on your needs.
VB Sample code
     Dim ean13 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
ean13.Symbology = KeepAutomation.Barcode.Symbology.EAN13Sup2
ean13.CodeToEncode = "131310000013"

'Apply checksum for EAN13 barcode.
ean13.ChecksumEnabled = True
'Display checksum in the EAN13 barcode text
ean13.DisplayChecksum = True

'EAN13 unit of measure, Pixel, Cm and Inch supported.
ean13.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
ean13.DPI = 72

'Set EAN13 image size

'EAN13 bar module width (X dimention)
ean13.X = 1
'EAN13 barcode image width (X dimention)
ean13.BarCodeWidth = 160
'EAN13 bar module height (Y dimention)
ean13.Y = 60

'Image left margin size, a 10X is automatically added according to specification.
ean13.LeftMargin = 0
'Image right margin size, a 10X is automatically added according to specification.
ean13.RightMargin = 0
'EAN13 image top margin size'
ean13.TopMargin = 0
'EAN13 image bottom margin size'
ean13.BottomMargin = 0

'EAN13 Supplimental data settings.
'To enable this, you need to set Barcode Symbology into "EAN13Sup2" or "EANSup5" first.

'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


'Orientation, 90, 180, 270 degrees supported' EAN13 image bottom margin size
ean13.Orientation = KeepAutomation.Barcode.Orientation.Degree0
ean13.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff

'Set EAN13 human readable text style
ean13.DisplayText = True
ean13.TextFont = New Drawing.Font("Arial", 10.0F, Drawing.FontStyle.Regular)
'Space between barcode and text
ean13.TextMargin = 6
ean13.generateBarcodeToImageFile("C://ean13-vb-net.tiff")
Free Trial DownloadC#/VB EAN-13For Web EAN-13For Windows EAN-13For Reports EAN-13Using C#Using VB.NETData Matrix for .NETPDF417 for .NETQR Code for .NETmoreCodabar for .NETCode 39 for .NETCode 128 for .NETEAN-8 for .NETEAN 128 for .NETIntelligent Mail for .NETInterleaved 2 of 5 for .NETISBN for .NETITF-14 for .NETRM4SCC for .NETUPC-A for .NETUPC-E for .NETmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.