Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
What is a barcode? A barcode is a square or rectangular image that can be read by a scanner and consists of a series of parallel black lines and white gaps of varying widths. Barcodes are used on products to make them easier to identify. They're used at retail stores as part of the buying process, in warehouses to track inventory, and on invoices to help with accounting, among other things.
Can you read and generate barcodes using the .NET platform? Yes, you can generate and read barcodes using the .NET platform. In this article, we will discuss how a developer can create barcodes and read them in .NET platform-supported programming languages. We will discuss and compare two sets of software that developers use to deal with barcodes. These tools are as follows:
OnBarcode is a market-leading provider of barcode generators, reader controls, and components for all major corporate development platforms, including ASP.NET, Windows Forms, WPF, Java, Android, and iOS (iPhone projects, Mac). OnBarcode offers a full barcode solution for constructing business applications when combined with its primary reporting barcode tools, the Microsoft Office (Excel & Word) barcode add-on, and barcode fonts.
OnBarcode software offers a wide variety of barcode-related features such as generating barcode images, printing barcode images in SQL Server, reading barcodes, completely coded in Visual Studio C#, compatible with the latest barcode symbology, and printing and drawing barcode images in .NET Crystal Reports. It also supports a variety of standard codes to represent textual strings.
For OnBarcode, only the contained backend (aka ZINT shared library) provides QR code generation services in all .NET platforms. OnBarcode also supports these other platforms:
Barcode Types Generation
The OnBarcode tool barcode encoding library offers two different types of barcode generators.
OnBarcode is better than any other open-source barcode library because it offers support for rotating barcodes (it can create barcodes at 0, 90, 180, and 270 degrees).
.NET Technology Barcode Generator
Visual Studio C# .NET 2005 was used to write this. Barcodes are simple to draw and print with VB.NET, C#, Managed C++, and Borland Delphi for .NET. Barcodes are printed in memory and then encoded into image files.
Installation and Deployment
It supports .NET 2.0, 3.0, 3.5 or later versions of .NET platforms. Deployment of barcodes is easy using Simple Xcopy Deployment. OnBarcode also provides royalty-free redistribution.
Barcode Image Generating, Encoding, and Printing
This allows you to draw a barcode object to an image file and encode it in GIF, BMP, PNG, JPEG, and TIFF image formats. It also supports different browsers such as Internet Explorer, Firefox, Chrome, Safari, and Opera. With a thermal printer, you can print high-quality barcode pictures.
IronBarcode is a .NET library that allows programmers to read and create barcodes. IronBarcode is a leading .NET barcode library that supports a broad range of 1 and 2-dimensional barcodes, as well as customized (colored and branded) QR codes. IronBarcode allows developers to use all .NET-related Languages.
Creating, formatting, and exporting barcodes as pictures using IronBarcode is exceedingly straightforward, and can frequently be accomplished with just a single line of code.
IronBarcode supports .NET Core 2x & 3x, .NET Standard, .NET Framework 4x, and Full Azure. It creates postscript output and accepts a variety of standard codes to convert text strings.
Barcode Formats
Barcode Reading Features
Barcode Writing Features
The BarcodeWriter and QRCodeWriter static classes are used to create a fault-tolerant barcode and QR-writing API. Barcode data can usually be extracted in two lines of code.
IronBarCode allows its users to export as images, export to HTML pages, and export to PDF or add to an existing PDF.
The Class QRCodeWriter provides advanced support for rendering QR codes with advanced features.
Open the Visual Studio software and go to the File menu. Select "new project" and then select console application.
Enter the project name and select the path in the appropriate text box. Then, click the Create button. Select the required .NET framework, as in the screenshot below:
The Visual Studio project will now generate the structure for the selected application, and if you have selected the console, Windows, and web application, it will open the program.cs file where you can enter the code and build/run the application.
Now we can add the library and test the program.
The IronBarcode library can be downloaded and installed in four different 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 available package libraries from the NuGet site. In the package manager, we need to search for the keyword "IronBarCode", as in the below screenshot:
From the above image, we can see the list of the related packages in the search list. We need to select the IronBarcode option and install the package in our solution.
In the Visual Studio menu, Go to Tools-> NuGet Package manager -> Package manager console.
Enter the following line in the package manager 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.
Unlike IronBarcode, OnBarcode does not provide multiple installation options, nor is it available on the NuGet website. OnBarcode provides separate services for barcode generators and barcode readers. To download the barcode generator use this link, and for the barcode reader use this link. After downloading, follow these steps:
A QR code is a two-dimensional variant of a barcode consisting of black and white pixel patterns.
OnBarcode's Barcode for .NET Generation Controls enables the generating and printing of QR codes and 2D bar codes for C# applications. The OnBarcode C# Barcode Generator makes it easy to generate and create QR codes.
The following code shows how to create QR codes using OnBarcode.
using System;
using OnBarcode.Barcode;
using System.Drawing.Imaging;
// Create a new QRCode instance
QRCode qrcode = new QRCode();
qrcode.Data = "ONBARCODE"; // Set the data to encode
qrcode.DataMode = QRCodeDataMode.AlphaNumeric; // Set data mode
qrcode.UOM = UnitOfMeasure.PIXEL; // Set unit of measure (Pixels)
qrcode.X = 3; // Module width
qrcode.Resolution = 72; // Image resolution
qrcode.Rotate = Rotate.Rotate0; // No rotation
qrcode.ImageFormat = ImageFormat.Gif; // Set image format
// Draw barcode (generate the QR code image)
qrcode.drawBarcode("C:\\qrcode.gif");
using System;
using OnBarcode.Barcode;
using System.Drawing.Imaging;
// Create a new QRCode instance
QRCode qrcode = new QRCode();
qrcode.Data = "ONBARCODE"; // Set the data to encode
qrcode.DataMode = QRCodeDataMode.AlphaNumeric; // Set data mode
qrcode.UOM = UnitOfMeasure.PIXEL; // Set unit of measure (Pixels)
qrcode.X = 3; // Module width
qrcode.Resolution = 72; // Image resolution
qrcode.Rotate = Rotate.Rotate0; // No rotation
qrcode.ImageFormat = ImageFormat.Gif; // Set image format
// Draw barcode (generate the QR code image)
qrcode.drawBarcode("C:\\qrcode.gif");
Imports System
Imports OnBarcode.Barcode
Imports System.Drawing.Imaging
' Create a new QRCode instance
Private qrcode As New QRCode()
qrcode.Data = "ONBARCODE" ' Set the data to encode
qrcode.DataMode = QRCodeDataMode.AlphaNumeric ' Set data mode
qrcode.UOM = UnitOfMeasure.PIXEL ' Set unit of measure (Pixels)
qrcode.X = 3 ' Module width
qrcode.Resolution = 72 ' Image resolution
qrcode.Rotate = Rotate.Rotate0 ' No rotation
qrcode.ImageFormat = ImageFormat.Gif ' Set image format
' Draw barcode (generate the QR code image)
qrcode.drawBarcode("C:\qrcode.gif")
Iron Barcode gives developers more choices when making QR codes than they do when creating regular barcodes. We may, for example, adjust the amount of QR error correction, decide to add color QR codes, or add logos.
When a logo is added to a QR code, it is automatically shrunk to an appropriate size so that the QR code can be read, and then snapped to grid so that it is properly aligned with the black-and-white squares on the QR image.
Simple QR code generation
using IronBarCode;
// Create and save a simple QR code
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium)
.SaveAsPng("MyQR.png");
using IronBarCode;
// Create and save a simple QR code
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium)
.SaveAsPng("MyQR.png");
Imports IronBarCode
' Create and save a simple QR code
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("MyQR.png")
Advanced QR code generation
using IronBarCode;
// Create a QR code with a logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
// Change the color of the QR code
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
using IronBarCode;
// Create a QR code with a logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
// Change the color of the QR code
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
Imports IronBarCode
' Create a QR code with a logo
Private MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500)
' Change the color of the QR code
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen)
Reading barcodes to get the information hidden inside can be incredibly useful. In this section, we will discuss how these tools read different barcodes.
The Barcode Reader is a script that reads barcodes. The IronBarCode namespace's QuicklyReadOneBarcode
function is a fantastic tool for reading barcodes in the .NET framework. We can considerably enhance speed by choosing a barcode encoding scheme, and we can force it to automatically adjust for perspective and digital noise by setting the TryHarder option to true
.
The QuicklyReadAllBarcodes
technique is similar, but it can scan multiple barcodes for multipage documents like PDFs and multipage TIFFs.
QuicklyReadOneBarcode
using IronBarCode;
// Read a single barcode from an image file
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("QR.png");
using IronBarCode;
// Read a single barcode from an image file
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("QR.png");
Imports IronBarCode
' Read a single barcode from an image file
Private QRResult As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("QR.png")
TryHarder
using IronBarCode;
// Read a single barcode with more accuracy and noise correction
BarcodeResult QRBetterResult = BarcodeReader.QuicklyReadOneBarcode("QR.png", BarcodeEncoding.QRCode, true);
using IronBarCode;
// Read a single barcode with more accuracy and noise correction
BarcodeResult QRBetterResult = BarcodeReader.QuicklyReadOneBarcode("QR.png", BarcodeEncoding.QRCode, true);
Imports IronBarCode
' Read a single barcode with more accuracy and noise correction
Private QRBetterResult As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("QR.png", BarcodeEncoding.QRCode, True)
QuicklyReadAllBarcodes
using IronBarCode;
// Read all barcodes from a PDF or TIFF file
BarcodeResult[] PDFResults = BarcodeReader.QuicklyReadAllBarcodes("MultipleBarcodes.pdf", BarcodeEncoding.AllOneDimensional, true);
using IronBarCode;
// Read all barcodes from a PDF or TIFF file
BarcodeResult[] PDFResults = BarcodeReader.QuicklyReadAllBarcodes("MultipleBarcodes.pdf", BarcodeEncoding.AllOneDimensional, true);
Imports IronBarCode
' Read all barcodes from a PDF or TIFF file
Private PDFResults() As BarcodeResult = BarcodeReader.QuicklyReadAllBarcodes("MultipleBarcodes.pdf", BarcodeEncoding.AllOneDimensional, True)
In Visual C# .NET applications, the OnBarcode .NET Barcode Reader is a C# .NET component (DLL) that reads and scans barcode images.
Read linear barcodes
using OnBarcode.Barcode;
using System;
// Scan all Code39 barcodes from an image
String[] barcodes = BarcodeScanner.Scan("code39image.gif", BarcodeType.Code39);
using OnBarcode.Barcode;
using System;
// Scan all Code39 barcodes from an image
String[] barcodes = BarcodeScanner.Scan("code39image.gif", BarcodeType.Code39);
Imports OnBarcode.Barcode
Imports System
' Scan all Code39 barcodes from an image
Private barcodes() As String = BarcodeScanner.Scan("code39image.gif", BarcodeType.Code39)
Scan defined areas in the image
using OnBarcode.Barcode;
using System;
using System.Collections.Generic;
// Define a region to scan
List<SRegion> areas = new List<SRegion>();
SRegion area = new SRegion(0, 0, 50, 60);
areas.Add(area);
// Scan Code39 barcodes from defined regions in the image
string[] barcodes = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas);
using OnBarcode.Barcode;
using System;
using System.Collections.Generic;
// Define a region to scan
List<SRegion> areas = new List<SRegion>();
SRegion area = new SRegion(0, 0, 50, 60);
areas.Add(area);
// Scan Code39 barcodes from defined regions in the image
string[] barcodes = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas);
Imports OnBarcode.Barcode
Imports System
Imports System.Collections.Generic
' Define a region to scan
Private areas As New List(Of SRegion)()
Private area As New SRegion(0, 0, 50, 60)
areas.Add(area)
' Scan Code39 barcodes from defined regions in the image
Dim barcodes() As String = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas)
IronBarcode is a library that provides a developer's license for free. IronBarcode also has a distinct pricing structure: the Lite bundle starts at $749 with no hidden fees. The redistribution of SaaS and OEM products is also possible. All licenses have a 30-day money-back guarantee, a year of software support and upgrades, dev/staging/production validity, and a perpetual license (one-time purchase). To see IronBarcode's entire price structure and license, go here.
The OnBarcode reader and barcode generator are not offered in a single package. This means that you have to purchase two different packages.
The .NET Barcode Generator Suite License
The .NET Barcode Generator Suite includes a set of dependable barcode controls that are simple to use in Visual Studio .NET. In .NET apps, you may use this suite to produce, print, and draw high-quality barcodes.
Its single-developer license with both linear and 2D support starts from $1,690, and the Unlimited Developer License is available for the price of $3,990.
The .NET Barcode Reader SDK License
IronBarcode is a leading .NET barcode library that allows programmers to read and create barcodes. It supports a broad range of 1 and 2-dimensional barcodes, as well as customized (colored and branded) QR codes. IronBarcode allows developers to use all .NET-related language. IronBarcode is faster than any other C# Barcode reader and generator. It supports .NET Core 2x & 3x, .NET Standard, .NET Framework 4x and Full Azure support.
OnBarcode is a market-leading provider of barcode generators, reader controls, and components for all major corporate development platforms, including ASP.NET, Windows Forms, WPF, Java, Android, and iOS (iPhone projects, mac). The company also offers a full barcode solution when combined with Microsoft Office (Excel & Word) barcode add-ons and barcode fonts. OnBarcode software offers a wide variety of barcode-related features such as generating barcode images, reading barcodes, and compatibility with the latest barcode symbology, as well as printing and drawing in .NET. It supports a variety of standard codes to represent textual strings.
The IronBarcode pricing structure is relatively more cost-effective than that of OnBarcode. IronBarcode provides all its features under a single license with a one-time purchase and no ongoing costs, whereas OnBarcode does not provide a single license for its barcode-related features, instead, it provides separate licenses for barcode generation and barcode reading. Its separate licensing strategy makes it three times more expensive than IronBarcode, thus making it unattractive to users.
After comparing the two, we can conclude that IronBarcode provides more features than OnBarcode, and also that OnBarcode is considerably more expensive than IronBarcode. The integration of IronBarcode is relatively easy due to its availability in the NuGet Package manager. On the other hand, OnBarcode is not available in NuGet, making it quite difficult to integrate with projects. For .NET programming, IronBarcode offers all the functions in only a few lines of code, something its competitor fails to provide. On top of all that, Iron Software is currently offering all of its five software tools for the price of just two! These five tools are the following:
Please visit this link to explore Iron Suite.
A barcode is a square or rectangular image that can be read by a scanner and consists of a series of parallel black lines and white gaps of varying widths. Barcodes are used to make products easier to identify.
Yes, you can generate and read barcodes using the .NET platform. Tools like OnBarcode and IronBarcode can be used in .NET platform-supported programming languages.
OnBarcode offers features such as generating and printing barcode images in various formats, compatibility with the latest barcode symbology, and support for multiple platforms including ASP.NET, Windows Forms, and more.
IronBarcode allows for easy creation, formatting, and exporting of barcodes with simple lines of code. It supports a broad range of 1D and 2D barcodes and provides options for customization, such as colored and branded QR codes.
IronBarcode can be installed using the Visual Studio NuGet Package Manager, Visual Studio Command-Line, or by direct download from the NuGet or IronBarcode websites.
IronBarcode offers a developer's license for free with a Lite bundle available. It provides a one-time purchase with no ongoing costs, including perpetual licenses with a 30-day money-back guarantee.
IronBarcode is more cost-effective than OnBarcode. It offers all features under a single license, while OnBarcode requires separate licenses for barcode generation and reading, making it more expensive.
Yes, IronBarcode allows developers to create QR codes with logos and offers customization options such as changing QR code colors and adding logos.
OnBarcode's SDK can be installed by downloading the package from their website. It involves unzipping the package, adding the DLL to your ASP.NET project, and referencing it in your project.
IronBarcode offers more features, is easier to integrate, is available in the NuGet Package Manager, and is more cost-effective compared to OnBarcode, which requires separate licenses and is not available on NuGet.