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
A barcode is a machine-readable visual representation of data, initially expressed through parallel lines of varying lengths and spacings. These types of barcodes can be scanned with optical scanners called barcode readers. With time, 2D barcodes were introduced, which use various shapes instead of lines and can be read with digital cameras or mobile devices equipped with appropriate software. In this article, we will compare two popular barcode libraries: Leadtools Barcode and IronBarcode. Both libraries support .NET frameworks and facilitate barcode image generation and recognition.
The LEADTOOLS Barcode SDK is a comprehensive toolkit for developers to detect, read, and generate various types of 1D and 2D barcodes. It supports multiple programming languages like .NET Framework, .NET Core, Xamarin, UWP, C++ Class Library, C#, VB, Java, etc. LEADTOOLS offers both SOAP and RESTful web services to manage barcodes across different platforms.
IronBarcode for .NET provides a straightforward API to read and write barcodes and QR codes within .NET applications. It supports various types of barcodes and QR standards and offers image pre-processing to enhance reading speeds and accuracy. Designed for .NET projects, it allows for quick integration with minimal code.
In Visual Studio, you can create a new Console/WPF/Windows Forms application to work with these libraries. After setting up the project, proceed with integrating the library of your choice.
There are several ways to download and install IronBarcode:
For example, using the Visual Studio Command-Line, you can enter the following command:
Install-Package BarCode
Similarly, Leadtools Barcode can be installed via similar methods. Use the command for command-line installation:
Install-Package Leadtools.Barcode
Both libraries facilitate easy barcode generation. Here are examples for each:
// Create a barcode and save it as an image format
var MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128);
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
// Create a barcode and save it as an image format
var MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128);
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
' Create a barcode and save it as an image format
Dim MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128)
MyBarCode.AddAnnotationTextBelowBarcode("123456")
MyBarCode.SaveAsImage("MyBarCode.jpeg")
The above code generates a barcode object using the specified parameters and saves it as an image.
// Create and save a barcode using Leadtools
barcodeEngineInstance.Writer.CalculateBarcodeDataBounds(
LeadRect.Empty,
imageResolution,
imageResolution,
qrData,
qrWriteOptions
);
imageHeight = qrData.Bounds.Height;
imageWidth = qrData.Bounds.Width;
barcodeImage = new RasterImage(
RasterMemoryFlags.Conventional,
imageWidth,
imageHeight,
bitsPerPixel,
RasterByteOrder.Rgb,
RasterViewPerspective.TopLeft,
palette,
IntPtr.Zero,
userDataLength
);
FillCommand fillCmd = new FillCommand(RasterColor.White);
fillCmd.Run(barcodeImage);
barcodeEngineInstance.Writer.WriteBarcode(
barcodeImage,
qrData,
qrWriteOptions
);
codecs.Save(
barcodeImage,
barcodeOutputStream,
RasterImageFormat.CcittGroup4,
bitsPerPixel
);
// Create and save a barcode using Leadtools
barcodeEngineInstance.Writer.CalculateBarcodeDataBounds(
LeadRect.Empty,
imageResolution,
imageResolution,
qrData,
qrWriteOptions
);
imageHeight = qrData.Bounds.Height;
imageWidth = qrData.Bounds.Width;
barcodeImage = new RasterImage(
RasterMemoryFlags.Conventional,
imageWidth,
imageHeight,
bitsPerPixel,
RasterByteOrder.Rgb,
RasterViewPerspective.TopLeft,
palette,
IntPtr.Zero,
userDataLength
);
FillCommand fillCmd = new FillCommand(RasterColor.White);
fillCmd.Run(barcodeImage);
barcodeEngineInstance.Writer.WriteBarcode(
barcodeImage,
qrData,
qrWriteOptions
);
codecs.Save(
barcodeImage,
barcodeOutputStream,
RasterImageFormat.CcittGroup4,
bitsPerPixel
);
' Create and save a barcode using Leadtools
barcodeEngineInstance.Writer.CalculateBarcodeDataBounds(LeadRect.Empty, imageResolution, imageResolution, qrData, qrWriteOptions)
imageHeight = qrData.Bounds.Height
imageWidth = qrData.Bounds.Width
barcodeImage = New RasterImage(RasterMemoryFlags.Conventional, imageWidth, imageHeight, bitsPerPixel, RasterByteOrder.Rgb, RasterViewPerspective.TopLeft, palette, IntPtr.Zero, userDataLength)
Dim fillCmd As New FillCommand(RasterColor.White)
fillCmd.Run(barcodeImage)
barcodeEngineInstance.Writer.WriteBarcode(barcodeImage, qrData, qrWriteOptions)
codecs.Save(barcodeImage, barcodeOutputStream, RasterImageFormat.CcittGroup4, bitsPerPixel)
This snippet involves generating a barcode and saving it into a desired image format.
Both libraries support barcode recognition across various image formats.
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
This reads a barcode from an image and outputs its value and type.
using (BarCodeReader reader = new BarCodeReader(@"MyBarCode.jpg"))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("Type: " + result.CodeType);
Console.WriteLine("CodeText: " + result.CodeText);
}
}
using (BarCodeReader reader = new BarCodeReader(@"MyBarCode.jpg"))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("Type: " + result.CodeType);
Console.WriteLine("CodeText: " + result.CodeText);
}
}
Using reader As New BarCodeReader("MyBarCode.jpg")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("Type: " & result.CodeType)
Console.WriteLine("CodeText: " & result.CodeText)
Next result
End Using
This example uses BarCodeReader
to extract barcode data from an image file.
IronBarcode offers a range of licensing options starting from a Lite License to an Unlimited License, with pricing dependent on developer, location, and project use. They provide a perpetual license with free updates and support.
Leadtools offers several packages with pricing based on user requirements. Their pricing starts from $1295 per year for a single developer license.
Both Leadtools Barcode and IronBarcode are robust libraries for barcode manipulation. IronBarcode, however, provides faster processing, is more affordable, and includes additional features that make it particularly versatile for reading both static images and PDFs. It's highly recommended to take advantage of the free trial to ascertain suitability for your needs.
Start your journey in barcode scanning and creation with ease!
IronBarcode offers a straightforward API for .NET applications with image pre-processing for faster reading speeds, while Leadtools Barcode provides a comprehensive toolkit supporting multiple programming languages and web services.
You can install IronBarcode via Visual Studio or using the Visual Studio Command-Line with the command: PM> Install-Package Barcode. It is also available for direct download from the NuGet or IronBarcode websites.
You can generate a barcode by creating a BarcodeWriter object, setting parameters such as barcode type and text, and then saving the barcode as an image using methods like SaveAsImage.
IronBarcode offers various licensing options, including Lite and Unlimited Licenses. Pricing depends on developer count, location, and project use, with a perpetual license offering free updates and support.
Yes, Leadtools Barcode supports multiple programming languages such as .NET Framework, .NET Core, Xamarin, UWP, C++, C#, VB, and Java.
Leadtools Barcode pricing starts from $1295 per year for a single developer license.
You can use the BarcodeReader.QuicklyReadOneBarcode method to read a barcode from an image and retrieve its value and type.
IronBarcode provides faster processing, is more affordable, and includes additional features for reading static images and PDFs, making it a versatile option for .NET projects.
Yes, both libraries support the generation and recognition of 1D and 2D barcodes, making them suitable for a wide range of applications.