IronBarcode和Leadtools條碼之間的比較
條碼是一種機器可讀的資料視覺表示,最初是透過長度和間距各異的平行線來表示的。 這類條碼可以用稱為條碼閱讀器的光學掃描器來掃描。 隨著時間的推移,二維條碼被引入,它使用各種形狀而不是線條,並且可以使用配備相應軟體的數位相機或行動裝置讀取。 在本文中,我們將比較兩個流行的條碼庫: Leadtools Barcode和IronBarcode 。 這兩個函式庫都支援 .NET 框架,並可實現條碼影像的生成和識別。
Leadtools 條碼
LEADTOOLS 條碼 SDK 是一個全面的工具包,供開發人員偵測、讀取和產生各種類型的 1D 和 2D 條碼。 它支援多種程式語言,例如 .NET Framework、.NET Core、Xamarin、UWP、C++ 類別庫、C#、VB、Java 等。 LEADTOOLS 提供 SOAP 和 RESTful Web 服務,用於跨不同平台管理條碼。
IronBarcode。
IronBarcode for .NET 提供了一個簡單的 API,在 .NET 應用程式中讀取和寫入條碼和二維碼。 它支援各種類型的條碼和二維碼標準,並提供影像預處理功能,以提高讀取速度和準確性。 它專為 .NET 專案而設計,只需編寫少量程式碼即可快速整合。
建立新專案
在 Visual Studio 中,您可以建立一個新的控制台/WPF/Windows 窗體應用程式來使用這些程式庫。 專案設定完成後,即可開始整合您選擇的庫。
安裝 IronBarcode 庫
使用 IronBarcode
下載和安裝IronBarcode有多種方法:
- 透過 Visual Studio 或 Visual Studio 命令列
- 可直接從 NuGet 或 IronBarcode 網站下載
例如,使用 Visual Studio 命令列,您可以輸入以下命令:
Install-Package BarCode
使用 Leadtools 條碼
同樣,Leadtools Barcode 也可以透過類似的方法安裝。 使用以下命令進行命令列安裝:
Install-Package Leadtools.Barcode
條碼生成
這兩個函式庫都方便產生條碼。 以下是一些範例:
使用 IronBarcode
// 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")上述程式碼使用指定的參數產生條碼物件並將其儲存為影像。
使用 Leadtools 條碼
// 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)這段程式碼片段涉及產生條碼並將其儲存為所需的圖像格式。
識別條碼
這兩個庫都支援對各種圖像格式的條碼進行識別。
使用 IronBarcode
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這段程式碼從影像中讀取條碼,並輸出其值和類型。
使用 Leadtools 條碼
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本範例使用BarCodeReader從影像檔案中提取條碼資料。
授權與定價
IronBarcode。。
IronBarcode 提供從精簡版授權到無限版授權的各種授權選項,價格取決於開發者、地點和專案用途。 他們提供永久授權,並提供免費更新和支援。
Leadtools
Leadtools提供多種套餐,價格依使用者需求而定。 他們的定價從每年 $1,295 美元起,適用於單一開發人員授權。
結論
Leadtools Barcode 和 IronBarcode 都是強大的條碼操作庫。 然而,IronBarcode 的處理速度更快,價格更實惠,並且包含一些額外的功能,使其在讀取靜態圖像和 PDF 方面特別靈活。 強烈建議您利用免費試用期來確定是否符合您的需求。
輕鬆開啟條碼掃描並建立之旅!
常見問題解答
IronBarcode 與 Leadtools Barcode 有何差異?
IronBarcode 為 .NET 應用程式提供簡化的 API,著重於速度與整合的簡易性,而 Leadtools BarCode 則為多種程式語言與跨平台網路服務提供全面的工具套件。
如何在 Visual Studio 中安裝 BarCode 程式庫?
若要在 Visual Studio 中安裝 IronBarcode,請使用 NuGet 套件管理員的指令:PM> Install-Package BarCode。您也可以直接從 NuGet Gallery 或 IronBarcode 官方網站下載。
如何在 C# 中生成 BarCode?
您可以使用 IronBarcode 在 C# 中生成條碼,方法是創建一個 BarcodeWriter 物件,設置所需的條碼類型和內容,並使用 SaveAsImage 方法將輸出保存為圖像。
IronBarcode 有哪些授權選項?
IronBarcode 提供多種授權選項,包括 Lite License 和 Unlimited License。定價依開發者人數、專案類型和地點而異,永久授權包含免費更新和支援。
Leadtools BarCode 支援多種程式語言嗎?
是的,Leadtools BarCode 支援多種語言,包括 .NET Framework、.NET Core、Xamarin、UWP、C++、C#、VB 及 Java,使其適用於各種開發環境。
Leadtools BarCode 授權的起始價格是多少?
Leadtools BarCode 單一開發人員授權的起始價格為每年 1295 美元。
如何使用 IronBarcode 讀取條碼?
要使用 IronBarcode 讀取條碼,請使用 BarcodeReader.QuicklyReadOneBarcode 方法從影像中擷取條碼資料及其類型。
為什麼選擇 IronBarcode 而不是 Leadtools Barcode?
IronBarcode 因其更快的處理能力、經濟實惠的價格以及讀取靜態圖像和 PDF 的附加功能而備受稱讚,使其成為 .NET 專案的多用途高效選擇。
IronBarcode 和 Leadtools BarCode 都支援二維條碼嗎?
是的,這兩個函式庫都支援 1D 和 2D 條碼的產生與辨識,為各種應用程式提供彈性。







