跳至頁尾內容
與其他組件的比較

DevExpress Barcode 與 IronBarcode:C# 條碼庫對比

MESCIUSComponentOne C1BarCodevs IronBarcode

MESCIUS ComponentOne的條碼控制(前身為GrapeCity,於2023年更名)在Windows Forms、WPF、WinUI、Blazor和ASP.NET Core MVC應用程式中生成條碼。 它能很好地完成這一工作——API清晰,輸出質量穩定,並能自然地與WinForms設計器整合。 但其功能範圍有限。 它無法讀取條碼。 WinForms和WPF版本只在Windows特定的目標框架上運行。 而且它不是一個單獨的產品——它作為ComponentOne Studio Enterprise的一部分供應,這是一項$1,299/每位開發者/每年訂閱,包括超過100個UI控制。 如果您正在評估.NET項目的條碼選項並在比較列表上找到了ComponentOne,本文將介紹該範圍在實際中的含意。

理解C1BarCode

C1BarCode是一個可視控制。 生成工作流程建立實例,設置屬性,並調用System.Drawing.Image

// ComponentOne C1BarCode
using C1.Win.Barcode;
using C1.BarCode;
using System.Drawing;

// License must be set before first use
C1.C1License.Key = "YOUR-COMPONENTONE-KEY";

var barcode = new C1BarCode();
barcode.CodeType = CodeType.Code128;
barcode.Text = "ITEM-12345";
barcode.BarHeight = 100;
barcode.ModuleSize = 2;
barcode.ShowText = true;
barcode.CaptionPosition = CaptionPosition.Below;

using var image = barcode.GetImage();
image.Save("barcode.png", System.Drawing.Imaging.ImageFormat.Png);
// ComponentOne C1BarCode
using C1.Win.Barcode;
using C1.BarCode;
using System.Drawing;

// License must be set before first use
C1.C1License.Key = "YOUR-COMPONENTONE-KEY";

var barcode = new C1BarCode();
barcode.CodeType = CodeType.Code128;
barcode.Text = "ITEM-12345";
barcode.BarHeight = 100;
barcode.ModuleSize = 2;
barcode.ShowText = true;
barcode.CaptionPosition = CaptionPosition.Below;

using var image = barcode.GetImage();
image.Save("barcode.png", System.Drawing.Imaging.ImageFormat.Png);
Imports C1.Win.Barcode
Imports C1.BarCode
Imports System.Drawing
Imports System.Drawing.Imaging

' License must be set before first use
C1.C1License.Key = "YOUR-COMPONENTONE-KEY"

Dim barcode As New C1BarCode()
barcode.CodeType = CodeType.Code128
barcode.Text = "ITEM-12345"
barcode.BarHeight = 100
barcode.ModuleSize = 2
barcode.ShowText = True
barcode.CaptionPosition = CaptionPosition.Below

Using image As Image = barcode.GetImage()
    image.Save("barcode.png", ImageFormat.Png)
End Using
$vbLabelText   $csharpLabel

屬性設置API對於WinForms開發者來說很熟悉——它直接映射到設計器介面。 CaptionPosition都是在程式碼中以相同方式運行的設計器可見屬性。

C1BarCode支持38種符號涵蓋主流1D和2D格式:Code 39, Code 128, EAN-8, EAN-13, UPC-A, UPC-E, ITF, QR Code, PDF417 和 DataMatrix等。 對於條碼生成,它涵蓋了常見的使用情況。

無讀取API

這不是配置選項可以彌補的差距。 沒有C1BarCodeReader類。 Decode()方法。 ComponentOne的條碼控制按設計來說僅限於生成。

如果您的應用程式需要從上傳的圖像中掃描條碼,驗證列印標籤,處理具有嵌入程式碼的文件,或從網路API中提取QR程式碼資料——C1BarCode無法做到這一點。 您將需要一個單獨的庫來讀取,這會引發為什麼要在一個覆蓋100多個控制的企業套件中支付僅限於條碼生成的組件的費用,而獨立的條碼庫涵蓋了這兩個操作。

缺少讀取API對於設計為列印輸出的WinForms條碼控制來說並不罕見。 當需求擴大時這就成了需要考慮的問題——而條碼需求幾乎總是會擴大。

僅限於Windows

C1BarCode的WinForms和WPF版本需要Windows特定的目標框架配置:


<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>

<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
XML

UseWindowsForms不是可選的。 Graphics——而這些僅存在於Windows上。 移除net8.0-windows會導致構建失敗。 ComponentOne確實提供針對跨平台TFM的Blazor和ASP.NET Core MVC版本的條碼控制,但WinForms和WPF套件受限於Windows。

相比之下,IronBarcode的目標是net8.0(或任何支持的TFM)而沒有平台限制:


<TargetFramework>net8.0</TargetFramework>

<TargetFramework>net8.0</TargetFramework>
XML

在幾種實際情況下這很重要:

  • Linux上的Azure App Service: 新的App Service部署的預設計畫。 net8.0-windows 無法定位到它。
  • Docker容器: Linux容器是標準。 Windows容器更大,成本更高,並在許多雲層中不可用。
  • ASP.NET Core Web API: 僅能部署到Windows的條碼生成端點是團隊最終需要移除的部署限制。
  • Azure Functions: 使用量方案在Linux上運行。 具有net8.0-windows目標的條碼生成函式無法部署到使用量方案。
  • macOS開發: 使用macOS的開發者無法本地運行net8.0-windows項目,即使用於測試生成邏輯。

如果您的應用程式是只能在Windows上運行的WinForms桌面工具,那麼平台限制不是問題。 一旦部署需求包括任何Linux或雲環境,這就成了問題。

套件綑綁

C1BarCode控制作為ComponentOne Studio Enterprise的一部分出售,該套件包括WinForms、WPF、Blazor和ASP.NET的完整ComponentOne控制套件。 ComponentOne Studio Enterprise的定價為每位開發者每年$1,299(訂閱); 單一平台版本(WinForms或WPF)為每位開發者每年$799。

該套件包括超過100個組件:網格、圖表、計劃、輸入控制、報告設計工具、地圖控制、儀表等等。 如果您正在構建一個以資料為主的應用程式並需要這些控制中的很多個,那麼套件定價可能有意義。 如果您需要條碼生成並選擇ComponentOne是因為它出現在搜索中,那麼您主要是為了一個控制購買企業UI套件。

NuGet包是C1.Blazor.BarCode),並通過ComponentOne Studio訂閱來授權。 對於希望獲得條碼功能而不需整個套件的開發者,沒有單獨的條碼專用授權級別。

IronBarcode的定價結構不同:它是一個獨立的條碼庫,以永久授權開始,單位開發者$749(Lite),三位$1,499(Plus),十位$2,999(Professional),無限開發者$5,999(Unlimited)。 沒有網格控制,沒有圖表庫,沒有報告設計器——只有您尋找的條碼功能。

QR程式碼自訂

兩個庫都支持具有自訂選項的QR程式碼生成。 API風格不同相當大。

ComponentOne屬性設置方法:

// ComponentOne — QR code with error correction and color
using C1.Win.Barcode;
using C1.BarCode;
using System.Drawing;

C1.C1License.Key = "YOUR-COMPONENTONE-KEY";

var barcode = new C1BarCode();
barcode.CodeType = CodeType.QRCode;
barcode.Text = "https://example.com/product/4821";
barcode.QRCodeVersion = QRCodeVersion.Version5;
barcode.QRCodeErrorCorrectionLevel = QRCodeErrorCorrectionLevel.High;
barcode.QRCodeModel = QRCodeModel.Model2;
barcode.ForeColor = Color.DarkBlue;
barcode.BackColor = Color.White;
barcode.ModuleSize = 4;

using var image = barcode.GetImage();
image.Save("product-qr.png", System.Drawing.Imaging.ImageFormat.Png);
// ComponentOne — QR code with error correction and color
using C1.Win.Barcode;
using C1.BarCode;
using System.Drawing;

C1.C1License.Key = "YOUR-COMPONENTONE-KEY";

var barcode = new C1BarCode();
barcode.CodeType = CodeType.QRCode;
barcode.Text = "https://example.com/product/4821";
barcode.QRCodeVersion = QRCodeVersion.Version5;
barcode.QRCodeErrorCorrectionLevel = QRCodeErrorCorrectionLevel.High;
barcode.QRCodeModel = QRCodeModel.Model2;
barcode.ForeColor = Color.DarkBlue;
barcode.BackColor = Color.White;
barcode.ModuleSize = 4;

using var image = barcode.GetImage();
image.Save("product-qr.png", System.Drawing.Imaging.ImageFormat.Png);
Imports C1.Win.Barcode
Imports C1.BarCode
Imports System.Drawing
Imports System.Drawing.Imaging

C1.C1License.Key = "YOUR-COMPONENTONE-KEY"

Dim barcode As New C1BarCode()
barcode.CodeType = CodeType.QRCode
barcode.Text = "https://example.com/product/4821"
barcode.QRCodeVersion = QRCodeVersion.Version5
barcode.QRCodeErrorCorrectionLevel = QRCodeErrorCorrectionLevel.High
barcode.QRCodeModel = QRCodeModel.Model2
barcode.ForeColor = Color.DarkBlue
barcode.BackColor = Color.White
barcode.ModuleSize = 4

Using image As Image = barcode.GetImage()
    image.Save("product-qr.png", ImageFormat.Png)
End Using
$vbLabelText   $csharpLabel

IronBarcode流暢鏈:

//IronBarcode— QR code with error correction and color
// NuGet: dotnet add package IronBarcode
using IronBarCode;
using System.Drawing;

QRCodeWriter.CreateQrCode(
        "https://example.com/product/4821",
        300,
        QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .ChangeBarCodeColor(Color.DarkBlue)
    .SaveAsPng("product-qr.png");
//IronBarcode— QR code with error correction and color
// NuGet: dotnet add package IronBarcode
using IronBarCode;
using System.Drawing;

QRCodeWriter.CreateQrCode(
        "https://example.com/product/4821",
        300,
        QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .ChangeBarCodeColor(Color.DarkBlue)
    .SaveAsPng("product-qr.png");
Imports IronBarCode
Imports System.Drawing

QRCodeWriter.CreateQrCode( _
        "https://example.com/product/4821", _
        300, _
        QRCodeWriter.QrErrorCorrectionLevel.Highest) _
    .ChangeBarCodeColor(Color.DarkBlue) _
    .SaveAsPng("product-qr.png")
$vbLabelText   $csharpLabel

ComponentOne的方法需要實例化一個GetImage()。 IronBarcode的.SaveAsPng()。 沒有要管理的實例。

IronBarcode還支持在QR程式碼中嵌入徽標,而C1BarCode則不支持:

// QR code with embedded brand logo
QRCodeWriter.CreateQrCode("https://example.com/track/8821", 500)
    .AddBrandLogo("company-logo.png")
    .ChangeBarCodeColor(Color.DarkBlue)
    .SaveAsPng("branded-qr.png");
// QR code with embedded brand logo
QRCodeWriter.CreateQrCode("https://example.com/track/8821", 500)
    .AddBrandLogo("company-logo.png")
    .ChangeBarCodeColor(Color.DarkBlue)
    .SaveAsPng("branded-qr.png");
' QR code with embedded brand logo
QRCodeWriter.CreateQrCode("https://example.com/track/8821", 500) _
    .AddBrandLogo("company-logo.png") _
    .ChangeBarCodeColor(Color.DarkBlue) _
    .SaveAsPng("branded-qr.png")
$vbLabelText   $csharpLabel

理解IronBarcode

IronBarcode是一個獨立的.NET條碼庫,涵蓋生成和讀取。 它可從NuGet中安裝 (dotnet add package IronBarcode),支持任何.NET TFM而無平台限制,並在Windows、Linux、macOS、Docker、Azure和AWS Lambda上運行。

讀取部分原生支持PDF文件:

// Read barcodes from a PDF — no image extraction needed
using IronBarCode;

var results = BarcodeReader.Read("invoice.pdf");
foreach (var barcode in results)
{
    Console.WriteLine($"Page {barcode.PageNumber}: {barcode.Format} — {barcode.Value}");
}
// Read barcodes from a PDF — no image extraction needed
using IronBarCode;

var results = BarcodeReader.Read("invoice.pdf");
foreach (var barcode in results)
{
    Console.WriteLine($"Page {barcode.PageNumber}: {barcode.Format} — {barcode.Value}");
}
Imports IronBarCode

' Read barcodes from a PDF — no image extraction needed
Dim results = BarcodeReader.Read("invoice.pdf")
For Each barcode In results
    Console.WriteLine($"Page {barcode.PageNumber}: {barcode.Format} — {barcode.Value}")
Next
$vbLabelText   $csharpLabel

對於高吞吐量場景,BarcodeReaderOptions控制速度與準確性的權衡及多條碼檢測:

// Multi-barcode read with performance options
using IronBarCode;

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.Code128 | BarcodeEncoding.QRCode
};

var results = BarcodeReader.Read("warehouse-manifest.jpg", options);
// Multi-barcode read with performance options
using IronBarCode;

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.Code128 | BarcodeEncoding.QRCode
};

var results = BarcodeReader.Read("warehouse-manifest.jpg", options);
Imports IronBarCode

' Multi-barcode read with performance options
Dim options As New BarcodeReaderOptions With {
    .Speed = ReadingSpeed.Balanced,
    .ExpectMultipleBarcodes = True,
    .ExpectBarcodeTypes = BarcodeEncoding.Code128 Or BarcodeEncoding.QRCode
}

Dim results = BarcodeReader.Read("warehouse-manifest.jpg", options)
$vbLabelText   $csharpLabel

生成涵蓋標準格式,具有一致的靜態API:

// Code 128 generation to file
BarcodeWriter.CreateBarcode("SHIP-20240312-7834", BarcodeEncoding.Code128)
    .SaveAsPng("shipping-label.png");

//QR碼生成to byte array (for HTTP response)
byte[] qrBytes = QRCodeWriter.CreateQrCode("https://example.com/order/7734", 400)
    .ToPngBinaryData();
// Code 128 generation to file
BarcodeWriter.CreateBarcode("SHIP-20240312-7834", BarcodeEncoding.Code128)
    .SaveAsPng("shipping-label.png");

//QR碼生成to byte array (for HTTP response)
byte[] qrBytes = QRCodeWriter.CreateQrCode("https://example.com/order/7734", 400)
    .ToPngBinaryData();
Imports System

' Code 128 generation to file
BarcodeWriter.CreateBarcode("SHIP-20240312-7834", BarcodeEncoding.Code128) _
    .SaveAsPng("shipping-label.png")

' QR碼生成to byte array (for HTTP response)
Dim qrBytes As Byte() = QRCodeWriter.CreateQrCode("https://example.com/order/7734", 400) _
    .ToPngBinaryData()
$vbLabelText   $csharpLabel

支持的平台:Windows、Linux、macOS、Docker、Azure(App Service和Functions)、AWS Lambda。 支持的.NET版本:.NET Framework 4.6.2+,.NET Core 3.1+,以及.NET 5/6/7/8。

特性比較

特性 MESCIUSComponentOne C1BarCode IronBarcode
條碼生成
條碼讀取
QR碼生成
QR 標誌嵌入
PDF讀取輸入 不適用(無讀取) 是的(原生)
.NET平台目標(WinForms/WPF版) net8.0-windows 任何TFM(net8.0等)
需要UseWindowsForms(WinForms版)
Linux / Docker部署 僅限Blazor/ASP.NET MVC版
macOS部署 僅限Blazor/ASP.NET MVC版
Azure Functions(Linux) 僅限Blazor/ASP.NET MVC版
ASP.NET Core伺服器端 ASP.NET Core MVC版
獨立NuGet包 套件授權包
獨立定價 不適用 從$749永久(Lite)
套件定價 $1,299/開發者/年Enterprise;$799/開發者/年單一平台 不適用
流暢生成API 否(屬性設置)
BarcodeReader.Read()
BarcodeWriter.CreateBarcode()
QRCodeWriter.CreateQrCode()
支持的.NET版本 .NET 6+(WinForms/WPF的Windows) .NET Framework 4.6.2+, .NET Core 3.1+, .NET 5–8
永久授權選項 否(訂閱)

API對映參考

對於從C1BarCode遷移到IronBarcode的團隊,這些直接等效適用:

ComponentOne C1BarCode IronBarcode
C1.C1License.Key = "..." IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
new C1BarCode() 靜態——無需實例
barcode.CodeType = CodeType.Code128 BarcodeEncoding.Code128(作為參數傳遞)
barcode.Text = "data" BarcodeWriter.CreateBarcode()的第一個參數
barcode.BarHeight = 100 .ResizeTo(width, 100)在條碼編寫器上
barcode.ModuleSize = 2 .ResizeTo()控制以像素為單位的大小
barcode.ForeColor = Color.DarkBlue .ChangeBarCodeColor(Color.DarkBlue)
barcode.BackColor = Color.White .ChangeBackgroundColor(Color.White)
barcode.GetImage() .SaveAsPng() / .ToPngBinaryData()
barcode.QRCodeErrorCorrectionLevel QRCodeWriter.QrErrorCorrectionLevel枚舉
barcode.QRCodeVersion 自動(或版本參數)
無讀取API BarcodeReader.Read(path)
net8.0-windows需要 net8.0(或任何TFM)
UseWindowsForms = true需要 不需要

當團隊轉換

讀取需求出現。 這是最常見的觸發器。 一個團隊用C1BarCode建構條碼標籤生成,然後有要求驗證掃描、處理入站的運輸文件或從上傳圖像解碼QR程式碼。 C1BarCode幫不上忙。選擇是:新增第二個條碼庫來讀取,或者用能處理這兩者的庫替代C1BarCode。

Linux或Docker部署。 發布到Windows桌面的WinForms桌面應用程式不面臨這種限制。 一個ASP.NET Core API生成條碼圖像確實這樣做——特別是當它需要運行在Linux容器中或部署到Linux上的Azure App Service時。 net8.0-windows目標框架立即阻擋了這些部署選項。

微服務或無伺服器架構。 Azure Functions、AWS Lambda和容器化微服務是Linux優先。無法部署到Linux的條碼生成服務不是可行的微服務。

套件訂閱成本與需求範圍。 那些為ComponentOne Studio Enterprise支付費用並且已經使用其網格、圖表和其他控件的團隊已經證明了訂閱的合理性。 主要或完全為條碼生成而訂閱的團隊正在為他們不使用的100多個控件支付費用。 每位開發者的訂閱成本隨團隊規模增加。

永久授權偏好。 ComponentOne Studio僅限於訂閱。 沒有永久授權選項。 對於那些希望擁有他們發布的軟體的團隊——特別是出於合規性或長期維護原因——IronBarcode的永久授權(從$749 Lite開始)結構上有所不同。

結論

C1BarCode在WinForms上下文中乾淨地生成條碼。 這確實是它擅長的事情,對於僅需要在Windows上進行標籤生成的WinForms桌面應用程式來說,這是ComponentOne套件內功能選擇。

範圍僅止於此。 無讀取,僅限Windows部署,無獨立包,訂閱授權。 當項目需求超出Windows上的WinForms生成時——一個讀取需求,一個Linux部署目標,一個網路API,一個Docker容器,一個雲函式——C1BarCode無法應對。 IronBarcode涵蓋生成和讀取,運行於.NET支持的任何平台,並作為獨立包提供,無需訂閱100控件的企業套件。

常見問題

什麼是 GrapeCity Barcode?

GrapeCity Barcode 是一款用於在 C# 應用程式中生成和讀取條碼的 .NET 條碼程式庫。在選擇 .NET 專案的條碼解決方案時,它是開發者考慮的幾個替代方案之一。

GrapeCity Barcode 和 IronBarcode 之間的主要區別是什麼?

IronBarcode 使用不需要實例管理的靜態、無狀態 API,而 GrapeCity Barcode 通常要求在使用前建立和配置實例。IronBarcode 還提供原生 PDF 支援、自動格式檢測,以及跨所有環境的單鍵授權。

比起 GrapeCity Barcode,IronBarcode 更容易取得授權嗎?

IronBarcode使用一個覆蓋開發和生產部署的單一授權金鑰。相比於將SDK金鑰與運行時金鑰分開的授權系統,這簡化了CI/CD管道和Docker配置。

IronBarcode 是否支援所有 GrapeCity Barcode 支援的條碼格式?

IronBarcode支持超過30種條碼符號,包括QR Code、Code 128、Code 39、DataMatrix、PDF417、Aztec、EAN-13、UPC-A、GS1等。格式自動檢測意味著不需要顯式的格式枚舉。

IronBarcode支持原生PDF條碼讀取嗎?

是的。IronBarcode可以直接從PDF文件中讀取條碼,使用BarcodeReader.Read("document.pdf"),無需單獨的PDF渲染程式庫。每頁結果包括頁碼、條碼格式、值和置信分數。

IronBarcode 如何處理與 GrapeCity Barcode 的批處理?

IronBarcode的靜態方法無狀態且天然執行緒安全,可以直接使用Parallel.ForEach而無需每個執行緒的實例管理。任何價格級別下都沒有吞吐量上限。

IronBarcode支持哪些.NET版本?

IronBarcode支持.NET Framework 4.6.2+、.NET Core 3.1,以及.NET 5、6、7、8和9,單一NuGet包。平台目標包括Windows x64/x86、Linux x64和macOS x64/ARM。

如何在.NET專案中安裝IronBarcode?

通過NuGet安裝IronBarcode:在Package Manager Console中運行 'Install-Package IronBarCode',或在CLI中運行 'dotnet add package IronBarCode'。不需要額外的SDK安裝程式或運行時文件。

與 GrapeCity 不同,我可以在購買前評估 IronBarcode 嗎?

可以。IronBarcode的試用模式返回完整解碼的條碼值——只有生成的輸出圖像上有水印。您可以在自己的文件上評估讀取準確性,然後再決定購買。

GrapeCity Barcode 和 IronBarcode 的價格差異是什麼?

IronBarcode起價為$749,為單開發者所適用的永久授權,覆蓋開發和生產。價格詳情和批量選項可在IronBarcode授權頁面獲得。無需單獨的運行時授權。

從 GrapeCity Barcode 遷移到 IronBarcode 是否簡單直接?

從 GrapeCity Barcode 遷移到 IronBarcode 主要涉及用 IronBarcode 的靜態方法替換基於實例的 API 呼叫,去除授權樣板,以及更新結果屬性名稱。大多數遷移涉及減少程式碼而不是增加程式碼。

IronBarcode可以生成帶有Logo的QR碼嗎?

可以。QRCodeWriter.CreateQrCode().AddBrandLogo("logo.png") 可以原生嵌入品牌圖像進QR碼,並可配置錯誤更正。也支持通過ChangeBarCodeColor() 生成彩色QR碼。

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

Iron 支援團隊

我們線上24小時,每週5天。
聊天
電子郵件
給我打電話