跳過到頁腳內容
與其他組件的比較

IronBarcode和OnBarcode之間的比較

1. 引言

什麼是條碼? 條碼是一種方形或矩形影像,可由掃描器讀取,它由一系列平行的黑線和寬度不一的白線組成。 條碼用於產品上,以便於識別。 它們被用於零售商店的購買流程中,在倉庫中用於追蹤庫存,以及在發票上用於幫助會計核算等等。

您能否使用.NET平台讀取和產生條碼? 是的,您可以使用.NET平台產生和讀取條碼。 在本文中,我們將討論開發人員如何使用.NET平台支援的程式語言建立條碼並讀取它們。 我們將討論並比較開發人員用於處理條碼的兩套軟體。 這些工具如下:

  • 條碼
  • IronBarcode

2. OnBarcode

OnBarcode 是市場領先的條碼產生器、讀取器控制和元件供應商,適用於所有主要企業開發平台,包括ASP.NET、Windows Forms、WPF、Java、Android 和 iOS(iPhone 專案、Mac)。 OnBarcode 提供完整的條碼解決方案,結合其主要報告條碼工具、Microsoft Office(Excel 和 Word)條碼插件和條碼字體,可用於建立業務應用程式。

OnBarcode 軟體提供各種與條碼相關的功能,例如產生條碼影像、在 SQL Server 中列印條碼映像、讀取條碼,完全使用 Visual Studio C# 編寫,相容於最新的條碼符號體系,以及在.NET Crystal Reports 中列印和繪製條碼影像。 它還支援多種標準代碼來表示文字字串。

對於 OnBarcode,只有其包含的後端(又稱 ZINT 共享庫)在所有.NET平台上提供二維碼生成服務。 OnBarcode 也支援以下其他平台:

  • C#
  • ASP.NET
  • .NET
  • Java
  • 安卓 macOS

2.1. OnBarcode 功能

條碼類型生成

OnBarcode 工具的條碼編碼庫提供了兩種不同類型的條碼產生器。

  • 一維/線性條碼:對於這類條碼,OnBarcode 提供不同類型的一維條碼,例如 Codabar、Code 11、Code 2 of 5、Code 39、Code 93、Code 128、EAN 8、EAN 13 以及更多不同類型的條碼。
  • 二維/矩陣條碼:OnBarcode 也提供不同類型的二維或矩陣條碼。這些條碼包括:資料矩陣碼、PDF 417 碼、QR 碼、Micro PDF-417 碼和 Micro QR 碼。

OnBarcode 比任何其他開源條碼庫都好,因為它支援旋轉條碼(它可以創建 0、90、180 和 270 度的條碼)。

.NET技術條碼產生器

本程式使用 Visual Studio C# .NET 2005 編寫。 使用 VB .NET、C#、託管 C++ 和 Borland Delphi for .NET可以輕鬆繪製和列印條碼。條碼列印在記憶體中,然後編碼成圖像檔案。

安裝與部署

它支援.NET 2.0、3.0、3.5 或更高版本的.NET平台。 使用 Simple Xcopy Deployment 可以輕鬆部署條碼。 OnBarcode 也提供免版稅的再分發服務。

條碼圖像生成、編碼和列印

這樣,您就可以在影像檔案中繪製條碼對象,並將其編碼為 GIF、BMP、PNG、JPEG 和 TIFF 影像格式。 它還支援不同的瀏覽器,例如 Internet Explorer、Firefox、Chrome、Safari 和 Opera。 使用熱感式印表機,您可以列印高品質的條碼圖片。

3. IronBarcode

IronBarcode是一個.NET函式庫,允許程式設計師讀取和建立條碼。 IronBarcode是一個領先的.NET條碼庫,支援各種一維和二維條碼,以及客製化的(彩色和品牌化的)二維碼。 IronBarcode讓開發人員可以使用所有與 .NET 相關的語言。

使用IronBarcode建立、格式化和匯出條碼圖片非常簡單,通常只需一行程式碼即可完成。

IronBarcode支援.NET Core 2x 和 3x、 .NET Standard、 .NET Framework 4x 以及完整的 Azure。 它產生 PostScript 輸出,並接受各種標準程式碼來轉換文字字串。

3.1. IronBarcode 的功能

條碼格式

  • 二維矩陣條碼格式包含 QR 碼、Aztec 碼和 Data Matrix 碼.NET讀取和創建。
  • 支援文字、數字和二進位資料的現代線性條碼格式包括 C# 的 PDF417、Code 39 和 Code 128 條碼產生器。
  • 僅支援數字代碼的舊式線性條碼格式包括 UPC-A、UPC-E、EAN-8、EAN-13、Codabar、ITF、MSI 和 Plessey。

條碼讀取功能

  • IronBarCode.BarcodeReader 靜態類別 API 將條碼和二維碼的讀取簡化為一行程式碼。
  • 支援從檔案讀取 Jpeg、Jpeg2000、Png、BMP、Tiff 和 Gif 影像格式的條碼。
  • 更高的精度和性能。 為了提高準確性和效能,請告訴閱讀器掃描一種、幾種或所有條碼格式。
  • 影像校正,以便讀取條碼。 若要解讀有缺陷的掃描件和影像,請對文件進行降噪和對比度調整。

條碼寫入功能

BarcodeWriter 和 QRCodeWriter 靜態類別用於建立容錯條碼和二維碼寫入 API。 條碼資料通常可以用兩行程式碼提取出來。

IronBarcode允許使用者匯出為圖片、匯出為 HTML 頁面、匯出為 PDF 或新增至現有 PDF 中。

QRCodeWriter 類別為渲染具有進階功能的二維碼提供了進階支援。

4. 在 Visual Studio 中建立新項目

開啟 Visual Studio 軟體,然後前往"檔案"選單。 選擇"新建專案",然後選擇控制台應用程式。

在對應的文字方塊中輸入項目名稱並選擇路徑。 然後,點擊"創建"按鈕。 選擇所需的.NET Framework,如下圖所示:

Onbarcode Generator Alternatives 1 related to 4. 在 Visual Studio 中建立新項目

Visual Studio 專案現在將為所選應用程式產生結構,如果您選擇了控制台、Windows 和 Web 應用程序,它將開啟 program.cs 文件,您可以在其中輸入程式碼並產生/運行應用程式。

Onbarcode Generator Alternatives 2 related to 4. 在 Visual Studio 中建立新項目

現在我們可以添加庫並測試程式了。

5. 安裝IronBarcode庫

IronBarcode庫可以透過四種不同的方式下載和安裝。 這些都是:

  • 使用 Visual Studio NuGet套件管理器
  • 使用 Visual Studio 命令列。
  • 直接從NuGet網頁下載。
  • 直接從IronBarcode網頁下載。

5.1 使用 Visual Studio NuGet套件管理器

Visual Studio 軟體提供了NuGet套件管理器選項,可以直接將套件安裝到解決方案中。 下面這張截圖展示如何開啟NuGet套件管理器。

Onbarcode Generator Alternatives 3 related to 5.1 使用 Visual Studio NuGet套件管理器

它提供了一個搜尋框,用於顯示NuGet網站上可用的包庫清單。在套件管理器中,我們需要搜尋關鍵字"IronBarcode",如下面的螢幕截圖所示:

Onbarcode Generator Alternatives 4 related to 5.1 使用 Visual Studio NuGet套件管理器

從上圖可以看出,搜尋清單中包含了相關的軟體包。我們需要選擇IronBarcode選項,並將該軟體包安裝到我們的解決方案中。

5.2 使用 Visual Studio 命令列

在 Visual Studio 選單中,前往"工具"-> "NuGet套件管理器"->"套件管理器控制台"。

在軟體包管理器控制台標籤中輸入以下命令:

Install-Package BarCode

現在該軟體包將下載/安裝到當前專案中,即可使用。

Onbarcode Generator Alternatives 5 related to 5.2 使用 Visual Studio 命令列
Onbarcode Generator Alternatives 6 related to 5.2 使用 Visual Studio 命令列

5.3 從NuGet網站直接下載

第三種方法是直接從網站下載軟體包。

  • Navigate to the Link.
  • 從右側選單中選擇下載軟體包選項。
  • 雙擊下載的軟體包。 它將自動安裝。
  • 現在重新載入解決方案,並在專案中開始使用它。

5.4 從IronBarcode網站直接下載

Click the link to download the latest package from the website. After the download, follow the steps below to add the package to the project.

  • 在解決方案視窗中右鍵點選項目。 然後,選擇參考文獻選項,瀏覽下載的參考文獻的位置。 然後,按一下"確定"以新增引用。

6. 安裝 OnBarcode SDK

OnBarcode 提供多種安裝選項,包括NuGet套件。 OnBarcode 可在NuGet上取得,包含 OnBarcode.Barcode.Generator 和 OnBarcode.Barcode.Reader 等軟體包。 OnBarcode 為條碼產生器和條碼閱讀器提供獨立的服務。 You can install via NuGet Package Manager or download directly from this link for the barcode generator, and this link for the barcode reader. 如需手動安裝,請依照以下步驟操作:

下載完成後,請解壓縮軟體包。

  • 在您的ASP.NET專案資料夾中,新增 OnBarcode.Barcode.ASPNET.dll。 無需將其放置在.NET bin 目錄中,因為 Visual Studio 產生工具會自動將 DLL 複製到.NET bin 目錄。
  • 在您的ASP.NET專案或網站中,參考 OnBarcode.Barcode.ASPNET.dll。
  • ASP.NET Web 窗體控制項應加入到ASP.NET Visual Studio 工具箱中。
  • 選擇商品... 從選單中右鍵點選.NET Visual Studio 工具箱。
  • 從"選擇工具箱項目"窗體的"瀏覽..."按鈕中選擇 DLL OnBarcode.Barcode.ASPNET.dll。
  • 選擇完成後,前往"元件"區域,尋找 LinearWebForm、DataMatrixWebForm、PDF417WebForm 和 QRCodeWebForm。
  • 選取全部四個元件後,它們會出現在.NET Visual Studio 工具箱中。

7. 二維碼產生器

二維碼是條碼的一種二維變體,由黑白像素圖案組成。

7.1. 使用 OnBarcode SDK 產生二維碼

OnBarcode 的.NET條碼產生控制項能夠為 C# 應用程式產生和列印二維碼和二維條碼。 OnBarcode C# 條碼產生器可以輕鬆產生和建立二維碼。

以下程式碼展示如何使用 OnBarcode 建立二維碼。

using System;
using OnBarcode.Barcode;
using System.Drawing.Imaging;

// Create a new QRCode instance
QRCode qrcode = new QRCode();
qrcode.Data = "ONBARCODE"; // Set the data to encode
qrcode.DataMode = QRCodeDataMode.AlphaNumeric; // Set data mode
qrcode.UOM = UnitOfMeasure.PIXEL; // Set unit of measure (Pixels)
qrcode.X = 3; // Module width
qrcode.Resolution = 72; // Image resolution
qrcode.Rotate = Rotate.Rotate0; // No rotation
qrcode.ImageFormat = ImageFormat.Gif; // Set image format

// Draw barcode (generate the QR code image)
qrcode.drawBarcode("C:\\qrcode.gif");
using System;
using OnBarcode.Barcode;
using System.Drawing.Imaging;

// Create a new QRCode instance
QRCode qrcode = new QRCode();
qrcode.Data = "ONBARCODE"; // Set the data to encode
qrcode.DataMode = QRCodeDataMode.AlphaNumeric; // Set data mode
qrcode.UOM = UnitOfMeasure.PIXEL; // Set unit of measure (Pixels)
qrcode.X = 3; // Module width
qrcode.Resolution = 72; // Image resolution
qrcode.Rotate = Rotate.Rotate0; // No rotation
qrcode.ImageFormat = ImageFormat.Gif; // Set image format

// Draw barcode (generate the QR code image)
qrcode.drawBarcode("C:\\qrcode.gif");
$vbLabelText   $csharpLabel

7.2. 使用IronBarcode庫產生二維碼

與創建普通條碼相比,Iron Barcode 為開發者在製作二維碼時提供了更多選擇。 例如,我們可以調整二維碼糾錯量,決定添加彩色二維碼,或添加徽標。

當在二維碼中新增徽標時,徽標會自動縮小到適當的大小,以便讀取二維碼,然後對齊到網格,使其與二維碼圖像上的黑白方塊正確對齊。

簡單的二維碼生成

using IronBarCode;

// Create and save a simple QR code
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium)
             .SaveAsPng("MyQR.png");
using IronBarCode;

// Create and save a simple QR code
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium)
             .SaveAsPng("MyQR.png");
$vbLabelText   $csharpLabel
Onbarcode Generator Alternatives 7 related to 7.2. 使用IronBarcode庫產生二維碼

高級二維碼生成

using IronBarCode;

// Create a QR code with a logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);

// Change the color of the QR code
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
using IronBarCode;

// Create a QR code with a logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);

// Change the color of the QR code
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
$vbLabelText   $csharpLabel
Onbarcode Generator Alternatives 8 related to 7.2. 使用IronBarcode庫產生二維碼

8. 讀取條碼

讀取條碼以獲取其中隱藏的資訊非常有用。 在本節中,我們將討論這些工具如何讀取不同的條碼。

8.1. 使用IronBarcode讀取條碼

條碼讀取器是一個讀取條碼的腳本。 IronBarcode命名空間的 QuicklyReadOneBarcode 函數是.NET Framework中讀取條碼的絕佳工具。 我們可以透過選擇條碼編碼方案來大幅提高速度,並且可以透過將 TryHarder 選項設為 true 來強制它自動調整透視和數位雜訊。

QuicklyReadAllBarcodes 技術與之類似,但它可以掃描 PDF 和多頁 TIFF 等多頁文件中的多個條碼。

QuicklyReadOneBarcode

using IronBarCode;

// Read a single barcode from an image file
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("QR.png");
using IronBarCode;

// Read a single barcode from an image file
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode("QR.png");
$vbLabelText   $csharpLabel

努力嘗試

using IronBarCode;

// Read a single barcode with more accuracy and noise correction
BarcodeResult QRBetterResult = BarcodeReader.QuicklyReadOneBarcode("QR.png", BarcodeEncoding.QRCode, true);
using IronBarCode;

// Read a single barcode with more accuracy and noise correction
BarcodeResult QRBetterResult = BarcodeReader.QuicklyReadOneBarcode("QR.png", BarcodeEncoding.QRCode, true);
$vbLabelText   $csharpLabel

快速讀取所有條碼

using IronBarCode;

// Read all barcodes from a PDF or TIFF file
BarcodeResult[] PDFResults = BarcodeReader.QuicklyReadAllBarcodes("MultipleBarcodes.pdf", BarcodeEncoding.AllOneDimensional, true);
using IronBarCode;

// Read all barcodes from a PDF or TIFF file
BarcodeResult[] PDFResults = BarcodeReader.QuicklyReadAllBarcodes("MultipleBarcodes.pdf", BarcodeEncoding.AllOneDimensional, true);
$vbLabelText   $csharpLabel

8.2. 使用 OnBarcode 讀取條碼

在 Visual C# .NET應用程式中,OnBarcode .NET條碼讀取器是一個 C# .NET元件(DLL),用於讀取和掃描條碼影像。

讀取線性條碼

using OnBarcode.Barcode;
using System;

// Scan all Code39 barcodes from an image
String[] barcodes = BarcodeScanner.Scan("code39image.gif", BarcodeType.Code39);
using OnBarcode.Barcode;
using System;

// Scan all Code39 barcodes from an image
String[] barcodes = BarcodeScanner.Scan("code39image.gif", BarcodeType.Code39);
$vbLabelText   $csharpLabel

掃描影像中的特定區域

using OnBarcode.Barcode;
using System;
using System.Collections.Generic;

// Define a region to scan
List<SRegion> areas = new List<SRegion>();
SRegion area = new SRegion(0, 0, 50, 60);
areas.Add(area);

// Scan Code39 barcodes from defined regions in the image
string[] barcodes = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas);
using OnBarcode.Barcode;
using System;
using System.Collections.Generic;

// Define a region to scan
List<SRegion> areas = new List<SRegion>();
SRegion area = new SRegion(0, 0, 50, 60);
areas.Add(area);

// Scan Code39 barcodes from defined regions in the image
string[] barcodes = BarcodeScanner.ScanRegions("code39image.gif", BarcodeType.Code39, areas);
$vbLabelText   $csharpLabel

9. 許可

IronBarcode是一個提供免費開發者許可證的函式庫。 IronBarcode 的定價結構也很獨特:Lite 套餐起價為 $liteLicense,沒有隱藏費用。 SaaS 和 OEM 產品的重新分發也是可行的。 所有許可證均提供 30 天退款保證、一年軟體支援和升級、開發/測試/生產有效期以及永久許可證(一次性購買)。 To see IronBarcode's entire price structure and license, go here.

OnBarcode 讀取器和條碼產生器並非以單一軟體包的形式提供。 這意味著您需要購買兩種不同的套餐。

.NET條碼產生器套件許可證

.NET條碼產生器套件包含一組可靠的條碼控制項,在 Visual Studio .NET中易於使用。 在.NET應用程式中,您可以使用此套件來產生、列印和繪製高品質的條碼。

其支援線性條碼和二維條碼的單開發者許可證起價為 $1,690,無限開發者許可證的價格為 $3,990。

  • 單一開發者許可證:此許可證允許單一開發者分發無限數量的使用者許可證,無需支付許可費,並且允許在無限數量的伺服器上安裝.NET條碼元件。
  • 5-開發者授權:此授權允許 5 位開發者分發無限數量的使用者許可證,無需支付版稅,並在無限數量的伺服器上安裝.NET條碼元件。
  • 無限制開發者許可證:允許無限制的開發者分發無限的使用者許可證,無需支付版稅,並在無限數量的伺服器上安裝.NET條碼元件。

.NET條碼讀取器 SDK 許可

  • 單一伺服器分發許可證:允許貴公司無限數量的開發人員在單一伺服器上使用我們的.NET條碼閱讀器並部署衍生產品。
  • 三伺服器分發許可證:此許可證允許貴公司無限數量的開發人員在三台伺服器上使用我們的.NET條碼閱讀器並部署衍生產品。
  • 五伺服器分發許可證:此許可證允許貴公司無限數量的開發人員使用我們的.NET條碼閱讀器,並在最多五台伺服器上部署衍生產品。
  • 無限制伺服器分發許可證:此許可證允許貴組織中無限數量的開發人員使用我們的.NET條碼閱讀器,並將生成的產品部署到無限數量的伺服器上。
  • Windows 應用程式分發許可證:此許可證允許貴組織中無限數量的開發人員使用我們的.NET條碼閱讀器,並將生成的產品部署到無限數量的機器(而非伺服器)上。

10. 結論

IronBarcode是一個領先的.NET條碼庫,允許程式設計師讀取和建立條碼。 它支援各種一維和二維條碼,以及定制的(彩色和品牌化的)二維碼。 IronBarcode讓開發人員可以使用所有與 .NET 相關的語言。 IronBarcode提供針對.NET環境最佳化的高效能條碼讀取和產生功能。 它支援.NET Core 2x 和 3x、 .NET Standard、 .NET Framework 4x 以及完整的 Azure 支援。

OnBarcode 是市場領先的條碼產生器、讀取器控制和元件供應商,適用於所有主要企業開發平台,包括ASP.NET、Windows Forms、WPF、Java、Android 和 iOS(iPhone 專案、Mac)。 該公司還提供完整的條碼解決方案,該方案結合了 Microsoft Office(Excel 和 Word)條碼外掛程式和條碼字型。 OnBarcode 軟體提供各種與條碼相關的功能,例如產生條碼影像、讀取條碼、相容最新的條碼符號體系,以及在.NET中進行列印和繪圖。 它支援多種標準代碼來表示文字字串。

IronBarcode 的定價結構比 OnBarcode 的更具成本效益。 IronBarcode提供所有功能,只需一次性購買一個許可證,無需後續費用;而 OnBarcode 不提供條碼相關功能的單一許可證,而是分別提供條碼產生和條碼讀取的單獨許可證。 由於其獨立的許可策略,其價格是IronBarcode的三倍,因此對用戶缺乏吸引力。

經過比較,我們可以得出結論: IronBarcode提供的功能比 OnBarcode 多,而且 OnBarcode 的價格也比IronBarcode高得多。 這兩個庫都可透過NuGet套件管理器獲取,以便輕鬆整合到.NET專案中。 對於.NET編程, IronBarcode只需幾行程式碼即可實現所有功能,這是其競爭對手無法做到的。更重要的是, Iron Software目前正以兩款軟體的價格出售全部五款軟體工具! 這五種工具分別是:

  • IronBarcode
  • IronXL
  • IronOCR
  • IronPDF
  • IronWebScraper

Please visit this link to explore Iron Suite.

請注意OnBarcode 是其各自所有者的註冊商標。 本網站與OnBarcode沒有任何關聯,也未獲得OnBarcode的認可或贊助。 所有產品名稱、標誌和品牌均為其各自所有者的財產。 比較僅供參考,反映的是撰寫本文時可公開取得的資訊。

常見問題解答

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

OnBarcode需要分別的條碼生成和讀取許可,這可能會增加成本,而IronBarcode在單一許可下提供所有功能,使其更加經濟實惠。IronBarcode也可以通過NuGet包管理器輕鬆整合,並提供廣泛的自定義選項。

如何在C#應用程式中整合條碼庫?

IronBarcode可以使用Visual Studio的NuGet包管理器整合到C#應用程式中。這包括在NuGet介面中搜尋IronBarcode,直接安裝到您的專案中。

使用IronBarcode可以生成哪些類型的條碼?

IronBarcode支持多種條碼格式,包括一維和二維條碼,如QR碼、Code 39、Code 128等。它還允許自定義彩色QR碼和標誌。

是否存在對.NET開發者有利的條碼生成解決方案?

是的,IronBarcode為.NET開發者提供了經濟有效的解決方案,單一許可包含所有功能且無持續費用,與OnBarcode需要不同功能的分別許可不同。

如何在我的.NET應用程式中自定義QR碼?

使用IronBarcode,您可以通過改變顏色或添加標誌來輕松地自定義QR碼。這可以通過簡單的代碼調整來實現,允許視覺品牌化QR碼。

在.NET中條碼庫的安裝選項有哪些?

IronBarcode可以通過Visual Studio的NuGet包管理器安裝,使此過程簡單快捷。或者,也可以從Iron Software網站下載包。

IronBarcode可以同時用於條碼生成和讀取嗎?

是的,IronBarcode設計為同時生成和讀取條碼,提供了一個單一庫中的完整解決方案,不像某些替代品需要為每項任務分別的工具。

使用IronBarcode超過其他條碼庫有什麼優勢?

IronBarcode提供簡化的整合過程、廣泛的條碼格式支持和自定義功能。它還通過將所有功能打包在一次購買中來提供經濟上有利的許可模式。

Jordi Bardia
軟體工程師
Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担產品测测试,產品開發和研究的责任時,Jordi 為持续的產品改進增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。

鋼鐵支援團隊

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