C#でバーコードを読む方法

C# Barcode Scanner: Read Barcodes & QR Codes in .NET Applications

This article was translated from English: Does it need improvement?
Translated
View the article in English

.NETアプリケーションでBARCODEやQRコードを素早く読み取る必要がありますか? IronBarcode を使用すれば、鮮明なデジタル画像から、読み取りが困難な実写写真まで、BarCodeの読み取りを簡単かつ確実に実行できます。 このガイドでは、すぐに使える実践的な例を用いて、C#でBarCodeスキャンを実装する方法を詳しく解説します。

クイックスタート:ファイルからBarCodeを即座に読み取る

この簡単な例では、IronBarcode をいかに簡単に使い始められるかをご紹介します。 たった1行のコードで、画像ファイルからBARCODEを読み取ることができます。複雑な設定は一切不要です。

  1. IronBarcode をNuGetパッケージマネージャでインストール

    PM > Install-Package BarCode
  2. このコード スニペットをコピーして実行します。

    var results = IronBarCode.BarcodeReader.Read("path/to/barcode.png");
  3. 実際の環境でテストするためにデプロイする

    今日プロジェクトで IronBarcode を使い始めましょう無料トライアル

    arrow pointer

.NETプロジェクトにIronBarcodeをインストールするにはどうすればよいですか?

IronBarcodeは、NuGetパッケージマネージャーを使用するか、DLLを直接ダウンロードすることで簡単にインストールできます。 NuGet によるインストールは、依存関係や更新を自動的に管理するため、推奨される方法です。

Install-Package BarCode

インストール後、C# ファイルに using IronBarCode; を追加して、BARCODE スキャン機能を利用してください。 各開発環境ごとの詳細なインストール手順については、インストールガイドをご確認ください。

C#を使用して最初のBarCodeを読み取るにはどうすればよいですか?

IronBarcode を使用すれば、たった 1 行のコードで BARCODE を読み取ることができます。 このライブラリはBARCODE形式を自動的に検出し、エンコードされたすべてのデータを抽出します。

Code128 barcode ready for scanning - contains text 'https://ironsoftware.com/csharp/barcode/' *IronBarcodeが瞬時に読み取れる標準的なCode128 BARCODE*
using IronBarCode;
using System;

// Read barcodes from the image file - supports PNG, JPG, BMP, GIF, and more
BarcodeResults results = BarcodeReader.Read("GetStarted.png");

// Check if any barcodes were detected
if (results != null && results.Co/unt > 0)
{
    // Process each barcode found in the image
    foreach (BarcodeResult result in results)
    {
        // Extract the text value from the barcode
        Console.WriteLine("Barcode detected! Value: " + result.Text);

        // Additional properties available:
        // result.BarcodeType - The format (Code128, QR, etc.)
        // result.BinaryValue - Raw binary data if applicable
        // result.Co/nfidence - Detection confidence score
    }
}
else
{
    Console.WriteLine("No barcodes detected in the image.");
}
using IronBarCode;
using System;

// Read barcodes from the image file - supports PNG, JPG, BMP, GIF, and more
BarcodeResults results = BarcodeReader.Read("GetStarted.png");

// Check if any barcodes were detected
if (results != null && results.Co/unt > 0)
{
    // Process each barcode found in the image
    foreach (BarcodeResult result in results)
    {
        // Extract the text value from the barcode
        Console.WriteLine("Barcode detected! Value: " + result.Text);

        // Additional properties available:
        // result.BarcodeType - The format (Code128, QR, etc.)
        // result.BinaryValue - Raw binary data if applicable
        // result.Co/nfidence - Detection confidence score
    }
}
else
{
    Console.WriteLine("No barcodes detected in the image.");
}
Imports IronBarCode
Imports System

' Read barcodes from the image file - supports PNG, JPG, BMP, GIF, and more
Dim results As BarcodeResults = BarcodeReader.Read("GetStarted.png")

' Check if any barcodes were detected
If results IsNot Nothing AndAlso results.Count > 0 Then
    ' Process each barcode found in the image
    For Each result As BarcodeResult In results
        ' Extract the text value from the barcode
        Console.WriteLine("Barcode detected! Value: " & result.Text)

        ' Additional properties available:
        ' result.BarcodeType - The format (Code128, QR, etc.)
        ' result.BinaryValue - Raw binary data if applicable
        ' result.Confidence - Detection confidence score
    Next
Else
    Console.WriteLine("No barcodes detected in the image.")
End If
$vbLabelText   $csharpLabel

BarcodeReader.Read メソッドは、検出されたすべての BARCODE を含む BarcodeResults コレクションを返します。 各 BarcodeResult には、BARCODEのテキスト値、フォーマットタイプ、位置座標、およびバイナリデータへのアクセスが含まれています。 このアプローチは、Code128、Code39、QRコード、Data Matrixコードなどの一般的なBARCODE形式とシームレスに連携します。

読み取りが困難なBARCODEや損傷したBARCODEを読み取るには、どのような方法がありますか?

実際のBARCODEスキャンでは、角度のずれ、照明の悪さ、部分的な損傷など、画像の状態が不完全な場合がよくあります。 IronBarcodeの高度なオプションは、これらの課題を効果的に解決します。

using IronBarCode;

// Configure advanced reading options for difficult barcodes
BarcodeReaderOptions options = new BarcodeReaderOptions
{
    // Speed settings: Faster, Balanced, Detailed, ExtremeDetail
    // ExtremeDetail performs deep analysis for challenging images
    Speed = ReadingSpeed.ExtremeDetail,

    // Specify expected formats to improve performance
    // Use bitwise OR (|) to combine multiple formats
    ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Co/de128,

    // Maximum number of barcodes to find (0 = unlimited)
    MaxParallelThreads = 4,

    // Crop region for faster processing of specific areas
    CropArea = null // Or specify a Rectangle
};

// Apply options when reading
BarcodeResults results = BarcodeReader.Read("TryHarderQR.png", options);

// Process detected barcodes
foreach (var barcode in results)
{
    Console.WriteLine($"Format: {barcode.BarcodeType}, Value: {barcode.Text}");
}
using IronBarCode;

// Configure advanced reading options for difficult barcodes
BarcodeReaderOptions options = new BarcodeReaderOptions
{
    // Speed settings: Faster, Balanced, Detailed, ExtremeDetail
    // ExtremeDetail performs deep analysis for challenging images
    Speed = ReadingSpeed.ExtremeDetail,

    // Specify expected formats to improve performance
    // Use bitwise OR (|) to combine multiple formats
    ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Co/de128,

    // Maximum number of barcodes to find (0 = unlimited)
    MaxParallelThreads = 4,

    // Crop region for faster processing of specific areas
    CropArea = null // Or specify a Rectangle
};

// Apply options when reading
BarcodeResults results = BarcodeReader.Read("TryHarderQR.png", options);

// Process detected barcodes
foreach (var barcode in results)
{
    Console.WriteLine($"Format: {barcode.BarcodeType}, Value: {barcode.Text}");
}
Imports IronBarCode

' Configure advanced reading options for difficult barcodes
Dim options As New BarcodeReaderOptions With {
    ' Speed settings: Faster, Balanced, Detailed, ExtremeDetail
    ' ExtremeDetail performs deep analysis for challenging images
    .Speed = ReadingSpeed.ExtremeDetail,

    ' Specify expected formats to improve performance
    ' Use bitwise OR (|) to combine multiple formats
    .ExpectBarcodeTypes = BarcodeEncoding.QRCode Or BarcodeEncoding.Code128,

    ' Maximum number of barcodes to find (0 = unlimited)
    .MaxParallelThreads = 4,

    ' Crop region for faster processing of specific areas
    .CropArea = Nothing ' Or specify a Rectangle
}

' Apply options when reading
Dim results As BarcodeResults = BarcodeReader.Read("TryHarderQR.png", options)

' Process detected barcodes
For Each barcode In results
    Console.WriteLine($"Format: {barcode.BarcodeType}, Value: {barcode.Text}")
Next barcode
$vbLabelText   $csharpLabel
QR code rotated 45 degrees demonstrating IronBarcode's rotation handling *IronBarcodeが高度なオプションを使用して正常に読み取った、回転されたQRコード*

ExpectBarcodeTypes プロパティは、検索を特定の形式に限定することで、パフォーマンスを大幅に向上させます。 問題のある画像の精度を最大限に高めるには、画像フィルターと自動回転機能を組み合わせて使用してください:

using IronBarCode;

BarcodeReaderOptions options = new BarcodeReaderOptions
{
    // Apply image processing filters to enhance readability
    ImageFilters = new ImageFilterCollection
    {
        new AdaptiveThresholdFilter(9, 0.01f), // Handles varying lighting
        new ContrastFilter(2.0f),               // Increases contrast
        new SharpenFilter()                     // Reduces blur
    },

    // Automatically rotate to find barcodes at any angle
    AutoRotate = true,

    // Use multiple CPU cores for faster processing
    Multithreaded = true
};

BarcodeResults results = BarcodeReader.Read("TryHarderQR.png", options);

foreach (var result in results)
{
    Console.WriteLine($"Detected {result.BarcodeType}: {result.Text}");
    Console.WriteLine($"Confidence: {result.Co/nfidence}%");
    Console.WriteLine($"Position: X={result.X}, Y={result.Y}");
}
using IronBarCode;

BarcodeReaderOptions options = new BarcodeReaderOptions
{
    // Apply image processing filters to enhance readability
    ImageFilters = new ImageFilterCollection
    {
        new AdaptiveThresholdFilter(9, 0.01f), // Handles varying lighting
        new ContrastFilter(2.0f),               // Increases contrast
        new SharpenFilter()                     // Reduces blur
    },

    // Automatically rotate to find barcodes at any angle
    AutoRotate = true,

    // Use multiple CPU cores for faster processing
    Multithreaded = true
};

BarcodeResults results = BarcodeReader.Read("TryHarderQR.png", options);

foreach (var result in results)
{
    Console.WriteLine($"Detected {result.BarcodeType}: {result.Text}");
    Console.WriteLine($"Confidence: {result.Co/nfidence}%");
    Console.WriteLine($"Position: X={result.X}, Y={result.Y}");
}
Imports IronBarCode

Dim options As New BarcodeReaderOptions With {
    .ImageFilters = New ImageFilterCollection From {
        New AdaptiveThresholdFilter(9, 0.01F), ' Handles varying lighting
        New ContrastFilter(2.0F),               ' Increases contrast
        New SharpenFilter()                     ' Reduces blur
    },
    .AutoRotate = True,                         ' Automatically rotate to find barcodes at any angle
    .Multithreaded = True                       ' Use multiple CPU cores for faster processing
}

Dim results As BarcodeResults = BarcodeReader.Read("TryHarderQR.png", options)

For Each result In results
    Console.WriteLine($"Detected {result.BarcodeType}: {result.Text}")
    Console.WriteLine($"Confidence: {result.Confidence}%")
    Console.WriteLine($"Position: X={result.X}, Y={result.Y}")
Next
$vbLabelText   $csharpLabel

これらの高度な機能により、IronBarcodeは、画像の画質が大きく異なる写真、防犯カメラ、またはモバイルデバイスで撮影した画像からBARCODEをスキャンするのに最適です。

PDF文書から複数のBarCodeをスキャンするにはどうすればよいですか?

PDFのBARCODEスキャンは、請求書、配送ラベル、在庫書類の処理に不可欠です。 IronBarcodeは、すべてのページにわたるすべてのBarCodeを効率的に読み取ります。

PDFファイルからBARCODEを読み取る

using System;
using IronBarCode;

try
{
    // Scan all pages of a PDF for barcodes
    BarcodeResults results = BarcodeReader.ReadPdf("MultipleBarcodes.pdf");

    if (results != null && results.Co/unt > 0)
    {
        foreach (var barcode in results)
        {
            // Access barcode data and metadata
            string value = barcode.Text;
            int pageNumber = barcode.PageNumber;
            BarcodeEncoding format = barcode.BarcodeType;
            byte[] binaryData = barcode.BinaryValue;

            // Extract barcode image if needed
            System.Drawing.Bitmap barcodeImage = barcode.BarcodeImage;

            Console.WriteLine($"Found {format} on page {pageNumber}: {value}");
        }
    }
    else
    {
        Console.WriteLine("No barcodes found in the PDF.");
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Error reading PDF: {ex.Message}");
}
using System;
using IronBarCode;

try
{
    // Scan all pages of a PDF for barcodes
    BarcodeResults results = BarcodeReader.ReadPdf("MultipleBarcodes.pdf");

    if (results != null && results.Co/unt > 0)
    {
        foreach (var barcode in results)
        {
            // Access barcode data and metadata
            string value = barcode.Text;
            int pageNumber = barcode.PageNumber;
            BarcodeEncoding format = barcode.BarcodeType;
            byte[] binaryData = barcode.BinaryValue;

            // Extract barcode image if needed
            System.Drawing.Bitmap barcodeImage = barcode.BarcodeImage;

            Console.WriteLine($"Found {format} on page {pageNumber}: {value}");
        }
    }
    else
    {
        Console.WriteLine("No barcodes found in the PDF.");
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Error reading PDF: {ex.Message}");
}
Imports System
Imports IronBarCode

Try
    ' Scan all pages of a PDF for barcodes
    Dim results As BarcodeResults = BarcodeReader.ReadPdf("MultipleBarcodes.pdf")

    If results IsNot Nothing AndAlso results.Count > 0 Then
        For Each barcode In results
            ' Access barcode data and metadata
            Dim value As String = barcode.Text
            Dim pageNumber As Integer = barcode.PageNumber
            Dim format As BarcodeEncoding = barcode.BarcodeType
            Dim binaryData As Byte() = barcode.BinaryValue

            ' Extract barcode image if needed
            Dim barcodeImage As System.Drawing.Bitmap = barcode.BarcodeImage

            Console.WriteLine($"Found {format} on page {pageNumber}: {value}")
        Next
    Else
        Console.WriteLine("No barcodes found in the PDF.")
    End If
Catch ex As Exception
    Console.WriteLine($"Error reading PDF: {ex.Message}")
End Try
$vbLabelText   $csharpLabel

コンソール出力を表示するPDFページ全体で複数のBARCODEが検出されました 異なるPDFページにまたがって複数のBARCODEが見つかったことを示すコンソール出力

特定のページ範囲や高度なPDF処理については、BarcodeReaderOptionsを使用してください:

// Read only specific pages to improve performance
BarcodeReaderOptions pdfOptions = new BarcodeReaderOptions
{
    // Scan pages 1-5 only
    PageNumbers = new[] { 1, 2, 3, 4, 5 },

    // PDF-specific settings
    PdfDpi = 300, // Higher DPI for better accuracy
    ReadBehindVectorGraphics = true
};

BarcodeResults results = BarcodeReader.ReadPdf("document.pdf", pdfOptions);
// Read only specific pages to improve performance
BarcodeReaderOptions pdfOptions = new BarcodeReaderOptions
{
    // Scan pages 1-5 only
    PageNumbers = new[] { 1, 2, 3, 4, 5 },

    // PDF-specific settings
    PdfDpi = 300, // Higher DPI for better accuracy
    ReadBehindVectorGraphics = true
};

BarcodeResults results = BarcodeReader.ReadPdf("document.pdf", pdfOptions);
' Read only specific pages to improve performance
Dim pdfOptions As New BarcodeReaderOptions With {
	.PageNumbers = { 1, 2, 3, 4, 5 },
	.PdfDpi = 300,
	.ReadBehindVectorGraphics = True
}

Dim results As BarcodeResults = BarcodeReader.ReadPdf("document.pdf", pdfOptions)
$vbLabelText   $csharpLabel

マルチフレーム TIFF 画像を処理するにはどうすればよいですか?

ドキュメントスキャンやFAXシステムで一般的なマルチフレームTIFFファイルも、PDFと同様に包括的なサポートが提供されています。

複数のフレームにまたがるBarCodeを含むマルチフレーム TIFF 異なるフレームにBARCODEが含まれるマルチフレームTIFFファイル

using IronBarCode;

// TIFF files are processed similarly to regular images
// Each frame is scanned automatically
BarcodeResults multiFrameResults = BarcodeReader.Read("Multiframe.tiff");

foreach (var result in multiFrameResults)
{
    // Access frame-specific information
    int frameNumber = result.PageNumber; // Frame number in TIFF
    string barcodeValue = result.Text;

    Console.WriteLine($"Frame {frameNumber}: {barcodeValue}");

    // Save individual barcode images if needed
    result.BarcodeImage?.Save($"barcode_frame_{frameNumber}.png");
}
using IronBarCode;

// TIFF files are processed similarly to regular images
// Each frame is scanned automatically
BarcodeResults multiFrameResults = BarcodeReader.Read("Multiframe.tiff");

foreach (var result in multiFrameResults)
{
    // Access frame-specific information
    int frameNumber = result.PageNumber; // Frame number in TIFF
    string barcodeValue = result.Text;

    Console.WriteLine($"Frame {frameNumber}: {barcodeValue}");

    // Save individual barcode images if needed
    result.BarcodeImage?.Save($"barcode_frame_{frameNumber}.png");
}
Imports IronBarCode

' TIFF files are processed similarly to regular images
' Each frame is scanned automatically
Private multiFrameResults As BarcodeResults = BarcodeReader.Read("Multiframe.tiff")

For Each result In multiFrameResults
	' Access frame-specific information
	Dim frameNumber As Integer = result.PageNumber ' Frame number in TIFF
	Dim barcodeValue As String = result.Text

	Console.WriteLine($"Frame {frameNumber}: {barcodeValue}")

	' Save individual barcode images if needed
	If result.BarcodeImage IsNot Nothing Then
		result.BarcodeImage.Save($"barcode_frame_{frameNumber}.png")
	End If
Next result
$vbLabelText   $csharpLabel

画像フィルターや回転設定を含むTIFF処理についても、同様のBarcodeReaderOptionsが適用されます。 TIFF ファイルの詳細な取り扱い方法については、当社の画像処理チュートリアルをご覧ください。

マルチスレッド化によって処理を高速化できますか?

複数のドキュメントを処理する場合、並列処理を活用することで劇的な効率化が図れます。 IronBarcodeは、最適なパフォーマンスを得るために利用可能なCPUコアを自動的に活用します。

using IronBarCode;

// List of documents to process - mix of formats supported
var documentBatch = new[] 
{ 
    "invoice1.pdf", 
    "shipping_label.png", 
    "inventory_sheet.tiff",
    "product_catalog.pdf"
};

// Configure for batch processing
BarcodeReaderOptions batchOptions = new BarcodeReaderOptions
{
    // Enable parallel processing across documents
    Multithreaded = true,

    // Limit threads if needed (0 = use all cores)
    MaxParallelThreads = Environment.ProcessorCount,

    // Apply consistent settings to all documents
    Speed = ReadingSpeed.Balanced,
    ExpectBarcodeTypes = BarcodeEncoding.All
};

// Process all documents in parallel
BarcodeResults batchResults = BarcodeReader.Read(documentBatch, batchOptions);

// Group results by source document
var resultsByDocument = batchResults.GroupBy(r => r.Filename);

foreach (var docGroup in resultsByDocument)
{
    Console.WriteLine($"\nDocument: {docGroup.Key}");
    foreach (var barcode in docGroup)
    {
        Console.WriteLine($"  - {barcode.BarcodeType}: {barcode.Text}");
    }
}
using IronBarCode;

// List of documents to process - mix of formats supported
var documentBatch = new[] 
{ 
    "invoice1.pdf", 
    "shipping_label.png", 
    "inventory_sheet.tiff",
    "product_catalog.pdf"
};

// Configure for batch processing
BarcodeReaderOptions batchOptions = new BarcodeReaderOptions
{
    // Enable parallel processing across documents
    Multithreaded = true,

    // Limit threads if needed (0 = use all cores)
    MaxParallelThreads = Environment.ProcessorCount,

    // Apply consistent settings to all documents
    Speed = ReadingSpeed.Balanced,
    ExpectBarcodeTypes = BarcodeEncoding.All
};

// Process all documents in parallel
BarcodeResults batchResults = BarcodeReader.Read(documentBatch, batchOptions);

// Group results by source document
var resultsByDocument = batchResults.GroupBy(r => r.Filename);

foreach (var docGroup in resultsByDocument)
{
    Console.WriteLine($"\nDocument: {docGroup.Key}");
    foreach (var barcode in docGroup)
    {
        Console.WriteLine($"  - {barcode.BarcodeType}: {barcode.Text}");
    }
}
Imports Microsoft.VisualBasic
Imports IronBarCode

' List of documents to process - mix of formats supported
Private documentBatch = { "invoice1.pdf", "shipping_label.png", "inventory_sheet.tiff", "product_catalog.pdf" }

' Configure for batch processing
Private batchOptions As New BarcodeReaderOptions With {
	.Multithreaded = True,
	.MaxParallelThreads = Environment.ProcessorCount,
	.Speed = ReadingSpeed.Balanced,
	.ExpectBarcodeTypes = BarcodeEncoding.All
}

' Process all documents in parallel
Private batchResults As BarcodeResults = BarcodeReader.Read(documentBatch, batchOptions)

' Group results by source document
Private resultsByDocument = batchResults.GroupBy(Function(r) r.Filename)

For Each docGroup In resultsByDocument
	Console.WriteLine($vbLf & "Document: {docGroup.Key}")
	For Each barcode In docGroup
		Console.WriteLine($"  - {barcode.BarcodeType}: {barcode.Text}")
	Next barcode
Next docGroup
$vbLabelText   $csharpLabel

この並列処理アプローチにより、ドキュメントが同時に処理され、マルチコアシステムではスキャン総時間を最大75%短縮できます。 Enterprise規模のBARCODE処理については、当社のパフォーマンス最適化ガイドをご覧ください。

概要

IronBarcodeは、複雑なBarCodeスキャン処理をシンプルなC#コードに変換します。 在庫管理システム、ドキュメント処理システム、あるいはモバイルアプリケーションの構築を問わず、このライブラリは、鮮明なデジタルBARCODEから、現実世界での困難なキャプチャまで、あらゆる状況に対応します。

主な機能:

  • 画像からの1行BarCode読み取り
  • 破損または回転したBARCODEに対する高度なオプション
  • PDFおよびTIFFドキュメントの包括的なスキャン
  • マルチスレッドによる高性能なバッチ処理
  • 主要なBarCode形式をすべてサポート

関連情報

以下のリソースを活用して、BarCode処理機能を拡張しましょう:

ソースコードのダウンロード

以下のサンプルを実際に実行してみてください:

アプリケーションにBARCODEスキャン機能を実装する準備はできていますか? 今すぐ無料トライアルを開始し、.NETプロジェクトにProfessionalなBarCode読み取り機能を追加しましょう。

今IronBarcodeを始めましょう。
green arrow pointer

よくある質問

.NETプロジェクトにバーコード読み取りライブラリをインストールするにはどうすればよいですか?

dotnet add package BarCodeというコマンドを使用してNuGetパッケージマネージャーを通じてIronBarcodeライブラリをインストールすることができます。または、Visual StudioのNuGetインターフェースを使用することもできます。手動インストールのためにDLLをダウンロードするという方法もあります。

C#を使用して画像からバーコードを読み取る方法は何ですか?

IronBarcodeからBarcodeReader.Readメソッドを1行のコードで使用します: var results = BarcodeReader.Read('image.png'); このメソッドは画像内のすべてのバーコード形式を検出して読み取ります。

単一の画像またはドキュメントで複数のバーコードを検出することは可能ですか?

はい、IronBarcodeは画像、PDF、またはマルチフレームTIFF内の複数のバーコードを自動的に検出して読み取り、各バーコードの値、タイプ、および位置をBarcodeResultsコレクションで返します。

C#を使用してPDFからバーコードを読む方法は何ですか?

IronBarcodeのBarcodeReader.ReadPdfメソッドを使用して、PDFドキュメントのすべてのページをスキャンします: var results = BarcodeReader.ReadPdf('document.pdf'); 各結果にはバーコードが発見されたページ番号が含まれます。

バーコード画像がぼやけていたり回転している場合はどうすればよいですか?

画像フィルタ SharpenFilter または AdaptiveThresholdFilter を適用し、AutoRotate = true を設定して難しい画像を処理するためにBarcodeReaderOptionsを設定します。より良い精度のためにSpeed = ExtremeDetailを使用します。

.NETアプリケーションでサポートされているバーコード形式はどれですか?

IronBarcodeは、QRコード、Code 128、Code 39、EAN-13、UPC-A、Data Matrix、PDF417、その他の主要なバーコード形式をすべてサポートしています。BarcodeEncoding.Allを使用して任意のサポートされた形式をスキャンします。

C#アプリケーションでバーコードスキャンのパフォーマンスをどのように向上させることができますか?

ExpectBarcodeTypesを使用して予想されるバーコードタイプを指定し、マルチスレッド処理を有効にし、適切なSpeed設定を選択してパフォーマンスを向上させます。バッチタスクの場合、ファイルパス付きのBarcodeReader.Readを使用します。

バーコード読み取りエラーを処理するための推奨アプローチは何ですか?

try-catchブロックでバーコード読み取りをカプセル化し、結果がnullまたは空であるかを確認します。IronBarcodeは、検出の信頼性を示す詳細なエラーメッセージとConfidenceプロパティを提供します。

スキャン後にバーコード画像を抽出できますか?

はい、IronBarcodeのBarcodeResultには、検出されたバーコードのBitmapを含むBarcodeImageプロパティが含まれており、それを保存したり別に処理したりできます。

PDFドキュメント内の特定のページからバーコードを読む方法は何ですか?

BarcodeReaderOptionsPageNumbersプロパティを設定してページを指定します: options.PageNumbers = new[] {1, 2, 3}; これにより指定されたページでのみスキャンすることでパフォーマンスが最適化されます。

.NETでのバーコードスキャンに対応した画像形式は何ですか?

IronBarcodeは、PNG、JPEG、BMP、GIF、TIFF(マルチフレームを含む)、PDFの形式でのスキャンをサポートしています。ファイルパス、ストリーム、またはバイト配列から画像をロードできます。

C#でスキャンされたバーコードからバイナリデータにアクセスする方法は何ですか?

特に圧縮情報やバイナリプロトコルなど、非テキストデータを含むバーコードの生のバイナリデータを取得するには、BarcodeResultBinaryValueプロパティを使用します。

Jacob Mellor、Ironチームの最高技術責任者(CTO)
最高技術責任者(CTO)

ジェイコブ・メラーはIron Softwareの最高技術責任者(CTO)であり、C# PDFテクノロジーを開拓する先見的なエンジニアです。Iron Softwareのコアコードベースを支えるオリジナル開発者として、彼は創業以来、会社の製品アーキテクチャを形成し、CEOのCameron Rimingtonとともに、会社をNASA、Tesla、および世界的な政府機関にサービスを提供する50人以上の会社に変えました。1999年にロンドンで最初のソフトウェアビジネスを開業し、2005年に最初 for .NETコンポーネントを作成した後、Microsoftのエコシステム全体で複雑な問題を解決することを専門としました。

彼の主要なIronPDFとIron Suite .NETライブラリは、世界中で3000万以上のNuGetインストールを達成し、彼の基礎となるコードは世界中で使用されている開発者ツールに力を与え続けています。25年の商業経験と41年のコーディングの専門知識を持つJacobは、次世代の技術リーダーを指導しながら、エンタープライズグレードのC#、Java、Python PDFテクノロジーにおけるイノベーションの推進に注力しています。

準備はできましたか?
Nuget ダウンロード 2,240,258 | バージョン: 2026.5 just released
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか? PM > Install-Package BarCode
サンプルを実行する 文字列が BarCode になるのを見る。