IRONSOFTWAREHOME
異步讀取條碼
using IronBarCode;

// Reading many images asynchronously using ReadAsync
string[] imagePaths = new string[] { "image1.png", "image2.png" };
var resultsAsync = BarcodeReader.ReadAsync(imagePaths, new BarcodeReaderOptions() { ExpectMultipleBarcodes = true });

// Reading many PDFs asynchronously using ReadPdfAsync
string[] pdfPaths = new string[] { "doc1.pdf", "doc2.pdf" };
var resultsPdfAsync = BarcodeReader.ReadPdfsAsync(pdfPaths, new PdfBarcodeReaderOptions() { ExpectMultipleBarcodes = true, Scale = 3, DPI = 300 });
Imports IronBarCode

' Reading many images asynchronously using ReadAsync
Dim imagePaths As String() = New String() {"image1.png", "image2.png"}
Dim resultsAsync = BarcodeReader.ReadAsync(imagePaths, New BarcodeReaderOptions() With {.ExpectMultipleBarcodes = True})

' Reading many PDFs asynchronously using ReadPdfAsync
Dim pdfPaths As String() = New String() {"doc1.pdf", "doc2.pdf"}
Dim resultsPdfAsync = BarcodeReader.ReadPdfsAsync(pdfPaths, New PdfBarcodeReaderOptions() With {.ExpectMultipleBarcodes = True, .Scale = 3, .DPI = 300})
NuGet Download
PM > Install-Package BarCode
異步讀取條碼

異步讀取條碼

我們可以使用BarcodeReader類別讀取條碼。 最簡單的方法是使用BarcodeReader.Read方法。 IronBarcode也有一個ReadAsync方法適用於多執行緒非同步程式設計。

關鍵要點

  • 同步與非同步方法

    • 當需要立即結果時,Read方法適合使用,並於主執行緒上呼叫。
    • ReadAsync方法適用於非同步執行,允許程式在等待條碼讀取完成的同時繼續執行其他任務。
  • BarcodeReaderOptions

    • ExpectMultipleBarcodes: 如果設置為true,讀取器將在影像中尋找多個條碼。
    • EnhanceAccuracy: 提高準確性但以速度為代價。
    • SpeedUp: 提高讀取效率,這可能在快速處理大量影像時有用。 但是,如果設置為true,這可能會降低準確性。
探索非同步與多執行緒條碼讀取
在 GitHub 上查看

準備好開始了嗎?

Nuget Downloads 2,422,100版本:2026.9剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
預訂您的免費即時演示
Booking Badge

全球數百萬工程師信賴

Iron Software的客戶標誌
獲取您的無義務諮詢
完成下方表單或發送電子郵件至sales@ironsoftware.com
您的詳細資訊將始終保密。
全球數百萬工程師信賴
Iron Software的客戶標誌
立即獲取您的30天試用金鑰
無需信用卡或帳戶建立