How to install Crystal Reports Barcode library in C#.NET project?
Install through NuGet
For .NET Framework 4.7.1 or later (Class library, Console, Windows Forms, WPF) apps on Windows
PM > Install-Package OnBarcode.Crystal.Reports
Download & install dll
OnBarcode Crystal Reports for .NET Barcode Generator library trial version is free to download. You can manually download it here :
Download C# Barcode Generator SDK trial version
To install the downloaded Crystal Reports barcode generator dll
To install the downloaded Crystal Reports barcode generator dll
- Add OnBarcode.Barcode.CrystalReports.dll from following folder to .NET project reference.
- For .NET Framework 4.x project, get dll from folder "{downloaded package}/dll/Net40/"
- For .NET Framework 3.x, 2.x project, get dll from folder "{downloaded package}/dll/Net20/"
- For .NET Standard 2.0 project, get dll from folder "{downloaded package}/dll/NetStandard2.0/"
- You need manually add nuget package
System.Drawing.Commonfrom "NuGet Package Manager" to .NET Core project reference.
Upgrade the dll
To upgrade the dll to latest version or upgrade the trial version dll to licensed one, you need
- Remove the installed dll or nuget package from the project. (you need clean the project cached data also)
- Add the new dll OnBarcode.Barcode.CrystalReports.dll to the .net project reference
Start to Create, Print Barcodes in Crystal Reports
We have prepared two step by step online tutorials to create new ASP.NET/WinForms projects to print barcodes in .rpt reports in .NET application.
How to print barcodes with specified width & height in Crystal Reports using C#?
Here we will explain how to print barcode with specified image width and height in Crystal Reports report files in C# ASP.NET, WinForms applications.
Here we will use our prepared WinForms tutorial to demonstrate. You can view the detailed tutorial here: How to create, print barcode in Crystal Reports in C# Windows Forms application?
In the following content, we will print Code 128 barcodes with 5-inch width and 2-inch height in Crystal Reports in C# .NET projects.
Here we will use our prepared WinForms tutorial to demonstrate. You can view the detailed tutorial here: How to create, print barcode in Crystal Reports in C# Windows Forms application?
In the following content, we will print Code 128 barcodes with 5-inch width and 2-inch height in Crystal Reports in C# .NET projects.
1. Customize barcode resolution and size settings
Open file
Add the following C# codes in the method
Form1.cs in the Visual Studio
Add the following C# codes in the method
Form1_Load
- Change the barcode unit of measure to
INCH - Set the barcode image resolution to 600 ppi. High resolution image will improve the printed barcode quality.
- Set the barcode image width to 5 inches, and height to 2 inches.
linear.UOM = UnitOfMeasure.INCH; linear.Resolution = 600; linear.BarcodeWidth = 5; linear.BarcodeHeight = 2;
2. Update the barcode object in the report properties
Open file
Select the barcode object in the report, and change the following properties.
Right click barcode object, and choose Format Object. Go to tab Picture.
Make sure the size settings are correct.
CrystalReport1.rpt in Visual Studio
Select the barcode object in the report, and change the following properties.
- Set
XScalingto 5 - Set
YScalingto 2
Right click barcode object, and choose Format Object. Go to tab Picture.
Make sure the size settings are correct.
3. View, measure the barcode in Crystal Reports
Run the Windows Forms project, and view the barcodes printed in the report.
View the rendered barcodes in PDF exported from Crystal Reports.
View the rendered barcodes in PDF exported from Crystal Reports.
Print, Customize Barcode Text Label in Crystal Reports
For linear (1d) barcodes, you can customize barcode text label in Crystal Reports using OnBarcode barcode generator library in .NET projects.
- Property
TextFontallows you to specify the barcode text font family, style, and size. - Property
TextColorallows you to customize the printed text color. - Property
TextMarginallows you to specify the space bar modules and the text label.
barcode.TextFont = new Font("OCR-b", 9f, FontStyle.Regular); barcode.TextColor = Color.Red; barcode.TextMargin = 10;
Hide barcode text label in report
You can easily hide the linear barcode text label in the Crystal Reports.
- Set property
ShowTextto false to hide the barcode text label in the report.
barcode.ShowText = false;
How to print high quality barcode images in report?
Crystal Reports reports usually need to be printed. To generate high-quality barcode images, set the resolution of barcode images higher than that of the printer.
You can view the printed PDF file from Crystal Reports with barcode high resolution applied.
- Set property
Resolutionto a high value to print high resolution (dpi) barcode images in report.
barcode.Resolution = 3000;
You can view the printed PDF file from Crystal Reports with barcode high resolution applied.
How to remove black borders around barcode in report?
If the printed barcodes in Crystal Reports contain black borders, you can use the following C# code to remove it.
Now you re-print the barcodes in report, and all borders are removed.
barcode..AutoResizePaddingTransparent = false;
Now you re-print the barcodes in report, and all borders are removed.
Barcode Types Supported By .NET Crystal Reports Barcode Control
Barcode Control for Crystal Report - Bar Code Type Generation
- Crystal Reports 1D / Linear Barcodes:
- Crystal Reports 2D / Matrix Barcodes: Data Matrix, PDF-417, QR Code, Micro PDF-417, Micro QR Code