Introduction of EAN-13 Crystal Reports Barcode Generator
This barcode generator is a robust report tool which completely integrated into .NET development environment such as Windows Forms or web applications. It is easy to change field in Crystal Report into EAN-13 barcodes with simple clicks.
Generating Barcode EAN-13 in .NET is one of the functions in OnBarcode's .NET Barcode Control for Crystal Reports, which supports creating & printing EAN-13 and 30+ other linear & 2D bar codes for C#, VB.NET & ASP.NET applications with detailed online
how-to guide:
- Linear Barcodes in Crystal Reports: Code 39, Code 128, EAN-8, EAN-13, GS1 128, UPC-A, UPC-E, Interleaved 2 of 5, Postal Codes etc.
- 2D Barcodes in Crystal Reports: including QR Code , Data Matrix, PDF-417.
How to Generate EAN-13 in .NET Using Crystal Reports Barcode Control
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 and WinForms 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.
Preparation
We have two step by step tutorials to create new ASP.NET and Windows Forms .net framework projects to print barcodes in .rpt report file in .NET application.
After you have created a new ASP.NET or Windows Forms project with the first barcode printed in the .rpt report, we will learn how to generate and customize EAN-13 barcodes in Crystal Reports in the .NET application.
- Print barcode in Crystal Reports in ASP.NET web application
- Print barcode in Crystal Reports in Windows Forms application
After you have created a new ASP.NET or Windows Forms project with the first barcode printed in the .rpt report, we will learn how to generate and customize EAN-13 barcodes in Crystal Reports in the .NET application.
Print EAN-13 barcodes in Crystal Report
Here we will start to print EAN-13 in the Crystal Reports report designer and report viewer.
In Visual Studio IDE,
After successfully generating the EAN-13 barcodes in report file in your C# ASP.NET/WinForms project, we will further customize the EAN-13 in the report.
In Visual Studio IDE,
- For ASP.NET project, open file
Default.aspx.cs - For Windows Forms project, open file
Form1.cs
- Change barcode type from Code 128 to EAN-13.
BarcodeType.EAN13;
linear.Type = BarcodeType.EAN13;
After successfully generating the EAN-13 barcodes in report file in your C# ASP.NET/WinForms project, we will further customize the EAN-13 in the report.
EAN-13 Barcode Add-on Symbol Configuration in Crystal Reports (C#)
EAN-13 supports 2-digit or 5-digit add-on symbols (positioned after the main symbol's right Quiet Zone) for supplementary data (e.g., price, 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) orBarcodeType.EAN13_5(5-digit add-on). - Assign the main EAN-13 data to the
Dataproperty (12 or 13 digits). - Set supplementary data to the
SupDataproperty (2 or 5 digits, matching the add-on type).
Linear barcode = new Linear(); barcode.Type = BarcodeType.EAN13_5; barcode.Data = "012345678912"; barcode.SupData = "12345";
Note: Mismatched add-on digit lengths (e.g., 3 digits for EAN13_2) will produce invalid barcodes.
Advanced Add-on Customization
The OnBarcode library offers additional properties to customize add-on symbol spacing and alignment (optimize for Crystal Reports Page Header/Footer layout):
SupHeight: Add-on symbol height, % of the EAN-13 main symbol. The default is 0.8f (80% of the main symbol height).SubSpace: Modify the gap between the main symbol and add-on (ensure compliance with GS1 quiet zone standards). The default is 15 pixel. The maximum space shall be 12X (property X is the bar module width).
EAN-13 Human Readable Interpretation (HRI) for Crystal Reports (C#)
The GS1 System recommends
OCR font for EAN-13's 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 report
- Set
AutoResizeBarcodeTextto false, to resize printed EAN-13 text font size. - Set
TextFontto "OCR-B" (match GS1 standards for Crystal Reports printing), and new font size. - Configure
TextMarginto control spacing between the barcode bars and HRI (minimum 0.5X per GS1, typically 1X for readability). - Config text color through property
TextColor
barcode.AutoResizeBarcodeText = false; barcode.TextFont = new Font("OCR-B", 26f, FontStyle.Regular); barcode.TextMargin = 20; barcode.TextColor = Color.Blue;
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 (C#)
Quiet Zone Indicator
Control the display of the EAN-13 quiet zone indicator (a small mark at the end of the barcode) for Crystal Reports layout optimization:
- Set
ShowQuietZoneIndicatorto false, to hide the EAN-13 quiet zone indicator mark.
barcode.ShowQuietZoneIndicator = false;
Lead/Trail Digit Spacing
Adjust spacing for improved readability in Crystal Reports:
UPCEANLeadDigitSpace: Space between the first digit and start bar (default: 0).UPCEANTrailDigitSpace: Space between the stop bar and quiet zone indicator (default: 0).
barcode.UPCEANLeadDigitSpace = 10; barcode.UPCEANTrailDigitSpace = 10;
EAN-13 Check Digit Validation in Crystal Reports (C#)
EAN-13 requires a mandatory check digit (calculated via module 10 algorithm) to ensure data integrity. The OnBarcode library auto-calculates the check digit if 12 digits are provided; if 13 digits are provided, it validates the check digit.
Calculation Logic
For a 12-digit EAN-13 input (e.g. "123456789012"):
- Sum the digits in odd positions (1st, 3rd, 5th, ..., 11th) and multiply by 3.
- Sum the digits in even positions (2nd, 4th, 6th, ..., 12th).
- Add the two sums together.
- 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
Here we have explained how to generate, print EAN-13 barcodes in Crystal Reports and customize it using OnBarcode Barcode Generator for Crystal Reports C# library.
Print EAN-13 in Report: Generate EAN-13 in C# and bind it to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates (compatible with ASP.NET Web Forms/WinForms PictureBox controls).
Customization: Use add-on symbols for supplementary data, GS1-compliant OCR-B font for HRI, and adjust spacing/quiet zone settings to fit Crystal Reports layout (Header/Footer/Details sections).
Data Integrity: Ensure EAN-13 data is numeric (12/13 digits) and validate check digits (auto-calculated by the library) to comply with GS1 standards and avoid invalid barcodes in report distribution.
Print EAN-13 in Report: Generate EAN-13 in C# and bind it to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates (compatible with ASP.NET Web Forms/WinForms PictureBox controls).
Customization: Use add-on symbols for supplementary data, GS1-compliant OCR-B font for HRI, and adjust spacing/quiet zone settings to fit Crystal Reports layout (Header/Footer/Details sections).
Data Integrity: Ensure EAN-13 data is numeric (12/13 digits) and validate check digits (auto-calculated by the library) to comply with GS1 standards and avoid invalid barcodes in report distribution.
Common Asked Questions
What is the EAN-13 code?
EAN-13 barcode is one of the GS1 standard supported barcode symbology, and it is the most commonly recognized barcode in Europe.
EAN-13 code is a 13-digit number, which includes 12 GS1 data digits and 1 check digit. EAN is short for European Article Number,
and now it is renamed as GTIN (Global Trade Item Number). EAN 13 code will be used to uniquely identify retail products worldwide.
Using Crystal Reports for .NET barcode generator add-in, you can create, customize and insert EAN-13 barcodes in Crystal report table columns in Crystal report desginer using Visual Studio .NET.
Using Crystal Reports for .NET barcode generator add-in, you can create, customize and insert EAN-13 barcodes in Crystal report table columns in Crystal report desginer using Visual Studio .NET.
What is the EAN-13 barcode layout?
The whole 13 digits EAN-13 code is containing:
- 2 or 3 digits for the number system or the country code
- 5 or 4 digits for the manufacturer code or prefix
- 5 digits for the product code
- 1 digit for the check sum digit
What is the difference between EAN and EAN-13?
EAN includes EAN-13, EAN-8 and with 2 or 5 digits add-on symbol.
OnBarcode Crystal Reports for .NET EAN Barcode Generator add-in supports both EAN-13 and EAN-8 barcode printing in Crystal report designer
and report viewer in Microsoft Visual Studio with the Crystal Report Designer extension.
How to check if the EAN-13 barcode created in Crystal report is valid?
The last digit (13th) of EAN-13 is a check digit. It will be used to verify the first 12-digit GS1 data message.
You can use OnBarcode free EAN-13 barcode scanner software to scan, and test the generated EAN barcodes in Crystal reports on Windows.
How do I print high quality EAN-13 barcodes in Crystal reports?
To print good quality EAN-13 barcodes in Crystal reports in .NET ASP.NET, Windows projects, you need follow the rules below.
- The EAN-13 barcode image resolution (DPI) is the same or higher than the printer's resolution.
- The EAN-13 barcode human readable text is using the legible fonts. The GS1 System recommends use OCR-B font to draw EAN-13 text label.
What is the minimum size for EAN-13?
The GS1 recommended minimum size for an EAN-13 barcode is 30mm in width and 20 mm in height.
You can easily customize the printed EAN-13 barcode dimension width and height in Crystal report designer report item property settings.