using IronBarCode;using System;using System.Diagnostics;using System.IO;using System.Linq;var optionsFaster = new BarcodeReaderOptions{Speed = ReadingSpeed.Faster};// Directory containing PDF filesstring folderPath = @"YOUR_FILE_PATH";// Get all PDF files in the directoryvar pdfFiles = Directory.GetFiles(folderPath, "*.jpg");int countFaster = 0;var stopwatch = Stopwatch.StartNew();foreach (var file in pdfFiles){ // Read the barcode var results = BarcodeReader.Read(file, optionsFaster); if (results.Any()) {Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}"); foreach (var result in results) {Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}"); countFaster++; } } else {Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}"); }}stopwatch.Stop();// Print number of images the barcode reader could decodeConsole.WriteLine($"Faster could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
var optionsFaster = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Faster
};
// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";
// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");
int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
// Read the barcode
var results = BarcodeReader.Read(file, optionsFaster);
if (results.Any())
{
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
foreach (var result in results)
{
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}");
countFaster++;
}
}
else
{
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
}
}
stopwatch.Stop();
// Print number of images the barcode reader could decode
Console.WriteLine($"Faster could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
ImportsIronBarCodeImportsSystemImportsSystem.DiagnosticsImportsSystem.IOImportsSystem.LinqDim optionsFaster As New BarcodeReaderOptionsWith { .Speed = ReadingSpeed.Faster}' Directory containing PDF filesDim folderPath AsString = "YOUR_FILE_PATH"' Get all PDF files in the directoryDim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")Dim countFaster AsInteger = 0Dim stopwatch AsStopwatch = Stopwatch.StartNew()For Each file In pdfFiles ' Read the barcode Dim results = BarcodeReader.Read(file, optionsFaster) If results.Any() ThenConsole.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}") For Each result In resultsConsole.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}") countFaster += 1 Next ElseConsole.WriteLine($"No barcode found in: {Path.GetFileName(file)}") End IfNextstopwatch.Stop()' Print number of images the barcode reader could decodeConsole.WriteLine($"Faster could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
Imports IronBarCode
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Dim optionsFaster As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Faster
}
' Directory containing PDF files
Dim folderPath As String = "YOUR_FILE_PATH"
' Get all PDF files in the directory
Dim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")
Dim countFaster As Integer = 0
Dim stopwatch As Stopwatch = Stopwatch.StartNew()
For Each file In pdfFiles
' Read the barcode
Dim results = BarcodeReader.Read(file, optionsFaster)
If results.Any() Then
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}")
For Each result In results
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}")
countFaster += 1
Next
Else
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}")
End If
Next
stopwatch.Stop()
' Print number of images the barcode reader could decode
Console.WriteLine($"Faster could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
using IronBarCode;using System;using System.Diagnostics;using System.IO;using System.Linq;var optionsFaster = new BarcodeReaderOptions{Speed = ReadingSpeed.Balanced};// Directory containing PDF filesstring folderPath = @"YOUR_FILE_PATH";// Get all PDF files in the directoryvar pdfFiles = Directory.GetFiles(folderPath, "*.jpg");int countFaster = 0;var stopwatch = Stopwatch.StartNew();foreach (var file in pdfFiles){ // Read the barcode var results = BarcodeReader.Read(file, optionsFaster); if (results.Any()) {Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}"); foreach (var result in results) {Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}"); countFaster++; } } else {Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}"); }}stopwatch.Stop();// Print number of images the barcode reader could decodeConsole.WriteLine($"Balanced could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
var optionsFaster = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced
};
// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";
// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");
int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
// Read the barcode
var results = BarcodeReader.Read(file, optionsFaster);
if (results.Any())
{
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
foreach (var result in results)
{
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}");
countFaster++;
}
}
else
{
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
}
}
stopwatch.Stop();
// Print number of images the barcode reader could decode
Console.WriteLine($"Balanced could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
ImportsIronBarCodeImportsSystemImportsSystem.DiagnosticsImportsSystem.IOImportsSystem.LinqDim optionsFaster As New BarcodeReaderOptionsWith { .Speed = ReadingSpeed.Balanced}' Directory containing PDF filesDim folderPath AsString = "YOUR_FILE_PATH"' Get all PDF files in the directoryDim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")Dim countFaster AsInteger = 0Dim stopwatch AsStopwatch = Stopwatch.StartNew()For Each file In pdfFiles ' Read the barcode Dim results = BarcodeReader.Read(file, optionsFaster) If results.Any() ThenConsole.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}") For Each result In resultsConsole.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}") countFaster += 1 Next ElseConsole.WriteLine($"No barcode found in: {Path.GetFileName(file)}") End IfNextstopwatch.Stop()' Print number of images the barcode reader could decodeConsole.WriteLine($"Balanced could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
Imports IronBarCode
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Dim optionsFaster As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced
}
' Directory containing PDF files
Dim folderPath As String = "YOUR_FILE_PATH"
' Get all PDF files in the directory
Dim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")
Dim countFaster As Integer = 0
Dim stopwatch As Stopwatch = Stopwatch.StartNew()
For Each file In pdfFiles
' Read the barcode
Dim results = BarcodeReader.Read(file, optionsFaster)
If results.Any() Then
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}")
For Each result In results
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}")
countFaster += 1
Next
Else
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}")
End If
Next
stopwatch.Stop()
' Print number of images the barcode reader could decode
Console.WriteLine($"Balanced could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
using IronBarCode;using System;using System.Diagnostics;using System.IO;using System.Linq;var optionsFaster = new BarcodeReaderOptions{Speed = ReadingSpeed.Detailed};// Directory containing PDF filesstring folderPath = @"YOUR_FILE_PATH";// Get all PDF files in the directoryvar pdfFiles = Directory.GetFiles(folderPath, "*.jpg");int countFaster = 0;var stopwatch = Stopwatch.StartNew();foreach (var file in pdfFiles){ // Read the barcode var results = BarcodeReader.Read(file, optionsFaster); if (results.Any()) {Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}"); foreach (var result in results) {Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}"); countFaster++; } } else {Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}"); }}stopwatch.Stop();// Print number of images the barcode reader could decodeConsole.WriteLine($"Detailed could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
var optionsFaster = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Detailed
};
// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";
// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");
int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
// Read the barcode
var results = BarcodeReader.Read(file, optionsFaster);
if (results.Any())
{
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
foreach (var result in results)
{
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}");
countFaster++;
}
}
else
{
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
}
}
stopwatch.Stop();
// Print number of images the barcode reader could decode
Console.WriteLine($"Detailed could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
ImportsIronBarCodeImportsSystemImportsSystem.DiagnosticsImportsSystem.IOImportsSystem.LinqDim optionsFaster As New BarcodeReaderOptionsWith { .Speed = ReadingSpeed.Detailed}' Directory containing PDF filesDim folderPath AsString = "YOUR_FILE_PATH"' Get all PDF files in the directoryDim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")Dim countFaster AsInteger = 0Dim stopwatch AsStopwatch = Stopwatch.StartNew()For Each file In pdfFiles ' Read the barcode Dim results = BarcodeReader.Read(file, optionsFaster) If results.Any() ThenConsole.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}") For Each result In resultsConsole.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}") countFaster += 1 Next ElseConsole.WriteLine($"No barcode found in: {Path.GetFileName(file)}") End IfNextstopwatch.Stop()' Print number of images the barcode reader could decodeConsole.WriteLine($"Detailed could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
Imports IronBarCode
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Dim optionsFaster As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Detailed
}
' Directory containing PDF files
Dim folderPath As String = "YOUR_FILE_PATH"
' Get all PDF files in the directory
Dim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")
Dim countFaster As Integer = 0
Dim stopwatch As Stopwatch = Stopwatch.StartNew()
For Each file In pdfFiles
' Read the barcode
Dim results = BarcodeReader.Read(file, optionsFaster)
If results.Any() Then
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}")
For Each result In results
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}")
countFaster += 1
Next
Else
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}")
End If
Next
stopwatch.Stop()
' Print number of images the barcode reader could decode
Console.WriteLine($"Detailed could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
ExtremeDetail 设置对条码图像进行了大量处理,显著降低了读取性能。 这种 CPU 密集型选项最适合扫描一个输入文件中多个不清晰或模糊的 BarCode。当其他选项无法产生预期结果时,请将其作为最后手段使用。 对于大批量处理场景,可探索 从 PDF 文件中读取条形码,这些文件通常每页包含多个条形码。
让我们应用 ExtremeDetail 设置,观察其影响。
using IronBarCode;using System;using System.Diagnostics;using System.IO;using System.Linq;var optionsFaster = new BarcodeReaderOptions{Speed = ReadingSpeed.ExtremeDetail};// Directory containing PDF filesstring folderPath = @"YOUR_FILE_PATH";// Get all PDF files in the directoryvar pdfFiles = Directory.GetFiles(folderPath, "*.jpg");int countFaster = 0;var stopwatch = Stopwatch.StartNew();foreach (var file in pdfFiles){ // Read the barcode var results = BarcodeReader.Read(file, optionsFaster); if (results.Any()) {Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}"); foreach (var result in results) {Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}"); countFaster++; } } else {Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}"); }}stopwatch.Stop();// Print number of images the barcode reader could decodeConsole.WriteLine($"ExtremeDetail could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
var optionsFaster = new BarcodeReaderOptions
{
Speed = ReadingSpeed.ExtremeDetail
};
// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";
// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");
int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
// Read the barcode
var results = BarcodeReader.Read(file, optionsFaster);
if (results.Any())
{
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
foreach (var result in results)
{
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}");
countFaster++;
}
}
else
{
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
}
}
stopwatch.Stop();
// Print number of images the barcode reader could decode
Console.WriteLine($"ExtremeDetail could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
ImportsIronBarCodeImportsSystemImportsSystem.DiagnosticsImportsSystem.IOImportsSystem.LinqDim optionsFaster As New BarcodeReaderOptionsWith { .Speed = ReadingSpeed.ExtremeDetail}' Directory containing PDF filesDim folderPath AsString = "YOUR_FILE_PATH"' Get all PDF files in the directoryDim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")Dim countFaster AsInteger = 0Dim stopwatch AsStopwatch = Stopwatch.StartNew()For Each file In pdfFiles ' Read the barcode Dim results = BarcodeReader.Read(file, optionsFaster) If results.Any() ThenConsole.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}") For Each result In resultsConsole.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}") countFaster += 1 Next ElseConsole.WriteLine($"No barcode found in: {Path.GetFileName(file)}") End IfNextstopwatch.Stop()' Print number of images the barcode reader could decodeConsole.WriteLine($"ExtremeDetail could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
Imports IronBarCode
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Dim optionsFaster As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.ExtremeDetail
}
' Directory containing PDF files
Dim folderPath As String = "YOUR_FILE_PATH"
' Get all PDF files in the directory
Dim pdfFiles = Directory.GetFiles(folderPath, "*.jpg")
Dim countFaster As Integer = 0
Dim stopwatch As Stopwatch = Stopwatch.StartNew()
For Each file In pdfFiles
' Read the barcode
Dim results = BarcodeReader.Read(file, optionsFaster)
If results.Any() Then
Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}")
For Each result In results
Console.WriteLine($" Value: {result.Value}, Type: {result.BarcodeType}")
countFaster += 1
Next
Else
Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}")
End If
Next
stopwatch.Stop()
' Print number of images the barcode reader could decode
Console.WriteLine($"ExtremeDetail could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms")
What is the impact of applying heavy processing in the ExtremeDetail setting?
The ExtremeDetail setting significantly lowers reading performance and increases CPU usage due to intensive image preprocessing. It can recover certain barcodes more effectively than other settings, particularly in highly degraded images.
Which barcode reading speed setting should I use for high-volume processing?
For high-volume processing with clear, high-quality images, the Faster setting is optimal due to its speed and low resource consumption. However, it's important to test it against your specific data set to ensure it meets your needs.