Crystal Reports Barcode How-Tos
PM > Install-Package BarcodeLib.Crystal.Reports


EAN-13 Crystal Reports Barcode Generator DLL

How to Generate EAN-13 Linear Barcode Images on .NET Crystal Reports
  • Fully written in Visual C# 2005, complying with Visual Studio 2005/2008/2010
  • Easy to install Crystal Reports EAN-13 Barcode Generator Control to VS .NET applications
  • Quickly generate linear EAN-13 barcodes on Crystal Reports for ASP.NET web applications
  • Create & draw EAN-13 barcode images on Crystal Reports for .NET windows applications
  • Easy to use Visual C# & VB.NET class code to generate & make Crystal Reports EAN-13 barcodes
  • Enable .NET developers to customize & control EAN-13 barcode image roperties
  • Provide royalty-free several developer license types for EAN-13 .NET Crystal Reports Barcode Generator
This barcode generator is a robust reporting tool fully integrated into .NET development environments such as Windows Forms, WPF, and web applications. It allows fields in Crystal Reports to be converted into EAN-13 barcodes with straightforward configuration steps.

This guide provides a structured, step-by-step approach to generating EAN-13 (a linear barcode symbology for global product identification) in Crystal Reports for .NET within ASP.NET, Windows Forms, and WPF projects. It covers core implementation, add-on symbol configuration, human-readable text customization, and check digit validation to ensure compliance with GS1 standards and seamless integration with Crystal Reports components.


.NET Crystal Reports EAN-13 Linear Barcode Overview
EAN-13, based upon the UPC-A standard, was implemented by the International Article Numbering Association (EAN) in Europe. And it is a superset of UPC-A. An EAN-13 barcode is composed of four parts: 1) The number system, 2) The manufacturer code, 3) the product code, and 4) the check digit.
EAN-13 Barcode Standard Compatibility: All EAN-13 barcode images created by our .NET Crystal Reports Barcode Generator Library are complying wiht its latest barcode specifications, like GS1 Specification. And all of them can be read & scanned by almost barcode printers.
For more EAN-13 barcode details, please refer to .NET EAN-13 Barcode Overview.


How to Create EAN-13 Barcode on Crystal Reports for ASP.NET Web
  1. Create a new ASP.NET website.
    • Choose "ASP.NET Crystal Reports Web Site" as the template and named the project as "BarcodeforCrystalReportsWebSite".
  2. Add a new item "Crystal Report" to your project.
    • Add a new item "Crystal Report" to the project and name it as "CustomerReport.rpt". view image
    • Select "Mail Label" in the pop-up window and click "OK". view image
    • In "Mailing Labels Report Creation Wizard", click "Create New Connection", and expand "ADO.NET". view image
    • In "ADO.NET" form, choose "CustomerDataSet.xsd" file in your downloaded package, and click "Finish". view image
    • In "Mailing Labels Report Creation Wizard", add table "Customer" under "ADO.NET" to selected table. And click "Next". view image
    • Add all three fields "ID", "CustomerId", "CustomerName" to "Fields to Display:", then click "Next". view image
    • Select default label "Return Address (Avery 5267)", and click "Finish".
    • Now you can view the report template and find that field "Barcode" not in the report template. view image
    • Now, please re-arrange the report template. view image
    • Drag field "Barcode" to the report template, right click "Barcode" object and choose "Format Object" menu. view image
    • In "Format Editor" form, check "Can Grow" property. view image
  3. Drag a "Crystal Report Viewer" to the "Default.aspx".
    • Add a reference to BarcodeLib.Barcode.CrystalReports.dll.
    • Copy the following C# code to the "Default.aspx.cs" file.
     using System.Data.OleDb;
using System.Drawing.Imaging;
using BarcodeLib.Barcode.CrystalReports;
using BarcodeLib.Barcode;


protected void Page_Load(object sender, EventArgs e)
{
// Create the database connection. Please change to correct data file (BarcodeDemoData.mdb) path.
OleDbConnection aConnection = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:/BarcodeLib_NETBarcode_Trial/ReportingData/BarcodeDemoData.mdb"
);
aConnection.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Customer", aConnection);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);

// Add the Barcode column to the DataSet
ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[])));

// Create an instance of Linear Barcode
LinearCrystal barcode = new LinearCrystal();
// Barcode settings
barcode.Type = BarcodeType.EAN13;
barcode.BarHeight = 50; //50 pixel
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.Data = (int)dr["CustomerId"] + "";
barcode.Data = "512345678900";
byte[] imageData = barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}

CrystalReportSource1.ReportDocument.Load(Server.MapPath("CustomerReport.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();

}
4. Run your project.


EAN-13 Barcode Add-on Symbol Configuration in Crystal Reports

EAN-13 supports 2 digit or 5 digit add on symbols, positioned after the main symbol's right quiet zone, for supplementary data such as price or batch numbers in Crystal Reports product labels.

Print EAN-13 with Add-on Symbol

To generate EAN-13 with add on symbols for Crystal Reports:
  • Set Type to BarcodeType.EAN13_2 (2 digit add on) or BarcodeType.EAN13_5 (5 digit add on).
  • Assign the main EAN-13 data to the Data property (12 or 13 digits).
  • Set the supplementary data to the SupData property (2 or 5 digits, matching the add on type).
Note: Mismatched add on digit lengths (e.g., 3 digits for EAN13_2) will produce invalid barcodes.


Advanced Add-on Customization

The BarcodeLib library offers additional properties to customize add on symbol spacing and alignment, optimizing for Crystal Reports page header or footer layout:
  • SupHeight: Add on symbol height as a percentage of the EAN-13 main symbol. The default is 0.8f (80% of the main symbol height).
  • SubSpace: Modifies the gap between the main symbol and the add on; ensure compliance with GS1 quiet zone standards. The default is 15 pixels, and the maximum space shall be 12X (where X is the bar module width).


EAN-13 Human Readable Interpretation (HRI) for Crystal Reports

The GS1 System recommends the OCR B font for EAN-13 human readable text (HRI) to ensure scannability and compliance. Crystal Reports for .NET supports HRI customization via the TextFont and TextMargin properties.

Customize EAN-13 HRI in the Report
  • Set AutoResizeBarcodeText to false to manually control the printed EAN-13 text font size.
  • Set TextFont to OCR-B to match GS1 standards for Crystal Reports printing, and specify the desired font size.
  • Configure TextMargin to control spacing between the barcode bars and the HRI; a minimum of 0.5X per GS1 is recommended, with 1X typical for readability.
  • Set the text color via the TextColor property.
Note: Using non OCR fonts may violate GS1 standards. Test HRI readability in Crystal Reports Print Preview before report distribution.


Advanced EAN-13 Customization for Crystal Reports



Quiet Zone Indicator

Control the display of the EAN-13 quiet zone indicator, a small mark at the end of the barcode, to optimize Crystal Reports layout:
  • Set ShowQuietZoneIndicator to false to hide the indicator.


Lead / Trail Digit Spacing

Adjust spacing for improved readability in Crystal Reports:
  • UPCEANLeadDigitSpace: Space between the first digit and the start bar (default: 0).
  • UPCEANTrailDigitSpace: Space between the stop bar and the quiet zone indicator (default: 0).


EAN-13 Check Digit Validation in Crystal Reports

EAN-13 requires a mandatory check digit, calculated using the modulo 10 algorithm, to ensure data integrity. The BarcodeLib library automatically calculates the check digit when 12 digits are provided; if 13 digits are provided, it validates the check digit.


Calculation Logic

For a 12 digit EAN-13 input, such as "123456789012":
  1. Sum the digits in odd positions (1st, 3rd, 5th, …, 11th) and multiply the sum by 3.
  2. Sum the digits in even positions (2nd, 4th, 6th, …, 12th).
  3. Add the two sums together.
  4. Calculate the check digit as the value needed to round the total to the next multiple of 10 (e.g., input "123456789012" yields check digit 8).


Summary

This guide has provided a comprehensive walkthrough for generating, printing, and customizing EAN-13 barcodes in Crystal Reports using the BarcodeLib .NET library.
  • Print EAN-13 in Reports: Generate EAN-13 barcodes in C# or VB.NET and bind them to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates. This approach is compatible with ASP.NET Web Forms, WinForms, and WPF (via WindowsFormsHost).
  • Customization: Use add on symbols for supplementary data, apply GS1 compliant OCR B fonts for human readable text, and adjust spacing and quiet zone settings to fit Crystal Reports layout requirements across headers, footers, and details sections.
  • Data Integrity: Ensure EAN-13 data consists of numeric digits (12 or 13 characters) and rely on the library’s automatic check digit calculation or validation to comply with GS1 standards and avoid invalid barcodes in report distribution.
Crystal Reports Barcode Generator DLL for .NET Supported Barcodes
Linear (1D) Barcodes:
Matrix(2D) Barcodes:
Crystal Reports Barcode Library for .NET - How to Create Linear Barcode Images: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, Code 128, EAN-8, EAN-13, EAN 128/GS1 128, Interleaved 2 of 5, ITF14, MSI Plessey, Intelligent Mail (Onecode), PLANET, POSTNET, RM4SCC, UPC-A, UPC-E.
Crystal Reports Barcode Library for .NET - How to Create 2D Barcode Images: Data Matrix, PDF417, QR Code.