异步读取条形码
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 });
NuGet Download
PM > Install-Package BarCode
异步读取条形码

异步读取条形码

我们可以使用BarcodeReader类读取条形码。 最简单的方法是使用BarcodeReader.Read方法。 IronBarcode还具有用于多线程异步编程的ReadAsync方法。

关键点

  • 同步与异步方法

  • Read方法在需要立即结果时是简单易用的,并且在主线程上被调用。

  • ReadAsync方法用于异步执行,允许程序在等待条形码读取完成时继续执行其他任务。

  • BarcodeReaderOptions

  • true,读取器将寻找图像中的多个条形码。

  • EnhanceAccuracy:提高精度,但速度降低。

  • SpeedUp:提高读取效率,这可能对快速处理大量图像有用。 然而,如果设置为true,这可能会降低精度。

探索异步和多线程条形码读取
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 2,540,041版本:2026.11刚刚发布