.NET MAUIバーコードスキャナ SDK アプリの構築方法
.NET MAUIは、Android、iOS、Windowsをターゲットとする単一のコードベースという約束を実現しています。 課題となるのは、バーコードスキャンなどのネイティブなハードウェア機能を統合する必要がある場合です。 カメラAPIを手動でブリッジするには、プラットフォーム固有の設定、条件付きコンパイルディレクティブ、そして何時間にも及ぶデバッグ作業が必要になります。 もっと速い方法がある。
このチュートリアルでは、 IronBarcodeを使用して.NET MAUIで動作するクロスプラットフォームのバーコードスキャナを構築する方法を説明します。 プロジェクトの設定、プラットフォーム権限の設定、画像ファイルからのバーコードスキャン、PDFドキュメントからのバーコード読み取り、スキャンオプションによる複数のシンボル体系の処理など、すべてサポートされているあらゆるターゲットで実行可能なコードで行います。
無料トライアルを開始し、以下の手順に従ってください。
どのように.NET MAUIでBarCodeスキャナーSDKをセットアップしますか?
.NET MAUI BarCodeスキャナSDKのセットアップには、新規プロジェクトの作成、NuGetパッケージのインストール、プラットフォーム権限の設定が必要です。 Visual Studioでの設定プロセス全体は数分で完了します。
.NETのMAUIプロジェクトを作成する
Visual Studioを開き、新しい.NET MAUI Appプロジェクトを作成します。 プロジェクト名には"BarcodeScanner"など、分かりやすい名前を付け、ターゲットフレームワークとして.NET 8以降を選択してください。 Visual Studio は、Android と iOS それぞれにプラットフォーム固有のフォルダーを含む、デフォルトのプロジェクト構造を生成します。
.NET 10 をターゲットとする場合も、同じプロジェクトテンプレートが適用されます。 必要に応じて、.csproj ファイル内の <TargetFrameworks> プロパティを更新して、net10.0-android、net10.0-ios、および net10.0-windows10.0.19041.0 を含めます。 .NET MAUIがサポートするプラットフォームのドキュメントを参照して、対象となるフレームワーク名と最小OSバージョンの要件の完全なリストを確認してください。
IronBarcodeをインストールする
パッケージマネージャーコンソールを使用して、 IronBarcode NuGetパッケージをインストールします。
Install-Package BarCode
このコマンドは、バーコードスキャナSDKと、 .NET MAUIアプリケーションに必要なすべての依存関係をダウンロードしてインストールします。
プラットフォーム権限の設定
ライブカメラ映像ではなく画像ファイルからスキャンする場合でも、 .NET MAUIバーコードスキャナーアプリに対して以下の権限を設定することをお勧めします。
Android の場合は、Platforms/Android/AndroidManifest.xml に以下を追加してください。
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
iOSの場合、Platforms/iOS/Info.plistに以下のエントリを追加してください。
<key>NSPhotoLibraryUsageDescription</key>
<string>Access needed to select barcode images for scanning.</string>
<key>NSCameraUsageDescription</key>
<string>Camera permission for barcode scanning.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Access needed to select barcode images for scanning.</string>
<key>NSCameraUsageDescription</key>
<string>Camera permission for barcode scanning.</string>
SDKを初期化します
アプリケーションのライフサイクルの早い段階でライセンスキーを設定し、スキャン呼び出しが行われる前にIronBarcodeが完全にアクティベートされるようにしてください。 アクティベーションを MauiProgram.cs に配置します。
using IronBarCode;
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
// Activate IronBarcode before the app starts
License.LicenseKey = "YOUR_LICENSE_KEY_HERE";
return builder.Build();
using IronBarCode;
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
// Activate IronBarcode before the app starts
License.LicenseKey = "YOUR_LICENSE_KEY_HERE";
return builder.Build();
Imports IronBarCode
Dim builder = MauiApp.CreateBuilder()
builder _
.UseMauiApp(Of App)() _
.ConfigureFonts(Sub(fonts)
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular")
End Sub)
' Activate IronBarcode before the app starts
License.LicenseKey = "YOUR_LICENSE_KEY_HERE"
Return builder.Build()
IronBarcodeは、開発およびテスト用の無料トライアルライセンスを提供しています。 起動時に一度キーを設定すると、同じプロセス内で BarcodeReader および BarcodeWriter への以降のすべての呼び出しで、有効化されたライセンスが使用されます。
画像ファイルからバーコードを読み取るにはどうすればよいですか?
MAUIバーコードスキャナーの主要機能は、選択した画像からバーコードを読み取ることです。 BarcodeReader.Read() メソッドはファイル パスを受け取り、検出されたバーコードごとに 1 つの BarcodeResult オブジェクトのコレクションを返します。
ユーザーインターフェイスのデザイン
MainPage.xaml に、ユーザーが画像ファイルを選択してスキャンしたバーコードデータを表示できる、すっきりとしたインターフェースを作成します。
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BarcodeScanner.MainPage">
<VerticalStackLayout Padding="20" Spacing="15">
<Label Text=".NET MAUI Barcode Scanner" FontSize="24" HorizontalOptions="Center"/>
<Button Text="Select Image to Scan" Clicked="OnSelectImageClicked"/>
<Image x:Name="SelectedImageView" HeightRequest="200"/>
<Label x:Name="ResultLabel" FontSize="16"/>
</VerticalStackLayout>
</ContentPage>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BarcodeScanner.MainPage">
<VerticalStackLayout Padding="20" Spacing="15">
<Label Text=".NET MAUI Barcode Scanner" FontSize="24" HorizontalOptions="Center"/>
<Button Text="Select Image to Scan" Clicked="OnSelectImageClicked"/>
<Image x:Name="SelectedImageView" HeightRequest="200"/>
<Label x:Name="ResultLabel" FontSize="16"/>
</VerticalStackLayout>
</ContentPage>
バーコード スキャンを実装する
MainPage.xaml.cs にスキャンロジックを追加します。 このコードは、MAUI FilePicker API を介して画像の選択を処理し、選択されたファイルパスをIronBarcodeに渡します。
using IronBarCode;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void OnSelectImageClicked(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
FileTypes = FilePickerFileType.Images,
PickerTitle = "Select a barcode image"
});
if (result != null)
{
// Display the selected image
SelectedImageView.Source = ImageSource.FromFile(result.FullPath);
// Read barcodes from the image file
var barcodes = BarcodeReader.Read(result.FullPath);
ResultLabel.Text = barcodes.Any()
? $"Found: {barcodes.First().Value}"
: "No barcodes detected in selected image.";
}
}
}
using IronBarCode;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void OnSelectImageClicked(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
FileTypes = FilePickerFileType.Images,
PickerTitle = "Select a barcode image"
});
if (result != null)
{
// Display the selected image
SelectedImageView.Source = ImageSource.FromFile(result.FullPath);
// Read barcodes from the image file
var barcodes = BarcodeReader.Read(result.FullPath);
ResultLabel.Text = barcodes.Any()
? $"Found: {barcodes.First().Value}"
: "No barcodes detected in selected image.";
}
}
}
Imports IronBarCode
Public Partial Class MainPage
Inherits ContentPage
Public Sub New()
InitializeComponent()
End Sub
Private Async Sub OnSelectImageClicked(sender As Object, e As EventArgs)
Dim result = Await FilePicker.PickAsync(New PickOptions With {
.FileTypes = FilePickerFileType.Images,
.PickerTitle = "Select a barcode image"
})
If result IsNot Nothing Then
' Display the selected image
SelectedImageView.Source = ImageSource.FromFile(result.FullPath)
' Read barcodes from the image file
Dim barcodes = BarcodeReader.Read(result.FullPath)
ResultLabel.Text = If(barcodes.Any(), $"Found: {barcodes.First().Value}", "No barcodes detected in selected image.")
End If
End Sub
End Class
出力

BarcodeReader.Read() メソッドは、選択された画像を分析し、検出されたすべてのバーコードを返します。 IronBarcodeは、QRコード、Code 128、Code 39、EAN-13、その他多くのサポートされているフォーマットを含む、複数のバーコードシンボルを自動的に認識します。 結果コレクションには、PageNumberなどのプロパティと、検出された各コードのバウンディングボックス座標が表示されます。
どのように PDF ドキュメントから BarCode をスキャンしますか?
IronBarcodeが他の多くの代替製品と一線を画す機能の一つは、PDFファイルから直接バーコードを読み取ることができる点です。 これは、出荷明細書、発注書、医療記録など、ドキュメントワークフローを処理する.NET MAUIアプリケーションにとって不可欠です。これらのアプリケーションはすべて、PDFに埋め込まれたバーコードに依存しています。
BarcodeReader.ReadPdf() メソッドはファイル パスを受け取り、画像リーダーと同じ BarcodeResult コレクションを返します。さらに、各バーコードがどの PDF ページから取得されたかを識別するプロパティが追加されています。
using IronBarCode;
private async void OnSelectPdfClicked(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Select a PDF with barcodes"
});
if (result != null)
{
// Read barcodes from every page of the PDF
var barcodes = BarcodeReader.ReadPdf(result.FullPath);
var output = string.Join("\n", barcodes.Select(b =>
$"Page {b.PageNumber}: [{b.BarcodeType}] {b.Value}"));
await DisplayAlert("Scan Results", output.Length > 0 ? output : "No barcodes found.", "OK");
}
}
using IronBarCode;
private async void OnSelectPdfClicked(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Select a PDF with barcodes"
});
if (result != null)
{
// Read barcodes from every page of the PDF
var barcodes = BarcodeReader.ReadPdf(result.FullPath);
var output = string.Join("\n", barcodes.Select(b =>
$"Page {b.PageNumber}: [{b.BarcodeType}] {b.Value}"));
await DisplayAlert("Scan Results", output.Length > 0 ? output : "No barcodes found.", "OK");
}
}
Imports IronBarCode
Private Async Sub OnSelectPdfClicked(sender As Object, e As EventArgs)
Dim result = Await FilePicker.PickAsync(New PickOptions With {
.PickerTitle = "Select a PDF with barcodes"
})
If result IsNot Nothing Then
' Read barcodes from every page of the PDF
Dim barcodes = BarcodeReader.ReadPdf(result.FullPath)
Dim output = String.Join(vbLf, barcodes.Select(Function(b) $"Page {b.PageNumber}: [{b.BarcodeType}] {b.Value}"))
Await DisplayAlert("Scan Results", If(output.Length > 0, output, "No barcodes found."), "OK")
End If
End Sub
出力

ReadPdf() メソッドは、PDF のすべてのページをスキャンし、ページ番号とともにバーコードデータを返すため、複数のバーコードを含むドキュメントを簡単に処理できます。 PDFが数十ページに及ぶ場合は、スキャン対象を関連ページに限定し処理時間を短縮するために、PageNumbers を特定の範囲に設定した BarcodeReaderOptions オブジェクトを渡すことを検討してください。
複数の BarCode や QR コードをどのように扱いますか?
実稼働中のアプリケーションでは、1枚の画像から複数のバーコードを検出したり、バーコードの種類で結果をフィルタリングしたりする必要がある場合がよくあります。 BarcodeReaderOptions クラスは、検出動作を制御する構成プロパティを公開します。 ExpectMultipleBarcodes を true に設定すると、リーダーは最初の一致後もスキャンを続行し、途中で停止しなくなります。
using IronBarCode;
// Configure the reader for multi-barcode detection with type filtering
var options = new BarcodeReaderOptions
{
ExpectMultipleBarcodes = true,
ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128,
Speed = ReadingSpeed.Balanced
};
var barcodes = BarcodeReader.Read(imagePath, options);
foreach (var barcode in barcodes)
{
Console.WriteLine($"Type: {barcode.BarcodeType}, Value: {barcode.Value}");
}
using IronBarCode;
// Configure the reader for multi-barcode detection with type filtering
var options = new BarcodeReaderOptions
{
ExpectMultipleBarcodes = true,
ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128,
Speed = ReadingSpeed.Balanced
};
var barcodes = BarcodeReader.Read(imagePath, options);
foreach (var barcode in barcodes)
{
Console.WriteLine($"Type: {barcode.BarcodeType}, Value: {barcode.Value}");
}
Imports IronBarCode
' Configure the reader for multi-barcode detection with type filtering
Dim options As New BarcodeReaderOptions With {
.ExpectMultipleBarcodes = True,
.ExpectBarcodeTypes = BarcodeEncoding.QRCode Or BarcodeEncoding.Code128,
.Speed = ReadingSpeed.Balanced
}
Dim barcodes = BarcodeReader.Read(imagePath, options)
For Each barcode In barcodes
Console.WriteLine($"Type: {barcode.BarcodeType}, Value: {barcode.Value}")
Next
Speed プロパティは、スキャン時間と精度のトレードオフを制御します。 ReadingSpeed.Faster はスループットを優先するため、高品質の画像を大量にスキャンするアプリケーションに適しています。ReadingSpeed.ExtraSlow は、コントラストが低い、角度がずれている、コードが部分的に遮られているなど、難しい入力に対してより積極的な画像補正処理を適用します。 ReadingSpeed.Balanced は、ほとんどのアプリケーションにとって適切な開始点です。
BarcodeEncoding 列挙型はビット単位の組み合わせをサポートしているため、不要なチェックでパフォーマンスを低下させることなく、使用事例に関連するシンボル体系のみにスキャンを限定できます。
メモリストリームからバーコードを読み取るにはどうすればよいですか?
ファイルパスはほとんどのシナリオでうまく機能しますが、一部 for .NET MAUIワークフローでは、カメラプレビューからキャプチャされたフレーム、REST APIからダウンロードされたバイト、またはプロセス内で生成された画像データなど、画像データをメモリ経由で渡します。 IronBarcodeは、System.IO.Stream 入力をBarcodeReader.Read() オーバーロードで直接サポートします。
using IronBarCode;
using System.IO;
// Read a barcode from a MemoryStream (e.g., an in-memory image buffer)
private BarcodeResult[] ReadFromStream(Stream imageStream)
{
return BarcodeReader.Read(imageStream);
}
// Example: download an image and scan without writing to disk
private async Task<string> ScanDownloadedBarcode(string imageUrl)
{
using var httpClient = new HttpClient();
using var stream = await httpClient.GetStreamAsync(imageUrl);
using var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream);
memoryStream.Position = 0;
var barcodes = BarcodeReader.Read(memoryStream);
return barcodes.Any() ? barcodes.First().Value : string.Empty;
}
using IronBarCode;
using System.IO;
// Read a barcode from a MemoryStream (e.g., an in-memory image buffer)
private BarcodeResult[] ReadFromStream(Stream imageStream)
{
return BarcodeReader.Read(imageStream);
}
// Example: download an image and scan without writing to disk
private async Task<string> ScanDownloadedBarcode(string imageUrl)
{
using var httpClient = new HttpClient();
using var stream = await httpClient.GetStreamAsync(imageUrl);
using var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream);
memoryStream.Position = 0;
var barcodes = BarcodeReader.Read(memoryStream);
return barcodes.Any() ? barcodes.First().Value : string.Empty;
}
Imports IronBarCode
Imports System.IO
Imports System.Net.Http
Imports System.Threading.Tasks
' Read a barcode from a MemoryStream (e.g., an in-memory image buffer)
Private Function ReadFromStream(imageStream As Stream) As BarcodeResult()
Return BarcodeReader.Read(imageStream)
End Function
' Example: download an image and scan without writing to disk
Private Async Function ScanDownloadedBarcode(imageUrl As String) As Task(Of String)
Using httpClient As New HttpClient()
Using stream As Stream = Await httpClient.GetStreamAsync(imageUrl)
Using memoryStream As New MemoryStream()
Await stream.CopyToAsync(memoryStream)
memoryStream.Position = 0
Dim barcodes = BarcodeReader.Read(memoryStream)
Return If(barcodes.Any(), barcodes.First().Value, String.Empty)
End Using
End Using
End Using
End Function
ストリームオーバーロードは、Streamサブクラスを受け入れます。 ライブラリはフォーマット検出を内部的に処理するため、Read() を呼び出す前に画像タイプを指定する必要はありません。
MAUIアプリでバーコードを生成するにはどうすればよいですか?
IronBarcodeは、バーコードの生成と読み取りの両方に対応しています。 BarcodeWriter クラスは、MAUI ビューにインラインで表示できる画像ファイル、Bitmap オブジェクト、または Stream インスタンスとしてバーコードを生成します。 これは、スキャン機能に加えてバーコードの印刷や共有が必要な在庫管理アプリに役立ちます。
using IronBarCode;
// Generate a QR code and display it in a MAUI Image control
private async void OnGenerateQrClicked(object sender, EventArgs e)
{
// Create a QR code barcode
var qrCode = QRCodeWriter.CreateQrCode(
value: "https://ironsoftware.com/csharp/barcode/",
qrCodeSize: 500,
errorCorrection: QRCodeWriter.QrErrorCorrectionLevel.Medium
);
// Save to a temporary file and display
var tempPath = Path.Combine(FileSystem.CacheDirectory, "generated-qr.png");
qrCode.SaveAsPng(tempPath);
GeneratedImageView.Source = ImageSource.FromFile(tempPath);
}
using IronBarCode;
// Generate a QR code and display it in a MAUI Image control
private async void OnGenerateQrClicked(object sender, EventArgs e)
{
// Create a QR code barcode
var qrCode = QRCodeWriter.CreateQrCode(
value: "https://ironsoftware.com/csharp/barcode/",
qrCodeSize: 500,
errorCorrection: QRCodeWriter.QrErrorCorrectionLevel.Medium
);
// Save to a temporary file and display
var tempPath = Path.Combine(FileSystem.CacheDirectory, "generated-qr.png");
qrCode.SaveAsPng(tempPath);
GeneratedImageView.Source = ImageSource.FromFile(tempPath);
}
Imports IronBarCode
' Generate a QR code and display it in a MAUI Image control
Private Async Sub OnGenerateQrClicked(sender As Object, e As EventArgs)
' Create a QR code barcode
Dim qrCode = QRCodeWriter.CreateQrCode(
value:="https://ironsoftware.com/csharp/barcode/",
qrCodeSize:=500,
errorCorrection:=QRCodeWriter.QrErrorCorrectionLevel.Medium
)
' Save to a temporary file and display
Dim tempPath = Path.Combine(FileSystem.CacheDirectory, "generated-qr.png")
qrCode.SaveAsPng(tempPath)
GeneratedImageView.Source = ImageSource.FromFile(tempPath)
End Sub
QRCodeWriter クラスは、QR エラー訂正の 4 つのレベル (低、中、四分位、高)、カスタムサイズ設定、および前景色/背景色の制御を含むスタイル設定オプションをサポートしています。 QR以外のシンボル体系の場合は、適切なBarcodeWriter.CreateBarcode()を使用してください。 バーコード生成APIのリファレンスドキュメントには、サポートされているすべての出力形式が記載されています。
このバーコードスキャナーライブラリの主な機能は何ですか?
IronBarcodeは、.NET MAUIバーコードスキャンプロジェクトにおいて、ZXing .NET.MAUIなどのオープンソースの代替製品とは異なる、いくつかの利点を提供します。
| 能力 | 詳細 |
|---|---|
| クロスプラットフォームサポート | 単一のNuGetパッケージから Android、iOS、Windows をターゲットとする |
| 複数の入力ソース | ファイルパス、メモリ ストリーム、および PDF ドキュメントからスキャンします |
| フォーマットのカバー範囲 | QRコード、データマトリックス、PDF417など、30種類以上の1次元および2次元シンボルをデコードします。 |
| バーコード生成 | QRコードと1次元バーコードをPNG、ビットマップ、またはストリーム出力として生成します。 |
| 画像補正 | 回転、傾斜、低コントラストの入力を自動的に処理します |
| ネイティブSDKへの依存なし | プラットフォーム固有のネイティブバインディングを必要としない、純粋な.NETライブラリ |
.NET MAUIプロジェクトにおいて"ネイティブSDKへの依存がない"という点は重要です。なぜなら、プラットフォーム固有のネイティブライブラリは、ターゲットごとに個別のリンク手順を必要とするからです。 IronBarcodeはこの複雑さを完全に回避しているため、同じNuGet参照を使用するだけで、追加の設定なしに、サポートされている3つのプラットフォームすべてに対応する動作するバイナリを生成できます。
サポートされているバーコード形式の完全なリストについては、 IronBarcodeのサポート対象形式に関するドキュメントを参照してください。 本番環境への導入における価格設定およびライセンス条件については、IronBarcodeのライセンスページをご覧ください。
生産現場におけるバーコードスキャンのベストプラクティスとは?
バーコードスキャナーを実稼働環境に導入するには、基本的な読み取り呼び出し以外にも、いくつかの点に注意を払う必要があります。 以下のガイドラインでは、.NET MAUIバーコードアプリで最もよく発生する障害点について説明します。
適切な読み取り速度を選択してください。 ReadingSpeed.Balanced は、ほとんどの実世界の画像を正しく処理します。 印刷された文書やユーザーが再取得できない画像のスキャン用に、ReadingSpeed.ExtraSlow を予約してください。 各スキャンにかなりの時間がかかるため、大量のワークフローでは ReadingSpeed.ExtraSlow の使用を避けてください。
想定されるタイプでフィルタリングします。アプリがQRコードのみを処理する場合は、ExpectBarcodeTypes = BarcodeEncoding.QRCode を設定します。 検索範囲を制限することで、処理時間を短縮し、背景画像に含まれる他のシンボルによる誤検出を排除できます。
ExpectMultipleBarcodes は必要な場合にのみ使用してください。これを true に設定すると、リーダーが常に追加のパスを実行します。 単一のバーコードを入力する場合は、デフォルト設定(false)のままにしておくと、最初の有効なコードが見つかった時点でスキャンが終了します。
空の結果を適切に処理します。 BarcodeReader.Read() バーコードが検出されない場合、例外をスローするのではなく、空の配列を返します。 First() にアクセスする前に .Any() を確認し、ユーザーに明確なメッセージを表示します。 "バーコードが十分に明るく中央に配置されていることを確認してください"といったガイダンス付きの再試行プロンプトは、一般的なエラーメッセージよりもユーザーエクスペリエンスを向上させます。
オプション オブジェクトをキャッシュします。スキャンごとに BarcodeReaderOptions インスタンスを作成すると、割り当てが増加します。 オプションはクラスレベルで一度構築し、呼び出しごとに再利用します。
スキャンエラーの診断とパフォーマンスの最適化に関する詳細なガイダンスについては、 IronBarcodeのトラブルシューティングガイドとバーコードリーダーのチュートリアルを参照してください。
次のステップは何ですか?
IronBarcodeを使用して.NET MAUIバーコード スキャナーを構築するには、単一のNuGetパッケージをインストールし、プラットフォームのアクセス許可を構成し、ファイル パスまたはストリームを使用して BarcodeReader.Read() を呼び出す必要があります。 同じAPIが、プラットフォーム固有のコード分岐なしに、Android、iOS、Windowsを対象としています。
アプリの機能をさらに拡張するには、以下のリソースを検討してください。
- IronBarcodeの全機能一覧-- 全てのスキャンおよび生成機能のカタログ -バーコードリーダーAPIリファレンス-- メソッドとプロパティの完全なドキュメント
- MAUIバーコードリーダーのステップバイステップチュートリアル-- カメラ統合を含む詳細な解説
- MAUIドキュメントスキャナーガイド- ドキュメントスキャンのユースケース
無料トライアルを開始して開発ライセンスキーを取得するか、本番環境への導入に関するライセンスオプションをご確認ください。
よくある質問
.NET MAUIとは何ですか? また、バーコード スキャンの統合が難しいのはなぜですか?
.NET MAUIは、単一のコードベースでAndroid、iOS、WindowsをターゲットとするクロスプラットフォームUIフレームワークです。バーコードスキャンは、プラットフォームごとに異なるカメラAPIとストレージAPIが公開されているため、容易ではありません。IronBarcodeは、プラットフォームの違いに対応する統合された.NET APIを提供します。
IronBarcode は.NET MAUIアプリでどのバーコード形式をサポートしていますか?
IronBarcodeは、QRコード、Code 128、Code 39、EAN-13、EAN-8、UPC-A、UPC-E、Data Matrix、PDF417、Aztec、ITFなど、30種類以上のバーコードシンボルをサポートしています。BarcodeEncoding列挙体を使用して、特定の形式でフィルタリングできます。
IronBarcode は.NET MAUIアプリで PDF ファイルからバーコードを読み取ることができますか?
はい。BarcodeReader.ReadPdf() メソッドは PDF ドキュメントの全ページをスキャンし、BarcodeResult コレクションを返します。各結果には、バーコードの値、種類、ページ番号が含まれます。
IronBarcode はすべて for .NET MAUIターゲット プラットフォームで動作しますか?
IronBarcodeは、単一のNuGetパッケージを使用して、 .NET MAUIプロジェクトでAndroid、iOS、Windowsのターゲットをサポートします。プラットフォーム固有のネイティブSDKバインディングは必要ありません。
1 つの画像から複数のバーコードをスキャンするにはどうすればよいですか?
BarcodeReaderOptions で ExpectMultipleBarcodes = true を設定し、オプションオブジェクトを BarcodeReader.Read() に渡します。リーダーは追加のスキャンパスを実行し、画像内のすべてのバーコードを検出します。
ReadingSpeed.Faster と ReadingSpeed.ExtraSlow の違いは何ですか?
ReadingSpeed.Faster はスループットを優先し、高画質画像に適しています。ReadingSpeed.ExtraSlow はより強力な画像補正を適用し、低コントラスト、回転、または部分的に隠れたバーコードなどの難しい入力に適しています。
IronBarcode はMemoryStream からバーコードを読み取ることができますか?
はい。BarcodeReader.Read() は、MemoryStream、FileStream、ネットワークストリームを含む System.IO.Stream パラメータを受け入れます。これにより、ディスクへの書き込みなしでメモリ内の画像データをスキャンできます。
IronBarcodeを使用して.NET MAUIアプリで QR コードを生成するにはどうすればよいでしょうか?
QRCodeWriter.CreateQrCode() を、対象値、サイズ、エラー訂正レベルを指定して実行します。SaveAsPng() を使用して結果を PNG ファイルとして保存し、ImageSource.FromFile() を使用して MAUI イメージコントロールに表示します。
.NET MAUI Android アプリでバーコードをスキャンするにはどのような権限が必要ですか?
AndroidManifest.xmlにandroid.permission.READ_EXTERNAL_STORAGEとandroid.permission.CAMERAを追加します。iOSの場合は、Info.plistにNSPhotoLibraryUsageDescriptionとNSCameraUsageDescriptionキーを追加します。



