Migrating from Scanbot SDK to IronBarcode
Scanbot SDKからIronBarcodeへの移行
このガイドは、サーバーサイド、デスクトップ、または拡張ファイルベースのシナリオにおいて、バーコード処理をScanbot SDKからIronBarcodeに移行する.NET開発チーム向けに作成されています。 これは完全に同じ機能を持つ代替品ではありません。Scanbot SDKはモバイルカメラのスキャンコンポーネントであり、 IronBarcodeはファイルおよびドキュメント処理ライブラリです。 今回の移行は、カメラのみのモデルでは満たせない要件によって生じた、スコープの変更です。 ライブモバイルカメラのスキャンUIを、他の要件を追加せずに置き換えるチームは、移行を進める前に、移行が適切かどうかを評価する必要があります。
MAUIモバイルアプリ向けにScanbotを導入したチームが、 ASP.NET Core、デスクトップビルド、またはドキュメントパイプラインでのバーコード処理を必要とする場合、機械的な移行は簡単です。 主な変更は、ScanbotSDKMain.Barcode.StartScannerAsync(configuration) を BarcodeReader.Read(source) に置き換えることであり、source はファイルパス、ストリーム、バイト配列、または PDF です。
Scanbot SDKから移行する理由
サーバー側処理の要件: Scanbot SDKは、 ASP.NET Core、コンソールアプリケーション、Azure Functions、またはMAUI以外のプロジェクトではコンパイルできません。 モバイルアプリケーションが、アップロードされたPDFからバーコードを抽出したり、受信ドキュメントのバーコード値を検証したりするなど、バーコードを処理するサーバー側のコンポーネントを必要とする場合、Scanbotはその境界を越えることができません。 IronBarcode は同じ BarcodeReader.Read() API を使用して、これらすべてのコンテキストで動作します。
デスクトップ MAUI サポート: Scanbot のパッケージは net10.0-android と net10.0-ios をターゲットにしています。 Scanbot パッケージがこれらのプラットフォーム向けのアセンブリを提供していないため、net10.0-windows または net10.0-maccatalyst を TargetFrameworks に追加する MAUI プロジェクトは、デスクトップターゲットをビルドすることができません。 IronBarcodeは、iOSおよびAndroidに加え、 WindowsおよびmacOSのMAUIもサポートしています。つまり、プラットフォーム固有の除外や条件付き参照を行うことなく、同じパッケージをマルチターゲットMAUIプロジェクトで使用できます。
PDF ドキュメントワークフロー: Scanbot には BarcodeScanner.Read(filePath) がありません。 ワークフローが進化して、ドキュメントのアップロード、スキャンされた画像アーカイブ、またはPDF請求書からバーコードを読み取る機能が含まれるようになった場合、Scanbotのアーキテクチャでは対応できません。 IronBarcodeはPDFファイルや画像ファイルを直接読み取り、各結果にはバーコードが見つかったページ番号が含まれます。
価格設定モデルの予測可能性: Scanbotは年間定額料金制を採用しています。 一部の組織にとって、年次更新は代替案の評価のきっかけです — 特にプロジェクトの範囲がサーバーサイドまたはScanbotのカバレッジ外のデスクトップターゲットを含むようになった場合。 IronBarcodeは一度購入すれば永久に利用できるため、年間更新の義務は一切ありません。
基本的な問題
Scanbot SDKにはライブカメラ映像が必要です。 要件がモバイル以外の分野に拡大した場合、既存の依存関係を通じて同等の経路を見つけることはできません。
// Scanbot SDK: camera-only — no file or server equivalent exists
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[] { BarcodeFormat.Code128, BarcodeFormat.QrCode }
};
// This call requires iOS or Android hardware and a MAUI camera UI
// It cannot be redirected to a file path, stream, or server context
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
// Scanbot SDK: camera-only — no file or server equivalent exists
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[] { BarcodeFormat.Code128, BarcodeFormat.QrCode }
};
// This call requires iOS or Android hardware and a MAUI camera UI
// It cannot be redirected to a file path, stream, or server context
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
Imports System.Threading.Tasks
' Scanbot SDK: camera-only — no file or server equivalent exists
Dim configuration As New BarcodeScannerScreenConfiguration With {
.BarcodeFormats = {BarcodeFormat.Code128, BarcodeFormat.QrCode}
}
' This call requires iOS or Android hardware and a MAUI camera UI
' It cannot be redirected to a file path, stream, or server context
Dim result = Await ScanbotSDKMain.Barcode.StartScannerAsync(configuration)
IronBarcodeは、あらゆるプロジェクトコンテキストにおいて、ファイル、ストリーム、バイト配列、PDFといった同じソースタイプを受け入れます。
// IronBarcode: the same call works in MAUI, ASP.NET Core, console, WPF, Azure Functions
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// From a file — works on any platform
var results = BarcodeReader.Read("invoice.pdf");
foreach (var result in results)
Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.BarcodeType})");
// IronBarcode: the same call works in MAUI, ASP.NET Core, console, WPF, Azure Functions
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// From a file — works on any platform
var results = BarcodeReader.Read("invoice.pdf");
foreach (var result in results)
Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.BarcodeType})");
Imports IronBarCode
' IronBarcode: the same call works in MAUI, ASP.NET Core, console, WPF, Azure Functions
License.LicenseKey = "YOUR-LICENSE-KEY"
' From a file — works on any platform
Dim results = BarcodeReader.Read("invoice.pdf")
For Each result In results
Console.WriteLine($"Page {result.PageNumber}: {result.Value} ({result.BarcodeType})")
Next
IronBarcodeとScanbot SDKの比較:機能比較
| フィーチャー | スキャンボットSDK | IronBarcode |
|---|---|---|
| ファイルパスからの入力 | なし | はい |
| ストリームからの入力 | なし | はい |
| バイト配列からの入力 | なし | はい |
| PDFバーコード抽出 | なし | はい |
| ライブカメラビューファインダー | はい | いいえ(MediaPickerを使用してください) |
| バーコード生成 | なし | はい |
| iOSのMAUI。 | はい | はい |
| AndroidのMAUI。 | はい | はい |
| ウィンドウズMAUI。 | なし | はい |
| macOSのMAUI。 | なし | はい |
| .NETコア。 | なし | はい |
| コンソール/サーバー | なし | はい |
| Azure(アジュール)/ Lambda(ラムダ)/ Docker(Docker)。 | なし | はい |
| .NET Framework 4.6.2以降 | なし | はい |
| 機械学習エラー訂正 | なし | はい |
| 破損したバーコードの復旧 | なし | はい |
| 自動フォーマット検出 | はい | はい |
| 1Dフォーマット | 20歳以上 | 30+ |
| 2Dフォーマット | QRコード、データマトリックス、PDF417、アステカ | QRコード、データマトリックス、PDF417、アステカ、マキシコード |
| ライセンスモデル | 年間定額料金 | 一度限りの永久 |
| 公開価格 | 営業担当 | はい ($999–$5,999) |
クイックスタート:Scanbot SDKからIronBarcodeへの移行
ステップ 1: NuGet パッケージを置き換える
Scanbotパッケージを削除してください。
dotnet remove package ScanbotBarcodeSDK.MAUI
dotnet remove package ScanbotBarcodeSDK.MAUI
プロジェクトが .csproj ファイルで条件付きパッケージ参照を使用している場合、それらのエントリも削除してください。
<PackageReference Include="ScanbotBarcodeSDK.MAUI" Version="8.0.0" />
<PackageReference Include="ScanbotBarcodeSDK.MAUI" Version="8.0.0" />
IronBarcodeをインストールしてください:
dotnet add package IronBarcode
dotnet add package IronBarcode
IronBarcodeはNuGetで入手可能で、 .NET 6、7、8、9、および.NET Framework 4.6.2以降をサポートしています。 MAUI マルチターゲットプロジェクトの場合、単一の dotnet add package がすべてのターゲットで動作します — プラットフォーム条件付きパッケージ参照は必要ありません。
ステップ 2: 名前空間の更新
Scanbotの名前空間をIronBarcodeの名前空間に置き換えてください。
// Remove
using ScanbotSDK.MAUI;
// Add
using IronBarCode;
// Remove
using ScanbotSDK.MAUI;
// Add
using IronBarCode;
Imports IronBarCode
ステップ 3: ライセンスの初期化
Scanbotの初期化ブロックを削除し、代わりにIronBarcodeのライセンスキーを挿入してください。 プロジェクトの種類に応じて、App.xaml.cs、または Program.cs でアプリケーションの起動時にライセンス初期化を追加してください。
// Remove this
ScanbotSDKMain.Initialize(new SdkConfiguration
{
LicenseKey = "YOUR-SCANBOT-LICENSE-KEY",
LoggingEnabled = false
});
// Add this — one line, placed once at startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Remove this
ScanbotSDKMain.Initialize(new SdkConfiguration
{
LicenseKey = "YOUR-SCANBOT-LICENSE-KEY",
LoggingEnabled = false
});
// Add this — one line, placed once at startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
' Remove this
ScanbotSDKMain.Initialize(New SdkConfiguration With {
.LicenseKey = "YOUR-SCANBOT-LICENSE-KEY",
.LoggingEnabled = False
})
' Add this — one line, placed once at startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
コード移行の例
マウイ島での写真撮影
Scanbotのスキャン呼び出しは、全画面カメラUIを開き、ユーザーがバーコードをスキャンするかキャンセルすると戻ります。 IronBarcodeにはカメラUIは提供されていません。 置き換えは MAUI の MediaPicker を使用してシステムカメラを呼び出し、写真を撮影し、イメージバイトを BarcodeReader.Read() に渡します。
Scanbot SDKのアプローチ:
using ScanbotSDK.MAUI;
private async void ScanButton_Clicked(object sender, EventArgs e)
{
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[]
{
BarcodeFormat.Code128,
BarcodeFormat.QrCode,
BarcodeFormat.Ean13
},
FinderAspectRatio = new AspectRatio(1, 1),
TopBarBackgroundColor = Colors.DarkBlue
};
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
if (result.Status == OperationResult.Ok)
{
foreach (var barcode in result.Barcodes)
ResultLabel.Text = $"{barcode.Format}: {barcode.Text}";
}
}
using ScanbotSDK.MAUI;
private async void ScanButton_Clicked(object sender, EventArgs e)
{
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[]
{
BarcodeFormat.Code128,
BarcodeFormat.QrCode,
BarcodeFormat.Ean13
},
FinderAspectRatio = new AspectRatio(1, 1),
TopBarBackgroundColor = Colors.DarkBlue
};
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
if (result.Status == OperationResult.Ok)
{
foreach (var barcode in result.Barcodes)
ResultLabel.Text = $"{barcode.Format}: {barcode.Text}";
}
}
Imports ScanbotSDK.MAUI
Private Async Sub ScanButton_Clicked(sender As Object, e As EventArgs)
Dim configuration = New BarcodeScannerScreenConfiguration With {
.BarcodeFormats = New BarcodeFormat() {
BarcodeFormat.Code128,
BarcodeFormat.QrCode,
BarcodeFormat.Ean13
},
.FinderAspectRatio = New AspectRatio(1, 1),
.TopBarBackgroundColor = Colors.DarkBlue
}
Dim result = Await ScanbotSDKMain.Barcode.StartScannerAsync(configuration)
If result.Status = OperationResult.Ok Then
For Each barcode In result.Barcodes
ResultLabel.Text = $"{barcode.Format}: {barcode.Text}"
Next
End If
End Sub
IronBarcodeのアプローチ:
// NuGet: dotnet add package IronBarcode
using IronBarCode;
private async void ScanButton_Clicked(object sender, EventArgs e)
{
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var stream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray());
var first = results.FirstOrDefault();
ResultLabel.Text = first != null
? $"{first.BarcodeType}: {first.Value}"
: "No barcode found";
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;
private async void ScanButton_Clicked(object sender, EventArgs e)
{
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var stream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray());
var first = results.FirstOrDefault();
ResultLabel.Text = first != null
? $"{first.BarcodeType}: {first.Value}"
: "No barcode found";
}
Imports IronBarCode
Imports System.IO
Imports System.Linq
Imports System.Threading.Tasks
Private Async Sub ScanButton_Clicked(sender As Object, e As EventArgs)
Dim photo = Await MediaPicker.CapturePhotoAsync()
If photo Is Nothing Then Return
Using stream = Await photo.OpenReadAsync()
Using ms As New MemoryStream()
Await stream.CopyToAsync(ms)
Dim results = BarcodeReader.Read(ms.ToArray())
Dim first = results.FirstOrDefault()
ResultLabel.Text = If(first IsNot Nothing, $"{first.BarcodeType}: {first.Value}", "No barcode found")
End Using
End Using
End Sub
ユーザーエクスペリエンスの変更点は、スキャン領域がオーバーレイ表示されたScanbotの組み込みビューファインダーではなく、システムカメラの画面が表示されるようになったことです。 在庫管理、物流、文書ワークフローといったビジネス用途であれば、システムカメラで十分です。 .NET MAUIバーコードスキャナーのチュートリアルでは、権限処理を含め、iOSとAndroidの両方のターゲットに対する完全な統合パターンを解説しています。
スキャンオプションと設定
Scanbot の BarcodeScannerScreenConfiguration はスキャナーが受け入れる形式とカメラ UI の外観を制御します。 IronBarcode の BarcodeReaderOptions は、画像の解析方法を制御します — 処理速度、マルチバーコード検出、類似のパラメータなど。 構成概念が異なる懸念事項に対応するのは、基となる操作が異なるためです。
Scanbot SDKのアプローチ:
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[] { BarcodeFormat.Code128, BarcodeFormat.QrCode },
FinderAspectRatio = new AspectRatio(1, 1),
FlashEnabled = false,
OrientationLockMode = OrientationLockMode.Portrait
};
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
if (result.Status == OperationResult.Ok)
{
foreach (var barcode in result.Barcodes)
Console.WriteLine($"{barcode.Format}: {barcode.Text}");
}
var configuration = new BarcodeScannerScreenConfiguration
{
BarcodeFormats = new[] { BarcodeFormat.Code128, BarcodeFormat.QrCode },
FinderAspectRatio = new AspectRatio(1, 1),
FlashEnabled = false,
OrientationLockMode = OrientationLockMode.Portrait
};
var result = await ScanbotSDKMain.Barcode.StartScannerAsync(configuration);
if (result.Status == OperationResult.Ok)
{
foreach (var barcode in result.Barcodes)
Console.WriteLine($"{barcode.Format}: {barcode.Text}");
}
Imports System
Imports System.Threading.Tasks
Dim configuration As New BarcodeScannerScreenConfiguration With {
.BarcodeFormats = {BarcodeFormat.Code128, BarcodeFormat.QrCode},
.FinderAspectRatio = New AspectRatio(1, 1),
.FlashEnabled = False,
.OrientationLockMode = OrientationLockMode.Portrait
}
Dim result = Await ScanbotSDKMain.Barcode.StartScannerAsync(configuration)
If result.Status = OperationResult.Ok Then
For Each barcode In result.Barcodes
Console.WriteLine($"{barcode.Format}: {barcode.Text}")
Next
End If
IronBarcodeのアプローチ:
using IronBarCode;
// Format detection is automatic — BarcodeReaderOptions controls processing behavior
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = false
};
// Combined with the MediaPicker capture pattern
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var photoStream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await photoStream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray(), options);
foreach (var result in results)
Console.WriteLine($"{result.BarcodeType}: {result.Value}");
using IronBarCode;
// Format detection is automatic — BarcodeReaderOptions controls processing behavior
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = false
};
// Combined with the MediaPicker capture pattern
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var photoStream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await photoStream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray(), options);
foreach (var result in results)
Console.WriteLine($"{result.BarcodeType}: {result.Value}");
Imports IronBarCode
Imports System.IO
' Format detection is automatic — BarcodeReaderOptions controls processing behavior
Dim options As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = False
}
' Combined with the MediaPicker capture pattern
Dim photo = Await MediaPicker.CapturePhotoAsync()
If photo Is Nothing Then Return
Using photoStream = Await photo.OpenReadAsync()
Using ms As New MemoryStream()
Await photoStream.CopyToAsync(ms)
Dim results = BarcodeReader.Read(ms.ToArray(), options)
For Each result In results
Console.WriteLine($"{result.BarcodeType}: {result.Value}")
Next
End Using
End Using
フォーマット指定は不要です。IronBarcodeはサポートされているすべてのフォーマットを自動的に検出します。 Scanbot 設定に最も直接対応する BarcodeReaderOptions パラメーターは、Speed (処理の徹底度とパフォーマンスを制御) と ExpectMultipleBarcodes (最初の一致の後もスキャンを続行) です。
サーバー側でのPDF処理
このシナリオにはScanbotに相当するものはありません。 IronBarcodeを使用すると、MAUIモバイルアプリ用にインストールされた同じパッケージで、サーバー側のASP.NET CoreエンドポイントでPDFからバーコードを抽出できるため、チームは両方のデプロイメントコンテキストで機能する単一のバーコード依存関係を持つことができます。
Scanbot SDKのアプローチ:
//スキャンボットSDKcannot be used here — the package does not compile
// in ASP.NET Core, Azure Functions, console apps, or any non-MAUI project.
// There is no server-side Scanbot equivalent for this endpoint.
//スキャンボットSDKcannot be used here — the package does not compile
// in ASP.NET Core, Azure Functions, console apps, or any non-MAUI project.
// There is no server-side Scanbot equivalent for this endpoint.
'スキャンボットSDKcannot be used here — the package does not compile
' in ASP.NET Core, Azure Functions, console apps, or any non-MAUI project.
' There is no server-side Scanbot equivalent for this endpoint.
IronBarcodeのアプローチ:
// NuGet: dotnet add package IronBarcode
// Works in ASP.NET Core, console apps, Azure Functions, Docker — the same package as MAUI
using IronBarCode;
[HttpPost("extract-barcodes")]
public async Task<IActionResult> ExtractBarcodes(IFormFile file)
{
using var ms = new MemoryStream();
await file.CopyToAsync(ms);
// Reads all barcodes from all pages of the uploaded PDF
var results = BarcodeReader.Read(ms.ToArray());
var values = results.Select(r => new
{
r.Value,
Format = r.Format.ToString(),
r.PageNumber
});
return Ok(values);
}
// NuGet: dotnet add package IronBarcode
// Works in ASP.NET Core, console apps, Azure Functions, Docker — the same package as MAUI
using IronBarCode;
[HttpPost("extract-barcodes")]
public async Task<IActionResult> ExtractBarcodes(IFormFile file)
{
using var ms = new MemoryStream();
await file.CopyToAsync(ms);
// Reads all barcodes from all pages of the uploaded PDF
var results = BarcodeReader.Read(ms.ToArray());
var values = results.Select(r => new
{
r.Value,
Format = r.Format.ToString(),
r.PageNumber
});
return Ok(values);
}
Imports IronBarCode
Imports Microsoft.AspNetCore.Mvc
Imports System.IO
Imports System.Threading.Tasks
<HttpPost("extract-barcodes")>
Public Async Function ExtractBarcodes(file As IFormFile) As Task(Of IActionResult)
Using ms As New MemoryStream()
Await file.CopyToAsync(ms)
' Reads all barcodes from all pages of the uploaded PDF
Dim results = BarcodeReader.Read(ms.ToArray())
Dim values = results.Select(Function(r) New With {
.Value = r.Value,
.Format = r.Format.ToString(),
.PageNumber = r.PageNumber
})
Return Ok(values)
End Using
End Function
IronBarcode は多ページの PDF をネイティブに処理し、各結果にはバーコードが見つかったページを示す PageNumber プロパティが含まれます。 PDFバーコード抽出ガイドでは、ページ範囲の選択や、大量のドキュメントをまとめて処理する際のパフォーマンス調整など、PDFの読み取りに関するあらゆるオプションを網羅しています。
ASP.NET Coreバックグラウンド処理
アーカイブされた PDF ドキュメントを処理する Azure Functions や Worker Services などのバッチ ワークフローの場合、 IronBarcode はMAUI アプリやASP.NET Coreコントローラーで使用されているものと同じ API を提供します。
Scanbot SDKのアプローチ:
//スキャンボットSDKdoes not support this deployment context.
// The package will not compile in Azure Functions or Worker Services.
//スキャンボットSDKdoes not support this deployment context.
// The package will not compile in Azure Functions or Worker Services.
'スキャンボットSDKdoes not support this deployment context.
' The package will not compile in Azure Functions or Worker Services.
IronBarcodeのアプローチ:
// NuGet: dotnet add package IronBarcode
using IronBarCode;
// Azure Function or Worker Service batch processing
public void ProcessInvoiceBatch(IEnumerable<string> filePaths)
{
foreach (var filePath in filePaths)
{
var results = BarcodeReader.Read(filePath);
foreach (var result in results)
Console.WriteLine($"File: {filePath} | Page {result.PageNumber}: {result.Value} ({result.BarcodeType})");
}
}
// NuGet: dotnet add package IronBarcode
using IronBarCode;
// Azure Function or Worker Service batch processing
public void ProcessInvoiceBatch(IEnumerable<string> filePaths)
{
foreach (var filePath in filePaths)
{
var results = BarcodeReader.Read(filePath);
foreach (var result in results)
Console.WriteLine($"File: {filePath} | Page {result.PageNumber}: {result.Value} ({result.BarcodeType})");
}
}
Imports IronBarCode
Public Sub ProcessInvoiceBatch(filePaths As IEnumerable(Of String))
For Each filePath In filePaths
Dim results = BarcodeReader.Read(filePath)
For Each result In results
Console.WriteLine($"File: {filePath} | Page {result.PageNumber}: {result.Value} ({result.BarcodeType})")
Next
Next
End Sub
スキャンボットSDKAPIとIronBarcodeのマッピングリファレンス
| スキャンボットSDK | IronBarcode |
|---|---|
ScanbotSDKMain.Initialize(new SdkConfiguration { LicenseKey = "..." }) |
IronBarCode.License.LicenseKey = "key" |
new BarcodeScannerScreenConfiguration() |
new BarcodeReaderOptions() |
ScanbotSDKMain.Barcode.StartScannerAsync(configuration) |
BarcodeReader.Read(path / stream / bytes) |
result.Status == OperationResult.Ok |
results.Any() または results.FirstOrDefault() != null |
result.Barcodes |
BarcodeReader.Read() の返り値 |
barcode.Format |
result.BarcodeType (IronBarCode.BarcodeEncoding) |
barcode.Text |
result.Value |
BarcodeFormat.Code128 |
BarcodeEncoding.Code128 |
BarcodeFormat.QrCode |
BarcodeEncoding.QRCode |
BarcodeFormat.Ean13 |
BarcodeEncoding.EAN13 |
BarcodeScannerScreenConfiguration.FinderAspectRatio |
同等のものはありません — 画像フレーミングはMediaPickerによって処理されます |
BarcodeScannerScreenConfiguration.FlashEnabled |
同等のオプションはありません。MediaPickerのオプションを使用してください。 |
| カメラに必要な入力 | ファイルパス、ストリーム、バイト配列、またはPDF |
| iOSおよびAndroid版MAUIのみ | すべて for .NETプラットフォームとプロジェクトタイプ |
一般的な移行の問題と解決策
問題点1:ライブビューファインダーに相当する機能がない
Scanbot SDK:スキャン体験に組み込まれたリアルタイムのカメラビューファインダーを提供し、スキャン領域のオーバーレイ、触覚フィードバック、ライブビデオフィードでの連続的なバーコード検出機能を備えています。
解決策: MAUI の MediaPicker.CapturePhotoAsync() を使用してシステムカメラを開き、処理用の静止画を撮影します。
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var stream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray());
var photo = await MediaPicker.CapturePhotoAsync();
if (photo == null) return;
using var stream = await photo.OpenReadAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
var results = BarcodeReader.Read(ms.ToArray());
Imports System.IO
Dim photo = Await MediaPicker.CapturePhotoAsync()
If photo Is Nothing Then Return
Using stream = Await photo.OpenReadAsync()
Using ms As New MemoryStream()
Await stream.CopyToAsync(ms)
Dim results = BarcodeReader.Read(ms.ToArray())
End Using
End Using
ビジネス用途であれば、システムカメラで十分です。 ライブオーバーレイがユーザーエクスペリエンスの中心となるコンシューマー向けアプリの場合、移行に着手する前に、このUX変更が許容できるかどうかを評価してください。
問題2:カメラのアクセス許可の違い
Scanbot SDK: Scanbotパッケージは、UIフローの一部としてカメラのアクセス許可要求を処理するため、カメラのアクセス許可はSDKの初期化とスキャナの起動によって暗黙的に管理されます。
解決策: MediaPicker を使用して、MAUI は標準メカニズムを介して権限を管理します。 AndroidManifest.xml にカメラの権限宣言が含まれていること、およびInfo.plist に NSCameraUsageDescription キーが含まれていることを確認してください。 これらのエントリは通常、スキャフォールディングされたMAUIプロジェクトテンプレートに含まれています。 アプリが以前、カメラアクセスにScanbotのみを使用していた場合は、テストを行う前に、以下のマニフェストエントリが正しく設定されていることを確認してください。
<uses-permission android:name="android.permission.CAMERA" />
<key>NSCameraUsageDescription</key>
<string>This app uses the camera to scan barcodes.</string>
<uses-permission android:name="android.permission.CAMERA" />
<key>NSCameraUsageDescription</key>
<string>This app uses the camera to scan barcodes.</string>
問題3:Windowsビルドエラーの解消
Scanbot SDK: ScanbotBarcodeSDK.MAUI パッケージは net10.0-android と net10.0-ios のみをターゲットとしており、TargetFrameworks に net10.0-windows が存在するとビルドが失敗します。
解決策: Scanbotパッケージへの参照を削除することで、Windowsビルドの失敗が解消されます。 IronBarcodeは、プラットフォーム依存の設定なしに、すべてのMAUIターゲットで正しく解決されます。
# Verify the build succeeds on all targets after removing Scanbot and adding IronBarcode
dotnet build -f net10.0-windows10.0.19041.0
dotnet build -f net10.0-ios
dotnet build -f net10.0-android
# Verify the build succeeds on all targets after removing Scanbot and adding IronBarcode
dotnet build -f net10.0-windows10.0.19041.0
dotnet build -f net10.0-ios
dotnet build -f net10.0-android
問題4:フォーマット列挙型名前空間の変更
Scanbot SDK: BarcodeFormat の列挙型値を ScanbotBarcodeSDK.MAUI の名前空間から BarcodeFormat.Code128 などで使用します。
解決策: IronBarcode は BarcodeEncoding の列挙型を IronBarCode の名前空間で使用します。 フォーマット参照と、フォーマット列挙値を格納、比較、または切り替えるコードをすべて更新してください。
// Before (Scanbot)
BarcodeFormat.Code128
BarcodeFormat.QrCode
BarcodeFormat.Ean13
// After (IronBarcode)
BarcodeEncoding.Code128
BarcodeEncoding.QRCode
BarcodeEncoding.EAN13
// Before (Scanbot)
BarcodeFormat.Code128
BarcodeFormat.QrCode
BarcodeFormat.Ean13
// After (IronBarcode)
BarcodeEncoding.Code128
BarcodeEncoding.QRCode
BarcodeEncoding.EAN13
' Before (Scanbot)
BarcodeFormat.Code128
BarcodeFormat.QrCode
BarcodeFormat.Ean13
' After (IronBarcode)
BarcodeEncoding.Code128
BarcodeEncoding.QRCode
BarcodeEncoding.EAN13
IronBarcode はデフォルトでサポートされているすべての形式を自動検出します。期待される形式が事前にわかっている場合に、パフォーマンス最適化のために BarcodeReaderOptions を使用した明示的形式フィルタリングが必要です。
Scanbot SDK移行チェックリスト
マイグレーション前のタスク
コードベースを監査して、Scanbot SDKの使用箇所をすべて特定します。
grep -rn "ScanbotSDK.Initialize" --include="*.cs" .
grep -rn "BarcodeScannerScreenConfiguration" --include="*.cs" .
grep -rn "ScanbotSDKMain.Barcode.StartScannerAsync" --include="*.cs" .
grep -rn "result\.Barcodes" --include="*.cs" .
grep -rn "barcode\.Format" --include="*.cs" .
grep -rn "barcode\.Text" --include="*.cs" .
grep -rn "OperationResult\.Ok" --include="*.cs" .
grep -rn "using ScanbotBarcodeSDK" --include="*.cs" .
grep -rn "BarcodeFormat\." --include="*.cs" .
grep -rn "ScanbotSDK.Initialize" --include="*.cs" .
grep -rn "BarcodeScannerScreenConfiguration" --include="*.cs" .
grep -rn "ScanbotSDKMain.Barcode.StartScannerAsync" --include="*.cs" .
grep -rn "result\.Barcodes" --include="*.cs" .
grep -rn "barcode\.Format" --include="*.cs" .
grep -rn "barcode\.Text" --include="*.cs" .
grep -rn "OperationResult\.Ok" --include="*.cs" .
grep -rn "using ScanbotBarcodeSDK" --include="*.cs" .
grep -rn "BarcodeFormat\." --include="*.cs" .
- すべてのスキャン呼び出し箇所を文書化し、それらが共有コード、プラットフォーム固有コード、またはUIイベントハンドラのいずれにあるかをメモする
- ページやフローが、主要なユーザー操作としてScanbotのリアルタイムビューファインダーに依存しているかどうかを特定する
AndroidManifest.xmlおよびInfo.plistにカメラ権限エントリが存在することを確認してください- Scanbot に関連する条件付きパッケージ参照のための
.csprojを確認してください
コード更新タスク
ScanbotSDK.MAUINuGet パッケージを削除します.csprojから Scanbot の条件付き<PackageReference>エントリをすべて削除しますIronBarcodeNuGet パッケージをインストールします- すべてのファイルで
using ScanbotSDK.MAUI;をusing IronBarCode;に置き換えます - アプリケーションの起動時に
ScanbotSDK.Initialize(...)をIronBarCode.License.LicenseKey = "key"に置き換えます ScanbotSDKMain.Barcode.StartScannerAsync(configuration)をMediaPicker.CapturePhotoAsync()に置き換えた後、ストリームコピーとBarcodeReader.Read(bytes)を MAUI カメラワークフローで行います- サーバーサイドおよびファイル処理のコンテキストで
ScanbotSDKMain.Barcode.StartScannerAsync(configuration)をBarcodeReader.Read(filePath)またはBarcodeReader.Read(stream)に置き換えます result.Status == OperationResult.Okチェックをresults.Any()またはresults.FirstOrDefault() != nullに置き換えますresult.Barcodesコレクションの参照をBarcodeReader.Read()の返り値に置き換えますbarcode.Textプロパティアクセスをresult.Valueに置き換えますBarcodeFormat.*の列挙型値をBarcodeEncoding.*と等価のものに置き換えます- 処理オプションが必要な場合には
new BarcodeScannerScreenConfiguration()をnew BarcodeReaderOptions()に置き換えます
移行後のテスト
- WindowsおよびmacOS(存在する場合)を含む、すべてのMAUIターゲットプラットフォームでビルドが成功することを確認します。
- 実際に動作する iOS デバイスおよび Android デバイスで
MediaPicker.CapturePhotoAsync()フローをテストしてください IronBarcodeでデコードされたバーコード値が、同じ物理バーコードに対してScanbotで以前にデコードされた値と一致することを確認します。 プロジェクトに文書処理ワークフローが含まれている場合は、複数ページPDFの抽出をテストしてください。 BarcodeScannerScreenConfiguration.BarcodeFormatsに以前に設定されたすべてのバーコードタイプを形式検出がカバーしていることを確認してください- サーバー側のエンドポイントまたはバックグラウンドジョブが、同じドキュメントサンプルに対して正しい結果を生成することを確認します。 iOSとAndroidで初回起動時にカメラのアクセス許可を求めるプロンプトが正しく表示されることを確認する。
IronBarcodeへの移行の主なメリット
すべての展開対象に共通する統合パッケージ: IronBarcodeは一度インストールするだけで、MAUIモバイル、MAUIデスクトップ、 ASP.NET Core、Azure Functions、コンソールアプリケーション、およびWindowsデスクトップアプリケーションで動作します。 チームは、同一システムの異なる部分ごとに個別のバーコード依存関係を持つ必要がなくなった。
PDFおよび文書処理: IronBarcodeはPDFファイルからバーコードをネイティブに読み取り、各結果にはバーコードが見つかったページ番号が記録されます。 Scanbot モデル内で以前は不可能だったドキュメントワークフローが、BarcodeReader.Read("document.pdf") で簡単な操作となります。
WindowsおよびmacOSデスクトップMAUIのサポート: Scanbotを削除した後、WindowsまたはmacOSを含むマルチターゲットMAUIプロジェクトがエラーなくビルドされます。 IronBarcodeは、4つのMAUIターゲットすべてで同じバーコード読み取りAPIを提供するため、Scanbotが必要としていたプラットフォーム依存の依存関係管理が不要になります。
永久ライセンス所有権:一度購入すれば、毎年更新する必要がなくなります。 IronBarcodeは、一度ライセンスを取得すれば、購入したプランで追加料金なしで無期限に使用できます。 プロジェクトの範囲がScanbotのモバイル対応範囲を超えたチームは、永続的な契約モデルの方が長期的なコスト計画により適していることに気づいています。
バーコード生成: IronBarcodeは、画像ファイル、ストリーム、埋め込みコンテンツなど、サポートされているすべての形式でバーコードを生成できます。 読み取りと生成の両方を必要とするプロジェクトでは、Scanbotとは別に別のライブラリを用意する必要がなくなりました。
機械学習による読み取り支援: IronBarcodeは、機械学習に基づくエラー訂正と損傷したバーコードの復元を、標準的な検出アルゴリズムでは解読できない、コントラストが低い、部分的な損傷がある、印刷品質が悪いなど、困難な現実世界の画像に適用します。 この機能は、画像品質が変動する文書処理ワークフローにおいて特に重要です。
よくある質問
なぜScanbot SDKからIronBarcodeに移行する必要があるのですか?
一般的な理由としては、ライセンスの簡素化(SDK + ランタイムキーの複雑さの排除)、スループット制限の排除、ネイティブPDFサポートの獲得、Docker/CI/CDデプロイの改善、プロダクションコード内のAPI定型文の削減などが挙げられます。
ScanbotのAPIコールをIronBarcodeに置き換えるには?
インスタンスの作成とライセンスの定型文をIronBarCode.License.LicenseKey = "key "に置き換えてください。リーダー・コールをBarcodeReader.Read(path)に、ライター・コールをBarcodeWriter.CreateBarcode(data, encoding)に置き換えてください。静的メソッドはインスタンス管理を必要としません。
Scanbot SDKからIronBarcodeに移行する際、コードはどのくらい変更されますか?
ほとんどのマイグレーションでは、コード行数は少なくなります。ライセンスの定型文、インスタンス・コンストラクタ、明示的なフォーマット設定が削除されます。コアとなる読み取り/書き込み操作は、より短いIronBarcodeに対応し、よりきれいな結果オブジェクトが得られます。
移行時にScanbot SDKとIronBarcodeの両方をインストールしておく必要がありますか?
ほとんどのマイグレーションは、並列操作ではなく、直接置き換えです。一度に1つのサービスクラスを移行し、NuGet参照を置き換え、インスタンス化とAPI呼び出しパターンを更新してから次のクラスに移行します。
IronBarcodeのNuGetパッケージ名は何ですか?
パッケージは'IronBarcode'(大文字のBとC)です。Install-Package IronBarcode'または'dotnet add package IronBarcode'でインストールしてください。コード中のusingディレクティブは'using IronBarcode;'である。
IronBarcode は Scanbot SDK と比較して、どのように Docker デプロイを簡素化しますか?
IronBarcodeは外部SDKファイルやマウントされたライセンス設定のないNuGetパッケージです。Dockerでは、IRONBARCODE_LICENSE_KEY環境変数を設定すると、パッケージが起動時にライセンス検証を処理します。
Scanbotから移行した後、IronBarcodeはすべてのバーコードフォーマットを自動的に検出しますか?
IronBarcodeは、サポートされているすべてのフォーマットのシンボルを自動検出します。明示的なBarcodeTypesの列挙は必要ありません。フォーマットが既に知られていて、パフォーマンスが重要な場合、BarcodeReaderOptionsは最適化として検索空間を制限することができます。
IronBarcodeは別のライブラリなしでPDFからバーコードを読み取ることができますか?
BarcodeReader.Read("document.pdf")は、PDFファイルをネイティブに処理します。結果には、見つかった各バーコードの PageNumber、Format、Value、および Confidence が含まれます。外部のPDFレンダリングステップは必要ありません。
IronBarcodeはどのようにパラレルバーコード処理を行うのですか?
IronBarcodeの静的メソッドはステートレスでスレッドセーフです。Parallel.ForEachをスレッドごとのインスタンス管理なしにファイルリスト上で直接使用します。BarcodeReaderOptions.MaxParallelThreadsは内部のスレッドバジェットを制御します。
Scanbot 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、ストリームなどの複数の出力形式をサポートしています。

