Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
A barcode is a type of label that encodes information about the item to which it is attached. It starts with a pattern of black bars and spaces, typically quite wide, which represent numbers. Barcodes simplify the process of data collection and analysis that is usually time-consuming and difficult. They can be scanned quickly and easily by a machine, which reduces errors and lowers costs. Some of their applications include inventory management, quality control, and supply chain management. For these cases, they have shown to be effective tools in differentiating product levels or tracking products over long distances until their final destination.
There are two coding systems that are used in conjunction with barcodes. These are called the Uniform Code Council (UPC) and the International Standards Organization (ISO). The UPC codes were designed to provide a representation of articles or products sold in retail outlets. The UPC is a 12-digit code that is broken down into 6, 10, or 13 digits. There are also 2 trailing check digits that are used for error correction purposes. When scanned, the first five digits represent the company for which it was manufactured and the product within that company's line. The last number identifies the specific product or article being scanned by its machine-readable barcode. The ISO code was originally developed by companies who trade internationally, and primarily as a representation of an article number instead of an article itself.
In this article, we are going to compare two popular barcode libraries:
Both libraries can be used for the generation and recognition of barcodes. They offer support for all dot net frameworks, and allow you to save the barcode images.
BarcodeReader
C# classBarcodelib for .NET is a suite of .NET barcode generator components designed for barcode generation in ASP.NET, .NET class, Console applications, Windows Forms applications, Microsoft Reporting Service, Crystal Reports for .NET, and Client RDlC Reports.
IronBarcode for .NET allows programmers to read and write barcodes and QR codes from within .NET apps and websites. IronBarcode simply requires a single line of code to read or write barcodes. Most barcode and QR standards can be read and written using the.NET barcode library. Code 39/93/128, UPC A/E, EAN 8/13, ITF, RSS 14 / Expanded, Databar, Codabar, Aztec, Data Matrix, MaxiCode, PDF417, MSI, Plessey, USPS, and QR are some of the most common. Type, text, binary data, page, and picture files are all included in the barcode result data. The Barcode API features are below:
Open Visual Studio and then go to the file menu. Select new project, and then select Console Application/Windows Forms/WPF Application. IronBarcode can be used on all types of applications. Also, you can use apps such as Webform/MVC/MVC Core.
Enter the project name and select the file path in the appropriate text box. Then, click the create button and select the required .NET Framework. The project will now be generated with the structure for the selected application, and, if you have selected the console application, it will open the program.cs file where you can enter the code and build/run the application.
The IronBarcode Library can be downloaded and installed in four ways:
These are:
The Visual Studio software provides the NuGet Package manager option to install the package directly to the solution. The below screenshot shows how to open the NuGet Package Manager.
It provides the search box to show the list of the packages from the NuGet website. In the package manager, we need to search for the keyword "Barcode", as in the screenshot below:
From the above image, we will get the list of the related search results. We need to select the required option to install the package to the solution.
In Visual Studio tools, go to Tools-> NuGet Package manager -> Package manager console
Enter the following line in the console tab:
Install-Package BarCode
Now the package will download/install to the current project and be ready to use.
The third way is to download the package directly from the website.
Click the link to download the latest package from the website. After the download, follow the steps below to add the package to the project.
The first thing we need to do is install the Iron Barcode library, adding barcode functionality to the .NET framework. We can do this using our NuGet package or by downloading the .NET Barcode DLL.
PM > Install-Package Barcode
The BarcodeLib library can be downloaded and installed in four different ways.
These are:
This method is similar to that used above for IronBarcode. The only thing we need to change is the search criteria, as in the image below.
Select the first option, which will then download the BarcodeLib barcode library.
In Visual Studio Tools, Go to Tools-> NuGet Package manager -> Package manager console
Enter the following line in the package manager console tab.
Install-Package BarcodeLib
The package will now download/install in the current project and be ready to use.
The third way is to download the package directly from the website.
Just click here to be redirected to the NuGet website where you can download the package.
Barcode generation can easily be done using IronBarcode and BarcodeLib. Let's take a look at that using an example.
IronBarcode can be used to create a barcode label and then saved into different types of image formats. Also, we can pass the barcode type which we need to generate. The following snippet is for barcode generation.
var MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128);
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
var MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128);
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
Dim MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128)
MyBarCode.AddAnnotationTextBelowBarcode("123456")
MyBarCode.SaveAsImage("MyBarCode.jpeg")
Barcodewriter.Createbarcode is a static class that is available in the IronBarcode namespace. It takes two parameters to create a barcode. We are also able to specify height and width options using the CreateBarcode function.
After sending the parameter, it will return the barcode object, which will in turn return different barcode properties, and with those we are able to add properties like the above sample code. AddAnnotationTextBelowBarcode is one of the properties which allows us to add the text below or above the barcode labels. If we need to, we can also hide the barcode text. In the above code, the jpeg generator helps barcodes save to the jpeg image format.
This is not only for the use of image formats — we are also able to export the barcodes in HTML format. We have different types of images generated and saved in different image formats. Also, we are able to read more than one barcode from the given barcode image.
var QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World",
"logo.png", 500);
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
QRWithLogo.SaveAsJpeg("Logoqr.jpeg");
var QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World",
"logo.png", 500);
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
QRWithLogo.SaveAsJpeg("Logoqr.jpeg");
Dim QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World", "logo.png", 500)
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen)
QRWithLogo.SaveAsJpeg("Logoqr.jpeg")
The above example shows that we are able to generate a barcode with the image inside the QR code. The CreateQrCodeWithLogo is a function that allows us to do this job. We are also using the function ChangeBarCodeColor which will help us to change the color of the barcode/QR code. These functions in IronBarcode create custom barcodes for business purposes.
BarcodeLib can be used for barcode generation. We can generate different barcode types. The following snippet can be used to create the barcode.
BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();
barcode.Type = BarcodeType.CODE39;
barcode.Data = "CODE39";
barcode.UOM = UnitOfMeasure.PIXEL;
barcode.BarWidth = 1;
barcode.BarHeight = 80;
barcode.LeftMargin = 5;
barcode.RightMargin = 5;
barcode.TopMargin = 5;
barcode.BottomMargin = 5;
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
// save barcode image into your file system
barcode.drawBarcode("C://barcode.png");
// generate barcode & output to byte array
byte [] barcodeInBytes = barcode.drawBarcodeAsBytes();
// generate barcode to Graphics object
Graphics graphics = ...
barcode.drawBarcode(graphics);
// generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode();
// generate barcode and output to HttpResponse object
HttpResponse response = ...;
barcode.drawBarcode(response);
// generate barcode and output to Stream object
Stream stream = ...;
barcode.drawBarcode(stream);
BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();
barcode.Type = BarcodeType.CODE39;
barcode.Data = "CODE39";
barcode.UOM = UnitOfMeasure.PIXEL;
barcode.BarWidth = 1;
barcode.BarHeight = 80;
barcode.LeftMargin = 5;
barcode.RightMargin = 5;
barcode.TopMargin = 5;
barcode.BottomMargin = 5;
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
// save barcode image into your file system
barcode.drawBarcode("C://barcode.png");
// generate barcode & output to byte array
byte [] barcodeInBytes = barcode.drawBarcodeAsBytes();
// generate barcode to Graphics object
Graphics graphics = ...
barcode.drawBarcode(graphics);
// generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode();
// generate barcode and output to HttpResponse object
HttpResponse response = ...;
barcode.drawBarcode(response);
// generate barcode and output to Stream object
Stream stream = ...;
barcode.drawBarcode(stream);
Dim barcode As New BarcodeLib.Barcode.Linear()
barcode.Type = BarcodeType.CODE39
barcode.Data = "CODE39"
barcode.UOM = UnitOfMeasure.PIXEL
barcode.BarWidth = 1
barcode.BarHeight = 80
barcode.LeftMargin = 5
barcode.RightMargin = 5
barcode.TopMargin = 5
barcode.BottomMargin = 5
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
' save barcode image into your file system
barcode.drawBarcode("C://barcode.png")
' generate barcode & output to byte array
Dim barcodeInBytes() As Byte = barcode.drawBarcodeAsBytes()
' generate barcode to Graphics object
Dim graphics As Graphics = ... barcode.drawBarcode(graphics)
' generate barcode and output to Bitmap object
Dim barcodeInBitmap As Bitmap = barcode.drawBarcode()
' generate barcode and output to HttpResponse object
Dim response As HttpResponse = ...
barcode.drawBarcode(response)
' generate barcode and output to Stream object
Dim stream As Stream = ...
barcode.drawBarcode(stream)
The above code shows that BarcodeGenerator is a class called BarcodeLib with which we can generate the barcode by creating an object, and that we need to pass two parameters: one is the barcode type, and the other parameter is the barcode string which we need to create a barcode. This will be then converted into a BarcodeGenerator object.
The Barcode generation object provides a function called save which allows us to save the created barcode into an image format. We are not limited to the jpeg format, as we are able to save in different barcode properties such as Tiff, etc.
Bar height and width can be resized using a separate function Barcode Generator object that has the value to set this: "Parameters.Barcode.dimension.Millimeters". This allows us to specify the line height and width.
IronBarcode and BarcodeLib allow us to recognize barcodes from different image formats and the types to which they belong. Let's take a more detailed look.
IronBarcode helps in reading the barcode from different image formats and can be defined in three ways: as string, stream, and images such as Jpeg, Tiff, Bitmap, etc. The following example is for reading the barcode from the image using the string method.
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("MyBarCode.jpg");
if (QRResult != null)
{
Console.WriteLine(QRResult.Value);
Console.WriteLine(QRResult.BarcodeType);
}
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("MyBarCode.jpg");
if (QRResult != null)
{
Console.WriteLine(QRResult.Value);
Console.WriteLine(QRResult.BarcodeType);
}
Dim QRResult As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("MyBarCode.jpg")
If QRResult IsNot Nothing Then
Console.WriteLine(QRResult.Value)
Console.WriteLine(QRResult.BarcodeType)
End If
The above describes that we are using a class BarcodeReader which has different properties. One of the properties is QuicklyReadOneBarcode, which helps us to read the barcode from the image formats.
QuicklyReadOneBarcode helps us to read the barcode from different types of image formats. It also helps us to convert them into BarcodeResult objects. Through the object, we are able to get the barcode value and the type of barcode we are reading from the image.
The BarcodeResult has the following values:
The type of the barcode in the supplied input image is returned by BarcodeType, which is an enum data type. IronBarcode supports a total of twenty-two barcode formats. The type of barcode that is applied to the provided input image will be returned.
The object type values available on the BarcodeResult are also value and text. String data types include value and text. This returns the barcode's string value. QuicklyReadOneBarcode reads a QR code/barcode and converts the string value of the image into value/text. The binary value is of the byte data type, and it returns the image's byte. The quick answer code is shown below and may be pasted into any net Windows Forms or net standard application.
The source for barcode recognition in BarCode for .NET can be defined in three ways: as an image file, a stream, or a bitmap. BMP, PNG, JPEG, GIF, and TIFF are the five picture formats that can be used to read a barcode from files. The implementation details for three different modes are also supplied. Below is the following example for using the string method.
OptimizeSetting setting = new OptimizeSetting();
setting.setMaxOneBarcodePerPage(true);
ScanArea top20 = new ScanArea(new PointF(0.0F, 0.0F), new PointF(100.0F, 20.0F));
ScanArea bottom20 = new ScanArea(new PointF(0.0F, 80.0F), new PointF(100.0F, 100.0F));
List<ScanArea> areas = new List<ScanArea>();
areas.Add(top20);
areas.Add(bottom20);
setting.setAreas(areas);
string [] results = BarcodeReader.read("c:/code39-barcode.gif", BarcodeReader.CODE39, setting);
OptimizeSetting setting = new OptimizeSetting();
setting.setMaxOneBarcodePerPage(true);
ScanArea top20 = new ScanArea(new PointF(0.0F, 0.0F), new PointF(100.0F, 20.0F));
ScanArea bottom20 = new ScanArea(new PointF(0.0F, 80.0F), new PointF(100.0F, 100.0F));
List<ScanArea> areas = new List<ScanArea>();
areas.Add(top20);
areas.Add(bottom20);
setting.setAreas(areas);
string [] results = BarcodeReader.read("c:/code39-barcode.gif", BarcodeReader.CODE39, setting);
Dim setting As New OptimizeSetting()
setting.setMaxOneBarcodePerPage(True)
Dim top20 As New ScanArea(New PointF(0.0F, 0.0F), New PointF(100.0F, 20.0F))
Dim bottom20 As New ScanArea(New PointF(0.0F, 80.0F), New PointF(100.0F, 100.0F))
Dim areas As New List(Of ScanArea)()
areas.Add(top20)
areas.Add(bottom20)
setting.setAreas(areas)
Dim results() As String = BarcodeReader.read("c:/code39-barcode.gif", BarcodeReader.CODE39, setting)
The above code shows that we are reading the barcode from the jpeg format. BarcodeReader is a class that helps us read the barcode image using the image path as a parameter. Once we pass the image path it will convert the image into a BarcodeReader object. Then we can use the object to get the value from the image.
BarcodeReader objects have a function called ReadBarCodes() which will help us to get all the available codes in the images. Using the for loop we can get the images one-by-one and hold them in the BarCodeResult object. Through the object, we can read the value and type of the barcode. Using this we are able to read multiple barcodes at once.
The 30-day money-back guarantee: when a license is purchased you will get 30 days of money back up if the license does not work.
Easy integration: the integration of IronBarcode with your project and environment is so easy that we can achieve it by writing just a single line of code by adding from NuGet Package, or we can download it from the web and integrate it with our environment that way.
Perpetual Licensing: Each license is purchased once and does not require renewal.
Free Support and Product Updates: every license comes with a year of free product updates and support from the team behind the product. It is possible to purchase extensions at any moment. Extensions can be viewed.
Immediate Licenses: registered license keys are sent out as soon as payment is received.
All licenses are perpetual and apply to development, staging, and production.
The Lite License
This license allows a single software developer in an organization to utilize the Iron Software in a single place. Iron Software can be used in a single web application, intranet application, or desktop software program. Licenses are non-transferable, and they cannot be shared outside of an organization or an agency/client relationship. This license type, like all other license types, expressly excludes all rights not expressly granted under the Agreement, without OEM redistribution and utilizing the Iron Software as a SaaS if additional coverage is not purchased.
Pricing: Starts from $749 per year.
Professional License:
This allows a predetermined number of software developers in an organization to utilize Iron Software in single locations, up to a maximum of ten. The Iron Software can be used in as many websites, intranet applications, or desktop software applications as you like. Licenses are non-transferable, and they cannot be shared outside of an organization or an agency/client relationship. This license type, like all other license types, expressly excludes all rights not expressly granted under the Agreement, including OEM redistribution and utilizing the Iron Software as a SaaS without purchasing additional coverage. This license can be integrated with a single project up to a maximum of 10.
Pricing: Starts from $999 per year.
Unlimited License
This allows an unlimited number of software developers in an organization to utilize Iron Software in an unlimited number of locations. The Iron Software can be used in as many websites, intranet applications, or desktop software applications as you like. Licenses are non-transferable, and they cannot be shared outside of an organization or an agency/client relationship. This license type, like all other license types, expressly excludes all rights not expressly granted under the Agreement, including OEM redistribution and utilizing the Iron Software as a SaaS if additional coverage is not purchased.
Pricing: Starts from $2999 per year.
Royalty-Free Redistribution: This allows you to distribute the Iron Software as part of a number of differently packaged commercial products (without having to pay royalties) based on the number of projects covered by the base license. It allows for the deployment of Iron Software within SaaS software services, based on the number of projects covered by the base license.
Pricing: Starts from $1599 per year.
Single Developer License: The Single Developer License allows one developer royalty-free distribution of unlimited user licenses and installation software on unlimited servers, which can be placed in more than one location.
Pricing: Starts from $999 per year.
5-Developer License: This allows five developers royalty-free distribution of unlimited user licenses and installation software on unlimited servers, which can be placed in more than one location.
Pricing: Starts from $1999 per year.
Unlimited Developers License: This allows unlimited developers royalty-free distribution, unlimited user licenses, and installation software on unlimited servers, which can be placed in more than one location.
Pricing: Starts from $2999 per year.
IronBarcode Lite includes a one-developer package with one year of support, and costs around $749, while the BarcodeLib one-developer package cost $999. The IronPDF Professional license, a 10-developer package with one year of support costs $999, while the BarcodeLib 10-developer package costs $2999 per year. Both these licenses come with regular updates, major releases, and technical support for 1 year.
The IronPDF Lite and Professional packages have SaaS or OEM service along with a 5-year support option. The Lite package for one developer with 5-year support and Saas and OEM service costs $2897 USD. BarcodeLib provides SaaS or OEM service and customized support options. The Iron Professional license provides a 10-developer package with 5-year support and Saas and OEM service for $3397. BarcodeLib includes a 10-developer package with 1-year support and Saas and OEM service, all costing $2999.00
IronBarcode is one of the most powerful libraries for helping generate and recognize barcodes. It is also one of the fastest libraries in terms of barcode generation and recognition. This library is supported by various operating systems. It supports a wide variety of barcode formats and is easy to create We can change the image format to jpeg and others, and change the color, line height, width, barcode text, etc.
BarcodeLib.Barcode is also a powerful library that can help us generate and recognize barcodes with different image formats. We can use various image formats to read and create barcodes. BarcodeLib also provides options to change a barcode's appearance, such as height, width, barcode text, etc.
IronBarcode packages provide better licensing and support than BarcodeLib. BarcodeLib is also more expensive, starting at $999 per year, while IronBarcode is clearly cheaper at the starting price of $749. Not only is IronBarcode more cost-effective, it also provides more features than BarcodeLib. Further, IronBarcode has the advantage of being faster than BarcodeLib. IronBarcode also has various properties which allow us to not only read barcodes from different image formats but also to read barcodes from PDF documents. It also allows us to add images inside the barcode or QR code, a feature that is not available in any other library.
So, what are you waiting for? The free trial is open to all. You can obtain the License here and begin straightaway
9 .NET API products for your office documents