フッターコンテンツにスキップ
ビデオ

IronBarcodeとZXing.NETライブラリの比較

Scandit SDKからIronBarcodeへの移行

Scandit SDKは、リアルタイムのモバイルバーコード検出のために構築されたカメラスキャンプラットフォームです。 IronBarcodeは、 .NET向けのサーバーサイドおよびファイルベースのバーコード処理ライブラリです。 これら2つのライブラリはそれぞれ異なる主要な用途を想定しており、一方から他方への移行は特定の状況においてのみ意味を持ちます。

このガイドでは、Scandit for .NETパッケージを使用してファイル、PDF、またはサーバーサイドのドキュメントストリームを処理するチームの移行パスについて説明します。これは、Scanditのカメラパイプラインアーキテクチャが価値を生み出すのではなく、むしろ摩擦を生むシナリオを想定しています。 もしあなたの主な要件が、モバイルカメラを物理的な物体に向けて、拡張現実オーバーレイによるリアルタイムのフィードバックを受け取ることであるならば、Scanditは依然として適切なツールであり、このガイドは適用されません。 アップロードされた画像からバーコードを読み取る、PDF ドキュメントからバーコードデータを抽出する、またはASP.NET Core、Azure Functions、Docker コンテナ、バックグラウンド処理サービスでバーコード検出を実行する必要がある場合は、このガイドが完全な移行パスを提供します。

Scandit SDKから移行する理由

カメラパイプラインのオーバーヘッド:カメラパイプラインオーバーヘッド: 展開環境にカメラが存在するかどうかにかかわらず、Iron製品のすべての統合は同じ初期化シーケンスで開始されます:Cameraインスタンスを取得し、それをフレームソースとして割り当て、カメラをアクティブな状態に移行し、バーコードキャプチャを有効にします。 Scanditはライブビデオフレームを処理するため、この初期化処理が必要となります。 サーバー側のファイル処理においては、この手順は何のメリットももたらさず、ターゲット環境には存在しないステートフルな複雑さを導入することになります。Dockerコンテナにはカメラがなく、Azure Functionsにはフレームソースがないためです。

価格非公開: Scanditは価格を公開していません。 SparkScan、MatrixScan、IDスキャン、ARオーバーレイ、およびパーサーは、それぞれ個別に価格設定されている製品であり、それぞれ個別に販売に関するお問い合わせが必要です。 予算提案、ベンダー比較、または費用対効果分析は、販売サイクルに入ることなしに完了できません。 IronBarcodeは価格を公開しており、749ドル、1,499ドル、または2,999ドルの1回限りの永久ライセンス購入となっているため、コードを一行も書く前に価格がわかるようになっている。

必須シンボル宣言: Scanditでは、スキャンセッションを開始する前に、各バーコード形式を明示的に有効にする必要があります。 リアルタイムのカメラスキャンにおいては、これはパフォーマンスの最適化であり、シンボル体系を制限することでフレームごとの処理オーバーヘッドを削減できる。 ファイルベースの文書処理では、受信する文書がどのサプライヤーやパートナーから送られてきたものであっても、どのようなバーコード形式であっても構わないため、形式を必須として宣言することが制約となる。 考えられるすべての記号体系を列挙すると、パフォーマンス上の利点が失われます。 ライブラリの上にフォーマット推測ロジックを記述すると、エンジニアリング上のオーバーヘッドが増加します。

PDF非サポート:PDF非サポート: Iron製品のAPIにはBarcodeReader.Read("invoice.pdf")に直接相当するものはありません。 PDF文書からバーコードを抽出するには、各ページを別のライブラリを使用してラスター画像にレンダリングし、レンダリングされた画像をカメラシミュレーションパイプラインに通す必要があります。このアプローチでは、文書処理ワークフローにおいて日常的に行われる作業であるにもかかわらず、追加の依存関係、追加のライセンス、そして相当なエンジニアリング作業が発生します。

基本的な問題

Scanditでは、バーコード関連の作業を開始する前に、カメラが動作している必要があります。 IronBarcodeに必要なのはファイルパスのみです。

// Scandit SDK: mandatory camera pipeline before first barcode read
var dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE");
var settings = BarcodeCaptureSettings.Create();
settings.EnableSymbologies(new HashSet<Symbology>
{
    Symbology.Ean13Upca,
    Symbology.Ean8,
    Symbology.Code128,
    Symbology.QrCode
});
var barcodeCapture = BarcodeCapture.Create(dataCaptureContext, settings);
var camera = Camera.GetDefaultCamera();
await dataCaptureContext.SetFrameSourceAsync(camera);
await camera.SwitchToDesiredStateAsync(FrameSourceState.On);
barcodeCapture.IsEnabled = true;
// Results arrive later via BarcodeScanned event callback
// Scandit SDK: mandatory camera pipeline before first barcode read
var dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE");
var settings = BarcodeCaptureSettings.Create();
settings.EnableSymbologies(new HashSet<Symbology>
{
    Symbology.Ean13Upca,
    Symbology.Ean8,
    Symbology.Code128,
    Symbology.QrCode
});
var barcodeCapture = BarcodeCapture.Create(dataCaptureContext, settings);
var camera = Camera.GetDefaultCamera();
await dataCaptureContext.SetFrameSourceAsync(camera);
await camera.SwitchToDesiredStateAsync(FrameSourceState.On);
barcodeCapture.IsEnabled = true;
// Results arrive later via BarcodeScanned event callback
Imports Scandit.DataCapture.Core
Imports Scandit.DataCapture.Barcode
Imports System.Collections.Generic

' Scandit SDK: mandatory camera pipeline before first barcode read
Dim dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE")
Dim settings = BarcodeCaptureSettings.Create()
settings.EnableSymbologies(New HashSet(Of Symbology) From {
    Symbology.Ean13Upca,
    Symbology.Ean8,
    Symbology.Code128,
    Symbology.QrCode
})
Dim barcodeCapture = BarcodeCapture.Create(dataCaptureContext, settings)
Dim camera = Camera.GetDefaultCamera()
Await dataCaptureContext.SetFrameSourceAsync(camera)
Await camera.SwitchToDesiredStateAsync(FrameSourceState.On)
barcodeCapture.IsEnabled = True
' Results arrive later via BarcodeScanned event callback
$vbLabelText   $csharpLabel
// IronBarcode: direct file reading
// NuGet: dotnet add package IronBarcode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var results = BarcodeReader.Read("barcode.png");
foreach (var result in results)
    Console.WriteLine($"{result.Value} ({result.Format})");
// IronBarcode: direct file reading
// NuGet: dotnet add package IronBarcode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var results = BarcodeReader.Read("barcode.png");
foreach (var result in results)
    Console.WriteLine($"{result.Value} ({result.Format})");
Imports IronBarCode

' IronBarcode: direct file reading
' NuGet: dotnet add package IronBarcode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim results = BarcodeReader.Read("barcode.png")
For Each result In results
    Console.WriteLine($"{result.Value} ({result.Format})")
Next
$vbLabelText   $csharpLabel

カメラパイプライン全体(コンテキストの作成、設定、シンボル表示の有効化、カメラの取得、フレームソースの割り当て、状態遷移)は、ライセンスキーの割り当てと単一のメソッド呼び出しに置き換えられます。

IronBarcodeとScandit SDKの比較:機能比較

フィーチャー Scandit SDK IronBarcode
主要配備 モバイルカメラスキャン サーバー、クラウド、デスクトップのファイル処理
カメラが必要です はい なし
画像ファイルの読み込み 設計されていません 主要入力タイプ
PDFバーコード抽出 サポートされていません ネイティブな複数ページサポート
ストリーム/バイト配列入力 サポートされていません はい
自動フォーマット検出 いいえ(必ず明記してください) はい(デフォルトの動作)
イベント主導型の結果 はい(バーコードスキャンコールバック) いいえ(同期リターン)
ASP.NET Core / サーバーサイド 設計されていません 完全サポート
Azure Functions / サーバーレス 実用的ではない 完全サポート
Docker(Docker)/ Linux(リナックス) サポートされていません 完全サポート
バーコード生成 サポートされていません パッケージに含まれるもの
複数バーコード検出 MatrixScan(別製品) パッケージに含まれるもの
価格設定モデル 販売担当者にお問い合わせください(製品ごと) 公開された永続的なティア
スキャンごと/デバイスごとの料金 はい なし

クイックスタート

ステップ 1: NuGet パッケージを置き換える

Scanditパッケージを削除します。

dotnet remove package Scandit.BarcodePicker
dotnet remove package Scandit.DataCapture.Core
dotnet remove package Scandit.DataCapture.Barcode
dotnet remove package Scandit.BarcodePicker
dotnet remove package Scandit.DataCapture.Core
dotnet remove package Scandit.DataCapture.Barcode
SHELL

IronBarcodeをインストールしてください:

dotnet add package IronBarcode
dotnet add package IronBarcode
SHELL

ステップ 2: 名前空間の更新

Scandit名前空間のインポートをIronBarcode名前空間で置き換えます:

// Before (Scandit SDK)
using Scandit.DataCapture.Core;
using Scandit.DataCapture.Barcode;
using Scandit.DataCapture.Barcode.Data;

// After (IronBarcode)
using IronBarCode;
// Before (Scandit SDK)
using Scandit.DataCapture.Core;
using Scandit.DataCapture.Barcode;
using Scandit.DataCapture.Barcode.Data;

// After (IronBarcode)
using IronBarCode;
' Before (Scandit SDK)
Imports Scandit.DataCapture.Core
Imports Scandit.DataCapture.Barcode
Imports Scandit.DataCapture.Barcode.Data

' After (IronBarcode)
Imports IronBarCode
$vbLabelText   $csharpLabel

ステップ 3: ライセンスの初期化

アプリケーションの起動時にライセンス初期化を追加し、DataCaptureContext.ForLicenseKey呼び出しを置き換えます。

// Before (Scandit SDK)
var dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE");

// After (IronBarcode)
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Before (Scandit SDK)
var dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE");

// After (IronBarcode)
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
' Before (Scandit SDK)
Dim dataCaptureContext = DataCaptureContext.ForLicenseKey("YOUR-SCANDIT-LICENSE")

' After (IronBarcode)
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

コード移行の例

画像ファイルからバーコードを読み取る

静止画像ファイルの処理は、 IronBarcodeではコアサポートされたシナリオですが、Scanditではサポートされていないワークフローです。 Scandit SDKはライブカメラフレームを処理します。 ファイルを読み込むには、キャプチャパイプラインを適応させてビットマップをフレームソースとして扱う必要があるが、これにはネイティブな実装がない。

Scandit SDKのアプローチ:

//Scandit SDKhas no direct file-read API.
// Reading a static image requires constructing a bitmap frame source
// and routing it through the capture pipeline — an unsupported workaround.
// The standard Scandit integration assumes a running camera at all times.
//Scandit SDKhas no direct file-read API.
// Reading a static image requires constructing a bitmap frame source
// and routing it through the capture pipeline — an unsupported workaround.
// The standard Scandit integration assumes a running camera at all times.
' Scandit SDK has no direct file-read API.
' Reading a static image requires constructing a bitmap frame source
' and routing it through the capture pipeline — an unsupported workaround.
' The standard Scandit integration assumes a running camera at all times.
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("product-label.png");
foreach (var result in results)
{
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Format: {result.Format}");
    Console.WriteLine($"Confidence: {result.Confidence}%");
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("product-label.png");
foreach (var result in results)
{
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Format: {result.Format}");
    Console.WriteLine($"Confidence: {result.Confidence}%");
}
Imports IronBarCode

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim results = BarcodeReader.Read("product-label.png")
For Each result In results
    Console.WriteLine($"Value: {result.Value}")
    Console.WriteLine($"Format: {result.Format}")
    Console.WriteLine($"Confidence: {result.Confidence}%")
Next
$vbLabelText   $csharpLabel

IronBarcodeを使用して画像からバーコードを読み取る場合、パイプラインの設定は不要です。メソッドの実行後すぐに結果コレクションが利用可能になり、イベントの購読も必要ありません。

PDF文書からバーコードを抽出する

PDFバーコードの抽出は、PDFをサポートしていないScanditから移行する場合、全く新しい領域となる。 IronBarcodeはPDF文書を直接読み込み、ページ番号順にインデックス付けされた結果を返します。

Scandit SDKのアプローチ:

// Scandit SDK: no PDF support.
// Implementing PDF barcode extraction with Scandit requires:
// 1. A separate PDF rendering library to convert pages to raster images
// 2. Routing each rendered image through the camera simulation pipeline
// 3. Correlating results back to page numbers manually
// This is not a supported workflow and requires significant custom engineering.
// Scandit SDK: no PDF support.
// Implementing PDF barcode extraction with Scandit requires:
// 1. A separate PDF rendering library to convert pages to raster images
// 2. Routing each rendered image through the camera simulation pipeline
// 3. Correlating results back to page numbers manually
// This is not a supported workflow and requires significant custom engineering.
' Scandit SDK: no PDF support.
' Implementing PDF barcode extraction with Scandit requires:
' 1. A separate PDF rendering library to convert pages to raster images
' 2. Routing each rendered image through the camera simulation pipeline
' 3. Correlating results back to page numbers manually
' This is not a supported workflow and requires significant custom engineering.
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("shipping-manifest.pdf");
foreach (var result in results)
{
    Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.Format})");
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("shipping-manifest.pdf");
foreach (var result in results)
{
    Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.Format})");
}
Imports IronBarCode

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim results = BarcodeReader.Read("shipping-manifest.pdf")
For Each result In results
    Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.Format})")
Next
$vbLabelText   $csharpLabel

PDF文書からバーコードを読み取るための完全なガイダンス(ページ範囲の選択や複数バーコードの処理など)については、 IronBarcodeのドキュメントにPDF処理のあらゆるシナリオが網羅されています。 追加のPDFライブラリへの依存は不要です。

イベントコールバックを直接の戻り値に変換する

Iron製品はBarcodeScannedイベントを通じてバーコード結果を提供します。これは、ライブカメラのスキャンが本質的に非同期であり、カメラが現在のフレームでバーコードを検出した場合に結果が届くためです。 IronBarcodeは、ファイルベースの読み取りには完了境界が既知であるため、結果を型付きコレクションとして返します。 これは、移住における構造的に最も重要な変化の一つである。

Scandit SDKのアプローチ:

// Scandit SDK: event-driven result delivery
barcodeCapture.BarcodeScanned += (sender, args) =>
{
    foreach (var barcode in args.Session.NewlyRecognizedBarcodes)
    {
        string value = barcode.Data;
        string symbology = barcode.Symbology.ToString();

        // Processing logic embedded inside event handler
        LogBarcodeResult(value, symbology);
        UpdateInventory(value);
    }
};

// Scan continues indefinitely until camera session is terminated
// Scandit SDK: event-driven result delivery
barcodeCapture.BarcodeScanned += (sender, args) =>
{
    foreach (var barcode in args.Session.NewlyRecognizedBarcodes)
    {
        string value = barcode.Data;
        string symbology = barcode.Symbology.ToString();

        // Processing logic embedded inside event handler
        LogBarcodeResult(value, symbology);
        UpdateInventory(value);
    }
};

// Scan continues indefinitely until camera session is terminated
Imports System

' Scandit SDK: event-driven result delivery
AddHandler barcodeCapture.BarcodeScanned, Sub(sender, args)
    For Each barcode In args.Session.NewlyRecognizedBarcodes
        Dim value As String = barcode.Data
        Dim symbology As String = barcode.Symbology.ToString()

        ' Processing logic embedded inside event handler
        LogBarcodeResult(value, symbology)
        UpdateInventory(value)
    Next
End Sub

' Scan continues indefinitely until camera session is terminated
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("document.png");
foreach (var result in results)
{
    // Same processing logic, now in standard control flow
    LogBarcodeResult(result.Value, result.Format.ToString());
    UpdateInventory(result.Value);
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var results = BarcodeReader.Read("document.png");
foreach (var result in results)
{
    // Same processing logic, now in standard control flow
    LogBarcodeResult(result.Value, result.Format.ToString());
    UpdateInventory(result.Value);
}
Imports IronBarCode

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim results = BarcodeReader.Read("document.png")
For Each result In results
    ' Same processing logic, now in standard control flow
    LogBarcodeResult(result.Value, result.Format.ToString())
    UpdateInventory(result.Value)
Next
$vbLabelText   $csharpLabel

イベントハンドラのコールバックに組み込まれていたすべての処理ロジックは、標準的な逐次コードに移行されます。 エラー処理、ログ記録、および下流処理は、イベントハンドラパターンではなく、通常の制御フローを使用して構成できます。

ASP.NET Coreファイルアップロード用エンドポイント

IronBarcodeの主なサーバー側ユースケースは、アップロードされたファイルからバーコードを読み取るステートレスなサーバーエンドポイントです。 このパターンは、Scanditのカメラパイプラインアーキテクチャではサポートされていません。

Scandit SDKのアプローチ:

// Scandit SDK: not applicable to ASP.NET Core file upload scenarios.
// The DataCaptureContext requires a camera hardware session.
// There is no mechanism to process an IFormFile through the Scandit pipeline
// without substantial custom camera-simulation infrastructure.
// Scandit SDK: not applicable to ASP.NET Core file upload scenarios.
// The DataCaptureContext requires a camera hardware session.
// There is no mechanism to process an IFormFile through the Scandit pipeline
// without substantial custom camera-simulation infrastructure.
' Scandit SDK: not applicable to ASP.NET Core file upload scenarios.
' The DataCaptureContext requires a camera hardware session.
' There is no mechanism to process an IFormFile through the Scandit pipeline
' without substantial custom camera-simulation infrastructure.
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

// NuGet: dotnet add package IronBarcode
using IronBarCode;

[ApiController]
[Route("api/[controller]")]
public class BarcodeController : ControllerBase
{
    [HttpPost("scan")]
    public IActionResult ScanUploadedDocument(IFormFile file)
    {
        if (file == null || file.Length == 0)
            return BadRequest("No file provided");

        using var stream = file.OpenReadStream();
        var results = BarcodeReader.Read(stream);

        if (!results.Any())
            return NotFound("No barcodes detected");

        return Ok(results.Select(r => new
        {
            r.Value,
            Format = r.Format.ToString(),
            r.PageNumber
        }));
    }
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;

[ApiController]
[Route("api/[controller]")]
public class BarcodeController : ControllerBase
{
    [HttpPost("scan")]
    public IActionResult ScanUploadedDocument(IFormFile file)
    {
        if (file == null || file.Length == 0)
            return BadRequest("No file provided");

        using var stream = file.OpenReadStream();
        var results = BarcodeReader.Read(stream);

        if (!results.Any())
            return NotFound("No barcodes detected");

        return Ok(results.Select(r => new
        {
            r.Value,
            Format = r.Format.ToString(),
            r.PageNumber
        }));
    }
}
Imports IronBarCode
Imports Microsoft.AspNetCore.Mvc

<ApiController>
<Route("api/[controller]")>
Public Class BarcodeController
    Inherits ControllerBase

    <HttpPost("scan")>
    Public Function ScanUploadedDocument(file As IFormFile) As IActionResult
        If file Is Nothing OrElse file.Length = 0 Then
            Return BadRequest("No file provided")
        End If

        Using stream = file.OpenReadStream()
            Dim results = BarcodeReader.Read(stream)

            If Not results.Any() Then
                Return NotFound("No barcodes detected")
            End If

            Return Ok(results.Select(Function(r) New With {
                .Value = r.Value,
                .Format = r.Format.ToString(),
                .PageNumber = r.PageNumber
            }))
        End Using
    End Function
End Class
$vbLabelText   $csharpLabel

Streamを受け入れ、仮のファイルは作成する必要がありません。 結果は、非同期カメラ管理なしで、リクエストとレスポンスのサイクル内で同期的に返されます。

複数の文書にわたる同時バッチ処理

大量のドキュメントキューを処理するには、複数のスレッドによる並列処理が必要です。 IronBarcodeのAPIはステートレスなので、本質的にスレッドセーフであり、Parallel.ForEachおよび非同期タスクパターンと直接統合できます。

Scandit SDKのアプローチ:

// Scandit SDK: no supported batch file processing pattern.
// The FrameSourceState model assumes a continuous camera session,
// not a queue of discrete documents. Batch processing would require
// one camera simulation pipeline per document or serialized processing
// through a shared pipeline — neither is a supported workflow.
// Scandit SDK: no supported batch file processing pattern.
// The FrameSourceState model assumes a continuous camera session,
// not a queue of discrete documents. Batch processing would require
// one camera simulation pipeline per document or serialized processing
// through a shared pipeline — neither is a supported workflow.
' Scandit SDK: no supported batch file processing pattern.
' The FrameSourceState model assumes a continuous camera session,
' not a queue of discrete documents. Batch processing would require
' one camera simulation pipeline per document or serialized processing
' through a shared pipeline — neither is a supported workflow.
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

// NuGet: dotnet add package IronBarcode
using IronBarCode;
using System.Collections.Concurrent;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    MaxParallelThreads = 4
};

var files = Directory.GetFiles("./documents/", "*.pdf");
var allResults = new ConcurrentBag<(string File, BarcodeResult Result)>();

Parallel.ForEach(files, file =>
{
    var results = BarcodeReader.Read(file, options);
    foreach (var result in results)
        allResults.Add((file, result));
});

foreach (var (file, result) in allResults)
    Console.WriteLine($"{Path.GetFileName(file)}: {result.Value} ({result.Format})");
// NuGet: dotnet add package IronBarcode
using IronBarCode;
using System.Collections.Concurrent;

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    MaxParallelThreads = 4
};

var files = Directory.GetFiles("./documents/", "*.pdf");
var allResults = new ConcurrentBag<(string File, BarcodeResult Result)>();

Parallel.ForEach(files, file =>
{
    var results = BarcodeReader.Read(file, options);
    foreach (var result in results)
        allResults.Add((file, result));
});

foreach (var (file, result) in allResults)
    Console.WriteLine($"{Path.GetFileName(file)}: {result.Value} ({result.Format})");
Imports IronBarCode
Imports System.Collections.Concurrent
Imports System.IO
Imports System.Threading.Tasks

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim options As New BarcodeReaderOptions With {
    .Speed = ReadingSpeed.Balanced,
    .ExpectMultipleBarcodes = True,
    .MaxParallelThreads = 4
}

Dim files = Directory.GetFiles("./documents/", "*.pdf")
Dim allResults As New ConcurrentBag(Of (File As String, Result As BarcodeResult))()

Parallel.ForEach(files, Sub(file)
    Dim results = BarcodeReader.Read(file, options)
    For Each result In results
        allResults.Add((file, result))
    Next
End Sub)

For Each item In allResults
    Console.WriteLine($"{Path.GetFileName(item.File)}: {item.Result.Value} ({item.Result.Format})")
Next
$vbLabelText   $csharpLabel

スループットの調整やスレッド数の設定など、非同期およびマルチスレッドによるバーコード読み取りに関する高度なパターンについては、 IronBarcodeのドキュメントに詳細なガイダンスが記載されています。

Scandit SDKAPIとIronBarcodeのマッピングリファレンス

Scandit SDK IronBarcode ノート
DataCaptureContext.ForLicenseKey("key") IronBarCode.License.LicenseKey = "key" 任務は1つ。 コンテキストオブジェクトなし
BarcodeCaptureSettings.Create() new BarcodeReaderOptions() オプション。 基本的な読解には必要ありません。
settings.EnableSymbologies(Symbology.Code128, ...) (not needed) IronBarcodeはすべてのフォーマットを自動検出します
Camera.GetDefaultCamera() (not applicable) カメラなしコンセプト
dataCaptureContext.SetFrameSourceAsync(camera) (not applicable) フレームソースなし
camera.SwitchToDesiredStateAsync(FrameSourceState.On) (not applicable) カメラ状態マシンなし
barcodeCapture.IsEnabled = true BarcodeReader.Read(path) 1回の呼び出しで読書が開始されます
BarcodeScanned +=イベントハンドラ 標準のforeach over return value イベントシステムは不要です
args.Session.NewlyRecognizedBarcodes BarcodeReader.Read()の戻り値 直接収集
barcode.Data result.Value 同じ意味内容
barcode.Symbology result.Format 同等のフォーマット列挙
using Scandit.DataCapture.Core using IronBarCode 単一のネームスペース
using Scandit.DataCapture.Barcode using IronBarCode 同じ名前空間に含まれる
SparkScan製品 BarcodeReader.Read(path) 別途製品は必要ありません
MatrixScan製品 BarcodeReaderOptions { ExpectMultipleBarcodes = true } 基本パッケージに含まれています

一般的な移行の問題と解決策

問題点1:カメラパイプラインコードには直接的な翻訳が存在しない

Scandit SDK:Scandit SDK: DataCaptureContext, BarcodeCaptureSettings, Camera, およびBarcodeCaptureセットアップブロックは、非同期状態遷移を伴う7〜10行の初期化コードを含んでいます。

解決策:このブロックは完全に削除されます。 IronBarcodeのファイルベースAPIはセッションの初期化を必要としないため、これに相当するIronBarcodeの機能は存在しません。 ブロック全体を以下に置き換えてください。

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
Imports IronBarCode

IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

問題2:バーコードスキャンイベントハンドラーロジック

Scandit SDK:Scandit SDK: 処理ロジックはBarcodeScanned +=イベントハンドラーのラムダまたはメソッド内に組み込まれています。 このパターンはIronBarcodeには存在しません。

解決策:解決策: ハンドラボディをBarcodeReader.Read呼び出しに続く標準コードに移動します。

// Before: event handler
barcodeCapture.BarcodeScanned += (s, args) =>
{
    foreach (var b in args.Session.NewlyRecognizedBarcodes)
        Console.WriteLine(b.Data);
};

// After: direct iteration
foreach (var result in BarcodeReader.Read("document.png"))
    Console.WriteLine(result.Value);
// Before: event handler
barcodeCapture.BarcodeScanned += (s, args) =>
{
    foreach (var b in args.Session.NewlyRecognizedBarcodes)
        Console.WriteLine(b.Data);
};

// After: direct iteration
foreach (var result in BarcodeReader.Read("document.png"))
    Console.WriteLine(result.Value);
Imports System

' Before: event handler
AddHandler barcodeCapture.BarcodeScanned, Sub(s, args)
    For Each b In args.Session.NewlyRecognizedBarcodes
        Console.WriteLine(b.Data)
    Next
End Sub

' After: direct iteration
For Each result In BarcodeReader.Read("document.png")
    Console.WriteLine(result.Value)
Next
$vbLabelText   $csharpLabel

問題3:EnableSymbologies呼び出しがコードベース全体に散在している

Scandit SDK:Scandit SDK: コードベースの複数の場所で、異なるスキャンコンテキストに対して異なるバーコード形式セットでsettings.EnableSymbologies(...)を呼び出すことがあります。

解決策:解決策: すべてのEnableSymbologies呼び出しを削除します。 IronBarcodeは、デフォルトでサポートされているすべてのフォーマットを自動的に検出します。 特定のシナリオでのパフォーマンス向上のためにフォーマット制限が必要な場合、BarcodeReaderOptions.ExpectBarcodeTypesを使用してください。

var options = new BarcodeReaderOptions
{
    ExpectBarcodeTypes = BarcodeEncoding.Code128 | BarcodeEncoding.QRCode
};
var results = BarcodeReader.Read("document.png", options);
var options = new BarcodeReaderOptions
{
    ExpectBarcodeTypes = BarcodeEncoding.Code128 | BarcodeEncoding.QRCode
};
var results = BarcodeReader.Read("document.png", options);
Imports System

Dim options As New BarcodeReaderOptions With {
    .ExpectBarcodeTypes = BarcodeEncoding.Code128 Or BarcodeEncoding.QRCode
}
Dim results = BarcodeReader.Read("document.png", options)
$vbLabelText   $csharpLabel

問題4:既存のコードベースにPDF読み取り機能がない

Scandit SDK:既存のコードベースでPDFページを画像に変換してからScanditパイプラインに供給する場合、このカスタムレンダリングインフラストラクチャは不要になります。

解決策: PDFを画像に変換する処理を完全に削除する。 PDFファイルのパスをIronBarcodeに直接渡してください。

// Before: render PDF pages to images, then pass each image to Scandit pipeline
// (multiple steps, external PDF library dependency)

// After: pass PDF directly to IronBarcode
var results = BarcodeReader.Read("document.pdf");
// Results include PageNumber property for each detected barcode
// Before: render PDF pages to images, then pass each image to Scandit pipeline
// (multiple steps, external PDF library dependency)

// After: pass PDF directly to IronBarcode
var results = BarcodeReader.Read("document.pdf");
// Results include PageNumber property for each detected barcode
' Before: render PDF pages to images, then pass each image to Scandit pipeline
' (multiple steps, external PDF library dependency)

' After: pass PDF directly to IronBarcode
Dim results = BarcodeReader.Read("document.pdf")
' Results include PageNumber property for each detected barcode
$vbLabelText   $csharpLabel

第5号:非同期カメラ初期化パターン

Scandit SDK:Scandit SDK: カメラ初期化はSwitchToDesiredStateAsyncのために使用します。 呼び出し元のコードがこれらの非同期操作を中心に構成されている場合、それらを取り除くことで非同期チェーンが簡素化されます。

解決策:非同期カメラ初期化処理を完全に削除する。 BarcodeReader.Readは同期です。 UIやサーバーコンテキストで応答性を向上させるために非同期実行が必要な場合、Task.Runでラップします。

// Async wrapper for non-blocking execution
var results = await Task.Run(() => BarcodeReader.Read("document.png"));
// Async wrapper for non-blocking execution
var results = await Task.Run(() => BarcodeReader.Read("document.png"));
Imports System.Threading.Tasks

' Async wrapper for non-blocking execution
Dim results = Await Task.Run(Function() BarcodeReader.Read("document.png"))
$vbLabelText   $csharpLabel

Scandit SDK移行チェックリスト

マイグレーション前のタスク

コードベース内のすべてのScandit統合ポイントを監査する:

grep -r "DataCaptureContext\|BarcodeCaptureSettings\|BarcodeCapture" --include="*.cs" .
grep -r "EnableSymbologies\|BarcodeScanned\|NewlyRecognizedBarcodes" --include="*.cs" .
grep -r "using Scandit" --include="*.cs" .
grep -r "barcode\.Data\|barcode\.Symbology\|FrameSourceState" --include="*.cs" .
grep -r "DataCaptureContext\|BarcodeCaptureSettings\|BarcodeCapture" --include="*.cs" .
grep -r "EnableSymbologies\|BarcodeScanned\|NewlyRecognizedBarcodes" --include="*.cs" .
grep -r "using Scandit" --include="*.cs" .
grep -r "barcode\.Data\|barcode\.Symbology\|FrameSourceState" --include="*.cs" .
SHELL

すべてのスキャンコンテキストを文書化し、リアルタイムカメラスキャン(Scandit を使い続ける)を処理するコードパスと、ファイルまたはドキュメント処理( IronBarcodeに移行する)を処理するコードパスを特定します。 Scandit処理の前にPDFページが画像にレンダリングされる箇所をすべてメモしておいてください。このレンダリング手順は後から削除されます。

コード更新タスク

  1. Scandit NuGetパッケージ (Scandit.BarcodePicker, Scandit.DataCapture.Core, Scandit.DataCapture.Barcode) を削除します。
  2. IronBarcode NuGetパッケージをインストールします。
  3. using IronBarCodeに置き換えます。
  4. DataCaptureContext初期化ブロックを完全に削除します。
  5. すべてのSetFrameSourceAsync呼び出しを削除します。
  6. すべてのEnableSymbologies呼び出しを削除します。
  7. BarcodeReader.Read(filePath)に置き換えます。
  8. BarcodeReader.Read()結果を用います。
  9. result.Valueに置き換えます。
  10. result.Formatに置き換えます。
  11. IronBarcodeがPDFを直接読み込むようになったため、PDFから画像へのレンダリングパイプラインを削除しました。
  12. アプリケーションの起動時にIronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"を追加します。

移行後のテスト

コードの更新が完了したら、以下の点を確認してください。

IronBarcodeが返したバーコード値が、同じ入力ドキュメントに対して Scandit が以前に返した値と一致することを確認します。

  • ドキュメントセットのすべてのサポートされているバーコード形式がExpectBarcodeTypes設定なしで検出されることを確認します。
  • PDF抽出がマルチページドキュメントに対して正しいPageNumber値を返すことをテストします。
  • 想定される負荷条件下で、 ASP.NET Coreエンドポイントが許容可能な応答時間内に結果を返すことを確認する
  • Dockerまたはコンテナ化されたデプロイメントがカメラハードウェアなしでバーコード読み取りを正常に完了することを確認します
  • Parallel.ForEachを使用した同時バッチ処理が競合条件なしで正しい結果を生成することをテストします。
  • Scandit コンテキストの代わりにIronBarcodeライセンスキーを使用して、アプリケーションが正しく起動および初期化されることを確認します。

IronBarcodeへの移行の主なメリット

カメラパイプラインオーバーヘッドの排除:カメラパイプラインオーバーヘッドの排除: DataCaptureContext初期化シーケンスを削除することで、ステートフルなカメラ管理、非同期状態遷移、プラットフォーム固有のカメラAPIがサーバーサイドコードから削除されます。 結果として得られるコードは、よりシンプルで短く、Linux、Dockerコンテナ、またはサーバーレスコンピューティング環境へのデプロイを妨げるプラットフォームの制約もありません。

直接PDF処理:ネイティブPDFバーコード抽出により、別途PDFレンダリングライブラリへの依存、ページから画像へのパイプラインのエンジニアリング上のオーバーヘッド、およびその依存に伴う追加のライセンス費用が不要になります。 複数ページのPDF文書は、単一のメソッド呼び出しで処理され、ページインデックス付きの結果が即座に利用可能になります。

同期ステートレスAPI:直接戻り値モデルにより、イベント駆動型のコールバックパターンが標準的なシーケンシャルコードに置き換えられます。 エラー処理、ログ記録、および下流処理は、イベント購読管理や非同期ステートマシンの調整を必要とせずに、既存のアプリケーションアーキテクチャと自然に統合されます。

公開された透明性の高い価格設定:永久ライセンスの価格は749ドル、1,499ドル、2,999ドルで公開されており、販売サイクルを経ずに予算案の作成、ベンダー比較、調達プロセスを進めることができます。 ライセンス費用は、統合コードを一行も書く前に決定できます。

クラウドおよびコンテナを完全にサポート: IronBarcodeのステートレスでハードウェアに依存しないAPIは、Azure Functions、AWS Lambda、Linux上のDockerコンテナ、および.NETランタイムが利用可能なその他のコンピューティング環境で、変更なしで動作します。 これらの環境に導入する際には、カメラシミュレーション、ハードウェア依存の回避策、プラットフォーム固有の設定は一切必要ありません。

自動フォーマット検出:自動フォーマット検出: EnableSymbologies宣言を削除することで、予期しないバーコード形式を持つ受信ドキュメントが、コード変更なしで正しく処理されます。 受信文書に含まれるフォーマットセットが変更された場合(新しいサプライヤー、新しいラベルフォーマット、新しい文書タイプなど)、 IronBarcodeは新しいフォーマットを自動的に処理します。

ご注意Scanditはその所有者の登録商標です。 このサイトはScanditとは無関係であり、承認やスポンサーを受けていません。 すべての製品名、ロゴ、およびブランドは各所有者の所有物です。 比較は情報提供のみを目的としており、執筆時点で公開されている情報を反映しています。

よくある質問

なぜScandit SDKからIronBarcodeに移行する必要があるのですか?

一般的な理由としては、ライセンスの簡素化(SDK + ランタイムキーの複雑さの排除)、スループット制限の排除、ネイティブPDFサポートの獲得、Docker/CI/CDデプロイの改善、プロダクションコード内のAPI定型文の削減などが挙げられます。

ScanditのAPIコールをIronBarcodeに置き換えるには?

インスタンスの作成とライセンスの定型文をIronBarCode.License.LicenseKey = "key "に置き換えてください。リーダー・コールをBarcodeReader.Read(path)に、ライター・コールをBarcodeWriter.CreateBarcode(data, encoding)に置き換えてください。静的メソッドはインスタンス管理を必要としません。

Scandit SDKからIronBarcodeに移行する際、コードはどのくらい変更されますか?

ほとんどのマイグレーションでは、コード行数は少なくなります。ライセンスの定型文、インスタンス・コンストラクタ、明示的なフォーマット設定が削除されます。コアとなる読み取り/書き込み操作は、より短いIronBarcodeに対応し、よりきれいな結果オブジェクトが得られます。

移行中にScandit SDKとIronBarcodeの両方をインストールしておく必要がありますか?

ほとんどのマイグレーションは、並列操作ではなく、直接置き換えです。一度に1つのサービスクラスを移行し、NuGet参照を置き換え、インスタンス化とAPI呼び出しパターンを更新してから次のクラスに移行します。

IronBarcodeのNuGetパッケージ名は何ですか?

パッケージは'IronBarcode'(大文字のBとC)です。Install-Package IronBarcode'または'dotnet add package IronBarcode'でインストールしてください。コード中のusingディレクティブは'using IronBarcode;'である。

IronBarcode はScandit SDKと比較して、どのようにDockerデプロイを簡素化しますか?

IronBarcodeは外部SDKファイルやマウントされたライセンス設定のないNuGetパッケージです。Dockerでは、IRONBARCODE_LICENSE_KEY環境変数を設定すると、パッケージが起動時にライセンス検証を処理します。

Scanditから移行した後、IronBarcodeはすべてのバーコードフォーマットを自動的に検出しますか?

IronBarcodeは、サポートされているすべてのフォーマットのシンボルを自動検出します。明示的なBarcodeTypesの列挙は必要ありません。フォーマットが既に知られていて、パフォーマンスが重要な場合、BarcodeReaderOptionsは最適化として検索空間を制限することができます。

IronBarcodeは別のライブラリなしでPDFからバーコードを読み取ることができますか?

BarcodeReader.Read("document.pdf")は、PDFファイルをネイティブに処理します。結果には、見つかった各バーコードの PageNumber、Format、Value、および Confidence が含まれます。外部のPDFレンダリングステップは必要ありません。

IronBarcodeはどのようにパラレルバーコード処理を行うのですか?

IronBarcodeの静的メソッドはステートレスでスレッドセーフです。Parallel.ForEachをスレッドごとのインスタンス管理なしにファイルリスト上で直接使用します。BarcodeReaderOptions.MaxParallelThreadsは内部のスレッドバジェットを制御します。

Scandit SDKからIronBarcodeに移行した場合、どのような結果プロパティが変更されますか?

一般的なリネーム:BarcodeValueはValueに、BarcodeTypeはFormatに。IronBarcodeの結果にはConfidenceとPageNumberも追加されます。ソリューション全体の検索と置換は、既存の結果処理コードで名前の変更を処理します。

CI/CDパイプラインでIronBarcodeのライセンスを設定するには?

IRONBARCODE_LICENSE_KEYをパイプラインシークレットとして保存し、アプリケーションの起動コードにIronBarCode.License.LicenseKeyを割り当てます。1つのシークレットで、開発環境、テスト環境、ステージング環境、本番環境を含むすべての環境をカバーできます。

IronBarcodeはカスタムスタイルのQRコード生成に対応していますか?

はい。QRCodeWriter.CreateQrCode()は、ChangeBarCodeColor()によるカスタムカラー、AddBrandLogo()によるロゴ埋め込み、設定可能なエラー訂正レベル、PNG、JPG、PDF、ストリームなどの複数の出力形式をサポートしています。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

アイアンサポートチーム

私たちは週5日、24時間オンラインで対応しています。
チャット
メール
電話してね