跳至页脚内容
与其他组件比较

Dynamsoft 条码阅读器与 IronBarcode:C# 条码库对比

Infragistics 条形码 vs IronBarcode:仅WPF阅读器与平台无关的API

Infragistics 条形码读取功能可在WPF中运行。 到达那里需要一个Decode()。 省略一个系列——比如说,留下Symbology.QRCode不在标志中——您图像中的任何QR条码都会悄悄返回无结果。 没有例外。 没有预警。 结果为空。

那是WPF方面。在WinForms方面,Infragistics.Win.UltraWinBarcode包中仅包含生成控件,但完全没有读取类。 如果您需要在WinForms项目中读取条形码,Infragistics 条形码包中没有任何可以调用的函数。 这同样适用于任何ASP.NET Core控制器、控制台工具、Azure 函数、 Blazor服务器组件或 Docker 容器。 Infragistics 条形码支持存在于 UI 框架边界内:WPF 获得生成和事件驱动读取功能;WinForms仅生成; 其他一切都得不到。

本次比较考察了这种拆分在实践中的意义,然后考察了IronBarcode如何使用单一的静态 API 处理相同的工作,该 API 在每种项目类型中的行为都相同。

了解 Infragistics 条形码支持

Infragistics 是最成熟的.NET UI 组件供应商之一。 Infragistics UltimateSuite(涵盖条形码功能的订阅服务)包含数百个适用于 WinForms、WPF、 ASP.NET、 Blazor和移动平台的控件。对于已经在使用 Infragistics 网格、图表或日程安排工具的团队来说,条形码控件的加入顺理成章:他们已经为订阅付费了。

然而,条形码支持并不是一个统一的库。 这是两个功能各自独立的组件,只有部分功能重叠。

WinForms:UltraWinBarcode

UltraWinBarcode类在WinForms应用程序中提供条码生成。 API 使用起来非常简单:

// InfragisticsWinFormsgeneration
using Infragistics.Win.UltraWinBarcode;

var barcode = new UltraWinBarcode();
barcode.Symbology = Symbology.Code128;
barcode.Data = "ITEM-12345";
barcode.SaveTo(outputPath);
// InfragisticsWinFormsgeneration
using Infragistics.Win.UltraWinBarcode;

var barcode = new UltraWinBarcode();
barcode.Symbology = Symbology.Code128;
barcode.Data = "ITEM-12345";
barcode.SaveTo(outputPath);
Imports Infragistics.Win.UltraWinBarcode

Dim barcode As New UltraWinBarcode()
barcode.Symbology = Symbology.Code128
barcode.Data = "ITEM-12345"
barcode.SaveTo(outputPath)
$vbLabelText   $csharpLabel

您设置一个符号格式,分配数据,调用SaveTo()。 对于WinForms中的仅生成场景,这种方法有效。 Symbology枚举涵盖常见格式:Code128、Code39、QR、EAN13等。

这个集会中缺少的是一个读者。 没有UltraBarcodeReader类。 没有Scan()方法。 如果您仅使用Infragistics.Win.UltraWinBarcode包在WinForms应用程序中尝试读取条形码图像,则没有可以调用的东西。

WPF:XamBarcode 和 BarcodeReader

WPF方面包括一个生成控件(Infragistics.WPF.BarcodeReader程序集)。 该阅读器是事件驱动的,围绕WPF线程和图像模型设计。

在WPF中读取条形码需要连接BitmapSource对象而不是文件路径进行加载,并在您的代码是异步时将回调模式转换为可等待的形式。

ASP.NET Core、控制台、Docker:无

没有针对net8.0的Infragistics条形码包,而不使用WPF或WinForms UI程序集。 ASP.NET Core项目、控制台工具、Azure Functions、 Blazor服务器 和 Linux Docker 容器没有 Infragistics 条形码选项。 该库与 UI 框架耦合。

WPF阅读模式

以下是使用 Infragistics 在WPF中读取条形码的实际过程:

// InfragisticsWPFreading: event-driven, requiresWPFassemblies
using Infragistics.Controls.Barcodes;
using System.Windows.Media.Imaging;

private BarcodeReader _reader;
private TaskCompletionSource<string> _result;

public InfragisticsBarcodeService()
{
    _reader = new BarcodeReader();
    _reader.DecodeComplete += OnDecodeComplete;
}

public async Task<string> ReadBarcodeAsync(string imagePath)
{
    _result = new TaskCompletionSource<string>();

    // Load asWPFBitmapSource — not a file path
    var bitmap = new BitmapImage(new Uri(imagePath, UriKind.Absolute));

    // Build the Symbology flags. The enum is [Flags];
    // EAN-8/EAN-13/UPC-A/UPC-E share a single EanUpc flag,
    // and Code 39 is exposed as Code39Ext. Use Symbology.All
    // to search every supported family.
    var symbologies = Symbology.Code128 |
                      Symbology.Code39Ext |
                      Symbology.QRCode |
                      Symbology.EanUpc |
                      Symbology.Interleaved2Of5;

    // Symbology is the second argument to Decode/DecodeAsync,
    // not a property on the reader. Result comes via callback.
    _reader.DecodeAsync(bitmap, symbologies);

    return await _result.Task;
}

private void OnDecodeComplete(object sender, ReaderDecodeArgs e)
{
    _result?.TrySetResult(e.SymbolFound ? e.Value : "No barcode found");
}

public void Dispose()
{
    if (_reader != null)
    {
        _reader.DecodeComplete -= OnDecodeComplete;
        _reader = null;
    }
}
// InfragisticsWPFreading: event-driven, requiresWPFassemblies
using Infragistics.Controls.Barcodes;
using System.Windows.Media.Imaging;

private BarcodeReader _reader;
private TaskCompletionSource<string> _result;

public InfragisticsBarcodeService()
{
    _reader = new BarcodeReader();
    _reader.DecodeComplete += OnDecodeComplete;
}

public async Task<string> ReadBarcodeAsync(string imagePath)
{
    _result = new TaskCompletionSource<string>();

    // Load asWPFBitmapSource — not a file path
    var bitmap = new BitmapImage(new Uri(imagePath, UriKind.Absolute));

    // Build the Symbology flags. The enum is [Flags];
    // EAN-8/EAN-13/UPC-A/UPC-E share a single EanUpc flag,
    // and Code 39 is exposed as Code39Ext. Use Symbology.All
    // to search every supported family.
    var symbologies = Symbology.Code128 |
                      Symbology.Code39Ext |
                      Symbology.QRCode |
                      Symbology.EanUpc |
                      Symbology.Interleaved2Of5;

    // Symbology is the second argument to Decode/DecodeAsync,
    // not a property on the reader. Result comes via callback.
    _reader.DecodeAsync(bitmap, symbologies);

    return await _result.Task;
}

private void OnDecodeComplete(object sender, ReaderDecodeArgs e)
{
    _result?.TrySetResult(e.SymbolFound ? e.Value : "No barcode found");
}

public void Dispose()
{
    if (_reader != null)
    {
        _reader.DecodeComplete -= OnDecodeComplete;
        _reader = null;
    }
}
Imports Infragistics.Controls.Barcodes
Imports System.Windows.Media.Imaging
Imports System.Threading.Tasks

Private _reader As BarcodeReader
Private _result As TaskCompletionSource(Of String)

Public Sub New()
    _reader = New BarcodeReader()
    AddHandler _reader.DecodeComplete, AddressOf OnDecodeComplete
End Sub

Public Async Function ReadBarcodeAsync(imagePath As String) As Task(Of String)
    _result = New TaskCompletionSource(Of String)()

    ' Load as WPF BitmapSource — not a file path
    Dim bitmap As New BitmapImage(New Uri(imagePath, UriKind.Absolute))

    ' Build the Symbology flags. The enum is [Flags];
    ' EAN-8/EAN-13/UPC-A/UPC-E share a single EanUpc flag,
    ' and Code 39 is exposed as Code39Ext. Use Symbology.All
    ' to search every supported family.
    Dim symbologies = Symbology.Code128 Or
                      Symbology.Code39Ext Or
                      Symbology.QRCode Or
                      Symbology.EanUpc Or
                      Symbology.Interleaved2Of5

    ' Symbology is the second argument to Decode/DecodeAsync,
    ' not a property on the reader. Result comes via callback.
    _reader.DecodeAsync(bitmap, symbologies)

    Return Await _result.Task
End Function

Private Sub OnDecodeComplete(sender As Object, e As ReaderDecodeArgs)
    _result?.TrySetResult(If(e.SymbolFound, e.Value, "No barcode found"))
End Sub

Public Sub Dispose()
    If _reader IsNot Nothing Then
        RemoveHandler _reader.DecodeComplete, AddressOf OnDecodeComplete
        _reader = Nothing
    End If
End Sub
$vbLabelText   $csharpLabel

读取一个条形码大约需要 35 条基础设施线路。 统计一下实际发生的事情:

  1. 作为字段创建并保持一个BarcodeReader实例。
  2. 构造函数中连接了一个事件处理程序。
  3. 每次调用TaskCompletionSource<string>并分配给共享字段——这意味着该服务按书写方式不支持线程安全。 并发调用将覆盖_result
  4. 图像必须作为Uri中加载——不是文件路径字符串、不是字节数组、不是流。
  5. DecodeAsync()异步触发事件。 TaskCompletionSource是回调世界和异步/等待世界之间的粘合。
  6. e.Value
  7. Dispose()方法必须分离事件处理程序以防止内存泄漏。

这些逻辑都与条形码无关。 这是围绕事件驱动设计运行所需的基础设施。 在生产代码中,您还需要处理_result.Task从未完成的情况——超时、取消令牌或某种防止事件永不触发的保护。

WinForms差距

WinForms 与其他技术之间的差距比乍看起来要大得多。 构建WinForms应用程序的团队经常会访问 Infragistics 条形码页面,希望获得对称的体验——在两个 UI 框架上生成和读取条形码。 他们发现Infragistics.Win.UltraWinBarcode根本不提供读取能力。

这不是文件记录疏忽。WinForms条形码程序集被设计为生成控件。 如果您需要在WinForms应用程序中扫描条形码(例如,从用户上传的图像文件中读取条形码,或从摄像头画面中解码条形码),则无法使用 Infragistics 条形码工具完成此操作。 你需要引入一个完全独立的库,这样一来,使用 Infragistics 进行生成的理由就站不住脚了。

这种不对称性为运行混合框架项目的团队创造了一个覆盖差距。 即使团队在其他所有地方都使用了 Infragistics,但如果他们同时拥有WPF桌面客户端和WinForms桌面客户端,则无法在WinForms项目中使用 Infragistics 进行条形码读取。

符号规范:一种静默故障模式

在WPF读取器中传递给Symbology标志参数值得单独开一个章节,因为其故障模式是静默的:缺少标志会返回空结果而不会出现错误。

当您调用读者时,您将要搜索的每个条码系列结合到一起。 支持的系列有QR、EAN/UPC(EanUpc)、Code 39(Code39Ext)、Code 128、MaxiCode和Interleaved 2 of 5——DataMatrix根本不在枚举中,因此WPF读取器无法解码它。 Symbology.All涵盖枚举中的所有内容:

// Build flags explicitly, or use Symbology.All to search every family
var symbologies = Symbology.Code128 |
                  Symbology.Code39Ext |
                  Symbology.QRCode |
                  Symbology.EanUpc |
                  Symbology.Interleaved2Of5;

_reader.DecodeAsync(bitmap, symbologies);
// Build flags explicitly, or use Symbology.All to search every family
var symbologies = Symbology.Code128 |
                  Symbology.Code39Ext |
                  Symbology.QRCode |
                  Symbology.EanUpc |
                  Symbology.Interleaved2Of5;

_reader.DecodeAsync(bitmap, symbologies);
' Build flags explicitly, or use Symbology.All to search every family
Dim symbologies = Symbology.Code128 Or
                  Symbology.Code39Ext Or
                  Symbology.QRCode Or
                  Symbology.EanUpc Or
                  Symbology.Interleaved2Of5

_reader.DecodeAsync(bitmap, symbologies)
$vbLabelText   $csharpLabel

如果条形码图像包含QR码,而e.Value为空。 解码事件仍然会触发。 不会抛出异常。 呼叫者收到"未找到条形码"的提示,但无法判断图像是无法读取还是根本没有配置。

实际上,这意味着:

  • 对于开发者测试过的格式,初始设置运行正常。
  • 系统中引入了新的条形码格式(供应商更改了标签类型,新产品线使用了不同的符号体系)。
  • 读者对该系列的所有图像无声失效。
  • 该故障看起来与"图像没有条形码"完全相同,而不是"格式未配置"。

调试此问题的团队在意识到系列从未出现在标志列表中之前会花时间检查图像质量。DataMatrix是一个更尖锐的例子:没有要添加的标志,因为WPF读者根本不支持它。

IronBarcode不需要格式参数。 它在每次读取时自动检测所有支持格式。 没有需要遗忘的旗帜。

平台矩阵

跨平台能力差距是理解架构限制的最直接方式:

平台 Infragistics 生成 Infragistics 阅读 IronBarcode生成 IronBarcode读取
WPF XamBarcode 控件 条形码读取器(事件驱动型)
WinForms UltraWinBarcode 无法使用
ASP.NET Core 无法使用 无法使用
控制台 无法使用 无法使用
Blazor服务器 无法使用 无法使用
Docker / Linux 无法使用 无法使用
Azure Functions 无法使用 无法使用

此表说明了为什么运行纯WPF桌面应用程序以外的任何应用程序的团队都会发现 Infragistics 条形码支持不足。 一旦项目跨越WinForms和ASP.NET Core ,或者WPF和后台工作服务,Infragistics 条形码库就只能覆盖部分代码库。

了解IronBarcode

IronBarcode是一个专用于.NET的条形码库,不依赖于 WinForms、WPF 或任何 UI 框架。 同一个NuGet包、同一个命名空间和同一个 API 可以在任何.NET项目中使用:WinForms、WPF、 ASP.NET Core、控制台、 Blazor Server、Docker、Azure Functions、AWS Lambda。

// IronBarcode: identical code in WinForms, WPF, ASP.NET Core, console, Docker
// NuGet: dotnet add package BarCode
using IronBarCode;

// Read — 2 lines, any platform
var results = BarcodeReader.Read(imagePath);
return results.FirstOrDefault()?.Value ?? "No barcode found";
// IronBarcode: identical code in WinForms, WPF, ASP.NET Core, console, Docker
// NuGet: dotnet add package BarCode
using IronBarCode;

// Read — 2 lines, any platform
var results = BarcodeReader.Read(imagePath);
return results.FirstOrDefault()?.Value ?? "No barcode found";
Imports IronBarCode

' Read — 2 lines, any platform
Dim results = BarcodeReader.Read(imagePath)
Return If(results.FirstOrDefault()?.Value, "No barcode found")
$vbLabelText   $csharpLabel

BarcodeReader.Read()是一个静态方法。 无需管理实例,无需连接事件,无需TaskCompletionSource来桥接回调模式。 它接受一个文件路径字符串、一个字节数组、一个Stream或这些的数组用于批处理。

对于生成,BarcodeWriter.CreateBarcode()返回一个可将其保存为PNG、JPEG、SVG或作为二进制数据获取的条码对象:

using IronBarCode;

// Generate Code 128
BarcodeWriter.CreateBarcode("ITEM-12345", BarcodeEncoding.Code128)
             .ResizeTo(400, 100)
             .SaveAsPng("barcode.png");

// Generate QR code
QRCodeWriter.CreateQrCode("https://example.com", 500,
    QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .SaveAsPng("qr.png");
using IronBarCode;

// Generate Code 128
BarcodeWriter.CreateBarcode("ITEM-12345", BarcodeEncoding.Code128)
             .ResizeTo(400, 100)
             .SaveAsPng("barcode.png");

// Generate QR code
QRCodeWriter.CreateQrCode("https://example.com", 500,
    QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .SaveAsPng("qr.png");
Imports IronBarCode

' Generate Code 128
BarcodeWriter.CreateBarcode("ITEM-12345", BarcodeEncoding.Code128) _
             .ResizeTo(400, 100) _
             .SaveAsPng("barcode.png")

' Generate QR code
QRCodeWriter.CreateQrCode("https://example.com", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest) _
    .SaveAsPng("qr.png")
$vbLabelText   $csharpLabel

许可证初始化操作在应用程序启动时执行一次:

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
Imports IronBarCode

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

并排:批量处理

批量处理暴露了 InfragisticsWPF读取器的另一个结构性限制。 由于读取器使用了共享的事件处理程序,并且每次调用都会覆盖_result字段,上述服务类不能安全地并发处理多张图像。 必须按顺序调用:

// Infragistics: must process sequentially — shared event handler and TaskCompletionSource
// field mean concurrent calls would overwrite _result before the previous decode completes
var service = new InfragisticsBarcodeService();
var results = new List<string>();

foreach (var file in imageFiles)
{
    // Each call must await before starting the next
    var value = await service.ReadBarcodeAsync(file);
    results.Add(value);
}
// Infragistics: must process sequentially — shared event handler and TaskCompletionSource
// field mean concurrent calls would overwrite _result before the previous decode completes
var service = new InfragisticsBarcodeService();
var results = new List<string>();

foreach (var file in imageFiles)
{
    // Each call must await before starting the next
    var value = await service.ReadBarcodeAsync(file);
    results.Add(value);
}
Imports System.Collections.Generic
Imports System.Threading.Tasks

' Infragistics: must process sequentially — shared event handler and TaskCompletionSource
' field mean concurrent calls would overwrite _result before the previous decode completes
Dim service As New InfragisticsBarcodeService()
Dim results As New List(Of String)()

For Each file In imageFiles
    ' Each call must await before starting the next
    Dim value As String = Await service.ReadBarcodeAsync(file)
    results.Add(value)
Next
$vbLabelText   $csharpLabel

使其并发需要显著的附加基础设施:锁、队列、或信号量以确保_result在上一解码正在进行时不被覆盖。 对于一个简单的 I/O 操作来说,这是一个相当复杂的并发问题。

IronBarcode的静态BarcodeReader.Read()是线程安全的。 它可以同时从多个线程调用,无需任何额外的同步操作。 对于批量工作负载,您可以直接使用Parallel.ForEach

using IronBarCode;

// IronBarcode: parallel batch with thread-safe static API
var results = new System.Collections.Concurrent.ConcurrentBag<string>();

Parallel.ForEach(imageFiles, file =>
{
    var barcodeResults = BarcodeReader.Read(file);
    foreach (var result in barcodeResults)
    {
        results.Add(result.Value);
    }
});
using IronBarCode;

// IronBarcode: parallel batch with thread-safe static API
var results = new System.Collections.Concurrent.ConcurrentBag<string>();

Parallel.ForEach(imageFiles, file =>
{
    var barcodeResults = BarcodeReader.Read(file);
    foreach (var result in barcodeResults)
    {
        results.Add(result.Value);
    }
});
Imports IronBarCode
Imports System.Collections.Concurrent
Imports System.Threading.Tasks

' IronBarcode: parallel batch with thread-safe static API
Dim results As New ConcurrentBag(Of String)()

Parallel.ForEach(imageFiles, Sub(file)
    Dim barcodeResults = BarcodeReader.Read(file)
    For Each result In barcodeResults
        results.Add(result.Value)
    Next
End Sub)
$vbLabelText   $csharpLabel

您还可以在单次调用中传递多个文件,并通过BarcodeReaderOptions配置并行度:

using IronBarCode;

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    MaxParallelThreads = 4
};

var results = BarcodeReader.Read(imageFiles, options);
foreach (var result in results)
{
    Console.WriteLine($"{result.Value} ({result.Format})");
}
using IronBarCode;

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    MaxParallelThreads = 4
};

var results = BarcodeReader.Read(imageFiles, options);
foreach (var result in results)
{
    Console.WriteLine($"{result.Value} ({result.Format})");
}
Imports IronBarCode

Dim options As New BarcodeReaderOptions With {
    .Speed = ReadingSpeed.Balanced,
    .ExpectMultipleBarcodes = True,
    .MaxParallelThreads = 4
}

Dim results = BarcodeReader.Read(imageFiles, options)
For Each result In results
    Console.WriteLine($"{result.Value} ({result.Format})")
Next
$vbLabelText   $csharpLabel

功能对比

特征 Infragistics 条形码 IronBarcode
WinForms条形码读取 不可用
WPF条形码读取 是的(事件驱动型) 是的(同步)
ASP.NET Core支持 不可用
控制台/工作服务 不可用
Docker / Linux 不可用
Azure Functions 不可用
Blazor服务器 不可用
自动格式检测 否——必须传递符号标志到Decode() 是——自动检测格式
PDF条形码读取 不可用 是的——原生支持,无需额外软件包
线程安全读取 否(共享事件处理程序) 是的(静态 API)
需要事件驱动型 API 是的(WPF)
显式图像加载(BitmapSource) 否——接受文件路径、字节数和流。
同步阅读 否(必须通过 TaskCompletionSource 进行桥接)
批量处理 仅顺序执行(不安全并发) 内置并行化
静默格式化失败 是(省略的符号系列)
Suite依赖项 是的——Infragistics Ultimate订阅 不——独立软件包
永久许可选项 不——年度订阅
大致许可费用 年度订阅(Infragistics Ultimate) 永久版(Lite)起价 749 美元

API 映射参考

WinForms(UltraWinBarcode) 到IronBarcode

InfragisticsWinForms—UltraWinBarcode IronBarcode
new UltraWinBarcode() BarcodeWriter.CreateBarcode(data, encoding)
barcode.Symbology = Symbology.Code128 CreateBarcode的参数)
barcode.Data = "ITEM-12345" CreateBarcode()的第一个参数
barcode.SaveTo(outputPath) .SaveAsPng(outputPath)
没有读取 API BarcodeReader.Read(imagePath)

WPF(条形码阅读器)到IronBarcode

InfragisticsWPF— 条形码阅读器 IronBarcode
new BarcodeReader() 静态类——无需实例
_reader.DecodeComplete += OnDecodeComplete 不需要
_reader.DecodeAsync(bitmap, Symbology.X |Symbology.Y) 自动检测——无需配置
new BitmapImage(new Uri(path)) + _reader.Decode(bitmap, ...) BarcodeReader.Read(path)
ReaderDecodeArgs中) result.Value
ReaderDecodeArgs中) result.Format
TaskCompletionSource<string>异步包装器 同步——无需包装器
Dispose() — 分离事件处理程序 不需要——没有实例或事件
仅限WPF项目 任何.NET项目类型

当球队切换

某些特定情况总是导致团队放弃使用 Infragistics 条形码支持。

WinForms阅读材料需求。这是最常见的应用场景。 使用UltraWinBarcode WinForms应用程序能很好地生成条码,但随后出现一个新要求:从上传的图像中扫描条码或打印前验证标签。 Infragistics 没有适用于WinForms的读取 API。 团队要么引入第二个库,要么用能够同时实现这两个功能的程序替换生成代码。

新增ASP.NET Core端点。带有 Infragistics 条形码生成功能的桌面应用程序现在拥有配套的 Web API。 该端点需要接受图像上传并返回条形码值,或者按需生成条形码图像。 在ASP.NET Core项目中使用 Infragistics 条形码包无法实现上述任何功能。 IronBarcode通过dotnet add package BarCode安装,并在控制器操作中与在控制台方法中工作方式相同。

Docker部署。WPF应用程序正在被容器化,或者其条形码逻辑正在被提取到微服务中。WPF程序集无法在Linux Docker容器中运行。 Infragistics WPFBarcodeReader随它们一起走。 IronBarcode原生支持 Linux x64 系统。

批量处理性能。一个工作流程可以处理成百上千张条形码图像。 事件驱动型 Infragistics 读取器按顺序处理它们。 IronBarcode的静态读取器是线程安全的,支持MaxParallelThreads选项,无需任何并发基础设施。

生产中的静默格式失败。 一个团队发现某个系列的条码已经失效几周了,因为传递给Symbology标志没有包含该系列。 切换到自动检测模式可以彻底消除故障模式。

缩减 Infragistics 订阅范围。一些团队之所以支付 Infragistics Ultimate 订阅费用,正是因为其中包含条形码控制功能。 如果订阅的唯一原因是需要条形码,那么价格低廉的专用条形码库值得考虑。

结论

Infragistics 条形码支持的核心问题是架构方面的,而不是功能方面的。WPFBarcodeReader确实可以读取条码。WinFormsUltraWinBarcode确实可以生成它们。 在每个组件所设计的特定范围内,它们都能发挥作用。 问题在于,这两种情况并不能涵盖大多数.NET团队实际需要的内容。

在现代.NET应用程序中,条形码功能很少只存在于一个 UI 框架中。 它出现在WinForms客户端和 Web API 中。 它运行在 Docker 容器和桌面系统上。它需要扫描上传到ASP.NET端点的图像,并通过控制台工具打印标签。 这些方法都无法与 Infragistics 条形码包配合使用,而且WPF阅读器的事件驱动模式以及所需的符号标志即使在唯一能够正常工作的上下文中也增加了很大的复杂性。

IronBarcode解决了同样的问题——读取和生成条形码——它使用静态 API,可以在每种.NET项目类型中编译和运行,结果都一样。 您在WPF服务类中编写的BarcodeReader.Read()调用与您在ASP.NET Core控制器中编写的调用相同,与您在Linux Docker容器中编写的调用相同。 无事件,无标志,无TaskCompletionSource。 条形码逻辑只有两行而不是三十五行,而且这两行在任何地方都能正常工作。

常见问题解答

什么是 Infragistics 条形码?

Infragistics Barcode 是一个 .NET 条形码库,用于在 C# 应用程序中生成和读取条形码。它是开发人员在为 .NET 项目选择条形码解决方案时评估的几个备选方案之一。

Infragistics Barcode 和 IronBarcode 的主要区别是什么?

IronBarcode 使用静态、无状态的 API,无需实例管理,而 Infragistics Barcode 通常需要在使用前创建和配置实例。IronBarcode 还提供原生 PDF 支持、自动格式检测以及跨所有环境的单密钥许可。

IronBarcode 的授权许可比 Infragistics Barcode 更容易获得吗?

IronBarcode 使用单一许可证密钥,同时涵盖开发和生产部署。与将 SDK 密钥与运行时密钥分开的许可系统相比,这简化了 CI/CD 流水线和 Docker 配置。

IronBarcode是否支持Infragistics Barcode支持的所有条形码格式?

IronBarcode 支持超过 30 种条码符号体系,包括 QR 码、Code 128、Code 39、DataMatrix、PDF417、Aztec、EAN-13、UPC-A、GS1 等等。格式自动检测功能意味着无需显式枚举格式。

IronBarcode是否支持原生PDF条码读取?

是的。IronBarcode 可以直接从 PDF 文件中读取条形码,使用 `BarcodeReader.Read("document.pdf")` 方法,无需单独的 PDF 渲染库。每页的读取结果包括页码、条形码格式、数值和置信度评分。

与 Infragistics Barcode 相比,IronBarcode 在批量处理方面有何不同?

IronBarcode 的静态方法是无状态的,并且天然线程安全,因此可以直接使用 Parallel.ForEach,而无需进行线程级实例管理。所有定价层级均无吞吐量上限。

IronBarcode支持哪些.NET版本?

IronBarcode 在单个 NuGet 包中支持 .NET Framework 4.6.2+、.NET Core 3.1 以及 .NET 5、6、7、8 和 9。平台目标包括 Windows x64/x86、Linux x64 和 macOS x64/ARM。

如何在.NET项目中安装IronBarcode?

通过 NuGet 安装 IronBarcode:在程序包管理器控制台中运行“Install-Package IronBarCode”,或在命令行界面中运行“dotnet add package IronBarCode”。无需其他 SDK 安装程序或运行时文件。

与 Infragistics 不同,我可以在购买前评估 IronBarcode 吗?

是的。IronBarcode 的试用模式会返回完整的解码条形码值——只有生成的输出图像才会带有水印。您可以在购买前,用自己的文档测试读取准确率。

Infragistics Barcode 和 IronBarcode 的价格有什么区别?

IronBarcode 的永久单开发者许可证起价为 749 美元,涵盖开发和生产环境。定价详情和批量许可选项请访问 IronBarcode 许可页面。无需单独的运行时许可证。

从 Infragistics Barcode 迁移到 IronBarcode 是否简单?

从 Infragistics Barcode 迁移到 IronBarcode 主要涉及将基于实例的 API 调用替换为 IronBarcode 的静态方法、移除许可相关的样板代码以及更新结果属性名称。大多数迁移工作都是减少代码,而不是增加代码。

IronBarcode 能生成带有 logo 的二维码吗?

是的。`QRCodeWriter.CreateQrCode().AddBrandLogo("logo.png")` 可以将品牌图片原生嵌入二维码中,并支持配置纠错功能。此外,它还支持通过 `ChangeBarCodeColor()` 函数创建彩色二维码。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

钢铁支援团队

我们每周 5 天,每天 24 小时在线。
聊天
电子邮件
打电话给我