异步读取 BarCode
我们可以使用 BarcodeReader
类读取条形码。 使用最简单的方法是 BarcodeReader.Read
方法。 IronBarcode 还有一个用于多线程异步编程的 ReadAsync
方法。
请注意 "BarcodeReaderOptions"(条形码阅读器选项)中的各种选项,这些选项允许您自定义您的阅读,使之更快、更节省内存、更准确。
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.ReadPdfAsync(pdfPaths, new PdfBarcodeReaderOptions() { ExpectMultipleBarcodes = true, Scale = 3, DPI = 300 });
Imports IronBarCode ' Reading many images asynchronously using ReadAsync Private imagePaths() As String = { "image1.png", "image2.png" } Private resultsAsync = BarcodeReader.ReadAsync(imagePaths, New BarcodeReaderOptions() With {.ExpectMultipleBarcodes = True}) ' Reading many PDFs asynchronously using ReadPdfAsync Private pdfPaths() As String = { "doc1.pdf", "doc2.pdf" } Private resultsPdfAsync = BarcodeReader.ReadPdfAsync(pdfPaths, New PdfBarcodeReaderOptions() With { .ExpectMultipleBarcodes = True, .Scale = 3, .DPI = 300 })
Install-Package BarCode
我们可以使用 BarcodeReader
类读取条形码。 使用最简单的方法是 BarcodeReader.Read
方法。 IronBarcode 还有一个用于多线程异步编程的 ReadAsync
方法。
请注意 "BarcodeReaderOptions"(条形码阅读器选项)中的各种选项,这些选项允许您自定义您的阅读,使之更快、更节省内存、更准确。