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

Migrating from Syncfusion Barcode to IronBarcode

Syncfusion BarcodeからIronBarcodeへの移行

このガイドは、IronBarcodeへの移行経路を提供し、Syncfusionのバーコードコントロール—WinFormsおよびWPF用SfBarcodeGeneratorを対象にしています。 本書では、チームがこの移行を行う構造的な理由、 NuGetパッケージとライセンス設定を置き換えるためのステップバイステップのクイックスタートガイド、一般的なシナリオすべてに対応した移行前後のコード例、および既存のコードベースを監査するための移行チェックリストについて解説しています。 プロジェクトで他のSyncfusionコンポーネント(グリッド、チャート、スケジューラーなど)も使用している場合、それらのパッケージとその登録には影響はなく、バーコード固有のコードのみが変更されます。

Syncfusion Barcodeから移行する理由

読み取りギャップ: SfBarcodeGeneratorは読み取り機能を持たない生成コントロールです。 いずれのクラスにも.Scan()メソッドはありません。 プロジェクトでアップロードされた画像、スキャンされた文書、またはPDFファイルからバーコードを読み取る必要がある場合、 Syncfusionのバーコード制御機能ではそれを実現する手段がありません。 Syncfusionのドキュメントでは、ソリューションとしてBarcode Reader OPXを推奨していますが、これは別途購入、ライセンス取得、保守が必要な商用製品です。

OPXは無料ソフトウェアを有料でラップしたソフトウェアです。バーコードリーダーであるOPXは、内部的にZXing .NETを使用しています。ZXing .Netは、Apache 2.0ライセンスの下で公開されているオープンソースのバーコード読み取りライブラリです。 Apache 2.0は寛容なライセンスです。 ど for .NET開発者でも、dotnet add package ZXing.Netを使って直接ZXing.Netをインストールし、商用アプリケーションで無料で使用できます。Syncfusionの完全な読み取りおよび生成ワークフローには、2つの別々のSyncfusion製品、2つのライセンス契約、および2つのAPIサーフェスが必要です—一方、読み取り機能はOPXがラップする無料ライブラリから直接取得できたはずです。

コミュニティライセンスの難点: Syncfusionのコミュニティライセンスを取得するには、以下の4つの条件を同時に継続的に満たす必要があります。年間総収益が100万ドル未満、開発者数が5人以下、従業員総数が10人以下、外部からの資金調達総額が300万ドル未満。政府機関は規模に関わらず対象外です。これらの条件のうちいずれか1つでも満たすと、直ちに商用ライセンスの義務が発生します。 シリーズA資金調達ラウンドでは、通常、完了した時点で調達資金が300万ドルを超え、チームの規模や収益に関係なくライセンス料が発生します。 商業的な移行は$0から開発者1人当たりの年次Essential Studioサブスクリプションに移行します — そのサブスクリプションはバーコードコンポーネントだけでなくスイート全体をカバーします。 Syncfusionの公開されたパスは営業からのカスタム見積りです。

バージョン固有のキーローテーション: Syncfusionのライセンスキーは、特定のEssential Studioのバージョン範囲に関連付けられています。 バージョン24.xから25.xにアップグレードするには、アカウントポータルから新しいキーを取得し、そのキーを各デプロイメント環境のシークレットストアで更新し、再デプロイして、試用版の透かしが本番環境の出力に表示されないようにする必要があります。 リリース頻度が高いチームや、複数のデプロイメント対象を持つチームにとって、このローテーションは、バーコード画像を生成するという基本的な要件に見合わない、繰り返し発生する運用上の負担となる。

基本的な問題

Syncfusionの制御アーキテクチャでは、プログラムによるファイル生成は間接的に行われます。 DrawToBitmapを呼び出し、それからビットマップを保存する必要があります—これは、Windows Formsランタイムを依存として持つWinFormsレンダリングパターンです。

// Syncfusion SfBarcode: indirect file output through DrawToBitmap
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");

var barcode = new SfBarcode();
barcode.Text = "SHIP-2024-001";
barcode.Symbology = BarcodeSymbolType.Code128A;
barcode.Width = 400;
barcode.Height = 150;

using var bitmap = new Bitmap(barcode.Width, barcode.Height);
barcode.DrawToBitmap(bitmap, barcode.ClientRectangle);
bitmap.Save("shipping-label.png", ImageFormat.Png);
// Reading: not possible — requires separate OPX purchase
// Syncfusion SfBarcode: indirect file output through DrawToBitmap
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");

var barcode = new SfBarcode();
barcode.Text = "SHIP-2024-001";
barcode.Symbology = BarcodeSymbolType.Code128A;
barcode.Width = 400;
barcode.Height = 150;

using var bitmap = new Bitmap(barcode.Width, barcode.Height);
barcode.DrawToBitmap(bitmap, barcode.ClientRectangle);
bitmap.Save("shipping-label.png", ImageFormat.Png);
// Reading: not possible — requires separate OPX purchase
Imports Syncfusion.Licensing
Imports System.Drawing
Imports System.Drawing.Imaging

' Syncfusion SfBarcode: indirect file output through DrawToBitmap
SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY")

Dim barcode As New SfBarcode()
barcode.Text = "SHIP-2024-001"
barcode.Symbology = BarcodeSymbolType.Code128A
barcode.Width = 400
barcode.Height = 150

Using bitmap As New Bitmap(barcode.Width, barcode.Height)
    barcode.DrawToBitmap(bitmap, barcode.ClientRectangle)
    bitmap.Save("shipping-label.png", ImageFormat.Png)
End Using
' Reading: not possible — requires separate OPX purchase
$vbLabelText   $csharpLabel

IronBarcodeはファイルを直接生成し、同じパッケージで読み込みます。

// IronBarcode: direct generation and reading in one package
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

// Generate
BarcodeWriter.CreateBarcode("SHIP-2024-001", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .SaveAsPng("shipping-label.png");

// Read — same package, no additional product required
var results = BarcodeReader.Read("shipping-label.png");
foreach (var result in results)
    Console.WriteLine($"{result.Format}: {result.Value}");
// IronBarcode: direct generation and reading in one package
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

// Generate
BarcodeWriter.CreateBarcode("SHIP-2024-001", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .SaveAsPng("shipping-label.png");

// Read — same package, no additional product required
var results = BarcodeReader.Read("shipping-label.png");
foreach (var result in results)
    Console.WriteLine($"{result.Format}: {result.Value}");
Imports IronBarCode

' IronBarcode: direct generation and reading in one package
License.LicenseKey = "YOUR-LICENSE-KEY"

' Generate
BarcodeWriter.CreateBarcode("SHIP-2024-001", BarcodeEncoding.Code128) _
    .ResizeTo(400, 150) _
    .SaveAsPng("shipping-label.png")

' Read — same package, no additional product required
Dim results = BarcodeReader.Read("shipping-label.png")
For Each result In results
    Console.WriteLine($"{result.Format}: {result.Value}")
Next
$vbLabelText   $csharpLabel

IronBarcodeとSyncfusion Barcode:機能比較

フィーチャー Syncfusionバーコード IronBarcode
バーコード生成 はい — UI コントロール (WinForms、WPF、 Blazor、MAUI) はい — 静的API、すべての環境
バーコード読み取り いいえ、別途バーコードリーダーOPXが必要です はい、同じパッケージです
OPXのリーディング製品は、ZXing .NET (Apache 2.0)をラップしています。 はい 該当なし
PDFバーコード出力 いいえ — Syncfusion.Pdf が別途必要です はい—SaveAsPdf()組み込み済み
PDFバーコード読み取り なし はい、ネイティブです
サーバーサイド/ヘッドレス生成 WinFormsランタイムが必要です(DrawToBitmap) ネイティブ — UIへの依存なし
Docker / Linux のデプロイ 制限的 フルサポート
ASP.NET Core の最小限の API 直接サポートされていません フルサポート
ロゴが埋め込まれたQRコード なし はい—.AddBrandLogo()
読み取り時の自動フォーマット検出 該当なし はい
コミュニティ/無料プラン コミュニティライセンス(4つの同時条件) 30日間無料トライアル(透かしのみ表示)
商用ライセンスモデル 年間購読(エッセンシャルスタジオ) 永続(1回限り、ironsoftware.com/csharp/barcode/licensingを参照)
ライセンスキーの範囲 バージョン固有で、主要なNuGetアップデートに合わせてローテーションされます。 メジャーリリース内でバージョンが安定している
プラットフォーム登録手順 3~4ステップ(RegisterLicense + AddSyncfusionBlazor + ConfigureSyncfusionCore + Razorインポート) 1路線、全プラットフォーム
1Dフォーマット範囲 コード128、コード39、EAN、UPC、Codabarなど Syncfusionの全フォーマットにPlus、 PDF417、Aztec、MaxiCode、GS1、USPS IMb、および50以上の
2Dフォーマット範囲 QRコード、データマトリックス QRコード、データマトリックス、PDF417、マイクロPDF417、アステカ、マキシコード

クイックスタート

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

使用中のプラットフォームに対応するSyncfusionバーコードパッケージを削除してください。 プロジェクトが複数のプラットフォームを対象としている場合は、それぞれのプラットフォームに対して削除処理を実行してください。

# Blazor
dotnet remove package Syncfusion.Blazor.BarcodeGenerator

# WinForms
dotnet remove package Syncfusion.SfBarcode.Windows

# WPF
dotnet remove package Syncfusion.SfBarcode.WPF

# MAUI
dotnet remove package Syncfusion.Maui.Barcode
# Blazor
dotnet remove package Syncfusion.Blazor.BarcodeGenerator

# WinForms
dotnet remove package Syncfusion.SfBarcode.Windows

# WPF
dotnet remove package Syncfusion.SfBarcode.WPF

# MAUI
dotnet remove package Syncfusion.Maui.Barcode
SHELL

バーコードパッケージを削除した後、プロジェクト内に他のSyncfusionパッケージが残っていない場合は、ライセンスパッケージも削除してください。

dotnet remove package Syncfusion.Licensing
dotnet remove package Syncfusion.Licensing
SHELL

IronBarcodeをインストールしてください ― すべてのプラットフォームに対応した単一パッケージです。

dotnet add package IronBarcode
dotnet add package IronBarcode
SHELL

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

Syncfusionのバーコード名前空間を削除し、 IronBarcodeの名前空間を追加します。

// Remove these (barcode-specific; leave others if non-barcode Syncfusion controls remain)
using Syncfusion.Windows.Forms.Barcode;
using Syncfusion.Licensing;
// @using Syncfusion.Blazor.BarcodeGenerator  (in _Imports.razor)

// Add this
using IronBarCode;
// Remove these (barcode-specific; leave others if non-barcode Syncfusion controls remain)
using Syncfusion.Windows.Forms.Barcode;
using Syncfusion.Licensing;
// @using Syncfusion.Blazor.BarcodeGenerator  (in _Imports.razor)

// Add this
using IronBarCode;
Imports IronBarCode
$vbLabelText   $csharpLabel

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

アプリケーションの起動時に、 Syncfusionのライセンス登録とプラットフォーム構成を削除します。次に、同じ起動場所にIronBarcodeのライセンス行を1つ追加します。

// Remove from Program.cs / App.xaml.cs / MauiProgram.cs:
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");
builder.Services.AddSyncfusionBlazor();         // Blazor only — remove if no other Syncfusion controls
builder.ConfigureSyncfusionCore();              // MAUI only — remove if no other Syncfusion controls

// Add at the same startup point:
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Remove from Program.cs / App.xaml.cs / MauiProgram.cs:
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");
builder.Services.AddSyncfusionBlazor();         // Blazor only — remove if no other Syncfusion controls
builder.ConfigureSyncfusionCore();              // MAUI only — remove if no other Syncfusion controls

// Add at the same startup point:
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
' Remove from Program.vb / App.xaml.vb / MauiProgram.vb:
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY")
builder.Services.AddSyncfusionBlazor()         ' Blazor only — remove if no other Syncfusion controls
builder.ConfigureSyncfusionCore()              ' MAUI only — remove if no other Syncfusion controls

' Add at the same startup point:
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

CI/CDパイプラインおよびDockerコンテナの場合、キーを環境変数に保存します。

IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE");
IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE");
Imports System

IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_LICENSE")
$vbLabelText   $csharpLabel

コード移行の例

WinForms SfBarcode から BarcodeWriter へ

WinFormsの移行ではDrawToBitmapの間接参照を排除し、直接ファイル出力チェーンに置き換えます。 Syncfusionパターンは、既知の寸法のBitmapを事前に割り当てる必要があります; IronBarcodeは、生成呼び出しの一部として寸法を計算します。

Syncfusion・アプローチ:

using Syncfusion.Windows.Forms.Barcode;
using System.Drawing;
using System.Drawing.Imaging;

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");

var barcode = new SfBarcode();
barcode.Text = "ORD-20240315-001";
barcode.Symbology = BarcodeSymbolType.Code128A;
barcode.BarHeight = 100;
barcode.NarrowBarWidth = 1;
barcode.ShowText = true;
barcode.Width = 400;
barcode.Height = 150;

using var bitmap = new Bitmap(barcode.Width, barcode.Height);
barcode.DrawToBitmap(bitmap, barcode.ClientRectangle);
bitmap.Save("order-label.png", ImageFormat.Png);
using Syncfusion.Windows.Forms.Barcode;
using System.Drawing;
using System.Drawing.Imaging;

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY");

var barcode = new SfBarcode();
barcode.Text = "ORD-20240315-001";
barcode.Symbology = BarcodeSymbolType.Code128A;
barcode.BarHeight = 100;
barcode.NarrowBarWidth = 1;
barcode.ShowText = true;
barcode.Width = 400;
barcode.Height = 150;

using var bitmap = new Bitmap(barcode.Width, barcode.Height);
barcode.DrawToBitmap(bitmap, barcode.ClientRectangle);
bitmap.Save("order-label.png", ImageFormat.Png);
Imports Syncfusion.Windows.Forms.Barcode
Imports System.Drawing
Imports System.Drawing.Imaging

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-VERSION-SPECIFIC-KEY")

Dim barcode As New SfBarcode()
barcode.Text = "ORD-20240315-001"
barcode.Symbology = BarcodeSymbolType.Code128A
barcode.BarHeight = 100
barcode.NarrowBarWidth = 1
barcode.ShowText = True
barcode.Width = 400
barcode.Height = 150

Using bitmap As New Bitmap(barcode.Width, barcode.Height)
    barcode.DrawToBitmap(bitmap, barcode.ClientRectangle)
    bitmap.Save("order-label.png", ImageFormat.Png)
End Using
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

using IronBarCode;

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

BarcodeWriter.CreateBarcode("ORD-20240315-001", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .AddBarcodeText()
    .SaveAsPng("order-label.png");
using IronBarCode;

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

BarcodeWriter.CreateBarcode("ORD-20240315-001", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .AddBarcodeText()
    .SaveAsPng("order-label.png");
Imports IronBarCode

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

BarcodeWriter.CreateBarcode("ORD-20240315-001", BarcodeEncoding.Code128) _
    .ResizeTo(400, 150) _
    .AddBarcodeText() _
    .SaveAsPng("order-label.png")
$vbLabelText   $csharpLabel

BarcodeEncoding.Code128にマッピングされます。 DrawToBitmap + .SaveAsPng()に統合されます。 バーコードをディスクに保存するのではなくWinForms.ToPngBinaryData()を使用してイメージをコントロール内にロードしてください。 IronBarcodeでサポートされている1次元バーコードフォーマットの範囲は、 Syncfusionコントロールでサポートされているフォーマットの範囲をはるかに超えています。

Blazor SfBarcodeGenerator から最小限の API エンドポイントへ

Blazorへの移行は、コードを一行ずつ置き換えるのではなく、構造的な変更です。 SfBarcodeGeneratorはSyncfusion for JavaScriptレイヤーを通じてブラウザでレンダリングされるRazorコンポーネントです。 IronBarcodeにはRazorコンポーネントがありません。 これはサーバーサイドライブラリです。 代替パターンは、サーバー上の最小限のAPIエンドポイントであり、バーコードバイトを返します。このバイトは、 Razorページ内で画像ソースとして参照されます。

Syncfusion・アプローチ:

@page "/fulfillment"
@using Syncfusion.Blazor.BarcodeGenerator

<SfBarcodeGenerator
    Width="300px"
    Height="150px"
    Type="BarcodeType.Code128"
    Value="@orderNumber">
    <BarcodeGeneratorDisplayText Visibility="true"></BarcodeGeneratorDisplayText>
</SfBarcodeGenerator>

@code {
    private string orderNumber = "ORD-20240315-001";
}

IronBarcodeのアプローチ:

Program.csに生成エンドポイントを追加します。

using IronBarCode;

app.MapGet("/barcode/{value}", (string value) =>
{
    var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
        .ResizeTo(300, 150)
        .AddBarcodeText()
        .ToPngBinaryData();

    return Results.File(bytes, "image/png");
});
using IronBarCode;

app.MapGet("/barcode/{value}", (string value) =>
{
    var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
        .ResizeTo(300, 150)
        .AddBarcodeText()
        .ToPngBinaryData();

    return Results.File(bytes, "image/png");
});
Imports IronBarCode

app.MapGet("/barcode/{value}", Function(value As String)
    Dim bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128) _
        .ResizeTo(300, 150) _
        .AddBarcodeText() _
        .ToPngBinaryData()

    Return Results.File(bytes, "image/png")
End Function)
$vbLabelText   $csharpLabel

Razorコンポーネントでエンドポイントを参照します。

@page "/fulfillment"

<img src="/barcode/@orderNumber" alt="Order barcode: @orderNumber" />

@code {
    private string orderNumber = "ORD-20240315-001";
}

このエンドポイントは、独立してテスト可能であり、あらゆるHTTPクライアントから再利用可能で、 Blazor Server、ホスト型APIバックエンドを備えたBlazor WebAssembly、およびその他のあらゆるWebフロントエンドと互換性があります。

QRコード生成

SyncfusionのQRコンポーネントもブラウザ上でレンダリングされ、サーバー側の出力パスはありません。 IronBarcodeは、サーバー側でQRコードを生成し、直接ファイルに出力します。

Syncfusion・アプローチ:

@using Syncfusion.Blazor.BarcodeGenerator

<SfQRCodeGenerator
    Width="300px"
    Height="300px"
    Value="https://example.com/product/ABC-123">
    <QRCodeGeneratorDisplayText Visibility="false">
    </QRCodeGeneratorDisplayText>
</SfQRCodeGenerator>

IronBarcodeのアプローチ:

using IronBarCode;

// Standard QR code
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 300,
    QRCodeWriter.QrErrorCorrectionLevel.High)
    .SaveAsPng("product-qr.png");

// QR code with embedded brand logo — not available in Syncfusion
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 500,
    QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .AddBrandLogo("company-logo.png")
    .SaveAsPng("product-qr-branded.png");
using IronBarCode;

// Standard QR code
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 300,
    QRCodeWriter.QrErrorCorrectionLevel.High)
    .SaveAsPng("product-qr.png");

// QR code with embedded brand logo — not available in Syncfusion
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 500,
    QRCodeWriter.QrErrorCorrectionLevel.Highest)
    .AddBrandLogo("company-logo.png")
    .SaveAsPng("product-qr-branded.png");
Imports IronBarCode

' Standard QR code
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 300, QRCodeWriter.QrErrorCorrectionLevel.High) _
    .SaveAsPng("product-qr.png")

' QR code with embedded brand logo — not available in Syncfusion
QRCodeWriter.CreateQrCode("https://example.com/product/ABC-123", 500, QRCodeWriter.QrErrorCorrectionLevel.Highest) _
    .AddBrandLogo("company-logo.png") _
    .SaveAsPng("product-qr-branded.png")
$vbLabelText   $csharpLabel

OPX読書用代替品

プロジェクトでバーコードリーダーOPXを使用している場合、または読み取り要件を将来のOPX購入に延期している場合、 IronBarcodeは既にインストールされているパッケージでその依存関係を置き換えます。 二次製品なし、二次ライセンスなし。

Syncfusionのアプローチ(バーコードリーダーOPX):

// Requires separate Syncfusionバーコード Reader OPX purchase
// OPX wraps ZXing.Net internally (Apache 2.0 — free to use directly)
using Syncfusion.BarcodeReader;

var reader = new BarcodeReader();
var results = reader.ReadBarcodes("warehouse-scan.png");
foreach (var result in results)
    Console.WriteLine($"Value: {result.Value}");
// Requires separate Syncfusionバーコード Reader OPX purchase
// OPX wraps ZXing.Net internally (Apache 2.0 — free to use directly)
using Syncfusion.BarcodeReader;

var reader = new BarcodeReader();
var results = reader.ReadBarcodes("warehouse-scan.png");
foreach (var result in results)
    Console.WriteLine($"Value: {result.Value}");
Imports Syncfusion.BarcodeReader

Dim reader As New BarcodeReader()
Dim results = reader.ReadBarcodes("warehouse-scan.png")
For Each result In results
    Console.WriteLine($"Value: {result.Value}")
Next
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

using IronBarCode;

// Included in the same NuGet package as generation — no second product required
var results = BarcodeReader.Read("warehouse-scan.png");
foreach (var result in results)
{
    Console.WriteLine($"Format: {result.Format}");
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Confidence: {result.Confidence}%");
}
using IronBarCode;

// Included in the same NuGet package as generation — no second product required
var results = BarcodeReader.Read("warehouse-scan.png");
foreach (var result in results)
{
    Console.WriteLine($"Format: {result.Format}");
    Console.WriteLine($"Value: {result.Value}");
    Console.WriteLine($"Confidence: {result.Confidence}%");
}
Imports IronBarCode

' Included in the same NuGet package as generation — no second product required
Dim results = BarcodeReader.Read("warehouse-scan.png")
For Each result In results
    Console.WriteLine($"Format: {result.Format}")
    Console.WriteLine($"Value: {result.Value}")
    Console.WriteLine($"Confidence: {result.Confidence}%")
Next
$vbLabelText   $csharpLabel

バーコード読み取りに関するドキュメントでは、アップロードハンドラ用のバイト配列からの読み取り、速度と精度の調整、および複数バーコードの検出について説明しています。

PDFバーコード生成

Syncfusionのバーコードコントロールには、PDF出力パスがありません。 IronBarcodeはPDFを第一級の出力フォーマットとして扱います。

Syncfusion・アプローチ:

// なし direct path — requires combining Syncfusion.Barcode.WinForms and Syncfusion.Pdf
// Step 1: Generate to Bitmap via DrawToBitmap
// Step 2: Load Syncfusion PDF document
// Step 3: Insert bitmap as image element
// Two packages, two APIs, two license obligations
// なし direct path — requires combining Syncfusion.Barcode.WinForms and Syncfusion.Pdf
// Step 1: Generate to Bitmap via DrawToBitmap
// Step 2: Load Syncfusion PDF document
// Step 3: Insert bitmap as image element
// Two packages, two APIs, two license obligations
' なし direct path — requires combining Syncfusion.Barcode.WinForms and Syncfusion.Pdf
' Step 1: Generate to Bitmap via DrawToBitmap
' Step 2: Load Syncfusion PDF document
' Step 3: Insert bitmap as image element
' Two packages, two APIs, two license obligations
$vbLabelText   $csharpLabel

IronBarcodeのアプローチ:

using IronBarCode;

// Generate directly to PDF — no secondary library required
BarcodeWriter.CreateBarcode("PALLET-2024-0891", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .SaveAsPdf("pallet-label.pdf");

// Read barcodes from an existing PDF
var pdfResults = BarcodeReader.Read("shipping-manifest.pdf");
foreach (var result in pdfResults)
    Console.WriteLine($"Page {result.PageNumber}: {result.Value}");
using IronBarCode;

// Generate directly to PDF — no secondary library required
BarcodeWriter.CreateBarcode("PALLET-2024-0891", BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .SaveAsPdf("pallet-label.pdf");

// Read barcodes from an existing PDF
var pdfResults = BarcodeReader.Read("shipping-manifest.pdf");
foreach (var result in pdfResults)
    Console.WriteLine($"Page {result.PageNumber}: {result.Value}");
Imports IronBarCode

' Generate directly to PDF — no secondary library required
BarcodeWriter.CreateBarcode("PALLET-2024-0891", BarcodeEncoding.Code128) _
    .ResizeTo(400, 150) _
    .SaveAsPdf("pallet-label.pdf")

' Read barcodes from an existing PDF
Dim pdfResults = BarcodeReader.Read("shipping-manifest.pdf")
For Each result In pdfResults
    Console.WriteLine($"Page {result.PageNumber}: {result.Value}")
Next
$vbLabelText   $csharpLabel

バーコード付きPDF生成ガイドでは、複数ページにわたるPDF出力と、他のドキュメントコンテンツとともにバーコードを埋め込む方法について解説しています。

SyncfusionバーコードAPIからIronBarcodeへのマッピングリファレンス

Syncfusion IronBarcode
SyncfusionLicenseProvider.RegisterLicense("KEY") IronBarCode.License.LicenseKey = "key"
builder.Services.AddSyncfusionBlazor() 不要
builder.ConfigureSyncfusionCore() 不要
new SfBarcode() BarcodeWriter.CreateBarcode()(静的)
barcode.Text = "value" CreateBarcode()の第一パラメータ
barcode.Symbology = BarcodeSymbolType.Code128A BarcodeEncoding.Code128
barcode.Symbology = BarcodeSymbolType.QRBarcode QRCodeWriter.CreateQrCode()
barcode.BarHeight = 100 .ResizeTo(width, 100)
barcode.ShowText = true .AddBarcodeText()
barcode.DrawToBitmap(bitmap, rect) .SaveAsPng(path)
手動MemoryStream .ToPngBinaryData()
<SfBarcodeGenerator Type="BarcodeType.Code128" Value="..."> APIエンドポイント内のBarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
<SfQRCodeGenerator Value="..."> APIエンドポイント内のQRCodeWriter.CreateQrCode(value, size)
BarcodeType.Code128(Blazorのenum) BarcodeEncoding.Code128
バーコードリーダー OPX(別製品、ZXing .NETをラップします) BarcodeReader.Read(path)—ネイティブ、同じパッケージ
コントロールに読み取りAPIはありません BarcodeReader.Read(path)
制御にPDF出力はありません .SaveAsPdf(path)
PDFの閲覧はできません BarcodeReader.Read("document.pdf")

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

問題1: NuGetアップデート後に試用版の透かしが表示される

Syncfusion: Essential Studio 24.xから25.xにアップグレードすると、既存のライセンスキーが無効になります。 シークレットストアを更新する前に生成された出力には、試用版の透かしが表示されます。 これはサイレントエラーです。アプリケーションは実行を継続しますが、規格に準拠しない出力を生成します。

解決策: IronBarcode NuGetパッケージを更新した後、メジャーバージョン内でライセンスキーが変更されない。 マイナーリリースやパッチリリースでは、シークレットの更新や再デプロイは不要です。 メジャーバージョンアップを行う際は、アプリケーションのエントリポイントでキーを一度更新してください。

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

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

問題2:ヘッドレス環境でDrawToBitmapが失敗する

Syncfusion: SfBarcode.DrawToBitmapはWindows Formsレンダリングパイプラインに依存しています。ASP.NET Coreプロセス、Azure Function、またはLinux DockerコンテナでInvalidOperationExceptionがスローされるか、空のビットマップが生成されます。なぜなら、Windows Formsメッセージループが存在しないためです。

解決策: BarcodeWriter.CreateBarcode()に置き換えます。 IronBarcodeは、UIランタイムへの依存関係なしに、マネージドコードで生成を実行します。

// Works in ASP.NET Core, Azure Functions, Docker on Linux, console apps
var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .ToPngBinaryData();
// Works in ASP.NET Core, Azure Functions, Docker on Linux, console apps
var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
    .ResizeTo(400, 150)
    .ToPngBinaryData();
' Works in ASP.NET Core, Azure Functions, Docker on Linux, console apps
Dim bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128) _
    .ResizeTo(400, 150) _
    .ToPngBinaryData()
$vbLabelText   $csharpLabel

問題3:SfBarcodeGeneratorにサーバー側出力がない

Syncfusion: SfBarcodeGeneratorはサーバーサイドAPIサーフェスを持たないRazorコンポーネントです。 コントローラーアクションやバックグラウンドサービスでこれを使用しようとしても、バーコードバイトを生成するための適切なメソッドは見つかりません。

解決策:サーバー側でバーコードを生成し、HTTPレスポンスとして返す最小限のAPIエンドポイントを作成する。 Razorコンポーネントから<img src="...">タグを介してエンドポイントを参照してください。

app.MapGet("/barcode/{value}", (string value) =>
{
    var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
        .ResizeTo(300, 150)
        .ToPngBinaryData();
    return Results.File(bytes, "image/png");
});
app.MapGet("/barcode/{value}", (string value) =>
{
    var bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128)
        .ResizeTo(300, 150)
        .ToPngBinaryData();
    return Results.File(bytes, "image/png");
});
Imports Microsoft.AspNetCore.Builder
Imports Microsoft.AspNetCore.Http

app.MapGet("/barcode/{value}", Function(value As String)
                                   Dim bytes = BarcodeWriter.CreateBarcode(value, BarcodeEncoding.Code128) _
                                       .ResizeTo(300, 150) _
                                       .ToPngBinaryData()
                                   Return Results.File(bytes, "image/png")
                               End Function)
$vbLabelText   $csharpLabel

問題4:読み取り機能の欠如(OPX未購入)

Syncfusion: OPXがまだ購入されていなかったためバーコード読み取りを延期したプロジェクトには、移行する読み取りコードがありません。 読み取り機能を新規に追加するには、OPXの調達、統合、および新しいライセンス契約が必要です。

解決策: IronBarcodeの読み取り機能は同一パッケージに含まれています。 調達や二次的なライセンスは必要ありません。 読み取りが必要な場所にBarcodeReader.Read(path)を追加します:

var results = BarcodeReader.Read("incoming-scan.png");
var results = BarcodeReader.Read("incoming-scan.png");
Dim results = BarcodeReader.Read("incoming-scan.png")
$vbLabelText   $csharpLabel

問題5:移行中のコミュニティライセンスの有効期限切れ

Syncfusion:コミュニティライセンスを使用しているチームが、移行期間中に(資金調達ラウンドの完了など)資格要件のしきい値を超えた場合、移行が完了する前にSyncfusionコントロールが有効な出力を生成しなくなる可能性があります。

解決策: IronBarcodeの30日間無料トライアルでは、収益、従業員数、資本などの条件なしに、完全な評価が可能です。 生成された出力には、試験版の透かしが表示されます。 購入したライセンスキーを有効化すると、そのライセンスは削除されます。 IronBarcodeのライセンスモデルには、組織規模に関する制限はありません。

Syncfusionバーコード移行チェックリスト

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

コードベースを監査して、 Syncfusionバーコードを参照しているすべてのファイルを特定します。

grep -r "SyncfusionLicenseProvider.RegisterLicense\|AddSyncfusionBlazor\|ConfigureSyncfusionCore" --include="*.cs" .
grep -r "new SfBarcode\(\)\|SfBarcodeGenerator\|SfQRCodeGenerator" --include="*.cs" --include="*.razor" .
grep -r "BarcodeSymbolType\.\|BarcodeType\." --include="*.cs" --include="*.razor" .
grep -r "DrawToBitmap\|barcode\.Text\s*=" --include="*.cs" .
grep -r "Syncfusion\.Barcode\|Syncfusion\.Blazor\.BarcodeGenerator" --include="*.csproj" .
grep -r "SyncfusionLicenseProvider.RegisterLicense\|AddSyncfusionBlazor\|ConfigureSyncfusionCore" --include="*.cs" .
grep -r "new SfBarcode\(\)\|SfBarcodeGenerator\|SfQRCodeGenerator" --include="*.cs" --include="*.razor" .
grep -r "BarcodeSymbolType\.\|BarcodeType\." --include="*.cs" --include="*.razor" .
grep -r "DrawToBitmap\|barcode\.Text\s*=" --include="*.cs" .
grep -r "Syncfusion\.Barcode\|Syncfusion\.Blazor\.BarcodeGenerator" --include="*.csproj" .
SHELL

移行コードを記述する前に、以下の事項を文書化してください。

  • SyncfusionLicenseProvider.RegisterLicenseを呼び出しているすべてのファイルをリストします
  • SfBarcodeのインスタンス生成とそのプロパティ割り当てをすべてリストします
  • <SfQRCodeGenerator>Razorコンポーネント使用をすべてリストします
  • DrawToBitmapの呼び出しと下流の保存または表示パスをすべてリストします
  • バーコードリーダーOPXがインストールされているかどうかを確認してください。 もしそうなら、すべての読書呼び出しをリストアップしてください。

コード更新タスク

  1. プロジェクト内の各プラットフォームからSyncfusionバーコードNuGetパッケージを削除します。
  2. 他のSyncfusionコントロールが残っていない場合、Syncfusion.LicensingNuGetパッケージを削除します
  3. IronBarcodeNuGetパッケージをインストールします
  4. アプリケーションのエントリーポイントでIronBarCode.License.LicenseKey = "KEY"に置き換えます
  5. 他のSyncfusionコントロールが残っていない場合、builder.Services.AddSyncfusionBlazor()を削除します
  6. 他のSyncfusionコントロールが残っていない場合、builder.ConfigureSyncfusionCore()を削除します
  7. _Imports.razorから削除します(該当する場合)
  8. using IronBarCodeに置き換えます
  9. new SfBarcode() + プロパティ割り当て + BarcodeWriter.CreateBarcode(value, BarcodeEncoding.X).ResizeTo(w, h).SaveAsPng(path)に置き換えます
  10. BarcodeEncoding.Code128に置き換えます
  11. BarcodeEncoding.Code128に置き換えます
  12. <img src="...">を参照します。
  13. <img src="...">参照に置き換えます
  14. すべてのBarcode Reader OPXの読み取り呼び出しをBarcodeReader.Read(path)に置き換えます
  15. OPXが購入されていないため、以前は読み取り機能がなかった場所にBarcodeReader.Read(path)を追加します

移行後のテスト

生成されたバーコード画像が、ハードウェアスキャナまたは参照リーダーアプリケーションを使用してスキャン可能であることを確認します。 ライセンスキーのアクティベーション後、生成された出力に試用版の透かしが表示されないことを確認してください。

  • 各バーコードタイプでBarcodeReader.Read()が期待される値とフォーマットを返すことを確認します
  • .SaveAsPdf()を使用してPDF出力をテストし、ページ寸法とバーコード寸法が設計要件に一致することを確認します Razorコンポーネント内でテストする前に、 Blazorの最小限のAPIエンドポイントを直接テストしてください(ブラウザまたはHTTPクライアント経由)。
  • DockerとLinuxのデプロイメントがWindows開発マシンと同じ出力を生成することを確認する
  • SyncfusionLicenseProviderの残りの参照がないことを確認します

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

生成と読み取りの統合:移行後、生成と読み取りの両方が単一のNuGetパッケージを介して、単一のライセンスの下で動作します。 購入すべき二次製品はなく、習得すべき別のAPIインターフェースもなく、ライセンス予算を消費するZXing .NETラッパーへの依存もありません。その予算は、本来であれば直接オープンソースライブラリに充てられるはずです。

バージョン固有のキーローテーションの廃止: IronBarcodeのライセンスキーは、メジャーリリース内のマイナーアップデートおよびパッチアップデートにおいても有効です。 新しいキーの取得、各デプロイ環境でのシークレットの更新、そして主要なNuGetバージョン更新のたびに試用版のウォーターマークをクリアするための再デプロイといった運用上のオーバーヘッドは、完全に排除されます。

プラットフォームに依存しないデプロイメント:同じIronBarcodeパッケージと生成 API は、WinForms デスクトップ、 ASP.NET Coreサービス、Azure Functions、コンソール アプリケーション、および Linux Docker コンテナで動作します。 DrawToBitmapによって導入されたWindows Formsランタイム依存は削除され、Blazorデプロイメントはクライアントに依存せず、独立してテスト可能なサーバーサイドAPIエンドポイントにシフトします。

ネイティブPDFサポート:生成と読み込みの両方で、PDFにネイティブに対応しています。 バーコード付きPDFを作成する際に、 Syncfusionの2つの製品を連携させる必要がなくなりました。 PDF形式のマニフェストや出荷書類からバーコードを読み取る際に、別途PDF抽出の手順は不要になりました。

予測可能なライセンス経済性: IronBarcodeの永久ライセンスモデルは、収益、従業員数、資本金などの基準値を課しません。 Syncfusionコミュニティライセンスの適用条件を超えて成長したチーム、または今後そうなる見込みのあるチームは、組織の成長がコンプライアンス違反を引き起こさないライセンスモデルに移行します。

ご注意SyncfusionとZXing.NET はそれぞれの所有者によって登録商標です。 このサイトはSyncfusionまたはZXing.NETと提携しておらず、承認または支援も受けていません。 すべての製品名、ロゴ、およびブランドは各所有者の所有物です。 比較は情報提供のみを目的としており、執筆時点で公開されている情報を反映しています。

よくある質問

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Syncfusion BarCodeから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時間オンラインで対応しています。
チャット
メール
電話してね