フッターコンテンツにスキップ
.NETヘルプ

.NET MAUI Blazor (PDF、EXCEL、OCR、BARCODE、QR コード)

.NET Multi-platform App UI (.NET MAUI) には BlazorWebView コントロールが含まれており、開発者は Visual Studio を使用して .NET MAUI プロジェクトに MAUI Blazor サーバーアプリを統合できます。 これらの Blazor ハイブリッド アプリ (.NET MAUI Blazor アプリと呼ばれる) は、Blazor ハイブリッド アプリとプラットフォーム固有機能を統合し、Web UI (ユーザーインターフェース) コントロールをレンダリングすることができます。 これらの .NET MAUI Blazor アプリはクロスプラットフォームアプリであり、.NET MAUI はクロスプラットフォームフレームワークであり、プラットフォーム固有のコードを必要としません。 .NET MAUI アプリを Android デバイス/Android エミュレーター、iOS、macOS、Mac Catalyst、Windows オペレーティングシステムで使用できます。

BlazorWebView コントロールは .NET MAUI ネイティブ アプリの任意のページに追加でき、MAUI Blazor Web アプリケーションのルートに誘導することができます。 .NET MAUI Blazor Web アプリの Razor コンポーネントは、.NET プロセス内でネイティブに実行され、埋め込まれた Web ビュー コントロールを介して Web UI コンポーネントをレンダリングします。 MAUI Blazor ハイブリッド アプリ、デスクトップ アプリ、または Windows フォームは、.NET MAUI がサポートするすべての異なるプラットフォームで使用でき、ブラウザーサンドボックスを含めることができます。

IronPDF: A .NET PDF Library

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 1: IronPDF

class="content__image-caption">IronPDF

C# 開発者としては、仕事に適したツールを持つことの重要性を理解しています。 それが IronPDF の出番です。 この強力な .NET クラスライブラリを使用すると、クロスプラットフォーム API を使用して .NET Core および .NET テクノロジを使用して PDF 処理アプリケーションを簡単に作成できます。IronPDF は .NET Chromium エンジンを使用して HTML ページ (コードまたは URL 形式) を PDF ファイルに変換し、複雑な API や手動デザイン作業の必要性を排除します。 HTML、ASPX、JS、CSS、画像などの標準的な Web ドキュメントをサポートしています。

Blazor および .NET MAUI との互換性

IronPDF は Blazor コンポーネントと .NET MAUI フレームワークで構築されたアプリケーションに簡単に統合でき、開発者に PDF ドキュメントの作成および操作に関するさまざまな機能を提供します。 これらの機能には、HTML、XML、およびその他のファイル形式から PDF を生成する機能、既存の PDF を編集してテキスト、イメージ、およびその他の .NET MAUI 辞書要素を追加または変更する機能が含まれます。

.NET MAUI Blazor アプリを作成する手順

以下の手順に従って Visual Studio で .NET MAUI アプリを作成します。

ステップ 1: Visual Studio を開く

最新バージョンの Visual Studio を開き、開発者モードを有効にします。 最新バージョンの Visual Studio をお勧めします。

ステップ 2: .NET Blazor 検索

新しいプロジェクトの作成ボタンをクリックして、.NET MAUI Blazor テンプレートを検索します。 検索結果から ".NET MAUI Blazor App" を選択し、次へボタンをクリックします。

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 2: Search .NET MAUI Blazor App

class="content__image-caption">Creating a Visual Studio .NET MAUI Application

ステップ 3: プロジェクト名の設定

プロジェクトに適切な名前を付け、次へボタンをクリックします。

ステップ 4: .NET Framework

.NET ターゲット フレームワークを選択します。 スムーズな動作のために最新のフレームワークをお勧めします。 フレームワークを選択した後、作成ボタンをクリックします。

上記の手順に従うと、.NET MAUI Blazor アプリが作成されます。

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 3: Search .NET MAUI Blazor App

class="content__image-caption">Creating a Visual Studio .NET MAUI Application

IronPDF 用のこのルート Blazor コンポーネント プロジェクトをどのように使用できるかを見てみましょう。

Blazor コンテンツを PDF にエクスポート

次のコードを使用すると、Blazor コンテンツを PDF に非常に簡単に変換できます。

最初に Index.razor ファイルを開き、次のコードでコードを置き換えます。

@page "/"
<!-- Input to take HTML content and button to trigger PDF generation -->
<input @bind="InputValue" placeholder="Enter HTML content" />
<button @onclick="SubmitHTML">Render HTML</button>

@code {
    // Property to bind input value
    private string InputValue { get; set; }

    // Async method to render HTML as PDF and save
    private async Task SubmitHTML()
    {
        // Create an instance of ChromePdfRenderer
        var renderer = new IronPdf.ChromePdfRenderer();

        // Render the HTML input value as a PDF document
        var doc = renderer.RenderHtmlAsPdf(InputValue);

        // Save the document as 'Test.pdf' on the local file system
        doc.SaveAs("Test.pdf");
    }
}
@page "/"
<!-- Input to take HTML content and button to trigger PDF generation -->
<input @bind="InputValue" placeholder="Enter HTML content" />
<button @onclick="SubmitHTML">Render HTML</button>

@code {
    // Property to bind input value
    private string InputValue { get; set; }

    // Async method to render HTML as PDF and save
    private async Task SubmitHTML()
    {
        // Create an instance of ChromePdfRenderer
        var renderer = new IronPdf.ChromePdfRenderer();

        // Render the HTML input value as a PDF document
        var doc = renderer.RenderHtmlAsPdf(InputValue);

        // Save the document as 'Test.pdf' on the local file system
        doc.SaveAs("Test.pdf");
    }
}
'INSTANT VB TODO TASK: The following line could not be converted:
page "/" <!-- Input [to] take HTML content [and] button [to] trigger PDF generation -- > <input bind="InputValue" placeholder="Enter HTML content" /> <button onclick="SubmitHTML"> Render HTML</button> code
If True Then
	' Property to bind input value
	private String InputValue {get;set;}

	' Async method to render HTML as PDF and save
'INSTANT VB TODO TASK: Local functions are not converted by Instant VB:
'	private async Task SubmitHTML()
'	{
'		' Create an instance of ChromePdfRenderer
'		var renderer = New IronPdf.ChromePdfRenderer();
'
'		' Render the HTML input value as a PDF document
'		var doc = renderer.RenderHtmlAsPdf(InputValue);
'
'		' Save the document as 'Test.pdf' on the local file system
'		doc.SaveAs("Test.pdf");
'	}
End If
$vbLabelText   $csharpLabel

このコードは、生成された PDF ファイルをローカルマシンにダウンロードするのに役立ちます。また、IronPDF を使用せずに Blazor コンテンツを PDF ファイルに変換する方法です。

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 4: Blazor Content to PDF

class="content__image-caption">Generating a PDF using .NET MAUI Blazor

テキスト ボックスに次の HTML を入力します。

<!DOCTYPE html>
<html>
  <head>
    <link href='https://fonts.googleapis.com/css2?family=Popin&display=swap' rel='stylesheet'>
    <style>
      /* Add CSS styles for the invoice here */
      body{
        font-family: 'Popin', cursive;
      }
      .invoice {
        width: 80%;
        margin: 0 auto;
        border: 1px solid #ccc;
        padding: 20px;
        background-color: #f5f5f5;
        color: #333;
      }
      .invoice h1 {
        text-align: center;
      }
      .invoice .invoice-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
      }
      .invoice .invoice-info div {
        width: 45%;
      }
      .invoice table {
        width: 100%;
        border-collapse: collapse;
      }
      .invoice table th, .invoice table td {
        border: 1px solid #ccc;
        padding: 10px;
      }
      .invoice table th {
        text-align: left;
        background-color: #f5f5f5;
      }
      .invoice table td {
        text-align: right;
      }
      .invoice table td.total {
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <div class="invoice">
      <h1>Invoice</h1>
      <div class="invoice-info">
        <div>
          <p><strong>From:</strong></p>
          <p>Your Company Name</p>
          <p>123 Main St</p>
          <p>City, State ZIP</p>
        </div>
        <div>
          <p><strong>To:</strong></p>
          <p>Customer Name</p>
          <p>456 Park Ave</p>
          <p>City, State ZIP</p>
        </div>
      </div>
      <table>
        <thead>
          <tr>
            <th>Product</th>
            <th>Quantity</th>
            <th>Price</th>
            <th>Total</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Product 1</td>
            <td>1</td>
            <td>$10.00</td>
            <td>$10.00</td>
          </tr>
          <tr>
            <td>Product 2</td>
            <td>2</td>
            <td>$5.00</td>
            <td>$10.00</td>
          </tr>
          <tr>
            <td colspan="3" class="total">Total:</td>
            <td class="total">$20.00</td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>
<!DOCTYPE html>
<html>
  <head>
    <link href='https://fonts.googleapis.com/css2?family=Popin&display=swap' rel='stylesheet'>
    <style>
      /* Add CSS styles for the invoice here */
      body{
        font-family: 'Popin', cursive;
      }
      .invoice {
        width: 80%;
        margin: 0 auto;
        border: 1px solid #ccc;
        padding: 20px;
        background-color: #f5f5f5;
        color: #333;
      }
      .invoice h1 {
        text-align: center;
      }
      .invoice .invoice-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
      }
      .invoice .invoice-info div {
        width: 45%;
      }
      .invoice table {
        width: 100%;
        border-collapse: collapse;
      }
      .invoice table th, .invoice table td {
        border: 1px solid #ccc;
        padding: 10px;
      }
      .invoice table th {
        text-align: left;
        background-color: #f5f5f5;
      }
      .invoice table td {
        text-align: right;
      }
      .invoice table td.total {
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <div class="invoice">
      <h1>Invoice</h1>
      <div class="invoice-info">
        <div>
          <p><strong>From:</strong></p>
          <p>Your Company Name</p>
          <p>123 Main St</p>
          <p>City, State ZIP</p>
        </div>
        <div>
          <p><strong>To:</strong></p>
          <p>Customer Name</p>
          <p>456 Park Ave</p>
          <p>City, State ZIP</p>
        </div>
      </div>
      <table>
        <thead>
          <tr>
            <th>Product</th>
            <th>Quantity</th>
            <th>Price</th>
            <th>Total</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Product 1</td>
            <td>1</td>
            <td>$10.00</td>
            <td>$10.00</td>
          </tr>
          <tr>
            <td>Product 2</td>
            <td>2</td>
            <td>$5.00</td>
            <td>$10.00</td>
          </tr>
          <tr>
            <td colspan="3" class="total">Total:</td>
            <td class="total">$20.00</td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>
HTML

MAUI Blazor アプリは、以下に示す出力を生成します。

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 5: PDF Output

class="content__image-caption">Generating a PDF using .NET MAUI Blazor

Get more information about IronPDF with Blazor PDF creation tutorials and .NET MAUI applications.

IronXL

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 6: IronXL

class="content__image-caption">IronXL

IronXL は、開発者が C# で Excel スプレッドシートを読み取り、編集し、作成することを可能にする .NET ライブラリです。 Microsoft Excel をインストールする必要はなく、Android、iOS、macOS、Windows マシン、Azure を含むすべてのプラットフォームをサポートしています。 さまざまな形式からのデータの読み込みと編集、さまざまな形式への保存およびエクスポート、System.Data オブジェクトの操作、数式の処理、データの並べ替え、セルのスタイリングなどの機能を提供します。 さらに、NuGet パッケージとして利用可能であり、そのウェブサイトや GitHub リポジトリでドキュメントと例が提供されています。

IronXL は .NET MAUI および Blazor をサポートしており、ユーザーが Excel スプレッドシート、Web や Azure サービス、その他のアプリケーションを含むさまざまなソースからのデータにアクセスまたは取得することを可能にします。 IronXL の .NET MAUI および Blazor サポートにより、開発者は iOS、macOS、Windows、Android デバイスで魅力的なユーザー インターフェースを開発するための最も強力なツールを提供できます。

IronXL のサンプルコードを見てみましょう。

using IronXL;
using IronXL.Formatting;
using IronXL.Formatting.Enums;
using IronXL.Styles;

// Load an existing Excel workbook
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;

// Create a specific conditional formatting rule for cells with values less than 8
ConditionalFormattingRule rule = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8");

// Set different style options for the rule
rule.FontFormatting.IsBold = true; // Bold text
rule.FontFormatting.FontColor = "#123456"; // Custom font color
rule.BorderFormatting.RightBorderColor = "#ffffff"; // Right border color
rule.BorderFormatting.RightBorderType = BorderType.Thick; // Right border thickness
rule.PatternFormatting.BackgroundColor = "#54bdd9"; // Background color
rule.PatternFormatting.FillPattern = FillPattern.Diamonds; // Fill pattern

// Add the formatting rule to the specified cell range
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule);

// Create another conditional formatting rule for values between 7 and 10
ConditionalFormattingRule rule1 = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10");

// Set additional style options for the new rule
rule1.FontFormatting.IsItalic = true; // Italic text
rule1.FontFormatting.UnderlineType = FontUnderlineType.Single; // Single underline

// Add this formatting rule to a different range of cells
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1);

// Save the workbook with the applied conditional formatting
workbook.SaveAs("ApplyConditionalFormatting.xlsx");
using IronXL;
using IronXL.Formatting;
using IronXL.Formatting.Enums;
using IronXL.Styles;

// Load an existing Excel workbook
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;

// Create a specific conditional formatting rule for cells with values less than 8
ConditionalFormattingRule rule = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8");

// Set different style options for the rule
rule.FontFormatting.IsBold = true; // Bold text
rule.FontFormatting.FontColor = "#123456"; // Custom font color
rule.BorderFormatting.RightBorderColor = "#ffffff"; // Right border color
rule.BorderFormatting.RightBorderType = BorderType.Thick; // Right border thickness
rule.PatternFormatting.BackgroundColor = "#54bdd9"; // Background color
rule.PatternFormatting.FillPattern = FillPattern.Diamonds; // Fill pattern

// Add the formatting rule to the specified cell range
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule);

// Create another conditional formatting rule for values between 7 and 10
ConditionalFormattingRule rule1 = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10");

// Set additional style options for the new rule
rule1.FontFormatting.IsItalic = true; // Italic text
rule1.FontFormatting.UnderlineType = FontUnderlineType.Single; // Single underline

// Add this formatting rule to a different range of cells
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1);

// Save the workbook with the applied conditional formatting
workbook.SaveAs("ApplyConditionalFormatting.xlsx");
Imports IronXL
Imports IronXL.Formatting
Imports IronXL.Formatting.Enums
Imports IronXL.Styles

' Load an existing Excel workbook
Private workbook As WorkBook = WorkBook.Load("test.xlsx")
Private sheet As WorkSheet = workbook.DefaultWorkSheet

' Create a specific conditional formatting rule for cells with values less than 8
Private rule As ConditionalFormattingRule = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8")

' Set different style options for the rule
rule.FontFormatting.IsBold = True ' Bold text
rule.FontFormatting.FontColor = "#123456" ' Custom font color
rule.BorderFormatting.RightBorderColor = "#ffffff" ' Right border color
rule.BorderFormatting.RightBorderType = BorderType.Thick ' Right border thickness
rule.PatternFormatting.BackgroundColor = "#54bdd9" ' Background color
rule.PatternFormatting.FillPattern = FillPattern.Diamonds ' Fill pattern

' Add the formatting rule to the specified cell range
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule)

' Create another conditional formatting rule for values between 7 and 10
Dim rule1 As ConditionalFormattingRule = sheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10")

' Set additional style options for the new rule
rule1.FontFormatting.IsItalic = True ' Italic text
rule1.FontFormatting.UnderlineType = FontUnderlineType.Single ' Single underline

' Add this formatting rule to a different range of cells
sheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1)

' Save the workbook with the applied conditional formatting
workbook.SaveAs("ApplyConditionalFormatting.xlsx")
$vbLabelText   $csharpLabel

上記のコードは、既存の Excel ファイルを開き、異なるセル範囲に条件付き書式を適用するのに役立ちます。 Excel 条件付き書式チュートリアル を使用して IronXL についての詳細なチュートリアルを取得します。

IronOCRの概要

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 7: IronOCR

class="content__image-caption">IronOCR

IronOCR は、C# 開発者の間で広く使用されている OCR ツールであり、C# アプリケーションに OCR 機能を統合するための簡単な API を提供します。 スキャンされたドキュメント、PDF、画像など、さまざまなソースからテキストを効果的に抽出し、歪んだり読みにくいテキストでさえ正確に認識するために、先進的な機械学習アルゴリズムを使用します。 IronOCR は、認識されたテキストの言語、フォント、文字セットを調整したり、予測コレクションを行ったり、OCR 精度向上のために画像を事前処理するなど、C# 開発者向けにさまざまなカスタマイズオプションを提供します。 これらのカスタマイズ機能により、開発者は特定のニーズに合わせて IronOCR のパフォーマンスを最適化できます。

IronOCR は強力な OCR 認識ライブラリであり、.NET MAUI および Blazor をサポートしています。 IronOCR を使用すると、開発者は大量のテキストデータをスキャン、読み取り、および書き込む複雑さを心配することなく、任意のプラットフォームで迅速にアプリケーションを作成できます。 他の OCR ソフトウェアは、このようにシンプルな統合で開発ツールへのアクセスを提供するものはありません。

PDF ファイルからテキストを抽出する方法を示す IronOCR の例を見てみましょう。

using IronOcr;

var ocrTesseract = new IronTesseract();

using (var ocrInput = new OcrInput())
{
    // OCR the entire document
    ocrInput.AddPdf("example.pdf", "password");

    // Alternatively OCR selected page numbers
    ocrInput.AddPdfPages("example.pdf", new[] { 1, 2, 3 }, "password");

    var ocrResult = ocrTesseract.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}
using IronOcr;

var ocrTesseract = new IronTesseract();

using (var ocrInput = new OcrInput())
{
    // OCR the entire document
    ocrInput.AddPdf("example.pdf", "password");

    // Alternatively OCR selected page numbers
    ocrInput.AddPdfPages("example.pdf", new[] { 1, 2, 3 }, "password");

    var ocrResult = ocrTesseract.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr

Private ocrTesseract = New IronTesseract()

Using ocrInput As New OcrInput()
	' OCR the entire document
	ocrInput.AddPdf("example.pdf", "password")

	' Alternatively OCR selected page numbers
	ocrInput.AddPdfPages("example.pdf", { 1, 2, 3 }, "password")

	Dim ocrResult = ocrTesseract.Read(ocrInput)
	Console.WriteLine(ocrResult.Text)
End Using
$vbLabelText   $csharpLabel

.NET MAUI で OCR を使用する方法に関するチュートリアル を訪問して IronOCR の詳細なチュートリアルを読むことができます。

PDF OCR チュートリアル を使用して IronOCR についての詳細なチュートリアルを入手できます。

IronBarcode

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 8: IronBarcode

class="content__image-caption">IronBarcode

class="hsg-featured-snippet">

How to Create Barcode Scanner in .NET Maui

  1. Download C# library to create barcode scanner in Maui
  2. Utilize Read method to scan barcode from PDF and image
  3. Support a wide variety of barcode formats, including QR codes, Code 39, Code 128, and more
  4. Integrate the C# library easily into existing .NET MAUI and Blazor projects
  5. Apply preprocessing onto the imperfect images

IronBarcode は、開発者が C# アプリケーションにバーコードの読み取りおよび書き込み機能を簡単に追加できるようにする C# ライブラリです。 このライブラリは、在庫管理システムや販売時点管理システム (POS) など、バーコードのスキャンや生成を伴うプロジェクトに取り組んでいる人々に特に役立ちます。 IronBarcode の主要な機能の 1 つは、QR コードやコード 39、コード 128 を含むさまざまなバーコード形式を読み取りおよび書き込みできるということです。 これにより、開発者はプロジェクトのニーズに応じてさまざまな種類のバーコードを扱うことができます。

IronBarcode は、開発者が最新のクロスプラットフォーム アプリケーションを構築するための人気のフレームワークである .NET MAUI および Blazor をサポートしています。 これは、開発者が .NET MAUI および Blazor プロジェクトに簡単に IronBarcode の強力なバーコード生成およびスキャン機能を統合できるため、開発者にとって有益です。

次のコード例は、IronBarcode を使用して複数の種類のバーコードを読み取る方法を示しています。 非常にシンプルでわかりやすいプロセスです。

using IronBarCode;
using IronSoftware.Drawing;

// Reading a barcode is easy with IronBarcode.
// Read from a File, Bitmap, Image, or Stream:

var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file

var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap

var resultFromAnyBitmap = BarcodeReader.Read(new AnyBitmap("barcode.bmp")); // From AnyBitmap

var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image

var resultFromStream = BarcodeReader.Read(myStream); // From a stream

// PDFs are more intricate and must be read using ReadPdf:
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf");
using IronBarCode;
using IronSoftware.Drawing;

// Reading a barcode is easy with IronBarcode.
// Read from a File, Bitmap, Image, or Stream:

var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file

var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap

var resultFromAnyBitmap = BarcodeReader.Read(new AnyBitmap("barcode.bmp")); // From AnyBitmap

var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image

var resultFromStream = BarcodeReader.Read(myStream); // From a stream

// PDFs are more intricate and must be read using ReadPdf:
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf");
Imports IronBarCode
Imports IronSoftware.Drawing

' Reading a barcode is easy with IronBarcode.
' Read from a File, Bitmap, Image, or Stream:

Private resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file

Private resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap

Private resultFromAnyBitmap = BarcodeReader.Read(New AnyBitmap("barcode.bmp")) ' From AnyBitmap

Private resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image

Private resultFromStream = BarcodeReader.Read(myStream) ' From a stream

' PDFs are more intricate and must be read using ReadPdf:
Private resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf")
$vbLabelText   $csharpLabel

.NET MAUI でバーコードスキャナーを使用する方法に関するチュートリアル を訪問して、IronBarcode の詳細なチュートリアルを読んでください。

Barcode Scanner Reader チュートリアル を使用して IronBarcode のユースケースとチュートリアルをもっと取得してください。

IronDrawing

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 9: IronDrawing

class="content__image-caption">IronDrawing

IronDrawing は、グラフィック、画像、フォントを使用するクロスプラットフォーム アプリケーションを作成する必要がある .NET 開発者に対してソリューションを提供する、無料の オープンソースライブラリ です。 異なるグラフィックスライブラリの間の橋渡し役として機能し、開発者がコーディング内で単一の一貫した形式を使用する一方で、選択した基礎ライブラリを使用することができます。IronDrawing は、.NET Framework 4.6.2 以降と互換性があり、.NET 5、6、7 を含みます。

IronDrawing は、.NET の成長と成功に貢献する経験豊富な .NET 開発者のチームである Iron Software によって開発され、維持されています。 彼らは IronDrawing を開発することにより、クラスライブラリと NuGet の開発を簡単にし、NuGet エコシステムを盛り上げることを目的としています。

IronDrawing 開発の理由

IronDrawing は、Microsoft によって発表された破壊的変更の対応として、System.Drawing.Common が Windows プラットフォームでのみサポートされるというもので開発されました。 この変更は、System.Drawing.Common を使用するクロスプラットフォームライブラリを維持する開発者にとって問題を引き起こし、Android、iOSなどの非 Windowsユーザーをサポートするにはライブラリを再構築する必要がありました。 IronDrawing は、異なるグラフィックスライブラリ間を転換する中間形式として作成され、開発者が新しいグラフィックス標準への移行を簡素化することを可能にします。

IronDrawing の特徴

IronDrawing は、開発者の作業を支援するいくつかの特徴を持っています。たとえば、さまざまな他の Bitmap 実装にキャストできる、普遍的に互換性のある Bitmap クラス AnyBitmap; 普遍的に互換性のある Color クラス Color; 普遍的に互換性のある Rectangle クラス CropRectangle; 普遍的に互換性のあるフォントクラス AnyFont。 また、これらのクラスと異なるグラフィックスライブラリの対応するクラスとの間の暗黙のキャストを提供し、容易に変換できるようにします。 NuGet サイト から取得できます。

IronDrawing は、.NET MAUI および Blazor を含むほとんどの .NET テンプレートをサポートしています。 そのプラットフォーム独立の性質により、Windows デスクトップからモバイルやウェブベースのプロジェクトまで、さまざまなアプリケーションに使用しやすくなっています。

オープンソースの特典

IronDrawing はオープンソースライブラリです。 誰でも GitHub リポジトリ からソースコードにアクセスでき、個々のプロジェクトとニーズにより適したようにライブラリをカスタマイズおよび変更することがこれまでになく簡単です。 それだけでなく、ソースコードが公開されていることにより、開発者が互いのアイデアを共有し、構築し合うことを促進します。 IronDrawing C# ライブラリを使ってできることは無限大です - GitHub をチェックして、ぜひ探索を始めてください!

IronDrawing のコード例を見て、他のファイル形式から AnyBitmap を生成する方法を見てみましょう。

using IronSoftware.Drawing;

AnyBitmap bitmap;

// Generate AnyBitmap using filepath
bitmap = AnyBitmap.FromFile(@"FILE_PATH");
bitmap.SaveAs("output.bmp");

// Generate AnyBitmap from bytes
byte[] bytes = File.ReadAllBytes(@"FILE_PATH");
bitmap = AnyBitmap.FromBytes(bytes);
bitmap.SaveAs("result.bmp"); 

// Generate AnyBitmap from memory stream
byte[] bytes = File.ReadAllBytes(@"FILE_PATH");
MemoryStream ms = new MemoryStream(bytes);
bitmap = AnyBitmap.FromStream(ms);
bitmap.SaveAs("output.bmp");  

// Generate AnyBitmap from Uri
Uri uri = new Uri("URI_PATH");
bitmap = AnyBitmap.FromUri(uri);
bitmap.SaveAs("uriImage.bmp"); 

// Generate AnyBitmap file from SVG file
bitmap = AnyBitmap.FromFile(@"FILE_PATH.svg");
bitmap.SaveAs("result.bmp"); 
using IronSoftware.Drawing;

AnyBitmap bitmap;

// Generate AnyBitmap using filepath
bitmap = AnyBitmap.FromFile(@"FILE_PATH");
bitmap.SaveAs("output.bmp");

// Generate AnyBitmap from bytes
byte[] bytes = File.ReadAllBytes(@"FILE_PATH");
bitmap = AnyBitmap.FromBytes(bytes);
bitmap.SaveAs("result.bmp"); 

// Generate AnyBitmap from memory stream
byte[] bytes = File.ReadAllBytes(@"FILE_PATH");
MemoryStream ms = new MemoryStream(bytes);
bitmap = AnyBitmap.FromStream(ms);
bitmap.SaveAs("output.bmp");  

// Generate AnyBitmap from Uri
Uri uri = new Uri("URI_PATH");
bitmap = AnyBitmap.FromUri(uri);
bitmap.SaveAs("uriImage.bmp"); 

// Generate AnyBitmap file from SVG file
bitmap = AnyBitmap.FromFile(@"FILE_PATH.svg");
bitmap.SaveAs("result.bmp"); 
Imports IronSoftware.Drawing

Private bitmap As AnyBitmap

' Generate AnyBitmap using filepath
bitmap = AnyBitmap.FromFile("FILE_PATH")
bitmap.SaveAs("output.bmp")

' Generate AnyBitmap from bytes
Dim bytes() As Byte = File.ReadAllBytes("FILE_PATH")
bitmap = AnyBitmap.FromBytes(bytes)
bitmap.SaveAs("result.bmp")

' Generate AnyBitmap from memory stream
Dim bytes() As Byte = File.ReadAllBytes("FILE_PATH")
Dim ms As New MemoryStream(bytes)
bitmap = AnyBitmap.FromStream(ms)
bitmap.SaveAs("output.bmp")

' Generate AnyBitmap from Uri
Dim uri As New Uri("URI_PATH")
bitmap = AnyBitmap.FromUri(uri)
bitmap.SaveAs("uriImage.bmp")

' Generate AnyBitmap file from SVG file
bitmap = AnyBitmap.FromFile("FILE_PATH.svg")
bitmap.SaveAs("result.bmp")
$vbLabelText   $csharpLabel

IronDrawing は、ファイルをパスからビットマップに変換するための複数の方法を使用します。IronDrawing がサーバーベースのアプリケーションで非常に役立つメモリストリームを使用してファイルを BMP に変換する方法がわかります。 同様に、SVG ファイルを使用して BMP を生成することもできます。

class="content-img-align-center"> .NET MAUI Blazor for (PDF,EXCEL,OCR,BARCODE,QR Code) - Figure 10: BMP File

class="content__image-caption">A Bitmap file generated from the IronDrawing open-source library

価格設定

Iron Software は、IronPDF、IronXL、IronOCR、IronWebscraper、IronBarcode という 5 つのソフトウェア製品を含む Iron Suite を提供しています。これらは、それぞれ PDF、スプレッドシート、画像、ウェブスクレイピング、バーコードと対話するためのツールです。

これらの製品は、ライセンスあたり $799 からの個別価格で提供されていますが、Iron Software は、製品の全セットの特別なバンドル価格も提供しており、$1498 から始まります。この Iron Suite は、複数のファイルタイプを操作し、変換、分析、および操作プロセスを自動化する必要がある人々にとって優れたソリューションです。

結論

結論として、.NET MAUI はクロスプラットフォームのデスクトップおよびモバイルアプリケーションを構築するためのフレームワークです。 この記事では、PDFドキュメントの作成および操作、Excelファイルの読み書き、バーコードの生成およびスキャン、光学式文字認識、グラフィックの描画および操作のためのさまざまな機能を提供する IronPDF、IronXL、IronBarcode、IronOCR、および IronDrawing といった複数のライブラリを論じました。

これらのライブラリの中で、IronDrawing は .NET アプリケーション内でベクター グラフィックを作成および編集するための強力なツールとして際立っており、新しい機能と使いやすさを提供しています。 全体として、.NET MAUI とこれらのライブラリの組み合わせは、さまざまなプラットフォームでモダンで機能豊富なアプリケーションを構築するための多用途のツールキットを開発者に提供します。 Overall, the combination of .NET MAUI and these libraries provides developers with a versatile toolkit for building modern and feature-rich applications across a variety of platforms.

よくある質問

.NET MAUIアプリケーションにPDF機能を統合するにはどうすればよいですか?

IronPDFを使用することでPDF機能を統合できます。これにより、.NET Chromiumエンジンを用いてHTMLをPDFに変換することができます。この統合により、.NET MAUIアプリケーション内でPDFドキュメントの作成と操作をサポートします。

.NET MAUIプロジェクトでExcelライブラリを使用する利点は何ですか?

.NET MAUIプロジェクトでIronXLを使用することで、Microsoft ExcelをインストールしなくてもExcelスプレッドシートを操作できます。Android、iOS、macOS、Windowsの各プラットフォーム間でスプレッドシートの読み取り、編集、作成をサポートします。

IronOCRは.NET MAUIアプリでどのようにテキスト抽出を強化しますか?

IronOCRは.NET MAUIアプリに先進的なOCR機能を提供し、スキャンしたドキュメント、PDF、画像からの正確なテキスト抽出を可能にします。機械学習アルゴリズムを使用し、言語やフォントのカスタマイズオプションを提供します。

.NET MAUIとBlazorアプリで実装可能なバーコード機能は何ですか?

IronBarcodeは.NET MAUIおよびBlazorアプリに統合でき、バーコードの読み取りと書き込み機能を追加します。QRコードやCode 128を含む複数のバーコード形式をサポートしており、在庫管理のようなアプリケーションに適しています。

IronDrawingはクロスプラットフォームのグラフィック開発にどのように役立ちますか?

IronDrawingは、.NETでクロスプラットフォームのグラフィックアプリケーションを作成するための無料のオープンソースライブラリです。MicrosoftによるSystem.Drawing.Commonのサポートの変更を補完するため、グラフィックの一貫したフォーマットを提供します。

.NET MAUIアプリケーションでのBlazorWebViewの役割は何ですか?

BlazorWebViewは、.NET MAUIでMAUI Blazorサーバーアプリを.NET MAUIプロジェクトに統合するのを可能にするコントロールです。ネイティブアプリ内でWeb UIコントロールをレンダリングすることで、クロスプラットフォームアプリの作成を促進します。

.NET MAUIでクロスプラットフォーム開発をどのように達成できますか?

.NET MAUIのフレームワークを利用することで、Android、iOS、macOS、Windowsで動作するアプリケーションを構築することで、クロスプラットフォーム開発が可能です。BlazorWebViewとの統合により、Web UIコントロールの活用がさらに強化されます。

現代のアプリケーション開発における.NET MAUIの主な特徴は何ですか?

.NET MAUIはネイティブパフォーマンスを備えたクロスプラットフォームアプリケーションを構築するためのフレームワークを提供します。主な特徴には、Web UIコントロールのためのBlazorWebViewの統合や、IronPDF、IronXL、IronOCR、IronBarcode、IronDrawingのようなライブラリと互換性が含まれています。

Curtis Chau
テクニカルライター

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

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