跳至頁尾內容
使用 IRONBARCODE

如何使用 IronBarcode 讀取多個條碼:現場示範回顧

IronBarcode 允許開發人員僅使用幾行 C# 程式碼即可建立和解釋各種條碼格式。 它支援從簡單的二維碼到複雜的多條碼文件處理,並可在桌面、網路和行動平台上運行。

在最近的一次直播中,Iron Software 團隊示範如何使用 IronBarcode 來產生和讀取多種條碼格式。 本次會議由銷售工程師 Shadman Majid 和銷售主管 Craig Beaumont 主持,內容涵蓋從簡單的條碼生成到高級讀取用例的所有內容,展示了 IronBarcode 庫在實際應用中的速度和靈活性。

IronBarcode網路研討會示範條碼產生介面

本次網路研討會涵蓋了條碼生成的哪些內容?

Shadman 首先解釋了使用 IronBarcode 只需幾行 C# 程式碼即可輕鬆產生條碼。 該工具支援多種條碼格式,並可輕鬆自訂輸出為 PNG 或 PDF 格式。 從製造業到物流業,這對於需要快速可靠產生條碼的行業來說非常理想。

IronBarcode 庫為開發者提供了一個完整的 API,可以處理條碼產生所需的複雜數學運算和渲染。 無論您需要建立簡單的 1D 條碼(如 Code 128 和 UPC-A),還是更複雜的 2D 格式(如 QR 碼和 Data Matrix),該程式庫都會抽象化技術細節,同時讓您完全控制外觀和編碼選項。

// Example C# code to generate various barcode formats using IronBarcode

using IronBarCode;

// Generate a QR code with custom text
BarcodeWriter.CreateBarcode("Hello World!", BarcodeEncoding.QRCode)
    .SaveAsPng("HelloWorldQRCode.png");

// Generate a Code 128 barcode with product information
BarcodeWriter.CreateBarcode("PROD-12345-2024", BarcodeEncoding.Code128)
    .ResizeTo(400, 100)  // Custom dimensions in pixels
    .AddBarcodeValueTextBelowBarcode()  // Add human-readable text
    .SaveAsPng("ProductBarcode.png");

// Generate a Data Matrix barcode for compact data storage
BarcodeWriter.CreateBarcode("Compact data for small labels", BarcodeEncoding.DataMatrix)
    .SaveAsPdf("DataMatrixLabel.pdf");
// Example C# code to generate various barcode formats using IronBarcode

using IronBarCode;

// Generate a QR code with custom text
BarcodeWriter.CreateBarcode("Hello World!", BarcodeEncoding.QRCode)
    .SaveAsPng("HelloWorldQRCode.png");

// Generate a Code 128 barcode with product information
BarcodeWriter.CreateBarcode("PROD-12345-2024", BarcodeEncoding.Code128)
    .ResizeTo(400, 100)  // Custom dimensions in pixels
    .AddBarcodeValueTextBelowBarcode()  // Add human-readable text
    .SaveAsPng("ProductBarcode.png");

// Generate a Data Matrix barcode for compact data storage
BarcodeWriter.CreateBarcode("Compact data for small labels", BarcodeEncoding.DataMatrix)
    .SaveAsPdf("DataMatrixLabel.pdf");
$vbLabelText   $csharpLabel

以上程式碼片段示範如何產生具有自訂選項的不同條碼格式。 該函式庫會自動處理每種格式的編碼規則、錯誤修正和渲染最佳化。 對於實施基於條碼的庫存系統的企業而言,這種靈活性意味著您可以適應任何標籤要求而無需更換工具。


! IronBarcode 條碼產生功能的現場演示

如何使用 IronBarcode 讀取多種條碼格式?

在生成演示之後,Craig 接手演示了 IronBarcode 的條碼讀取功能。

這些特性使得 IronBarcode 非常適合複雜的自動化工作流程,尤其是當文件可能包含多種條碼類型或處理大量資料時。 該圖書館先進的圖像處理能力可以檢測和解碼條碼,即使來自不完美的來源——包括傾斜的掃描、低解析度的照片或部分損壞的標籤。 這種可靠性對於無法保證完美條件的實際應用至關重要。

// Complete example of reading barcodes with advanced options

using IronBarCode;
using System;
using System.Linq;

// Read all barcodes in a given image file
var results = BarcodeReader.Read(@"exampleImageWithBarcodes.png");

// Process each barcode read with detailed information
foreach (var result in results)
{
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Format: {result.BarcodeType}");
    Console.WriteLine($"Position: X={result.X}, Y={result.Y}");
    Console.WriteLine($"Dimensions: {result.Width}x{result.Height}");
    Console.WriteLine("---");
}

// Read with specific options for challenging scenarios
var advancedResults = BarcodeReader.ReadAsync(
    @"lowQualityDocument.pdf",
    new BarcodeReaderOptions
    {
        Speed = ReadingSpeed.Balanced,  // Balance between speed and accuracy
        ExpectMultipleBarcodes = true,   // Improve for multiple barcode detection
        ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128,  // Filter specific types
        CropArea = new System.Drawing.Rectangle(100, 100, 500, 500)  // Focus on specific region
    }
).Result;

// Handle results with error checking
if (advancedResults.Any())
{
    Console.WriteLine($"Found {advancedResults.Count()} barcodes in the document");
}
// Complete example of reading barcodes with advanced options

using IronBarCode;
using System;
using System.Linq;

// Read all barcodes in a given image file
var results = BarcodeReader.Read(@"exampleImageWithBarcodes.png");

// Process each barcode read with detailed information
foreach (var result in results)
{
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Format: {result.BarcodeType}");
    Console.WriteLine($"Position: X={result.X}, Y={result.Y}");
    Console.WriteLine($"Dimensions: {result.Width}x{result.Height}");
    Console.WriteLine("---");
}

// Read with specific options for challenging scenarios
var advancedResults = BarcodeReader.ReadAsync(
    @"lowQualityDocument.pdf",
    new BarcodeReaderOptions
    {
        Speed = ReadingSpeed.Balanced,  // Balance between speed and accuracy
        ExpectMultipleBarcodes = true,   // Improve for multiple barcode detection
        ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128,  // Filter specific types
        CropArea = new System.Drawing.Rectangle(100, 100, 500, 500)  // Focus on specific region
    }
).Result;

// Handle results with error checking
if (advancedResults.Any())
{
    Console.WriteLine($"Found {advancedResults.Count()} barcodes in the document");
}
$vbLabelText   $csharpLabel

此程式碼範例展示如何使用基本配置和進階配置讀取條碼。 BarcodeReaderOptions 類別提供了對讀取過程的精細控制,讓開發人員可以針對速度、準確性或特定用例進行改進。 在批量處理數千份文件或處理具有挑戰性的原始材料時,這種控制水平尤其有價值。


各行業常見的應用場景有哪些?

Craig 也分享了一些 IronBarcode 已經產生影響力的實際應用案例:

*庫存與資產管理– 追蹤庫存水準並實現倉庫操作自動化。

*文件處理– 自動從 PDF 和掃描文件中提取條碼資料。

*物流與供應鏈– 實現整個運輸過程的即時追蹤。

*醫療保健– 透過準確識別和藥物追蹤來確保患者安全。

  • 付款和票務 – 處理用於入場驗證和數位交易的二維碼。

  • 生產製造 – 監控生產線並維持品質控制標準。

  • 銷售點 (POS) – 透過即時掃描產品條碼加快結帳速度。

  • 安全性與驗證 – 透過基於條碼的憑證驗證使用者身分。

IronBarcode 如何處理單次和多次條碼讀取?

Shadman 再次示範了 IronBarcode 如何即時處理單一和多個條碼讀取。

技術演示,展示條碼讀取座標和元資料擷取

該庫的智慧型偵測演算法可以識別和處理單一影像或文件頁面中的多個條碼,即使它們使用不同的編碼格式。 對於諸如貨運清單之類的應用來說,這項功能至關重要,因為貨運清單可能在同一標籤上包含追蹤條碼、產品代碼和路線資訊。 多執行緒處理引擎確保即使是包含大量條碼的大型文件也能高效處理。

IronBarcode會擷取哪些關鍵資訊?

  1. 單條碼讀取 – 針對最快讀取速度進行了最佳化
  2. 條碼值 – 支援 UTF-8 的解碼數據
  3. 格式偵測 – 自動辨識條碼類型
  4. 精確座標 – 像素級 x、y 位置數據
  5. 完整的元資料-高度、寬度和編碼詳情

除了基本的提取功能外,IronBarcode 還提供每次讀取的置信度評分,使應用程式能夠根據其用例實施適當的品質閾值。 對於像藥品標籤或財務文件處理這樣的關鍵任務應用,這確保只接受高置信度的讀取,而不太重要的應用可以配置為最大吞吐量。


為什麼您的專案應該使用 IronBarcode?

借助 IronBarcode,開發人員可以輕鬆地在各種格式和平台上產生和讀取條碼,包括桌面、Web,現在甚至可以透過 .NET MAUI 在行動裝置上讀取。 無論您是建立倉庫追蹤系統還是零售結帳應用程序,IronBarcode 都能提供完成工作所需的靈活性和效能。

該程式庫的跨平台支援意味著您可以將相同的條碼邏輯部署到 Windows、Linux、macOS、iOS 和 Android 上,而無需進行任何修改。 這種一次編寫、到處運作的方法可以顯著降低開發時間和維護成本。 IronBarcode 結合了完整的文件和快速回應的支持,可以幫助團隊更快地交付條碼功能,比從頭開始建立或整合多個專用庫快得多。

對於正在評估條碼解決方案的企業而言,IronBarcode 提供了幾個關鍵優勢:部署無需執行時間費用、Web 應用程式執行緒安全操作以及與現有 .NET 程式碼庫的兼容性。 該庫可以處理一些簡單的解決方案經常遇到的極端情況,例如從傳真文件中讀取條碼、處理混合方向的批量掃描,或產生具有自訂樣式以符合品牌指南的條碼。

準備好嘗試了嗎? 立即取得30天免費試用

常見問題解答

如何在C#中產生條碼?

您可以使用 IronBarcode 在 C# 中產生條碼。透過使用BarcodeWriter.CreateBarcode方法,您可以建立各種條碼格式,並將其儲存為 PNG 或 PDF 等影像格式。

在 C# 中,如何從影像中讀取多個條碼?

若要在 C# 中從影像中讀取多個條碼,請使用 IronBarcode 的BarcodeReader.Read方法。此方法可讓您處理包含多種條碼格式的影像,並有效率地提取它們的值和類型。

哪些行業可以從使用條碼庫中受益?

製造業、物流業、醫療保健業和零售業等行業都能從使用IronBarcode等條碼庫中獲益。這些條碼庫能夠有效率地產生和讀取條碼,用於庫存管理、文件處理和POS系統等任務。

IronBarcode 能處理即時條碼掃描嗎?

是的,IronBarcode能夠處理即時條碼掃描。它支援即時讀取單一或多個條碼,因此適用於需要立即處理條碼的應用場景。

IronBarcode可以在哪些平台上使用?

IronBarcode 可用於桌面、Web 和行動平台。它支援使用 .NET MAUI 等框架進行跨平台開發,使開發人員能夠將條碼功能整合到各種應用程式中。

IronBarcode 是否提供免費試用版供用戶評估?

是的,IronBarcode 提供 30 天免費試用。這讓開發者可以在購買前探索其功能並評估其性能。

IronBarcode 如何支援自動化工作流程?

IronBarcode 支援從文件和影像中讀取多種條碼格式,從而為自動化工作流程提供支援。此功能對於物流和文件管理等行業的流程自動化至關重要。

在現場演示中,IronBarcode 的主要功能有哪些?

在現場演示中,主要功能包括用最少的程式碼產生條碼、讀取多種條碼格式以及為各種行業應用客製化條碼輸出。

柯蒂斯·週
技術撰稿人

Curtis Chau擁有卡爾頓大學電腦科學學士學位,專長於前端開發,精通Node.js、TypeScript、JavaScript和React。他熱衷於打造直覺美觀的使用者介面,喜歡使用現代框架,並擅長撰寫結構清晰、視覺效果出色的使用者手冊。

除了開發工作之外,柯蒂斯對物聯網 (IoT) 也抱有濃厚的興趣,致力於探索硬體和軟體整合的創新方法。閒暇時,他喜歡玩遊戲和製作 Discord 機器人,將他對科技的熱愛與創造力結合。