
Barkoder SDK 與 IronBarcode:C# 條碼庫對比
Dynamsoft Barcode Reader在其設計的用途上確實非常出色:以每秒30幀的速度從實時攝像頭鏡頭讀取條碼。 演算法速度很快,支持多種符號,且在iOS和Android上的行動SDK是此領域中較好的選擇之一。 如果您的產品是倉庫掃描應用程式,工人將手機對準托盤標籤並希望在100毫秒以內識別,Dynamsoft是一個可信的選擇。
如果您的條碼在無法存取互聯網的伺服器上的PDF文件中,則該程式庫與使用案例不匹配 - 首次部署時的許可證激活將提醒您這一點。 LicenseManager.InitLicense會在首次激活時與Dynamsoft的許可證伺服器進行在線握手,並定期重新驗證。 在氣隙資料中心,孤立的VPC或任何出站互聯網存取受限的環境中,首次激活需要替代方法。離線路徑 - 從Dynamsoft獲取許可證內容 blob並通過InitLicenseFromLicenseContent重播 - 起作用,但會增加大多數文件處理工作流程未預算的操作負擔。
這次比較涉及的是使用案例是否適合,而不是程式庫的質量。 Dynamsoft構建了一個以攝像機爲中心的庫,並且建得很好。 問題在於相機至上的假設是否能轉化為伺服器端的文件處理工作流程。
了解Dynamsoft Barcode Reader
Dynamsoft的架構反映了它來自攝像機的起源。 啟動序列需要在線許可證激活,設置模型包括適合實時幀處理的超時值,API公開了針對手持攝像頭可變聚焦和運動模糊條件調整的設置:
// Dynamsoft: license activation required at startup
using Dynamsoft.CVR;
using Dynamsoft.DBR;
using Dynamsoft.License;
using Dynamsoft.Core;
// LicenseManager.InitLicense performs an online activation on first run
int errorCode = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
throw new InvalidOperationException($"License activation failed: {errorMsg}");
using var router = new CaptureVisionRouter();
// Settings tuned for camera frame processing
SimplifiedCaptureVisionSettings settings = router.GetSimplifiedSettings(
PresetTemplate.PT_READ_BARCODES);
settings.BarcodeSettings.ExpectedBarcodesCount = 1; // single barcode per frame
settings.Timeout = 100; // 100ms suits a 30fps pipeline
router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings);Imports Dynamsoft.CVR
Imports Dynamsoft.DBR
Imports Dynamsoft.License
Imports Dynamsoft.Core
' Dynamsoft: license activation required at startup
' LicenseManager.InitLicense performs an online activation on first run
Dim errorCode As Integer = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", errorMsg:=Nothing)
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
Throw New InvalidOperationException($"License activation failed: {errorMsg}")
End If
Using router As New CaptureVisionRouter()
' Settings tuned for camera frame processing
Dim settings As SimplifiedCaptureVisionSettings = router.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES)
settings.BarcodeSettings.ExpectedBarcodesCount = 1 ' single barcode per frame
settings.Timeout = 100 ' 100ms suits a 30fps pipeline
router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings)
End UsingImports Dynamsoft.CVR
Imports Dynamsoft.DBR
Imports Dynamsoft.License
Imports Dynamsoft.Core
' Dynamsoft: license activation required at startup
' LicenseManager.InitLicense performs an online activation on first run
Dim errorCode As Integer = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", errorMsg:=Nothing)
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
Throw New InvalidOperationException($"License activation failed: {errorMsg}")
End If
Using router As New CaptureVisionRouter()
' Settings tuned for camera frame processing
Dim settings As SimplifiedCaptureVisionSettings = router.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES)
settings.BarcodeSettings.ExpectedBarcodesCount = 1 ' single barcode per frame
settings.Timeout = 100 ' 100ms suits a 30fps pipeline
router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings)
End Using這是個為其目的設計良好的API。 Timeout = 100設置在從攝像機處理每秒30幀時有意義,無法在單一幀上花費500毫秒。 對於伺服器處理上傳的PDF,100毫秒的超時毫無意義,可能會導致對更密集條碼的讀取失敗。
路由器和會話設計 - router.Dispose() - 遵循攝像機會話語義:您開啟路由器,處理幀,處置。 對於文件處理,此生命周期新增了樣板,卻沒有好處。
PDF問題
Dynamsoft條碼讀取器能夠在Windows版本中直接接受部分PDF輸入,但對於跨平台部署,很多團隊仍在將每個PDF頁面預先渲染為圖像,然後傳遞給CaptureVisionRouter.Capture。 這通常會引入一個單獨的PDF渲染庫 - 常用的是PdfiumViewer - 增加了NuGet依賴性、一個本地二進制依賴(在Windows上是pdfium.dll或在Linux上是libpdfium),以及每個PDF操作圍繞的一個渲染迴圈:
// Dynamsoft PDF processing — typical cross-platform pattern with PdfiumViewer
// dotnet add package PdfiumViewer
using PdfiumViewer;
using System.Drawing.Imaging;
using Dynamsoft.CVR;
using Dynamsoft.DBR;
public List<string> ReadBarcodesFromPdf(string pdfPath)
{
var results = new List<string>();
using (var pdfDoc = PdfDocument.Load(pdfPath))
using (var router = new CaptureVisionRouter())
{
for (int page = 0; page < pdfDoc.PageCount; page++)
{
// Render each page at 300 DPI
using var image = pdfDoc.Render(page, 300, 300, true);
using var ms = new MemoryStream();
image.Save(ms, ImageFormat.Png);
byte[] imageBytes = ms.ToArray();
// Now pass rendered image bytes to the Capture Vision Router
CapturedResult result = router.Capture(imageBytes,
PresetTemplate.PT_READ_BARCODES);
foreach (var item in result.GetDecodedBarcodesResult().GetItems())
results.Add(item.GetText());
}
}
return results;
}// Dynamsoft PDF processing — typical cross-platform pattern with PdfiumViewer
// dotnet add package PdfiumViewer
using PdfiumViewer;
using System.Drawing.Imaging;
using Dynamsoft.CVR;
using Dynamsoft.DBR;
public List<string> ReadBarcodesFromPdf(string pdfPath)
{
var results = new List<string>();
using (var pdfDoc = PdfDocument.Load(pdfPath))
using (var router = new CaptureVisionRouter())
{
for (int page = 0; page < pdfDoc.PageCount; page++)
{
// Render each page at 300 DPI
using var image = pdfDoc.Render(page, 300, 300, true);
using var ms = new MemoryStream();
image.Save(ms, ImageFormat.Png);
byte[] imageBytes = ms.ToArray();
// Now pass rendered image bytes to the Capture Vision Router
CapturedResult result = router.Capture(imageBytes,
PresetTemplate.PT_READ_BARCODES);
foreach (var item in result.GetDecodedBarcodesResult().GetItems())
results.Add(item.GetText());
}
}
return results;
}Imports PdfiumViewer
Imports System.Drawing.Imaging
Imports Dynamsoft.CVR
Imports Dynamsoft.DBR
Imports System.IO
Public Function ReadBarcodesFromPdf(pdfPath As String) As List(Of String)
Dim results As New List(Of String)()
Using pdfDoc = PdfDocument.Load(pdfPath)
Using router = New CaptureVisionRouter()
For page As Integer = 0 To pdfDoc.PageCount - 1
' Render each page at 300 DPI
Using image = pdfDoc.Render(page, 300, 300, True)
Using ms As New MemoryStream()
image.Save(ms, ImageFormat.Png)
Dim imageBytes As Byte() = ms.ToArray()
' Now pass rendered image bytes to the Capture Vision Router
Dim result As CapturedResult = router.Capture(imageBytes, PresetTemplate.PT_READ_BARCODES)
For Each item In result.GetDecodedBarcodesResult().GetItems()
results.Add(item.GetText())
Next
End Using
End Using
Next
End Using
End Using
Return results
End FunctionImports PdfiumViewer
Imports System.Drawing.Imaging
Imports Dynamsoft.CVR
Imports Dynamsoft.DBR
Imports System.IO
Public Function ReadBarcodesFromPdf(pdfPath As String) As List(Of String)
Dim results As New List(Of String)()
Using pdfDoc = PdfDocument.Load(pdfPath)
Using router = New CaptureVisionRouter()
For page As Integer = 0 To pdfDoc.PageCount - 1
' Render each page at 300 DPI
Using image = pdfDoc.Render(page, 300, 300, True)
Using ms As New MemoryStream()
image.Save(ms, ImageFormat.Png)
Dim imageBytes As Byte() = ms.ToArray()
' Now pass rendered image bytes to the Capture Vision Router
Dim result As CapturedResult = router.Capture(imageBytes, PresetTemplate.PT_READ_BARCODES)
For Each item In result.GetDecodedBarcodesResult().GetItems()
results.Add(item.GetText())
Next
End Using
End Using
Next
End Using
End Using
Return results
End Function這是三個依賴項(Dynamsoft,PdfiumViewer,以及平台特定的本地二進制),每頁渲染迴圈,並且隨著頁面數量增加而增加的記憶體負擔。
IronBarcode直接從PDF文件讀取:
// IronBarcode: PDF is native — no extra library, no render loop
// NuGet: dotnet add package BarCode
var results = BarcodeReader.Read("invoice.pdf");
foreach (var result in results)
{
Console.WriteLine($"{result.Format}: {result.Value}");
}// IronBarcode: PDF is native — no extra library, no render loop
// NuGet: dotnet add package BarCode
var results = BarcodeReader.Read("invoice.pdf");
foreach (var result in results)
{
Console.WriteLine($"{result.Format}: {result.Value}");
}Imports IronBarCode
' IronBarcode: PDF is native — no extra library, no render loop
' NuGet: dotnet add package BarCode
Dim results = BarcodeReader.Read("invoice.pdf")
For Each result In results
Console.WriteLine($"{result.Format}: {result.Value}")
NextImports IronBarCode
' IronBarcode: PDF is native — no extra library, no render loop
' NuGet: dotnet add package BarCode
Dim results = BarcodeReader.Read("invoice.pdf")
For Each result In results
Console.WriteLine($"{result.Format}: {result.Value}")
Next一次調用。 無需PDF渲染器。 沒有每頁迴圈。沒有PDF支持的特定平台本地二進位。
許可證複雜性
當伺服器能夠存取互聯網時,線上許可證激活很簡單。 當伺服器不能存取或者網路策略要求顯示允許外發主機時,驗證失敗的範圍擴大:
// Dynamsoft: error code pattern required
int errorCode = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
{
// Possible causes: network timeout, license server unreachable,
// invalid key, expired key, activation quota exceeded, etc.
throw new InvalidOperationException($"Dynamsoft license failed [{errorCode}]: {errorMsg}");
}// Dynamsoft: error code pattern required
int errorCode = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
{
// Possible causes: network timeout, license server unreachable,
// invalid key, expired key, activation quota exceeded, etc.
throw new InvalidOperationException($"Dynamsoft license failed [{errorCode}]: {errorMsg}");
}Imports System
' Dynamsoft: error code pattern required
Dim errorCode As Integer = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", errorMsg)
Dim errorMsg As String
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
' Possible causes: network timeout, license server unreachable,
' invalid key, expired key, activation quota exceeded, etc.
Throw New InvalidOperationException($"Dynamsoft license failed [{errorCode}]: {errorMsg}")
End IfImports System
' Dynamsoft: error code pattern required
Dim errorCode As Integer = LicenseManager.InitLicense("YOUR-DYNAMSOFT-LICENSE-KEY", errorMsg)
Dim errorMsg As String
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
' Possible causes: network timeout, license server unreachable,
' invalid key, expired key, activation quota exceeded, etc.
Throw New InvalidOperationException($"Dynamsoft license failed [{errorCode}]: {errorMsg}")
End If使用Dynamsoft的離線許可證是個單獨的工作流程。 在連網的機器上進行初步的在線激活以獲取一個許可證包並持久化,然後再通過InitLicenseFromLicenseContent重播該包來激活離線機器:
// Dynamsoft offline license — replay a pre-fetched license bundle
int errorCode = LicenseManager.InitLicenseFromLicenseContent(
licenseContent, out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
throw new InvalidOperationException($"Offline activation failed: {errorMsg}");// Dynamsoft offline license — replay a pre-fetched license bundle
int errorCode = LicenseManager.InitLicenseFromLicenseContent(
licenseContent, out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
throw new InvalidOperationException($"Offline activation failed: {errorMsg}");Imports System
' Dynamsoft offline license — replay a pre-fetched license bundle
Dim errorCode As Integer = LicenseManager.InitLicenseFromLicenseContent(licenseContent, errorMsg)
Dim errorMsg As String = Nothing
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
Throw New InvalidOperationException($"Offline activation failed: {errorMsg}")
End IfImports System
' Dynamsoft offline license — replay a pre-fetched license bundle
Dim errorCode As Integer = LicenseManager.InitLicenseFromLicenseContent(licenseContent, errorMsg)
Dim errorMsg As String = Nothing
If errorCode <> CType(EnumErrorCode.EC_OK, Integer) Then
Throw New InvalidOperationException($"Offline activation failed: {errorMsg}")
End If以這種方式獲得的許可證包有個過期窗口(通常幾天到一年)需要在失效前刷新,這意味著一台連網的機器必須定期參與工作流程。
IronBarcode許可證激活是單一指派並在本機評估:
// IronBarCode: local validation, no network required
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";// IronBarCode: local validation, no network required
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";' IronBarCode: local validation, no network required
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"' IronBarCode: local validation, no network required
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"無需檢查錯誤程式碼。 無需網路依賴。 無需許可證包刷新周期。 同一行在開發機、CI/CD管道、Docker容器和氣隙伺服器上均可運行。
相機與文件使用情況
Dynamsoft和IronBarcode是針對不同的主要場景進行優化的。 下表描述了這一點,而非聲明一個庫的普遍優越性:
| 場景 | Dynamsoft Barcode Reader | IronBarcode |
|---|---|---|
| 實時相機鏡頭(30fps) | 為實時優化 | 這不是主要使用案例 |
| 移動SDK(iOS/Android) | 提供完整SDK | 僅限 .NET |
| 伺服器端文件處理 | 通過CaptureVisionRouter支持 | 主要使用案例 |
| ** PDF 條碼讀取 ** | 直接在Windows上; render loop common cross-platform | 原生支持 |
| 氣隙部署 | 需要離線許可證包工作流程 | 開箱即用 |
| Docker / 短暫容器 | 每個環境的許可證包刷新 | 單個環境變數 |
| 離線許可證 | 來自之前在線激活的許可證內容 blob | 標準許可證金鑰 |
| ASP.NET Core API | 支持(額外許可證樣板) | 支持 |
| Azure功能 | 首次激活的外發網路 | 無網路需求 |
| 條碼生成 | 僅僅在條碼讀取器包中進行讀取 | 是的 - 生成與讀取 |
| QR 程式碼生成 | 不在條碼讀取器包中 | 是的 - QRCodeWriter |
理解IronBarcode
IronBarcode是用於生成和讀取條碼的 .NET 程式庫。 API是靜態的 - 無實例,無處置調用,無會話生命周期。 許可證激活是在本地進行的。 內建PDF支持:
// NuGet: dotnet add package BarCode
using IronBarCode;
// License — local validation, no network call
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Read from an image file
var results = BarcodeReader.Read("label.png");
foreach (var result in results)
Console.WriteLine($"{result.Format}: {result.Value}");
// Read from a PDF — native, no extra library
var pdfResults = BarcodeReader.Read("manifest.pdf");
// Read with options for high-accuracy or high-throughput scenarios
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = true,
MaxParallelThreads = 4
};
var multiResults = BarcodeReader.Read("multi-barcode-sheet.png", options);// NuGet: dotnet add package BarCode
using IronBarCode;
// License — local validation, no network call
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Read from an image file
var results = BarcodeReader.Read("label.png");
foreach (var result in results)
Console.WriteLine($"{result.Format}: {result.Value}");
// Read from a PDF — native, no extra library
var pdfResults = BarcodeReader.Read("manifest.pdf");
// Read with options for high-accuracy or high-throughput scenarios
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = true,
MaxParallelThreads = 4
};
var multiResults = BarcodeReader.Read("multi-barcode-sheet.png", options);Imports IronBarCode
' License — local validation, no network call
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
' Read from an image file
Dim results = BarcodeReader.Read("label.png")
For Each result In results
Console.WriteLine($"{result.Format}: {result.Value}")
Next
' Read from a PDF — native, no extra library
Dim pdfResults = BarcodeReader.Read("manifest.pdf")
' Read with options for high-accuracy or high-throughput scenarios
Dim options As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = True,
.MaxParallelThreads = 4
}
Dim multiResults = BarcodeReader.Read("multi-barcode-sheet.png", options)Imports IronBarCode
' License — local validation, no network call
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
' Read from an image file
Dim results = BarcodeReader.Read("label.png")
For Each result In results
Console.WriteLine($"{result.Format}: {result.Value}")
Next
' Read from a PDF — native, no extra library
Dim pdfResults = BarcodeReader.Read("manifest.pdf")
' Read with options for high-accuracy or high-throughput scenarios
Dim options As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = True,
.MaxParallelThreads = 4
}
Dim multiResults = BarcodeReader.Read("multi-barcode-sheet.png", options)生成也同樣簡單:
// Generate Code 128
BarcodeWriter.CreateBarcode("SHIP-7734-X", BarcodeEncoding.Code128)
.ResizeTo(400, 100)
.SaveAsPng("shipping-label.png");
// Generate QR with error correction and embedded logo
QRCodeWriter.CreateQrCode("https://track.example.com/7734", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest)
.AddBrandLogo("company-logo.png")
.SaveAsPng("tracking-qr.png");
// Get bytes for HTTP response
byte[] bytes = BarcodeWriter.CreateBarcode("ITEM-001", BarcodeEncoding.Code128)
.ResizeTo(400, 100)
.ToPngBinaryData();// Generate Code 128
BarcodeWriter.CreateBarcode("SHIP-7734-X", BarcodeEncoding.Code128)
.ResizeTo(400, 100)
.SaveAsPng("shipping-label.png");
// Generate QR with error correction and embedded logo
QRCodeWriter.CreateQrCode("https://track.example.com/7734", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest)
.AddBrandLogo("company-logo.png")
.SaveAsPng("tracking-qr.png");
// Get bytes for HTTP response
byte[] bytes = BarcodeWriter.CreateBarcode("ITEM-001", BarcodeEncoding.Code128)
.ResizeTo(400, 100)
.ToPngBinaryData();Imports System
' Generate Code 128
BarcodeWriter.CreateBarcode("SHIP-7734-X", BarcodeEncoding.Code128) _
.ResizeTo(400, 100) _
.SaveAsPng("shipping-label.png")
' Generate QR with error correction and embedded logo
QRCodeWriter.CreateQrCode("https://track.example.com/7734", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest) _
.AddBrandLogo("company-logo.png") _
.SaveAsPng("tracking-qr.png")
' Get bytes for HTTP response
Dim bytes As Byte() = BarcodeWriter.CreateBarcode("ITEM-001", BarcodeEncoding.Code128) _
.ResizeTo(400, 100) _
.ToPngBinaryData()Imports System
' Generate Code 128
BarcodeWriter.CreateBarcode("SHIP-7734-X", BarcodeEncoding.Code128) _
.ResizeTo(400, 100) _
.SaveAsPng("shipping-label.png")
' Generate QR with error correction and embedded logo
QRCodeWriter.CreateQrCode("https://track.example.com/7734", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest) _
.AddBrandLogo("company-logo.png") _
.SaveAsPng("tracking-qr.png")
' Get bytes for HTTP response
Dim bytes As Byte() = BarcodeWriter.CreateBarcode("ITEM-001", BarcodeEncoding.Code128) _
.ResizeTo(400, 100) _
.ToPngBinaryData()特性比較
| 特性 | Dynamsoft Barcode Reader | IronBarcode |
|---|---|---|
| 條碼讀取 | 是的 - 相機優化 | 是的 - 文件和文件優化 |
| 條碼生成 | 否 | 是 |
| QR 程式碼生成 | 否 | 是的 - QRCodeWriter |
| 原生PDF支持 | 直接在Windows上; render loop common cross-platform | 是 - BarcodeReader.Read(pdf) |
| 許可證驗證 | 在線激活 + 定期重新檢查 | 本地 |
| 氣隙 / 離線 | 許可證內容 blob 工作流程 | 標準金鑰,離線工作 |
| Docker / 容器 | 每個環境的許可證包工作流程 | 單個環境變數 |
| Azure功能 | 首次激活的外發網路 | 無網路需求 |
| AWS Lambda | 首次激活的外發網路 | 無網路需求 |
| 移動SDK | iOS和Android可用 | 僅限 .NET |
| 實時相機(30fps) | 主要設計目標 | 未為此設計 |
| Code 128 | 是 | 是 |
| QR Code | 是的(讀取) | 是的(讀取和生成) |
| Data Matrix | 是 | 是 |
| PDF417 | 是 | 是 |
| Aztec | 是 | 是 |
| EAN / UPC | 是 | 是 |
| 實例管理 | new CaptureVisionRouter() + Dispose() | 靜態 - 無實例 |
| 多條碼讀取 | BarcodeSettings的ExpectedBarcodesCount | ExpectMultipleBarcodes = true |
| 讀取速度控制 | 超時 + 模板調校 | ReadingSpeed枚舉 |
| 並行讀取 | 手動執行緒 | MaxParallelThreads |
| 定價模型 | 年度訂閱 / 協商永久 | 永久從 $999 開始 |
| .NET支持 | .NET 6.0+ and .NET Framework 3.5+ | .NET 4.6.2 到 .NET 9 |
| 平台 | Windows(x86/x64),Linux(x64) | Windows、Linux、macOS、Docker、Azure、AWS Lambda |
API對映參考
對於有Dynamsoft程式碼的團隊來說,需要了解概念如何轉換:
| Dynamsoft Barcode Reader | IronBarcode |
|---|---|
LicenseManager.InitLicense(key, out errorMsg) | IronBarCode.License.LicenseKey = "key" |
errorCode != (int)EnumErrorCode.EC_OK檢查 | 不需要 |
LicenseManager.InitLicenseFromLicenseContent(content, out msg) | 不需要 |
new CaptureVisionRouter() | 靜態 - 無實例 |
router.Dispose() | 不需要 |
router.Capture(imagePath, PresetTemplate.PT_READ_BARCODES) | BarcodeReader.Read(imagePath) |
router.Capture(imageBytes, PresetTemplate.PT_READ_BARCODES) | BarcodeReader.Read(imageBytes) |
BarcodeResultItem.GetText() | result.Value |
BarcodeResultItem.GetFormatString() | result.Format |
通過SimplifiedCaptureVisionSettings | new BarcodeReaderOptions { ... } |
settings.Timeout = 100 | Speed = ReadingSpeed.Balanced |
settings.BarcodeSettings.ExpectedBarcodesCount = 1 | ExpectMultipleBarcodes = false(預設) |
router.UpdateSettings(template, settings) | 作為參數傳遞給Read() |
| 外部PDF庫 + 頁面渲染迴圈 | BarcodeReader.Read("doc.pdf") |
當團隊轉換
伺服器端文件處理,而非攝像頭掃描。 最常見的遷移場景是一個由於名聲選擇了Dynamsoft的新團隊,把它整合進來,然後發現攝像頭為中心的API和PDF渲染步驟使得文件處理工作流程顯得笨重。 從上傳的PDF中讀取條碼為Web應用程式的核心使用案例,這在Dynamsoft中需要額外的準備,但在IronBarcode中卻是單一調用。
氣隙或限制網路環境。 金融機構、醫療系統和政府部署通常禁止從應用伺服器建立外發網路連接。 Dynamsoft的在線激活在這些環境中無法運行,除非使用離線許可證包工作流程,這新增了操作步驟。 這些環境中的團隊通常選擇遷移到IronBarcode,因為許可證檢查不包含網路元件。
Docker 和 Kubernetes的短暫容器。 容器化部署中,實例頻繁擴展和縮減,使得經常性的許可證包刷新難以管理。 IronBarcode的許可證金鑰作為標準環境變數工作,無需單個實例註冊。
不僅需要讀取還需要生成。 Dynamsoft Barcode Reader包僅限於讀取。 需要生成條碼標籤,印刷QR碼或建立包含嵌入條碼的發運清單的應用需要第二個程式庫。 該情況下的團隊往往選擇合併至IronBarcode以避免管理兩個單獨的條碼依賴項。
簡化的操作佈局。 從必須可達的外部依賴項名單中刪除Dynamsoft許可證伺服器,刪除PDF渲染庫,並用靜態調用取代路由器生命周期管理,可減少生產中可能出錯的事項數量。
結論
Dynamsoft Barcode Reader是一個高質量的庫,非常適合其預期的使用案例:基於實時相機的條碼掃描,尤其是在移動應用中。 演算法對於手持掃描的條件進行了良好的校正 - 可變照明、運動模糊、部分遮擋。 如果這是您的使用案例,Dynamsoft競爭力很強。
對於伺服器端文件處理 - 從PDF中讀取條碼、生成條碼標籤、在氣隙環境中運行或在短暫的Docker容器中部署 - 該程式庫的架構要求每一步都進行更多設置。線上許可證激活、跨平台PDF渲染模式、相機優化超時設置和離線許可證包工作流程都是為移動攝像頭使用而建的結果。 這些不是錯誤; 這是在不同背景下的故意設計選擇。
IronBarcode是為文件和伺服器端情境而建的。 本地許可證驗證、原生PDF讀取、靜態API和生成支持都是主要功能,而不是變通方案。 關鍵在於您的條碼實際所在的環境。
Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。
相關文章


