C# EAN-13 Generator Library
C# Imaging - EAN-13 Creation & Printing
Generate & Insert EAN-13 Barcode into Document and Image Files Using C#
C# EAN-13 Barcode Creator Overview
RasterEdge .NET EAN-13 barcode generation add-on is a fully functional utility, which offers advanced and mature API for C# developers to
create high-quality EAN-13 barcode and add generated EAN-13 barcode to target document or image file
in both .NET web-based application and Windows Forms project.
Related .net document control helps:
document viewer asp.net c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net pdf editor component: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net annotate pdf control:
ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net image viewer jquery: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
powerpoint viewer asp.net mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
Here we offer a brief feature list of RasterEdge C#.NET linear EAN-13 barcode generator add-on.
100% .NET solution that allows developers to generate EAN-13 barcode in C# imaging applications
Generate and add created EAN-13 barcode on image file formats (JPEG, JBIG2, BMP, GIF & PNG) using C# code
Created linear EAN-13 barcode can be easily and accurately inserted into PDF, TIFF, Word, Excel and PowerPoint document files using C#.NET
Created EAN-13 barcodes meeting latest industry standards and can be read by all linear barcode readers in C#
Fully-featured EAN-13 barcode generating API that helps C# developers create customized barcode
C# Code for Customizing EAN-13 Barcode Generation
You can easily generator EAN-13 barcode and save it to image files/object using this C#.NET barcode generator control. The following steps will show how to create a EAN-13 type barcode encoding numeric data text "012345678901" into the image object with XImage.Barcode.Creator.
Add References
RasterEdge.Imaging.Basic.dll
RasterEdge.Imaging.Drawing.dll
RasterEdge.Imaging.Font.dll
RasterEdge.Imaging.Processing.dll
RasterEdge.XImage.BarcodeCreator.dll
System.Drawing.dll
Using Namespaces
using System.Drawing;
using RasterEdge.XImage.BarcodeCreator;
Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:
If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.
If using x86, the platform target should be x86.
Please copy the sample code as follow to generator a EAN-13 barcode.
private static Linear CreateBarcode()
{
Linear barcode = new Linear();// create a barcode
barcode.Type = BarcodeType.EAN13;// select barcode type
barcode.Data = "012345678901";// set barcode data
barcode.X = 1.0F;// set x
barcode.Y = 60.0F;// set y
barcode.Resolution = 96;// set resolution
barcode.Rotate = Rotate.Rotate0;// set rotation
barcode.BarcodeWidth = 200;
barcode.BarcodeHeight = 200;
barcode.AutoResize = true;
//convert barcode to a bitmap and save it to image file
//Bitmap bmp = barcode.ToImage();
//bmp.Save(@"C:\barcode.bmp");
return barcode;
}
|

|
|
Generate EAN-13 Barcode on Image in C#
In this section, we will offer you a C# programming example which aims to demonstrate how to generate a standard EAN-13 barcode on raster image file PNG. Using RasterEdge .NET EAN-13 barcode creator add-on, you can also generate EAN-13 barcode on other image file formats, like JPEG, BMP and GIF.
private static void AddBarcodeToImage(Linear barcode)
{
REImage image = new REImage(inputDirectory + "Sample.png");
barcode.DrawBarcode(image, 150F, 150F);
image.Save(ImageType.PNG, outputDirectory + "Sample_Barcode.png");
}
|
Generate EAN-13 on Document Page in C#
Besides generating EAN-13 barcode on image files, RasterEdge C#.NET EAN-13 barcode creator can also generate & add EAN-13 barcode on document files, like PDF, TIFF, Word, Excel and PowerPoint. Using the sample C# codes below, you can not only insert EAN-13 barcode on target document page, but also own the ability to adjust the position where created EAN-13 barcode will be located.
EAN-13 Creation on PDF Document in C#
Add References(Extra)
RasterEdge.Imaging.Basic.Codec.dll
RasterEdge.XImage.Raster.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XDoc.PDF.dll
Using Namespace(Extra)
RasterEdge.XDoc.PDF;
RasterEdge.Imaging.Basic;
RasterEdge.Imaging.Raster.Core;
private static void AddBarcodeToPDF(Linear barcode)
{
PDFDocument docx = new PDFDocument(inputDirectory + "Sample.pdf");
BasePage page = docx.GetPage(0);
REImage image = new REImage(barcode.ToImage());
page.AddImage(image, new PointF(100F, 100F));
docx.Save(outputDirectory + "Sample_Barcode.pdf");
}
|
EAN-13 Creation on TIFF File Page Using C#
Add References(Extra)
RasterEdge.Imaging.Basic.Codec.dll
RasterEdge.XImage.Raster.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XDoc.TIFF.dll
Using Namespace(Extra)
RasterEdge.XDoc.TIFF;
RasterEdge.Imaging.Basic;
RasterEdge.Imaging.Raster.Core;
private static void AddBarcodeToTIFF(Linear barcode)
{
TIFFDocument docx = new TIFFDocument(inputDirectory + "Sample.tif");
BasePage page = docx.GetPage(0);
REImage image = new REImage(barcode.ToImage());
page.AddImage(image, new PointF(100F, 100F));
docx.Save(outputDirectory + "Sample_Barcode.tif");
}
|
C# EAN-13 Creation on Word Document Using C#
Add References(Extra)
RasterEdge.XDoc.Word.dll
RasterEdge.XImage.Raster.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner..Office03.dll
Using Namespace(Extra)
RasterEdge.XDoc.Word;
RasterEdge.Imaging.Basic;
RasterEdge.Imaging.Raster.Core;
private static void AddBarcodeToWord(Linear barcode)
{
DOCXDocument docx = new DOCXDocument(inputDirectory + "Sample.docx");
BasePage page = docx.GetPage(0);
REImage image = new REImage(barcode.ToImage());
page.AddImage(image, new PointF(100F, 100F));
docx.Save(outputDirectory + "Sample_Barcode.docx");
}
|
C# EAN-13 Creation on Excel Document Using C#
Add References(Extra)
RasterEdge.XDoc.Excel.dll
RasterEdge.XImage.Raster.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner..Office03.dll
Using Namespace(Extra)
RasterEdge.XDoc.Excel;
RasterEdge.Imaging.Basic;
RasterEdge.Imaging.Raster.Core;
private static void AddBarcodeToExcel(Linear barcode)
{
XLSXDocument docx = new XLSXDocument(inputDirectory + "Sample.xlsx");
BasePage page = docx.GetPage(0);
REImage image = new REImage(barcode.ToImage());
page.AddImage(image, new PointF(100F, 100F));
docx.Save(outputDirectory + "Sample_Barcode.xlsx");
}
|
C# EAN-13 Creation on PowerPoint Document Using C#
Add References(Extra)
RasterEdge.XDoc.PowerPoint.dll
RasterEdge.XImage.Raster.dll
RasterEdge.XImage.Raster.Core.dll
RasterEdge.XDoc.Office.Inner.Common.dll
RasterEdge.XDoc.Office.Inner..Office03.dll
Using Namespace(Extra)
RasterEdge.XDoc.PowerPoint;
RasterEdge.Imaging.Basic;
RasterEdge.Imaging.Raster.Core;
private static void AddBarcodeToPowerPoint(Linear barcode)
{
PPTXDocument docx = new PPTXDocument(inputDirectory + "Sample.pptx");
BasePage page = docx.GetPage(0);
REImage image = new REImage(barcode.ToImage());
page.AddImage(image, new PointF(100F, 100F));
docx.Save(outputDirectory + "Sample_Barcode.pptx");
}
|
C# Code to Generate Customized EAN-13 on Document Image
The C# code demo below contains all parameters that C# developers can use to create a customized EAN-13 barcode on target image file. For example, you can adjust the size, color, font style and generating orientation of created EAN-13 barcode by C# code.
// create REImage on which you want to draw the barcode
REImage reImage = new REImage("c:/Sample.png");
Linear barcode = new Linear();// create a barcode
barcode.Type = BarcodeType.EAN13;// select barcode type
barcode.Data = "012345678901";// set barcode data
// EAN-13 barcode size related
barcode.X = 1.0F;// set x
barcode.Y = 60.0F;// set y
barcode.BarcodeHeight = 60;
barcode.BarcodeWidth = 0;
barcode.BottomMargin = 0;
barcode.LeftMargin = 0;
barcode.RightMargin = 0;
barcode.BarAlignment = AlignmentHori.Left;
barcode.Resolution = 96;// set resolution
barcode.Rotate = Rotate.Rotate0;// set rotation
barcode.AddCheckSum = false;
barcode.UOM = RasterEdge.Imaging.Barcode.Creator.UnitOfMeasure.PIXEL;
// EAN-13 colors
barcode.BackColor = System.Drawing.Color.White;
barcode.ForeColor = System.Drawing.Color.Black;
// EAN-13 font style
barcode.TextFont = new Font("Arial", 9f, FontStyle.Regular);
barcode.TextColor = System.Drawing.Color.Black;
barcode.TextMargin = 6;
barcode.ShowText = true;
// EAN-13 special
// barcode.SupData = "";
// barcode.SupHeight = 0.8f;
// barcode.SupSpace = 15;
barcode.DrawBarcode(reImage, 0, 0);// draw barcode on REImage with location x and y
reImage.Save(ImageType.PNG, @"c:/barcode.png");
|
Create and customize EAN-13 barcode in C# ASP.NET, MVC, WinForms apps
Using OnBarcode C# Barcode Generator library, you
can apply the following barcode options to further customize the EAN-13 barcode labels in C# ASP.NET, MVC, WinForms, WPF web and desktop apps.
- ShowQuietZoneIndicator: Display or hide EAN barcode quiet zone indicator. The default value is
true.
- UPCEANLeadDigitSpace: The space between the first digit and the start character bar. The default value is
0.
- UPCEANTrailDigitSpace: The space between the stop character bar and the quiet zone indicator. The default value is
0.
Here we will show how to customize the EAN-13 barcode image below using the above EAN-13 barcode options in C# class.
EAN barcode quiet zone indicator
You can display or hide the EAN barcode quiet zone indicator in barcode label. By default, the C# barocde library will print
the EAN-13 barcode quiet zone indicator mark on the end of the EAN-13 barcode.
The property
ShowQuietZoneIndicator will allow you to show or hide the EAN-13 quiet zone indicator.
barcode.ShowQuietZoneIndicator = false;
EAN-13 the first and last digit space
You can increase the space between the EAN-13 first code and the start bar, and the space between the stop char and quiet zone indicator through
barcode options
UPCEANLeadDigitSpace and
UPCEANTrailDigitSpace.
barcode.UPCEANLeadDigitSpace = 10;
barcode.UPCEANTrailDigitSpace = 10;
Common Asked Questions
The EAN-13 is a global standard for identifying retail products. EAN-13 is a 13-digit barcode with 12 data digits and 1 check digit.
Formerly European Article Number (EAN), it's now called GTIN (Global Trade Item Number) and uniquely identifies retail products globally.
Using XImage EAN-13 Barcode Generator C# library, you can quickly create and print EAN-13 barcodes in C# ASP.NET Core, Blazor, MVC, Web Forms
and Windows Forms, WPF web and desktop application.
What's the distinction between EAN and EAN-13 barcodes?
The EAN barcode family covers EAN-13, EAN-8, and their associated 2-digit or 5-digit add-on barcodes, and is the overall system for product barcodes.
EAN-13 is a specific version of this system, using 13 digits. The EAN family also includes shorter 8-digit codes and optional supplemental barcodes.
Using XImage EAN-13 Barcode Generator C# library, you are able to generate all EAN barcodes including EAN-13, EAN-8, EAN-128 in C# Visual Studio .NET
web and desktop projects.
What's the structure of an EAN-13 barcode?
An EAN-13 barcode has 13 digits organized into four parts:
- 2–3 digits: Number system or country code
- 4–5 digits: Manufacturer code (or prefix)
- 5 digits: Product code
- 1 digit: Check digit
Using EAN-13 C# barcode library, you will create and make well structured EAN-13 barcode images in C# class.
How to verify if a generated EAN-13 barcode is valid?
The final digit in an EAN-13 code is a check digit, which is used to validate the first 12 digits.
C# EAN-13 barcode generation library supports standard EAN-13 barcode generation in C# ASP.NET Core, and Windows application. And
you can use C# barcode reader library to verify the printed EAN-13 barcode images.
What's the minimum size of an EAN-13 barcode, and how is it applied?
GS1 recommends that the minimum dimensions for an EAN-13 barcode are 30mm wide and 20mm tall.
To use it, simply ensure your generated barcode image meets these dimensions.
Using C# EAN-13 generator sdk, you will generate, print EAN-13 with barcode size customized in C# ASP.NET web apps.
How to print EAN-13 barcodes?
For high-quality EAN-13 barcode printing, these two key rules:
The barcode image's DPI (resolution) should match or exceed the printer's resolution.
Use a clear, legible font for the numbers below the bars. The GS1 standard recommends the OCR-B font.
Using XImage EAN-13 Barcode Generator C# library, you can make and print high quality EAN-13 barcode images with DPI, text customized in C# applications.