異步讀取條碼
我們可以使用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
中有各種選項,讓您可以自訂您的讀取方式,使其更快速、記憶體使用更有效率,且更準確。