フッターコンテンツにスキップ
移行ガイド

C#でBitMiracle Docotic PDFからIronPDFに移行する方法

BitMiracle Docotic PDFは、100%マネージドコードアーキテクチャと広範なプログラムPDF操作機能で知られる、定評ある.NET PDFライブラリです。 しかし、モジュール式のアドオン構造であるため、HTMLからPDFへの変換、レイアウト機能、その他の機能には個別のパッケージが必要であり、プロジェクト管理とライセンスが複雑になっています。 この包括的なガイドは、BitMiracle Docotic PDFからIronPDF-ChromiumベースのHTMLレンダリングを内蔵し、すべての機能が単一のNuGetパッケージに含まれる統合.NET PDFライブラリへの移行パスをステップバイステップで提供します。

なぜBitMiracle Docotic PDFからIronPDFに移行するのですか?

BitMiracle Docotic PDFは堅牢なPDF操作機能を提供していますが、開発チームがより合理的なアーキテクチャを持つ代替ツールを求めるようになったのには、いくつかの要因があります。

パッケージ アーキテクチャの比較

BitMiracle Docotic PDFは、モジュール式のアドオンアプローチを採用しており、完全な機能を実現するには複数のパッケージが必要です:

アスペクト BitMiracle Docotic PDF IronPDF
HTMLからPDFへ 別のアドオン(HtmlToPdf)が必要です。 組み込みのコア機能
パッケージ構造 コア+複数のアドオン 単一のNuGetパッケージ
ライセンスモデル アドオンライセンス 含まれる機能
APIの複雑さ アドオンごとに名前空間を分ける 統一API
HTMLエンジン Chromium (アドオン経由) Chromium(組み込み)
コミュニティサイズ 小規模 より多くのリソース
ドキュメント 技術リファレンス 豊富なチュートリアル

フィーチャー パリティ

どちらのライブラリも包括的なPDF機能をサポートしています:

フィーチャー BitMiracle Docotic PDF IronPDF
ゼロからPDFを作成
HTMLからPDFへ ✅ (アドオンが必要) ✅ (ビルトイン)
URLからPDFへ ✅ (アドオンが必要) ✅ (ビルトイン)
PDF操作
テキスト抽出
マージ/スプリット
デジタル署名
暗号化
フォーム入力
PDF/A準拠

アプローチの主な違い

BitMiracle Docotic PDF は座標配置を使用したキャンバスベースの描画 (canvas.DrawString(x, y, text)) を使用し、IronPDFはレイアウトと配置に HTML/CSS を活用します。 これは、ウェブ技術に精通した開発者のコンテンツ作成を簡素化するパラダイムシフトを意味します。

移行前の準備

前提条件

あなたの環境がこれらの要件を満たしていることを確認してください:

  • .NET Framework 4.6.2+または.NET Core 3.1 / .NET 5-9
  • Visual Studio 2019+またはC#拡張機能付きVS Code
  • NuGetパッケージマネージャへのアクセス
  • IronPDFライセンスキー (ironpdf.com にて無料トライアル可能)

BitMiracleのDocotic PDFの使用状況を監査する

ソリューションディレクトリで以下のコマンドを実行し、すべてのDocotic.Pdf参照を特定します:

# Find all Docotic.Pdf usages in your codebase
grep -r "using BitMiracle.Docotic" --include="*.cs" .
grep -r "PdfDocument\|PdfPage\|PdfCanvas" --include="*.cs" .

# Find NuGet package references
grep -r "Docotic.Pdf" --include="*.csproj" .
# Find all Docotic.Pdf usages in your codebase
grep -r "using BitMiracle.Docotic" --include="*.cs" .
grep -r "PdfDocument\|PdfPage\|PdfCanvas" --include="*.cs" .

# Find NuGet package references
grep -r "Docotic.Pdf" --include="*.csproj" .
SHELL

予想される画期的な変更

変更 BitMiracle Docotic PDF IronPDF インパクト
HTMLレンダリング HtmlToPdfアドオンが必要です。 内蔵 アドオンパッケージの削除
ページ索引 0から始まる (Pages[0]) 0から始まる (Pages[0]) 変更不要
座標系 左下オリジン HTML/CSSフロー 位置決めにCSSを使用
キャンバス描画 PdfCanvas.DrawText() HTMLマークアップ パラダイムシフト
テキスト抽出 page.GetText() pdf.ExtractAllText() メソッド名の変更
ドキュメントの読み込み new PdfDocument(path) PdfDocument.FromFile(path) コンストラクタ → 静的メソッド
セービング document.Save(path) pdf.SaveAs(path) メソッド名の変更
処分 IDisposable パターン 不要 よりシンプルなリソース管理

ステップごとの移行プロセス

ステップ 1: NuGet パッケージを更新する

BitMiracle Docotic PDFパッケージを削除し、IronPDFをインストールしてください:

# Remove Docotic.Pdf packages
dotnet remove package BitMiracle.Docotic.Pdf
dotnet remove package BitMiracle.Docotic.Pdf.HtmlToPdf
dotnet remove package BitMiracle.Docotic.Pdf.Layout

# Install IronPDF
dotnet add package IronPdf
# Remove Docotic.Pdf packages
dotnet remove package BitMiracle.Docotic.Pdf
dotnet remove package BitMiracle.Docotic.Pdf.HtmlToPdf
dotnet remove package BitMiracle.Docotic.Pdf.Layout

# Install IronPDF
dotnet add package IronPdf
SHELL

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

BitMiracle Docotic PDFの名前空間をIronPDFに置き換えてください:

// Remove these
using BitMiracle.Docotic.Pdf;
using BitMiracle.Docotic.Pdf.Layout;
using BitMiracle.Docotic.Pdf.HtmlToPdf;

// Add this
using IronPdf;
// Remove these
using BitMiracle.Docotic.Pdf;
using BitMiracle.Docotic.Pdf.Layout;
using BitMiracle.Docotic.Pdf.HtmlToPdf;

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

ステップ 3: ライセンスの設定

// Add at application startup (Program.cs or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

完全な API 移行のリファレンス

ドキュメント操作

タスク BitMiracle Docotic PDF IronPDF
空のドキュメントを作成 new PdfDocument() new PdfDocument()
ファイルから読み込む new PdfDocument(path) PdfDocument.FromFile(path)
ストリームから読み込む PdfDocument.Load(stream) PdfDocument.FromStream(stream)
バイトから読み込む PdfDocument.Load(bytes) PdfDocument.FromBinaryData(bytes)
ファイルに保存 document.Save(path) pdf.SaveAs(path)
ページ数を取得 document.PageCount pdf.PageCount
閉じる/破棄する document.Dispose() 不要

HTMLからPDFへの変換

タスク BitMiracle Docotic PDF(HtmlToPdfアドオン) IronPDF
HTML文字列からPDFへ HtmlConverter.Create(html).ToPdf() renderer.RenderHtmlAsPdf(html)
HTMLファイルからPDFへ HtmlConverter.Create(new Uri(filePath)).ToPdf() renderer.RenderHtmlFileAsPdf(path)
URLからPDFへ HtmlConverter.Create(new Uri(url)).ToPdf() renderer.RenderUrlAsPdf(url)
ページサイズの設定 options.PageSize = PageSize.A4 renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
余白の設定 options.PageMargins = new Margins(20) renderer.RenderingOptions.MarginTop = 20

マージと分割の操作

タスク BitMiracle Docotic PDF IronPDF
ドキュメントのマージ doc1.Append(doc2) PdfDocument.Merge(pdf1, pdf2)
文書の分割 document.CopyPage(index) 新しいドキュメントへ pdf.CopyPages(start, end)

コード移行の例

HTMLからPDFへの変換

最も一般的な操作は、IronPDFが提供する大幅な簡素化を示しています。

BitMiracle Docotic PDFの実装:

// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf = new PdfDocument())
        {
            string html = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>";

            pdf.CreatePage(html);
            pdf.Save("output.pdf");
        }

        Console.WriteLine("PDF created successfully");
    }
}
// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf = new PdfDocument())
        {
            string html = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>";

            pdf.CreatePage(html);
            pdf.Save("output.pdf");
        }

        Console.WriteLine("PDF created successfully");
    }
}
Imports BitMiracle.Docotic.Pdf
Imports System

Class Program
    Shared Sub Main()
        Using pdf As New PdfDocument()
            Dim html As String = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>"

            pdf.CreatePage(html)
            pdf.Save("output.pdf")
        End Using

        Console.WriteLine("PDF created successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDFの実装:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");

        Console.WriteLine("PDF created successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");

        Console.WriteLine("PDF created successfully");
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim html As String = "<html><body><h1>Hello World</h1><p>This isHTMLからPDFへconversion.</p></body></html>"

        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("output.pdf")

        Console.WriteLine("PDF created successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF は、using ステートメントの要件を排除し、Chromium ベースのレンダリング機能を明確に示す専用の ChromePdfRenderer クラスを提供します。 その他のHTML変換オプションについては、HTML to PDF documentationを参照してください。

複数のPDFをマージする

BitMiracle Docotic PDFの実装:

// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf1 = new PdfDocument("document1.pdf"))
        using (var pdf2 = new PdfDocument("document2.pdf"))
        {
            pdf1.Append(pdf2);
            pdf1.Save("merged.pdf");
        }

        Console.WriteLine("PDFs merged successfully");
    }
}
// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf1 = new PdfDocument("document1.pdf"))
        using (var pdf2 = new PdfDocument("document2.pdf"))
        {
            pdf1.Append(pdf2);
            pdf1.Save("merged.pdf");
        }

        Console.WriteLine("PDFs merged successfully");
    }
}
Imports BitMiracle.Docotic.Pdf
Imports System

Class Program
    Shared Sub Main()
        Using pdf1 As New PdfDocument("document1.pdf"), pdf2 As New PdfDocument("document2.pdf")
            pdf1.Append(pdf2)
            pdf1.Save("merged.pdf")
        End Using

        Console.WriteLine("PDFs merged successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDFの実装:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
        merged.SaveAs("merged.pdf");

        Console.WriteLine("PDFs merged successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
        merged.SaveAs("merged.pdf");

        Console.WriteLine("PDFs merged successfully");
    }
}
Imports IronPdf
Imports System
Imports System.Collections.Generic

Module Program
    Sub Main()
        Dim pdf1 As PdfDocument = PdfDocument.FromFile("document1.pdf")
        Dim pdf2 As PdfDocument = PdfDocument.FromFile("document2.pdf")

        Dim merged As PdfDocument = PdfDocument.Merge(New List(Of PdfDocument) From {pdf1, pdf2})
        merged.SaveAs("merged.pdf")

        Console.WriteLine("PDFs merged successfully")
    End Sub
End Module
$vbLabelText   $csharpLabel

IronPDF の静的な Merge メソッドは複数のドキュメントを直接受け入れ、反復的な Append パターンよりもクリーンな API を提供します。 その他のオプションについては、 PDF 結合のドキュメントを参照してください。

テキスト抽出

BitMiracle Docotic PDFの実装:

// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf = new PdfDocument("document.pdf"))
        {
            string allText = "";

            foreach (var page in pdf.Pages)
            {
                allText += page.GetText();
            }

            Console.WriteLine("Extracted text:");
            Console.WriteLine(allText);
        }
    }
}
// NuGet: Install-Package Docotic.Pdf
using BitMiracle.Docotic.Pdf;
using System;

class Program
{
    static void Main()
    {
        using (var pdf = new PdfDocument("document.pdf"))
        {
            string allText = "";

            foreach (var page in pdf.Pages)
            {
                allText += page.GetText();
            }

            Console.WriteLine("Extracted text:");
            Console.WriteLine(allText);
        }
    }
}
Imports BitMiracle.Docotic.Pdf
Imports System

Module Program
    Sub Main()
        Using pdf As New PdfDocument("document.pdf")
            Dim allText As String = ""

            For Each page In pdf.Pages
                allText &= page.GetText()
            Next

            Console.WriteLine("Extracted text:")
            Console.WriteLine(allText)
        End Using
    End Sub
End Module
$vbLabelText   $csharpLabel

IronPDFの実装:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");
        string allText = pdf.ExtractAllText();

        Console.WriteLine("Extracted text:");
        Console.WriteLine(allText);
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");
        string allText = pdf.ExtractAllText();

        Console.WriteLine("Extracted text:");
        Console.WriteLine(allText);
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim pdf = PdfDocument.FromFile("document.pdf")
        Dim allText As String = pdf.ExtractAllText()

        Console.WriteLine("Extracted text:")
        Console.WriteLine(allText)
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPdfはテキスト抽出を複数行のループから単一のメソッド呼び出しに減らします。 その他の抽出オプションについては、テキスト抽出のドキュメントを参照してください。

パスワード保護と暗号化

IronPDFの実装:

using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Confidential Document</h1>");

// Set security
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

pdf.SaveAs("protected.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Confidential Document</h1>");

// Set security
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

pdf.SaveAs("protected.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Confidential Document</h1>")

' Set security
pdf.SecuritySettings.UserPassword = "userPassword"
pdf.SecuritySettings.OwnerPassword = "ownerPassword"
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights
pdf.SecuritySettings.AllowUserCopyPasteContent = False

pdf.SaveAs("protected.pdf")
$vbLabelText   $csharpLabel

包括的なセキュリティ オプションについては、暗号化のドキュメントを参照してください。

ヘッダーとフッター

IronPDFの実装:

using IronPdf;

var renderer = new ChromePdfRenderer();

renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
    HtmlFragment = @"
        <div style='text-align:center; font-size:12px;'>
            Company Header - Confidential
        </div>",
    DrawDividerLine = true,
    MaxHeight = 30
};

renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
    HtmlFragment = @"
        <div style='text-align:center; font-size:10px;'>
            Page {page} of {total-pages}
        </div>",
    DrawDividerLine = true,
    MaxHeight = 25
};

var pdf = renderer.RenderHtmlAsPdf("<h1>Document Content</h1>");
pdf.SaveAs("with_headers.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
    HtmlFragment = @"
        <div style='text-align:center; font-size:12px;'>
            Company Header - Confidential
        </div>",
    DrawDividerLine = true,
    MaxHeight = 30
};

renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
    HtmlFragment = @"
        <div style='text-align:center; font-size:10px;'>
            Page {page} of {total-pages}
        </div>",
    DrawDividerLine = true,
    MaxHeight = 25
};

var pdf = renderer.RenderHtmlAsPdf("<h1>Document Content</h1>");
pdf.SaveAs("with_headers.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter With {
    .HtmlFragment = "
        <div style='text-align:center; font-size:12px;'>
            Company Header - Confidential
        </div>",
    .DrawDividerLine = True,
    .MaxHeight = 30
}

renderer.RenderingOptions.HtmlFooter = New HtmlHeaderFooter With {
    .HtmlFragment = "
        <div style='text-align:center; font-size:10px;'>
            Page {page} of {total-pages}
        </div>",
    .DrawDividerLine = True,
    .MaxHeight = 25
}

Dim pdf = renderer.RenderHtmlAsPdf("<h1>Document Content</h1>")
pdf.SaveAs("with_headers.pdf")
$vbLabelText   $csharpLabel

IronPDF は、動的なページ番号付けのために、{page}{total-pages} などのプレースホルダー トークンをサポートしています。 その他のオプションについては、headers and footers documentationを参照してください。

重要な移行に関する注意事項

キャンバスから HTML へのパラダイムシフト

BitMiracle Docotic PDFのキャンバスベースの描画アプローチは、CSSポジショニングでHTMLに変換する必要があります:

BitMiracleドコティックPDFパターン:

var canvas = pdfPage.Canvas;
canvas.DrawString(50, 50, "Hello, World!");
var canvas = pdfPage.Canvas;
canvas.DrawString(50, 50, "Hello, World!");
Dim canvas = pdfPage.Canvas
canvas.DrawString(50, 50, "Hello, World!")
$vbLabelText   $csharpLabel

IronPDFパターン:

var html = "<div style='position:absolute; left:50px; top:50px;'>Hello, World!</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
var html = "<div style='position:absolute; left:50px; top:50px;'>Hello, World!</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
Dim html As String = "<div style='position:absolute; left:50px; top:50px;'>Hello, World!</div>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
$vbLabelText   $csharpLabel

同じページのインデックス

どちらのライブラリも 0 ベースのインデックスを使用します (Pages[0] は最初のページです)。ページ アクセス コードを変更する必要はありません。

処分不要

IronPDF はメモリ管理に using ステートメントを必要としないため、コード構造が簡素化されます。

//BitMiracle Docotic PDF- disposal required
using (var pdf = new PdfDocument("input.pdf"))
{
    // operations
}

//IronPDF- disposal optional
var pdf = PdfDocument.FromFile("input.pdf");
// operations - no using statement needed
//BitMiracle Docotic PDF- disposal required
using (var pdf = new PdfDocument("input.pdf"))
{
    // operations
}

//IronPDF- disposal optional
var pdf = PdfDocument.FromFile("input.pdf");
// operations - no using statement needed
Imports BitMiracle.Docotic.Pdf

' BitMiracle Docotic PDF - disposal required
Using pdf As New PdfDocument("input.pdf")
    ' operations
End Using

' IronPDF - disposal optional
Dim pdf = PdfDocument.FromFile("input.pdf")
' operations - no using statement needed
$vbLabelText   $csharpLabel

非同期サポート

BitMiracle Docotic PDFのHtmlToPdfアドオンは、あらゆるところで非同期パターンを必要とします。 IronPdfは同期と非同期の両方のメソッドをサポートしています:

// Synchronous
var pdf = renderer.RenderHtmlAsPdf(html);

// Asynchronous
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
// Synchronous
var pdf = renderer.RenderHtmlAsPdf(html);

// Asynchronous
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
' Synchronous
Dim pdf = renderer.RenderHtmlAsPdf(html)

' Asynchronous
Dim pdf = Await renderer.RenderHtmlAsPdfAsync(html)
$vbLabelText   $csharpLabel

.NETコアの統合

IronPDFパターン:

[ApiController]
[Route("[controller]")]
public class PdfController : ControllerBase
{
    [HttpGet("generate")]
    public IActionResult GeneratePdf()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");

        return File(pdf.BinaryData, "application/pdf", "report.pdf");
    }

    [HttpGet("generate-async")]
    public async Task<IActionResult> GeneratePdfAsync()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>");

        return File(pdf.Stream, "application/pdf", "report.pdf");
    }
}
[ApiController]
[Route("[controller]")]
public class PdfController : ControllerBase
{
    [HttpGet("generate")]
    public IActionResult GeneratePdf()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");

        return File(pdf.BinaryData, "application/pdf", "report.pdf");
    }

    [HttpGet("generate-async")]
    public async Task<IActionResult> GeneratePdfAsync()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>");

        return File(pdf.Stream, "application/pdf", "report.pdf");
    }
}
Imports Microsoft.AspNetCore.Mvc

<ApiController>
<Route("[controller]")>
Public Class PdfController
    Inherits ControllerBase

    <HttpGet("generate")>
    Public Function GeneratePdf() As IActionResult
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>")

        Return File(pdf.BinaryData, "application/pdf", "report.pdf")
    End Function

    <HttpGet("generate-async")>
    Public Async Function GeneratePdfAsync() As Task(Of IActionResult)
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = Await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>")

        Return File(pdf.Stream, "application/pdf", "report.pdf")
    End Function
End Class
$vbLabelText   $csharpLabel

移行後のチェックリスト

コードの移行が完了したら、以下を確認してください:

  • すべてのユニットテストを実行して、PDF生成が正しく機能することを確認します。
  • PDF出力品質を比較します(IronPDFのChromiumエンジンでは若干異なるレンダリングが行われる場合がありますが、通常はより優れています)
  • テキスト抽出の精度を検証する
  • フォーム入力機能をテストする
  • 該当する場合はデジタル署名を検証する
  • パフォーマンステストのバッチ操作
  • すべてのターゲット環境でテストする
  • CI/CDパイプラインを更新する
  • Docotic.Pdf ライセンスファイルを削除する

PDFインフラストラクチャの将来性を確保する

.NET 10が目前に迫り、C# 14が新しい言語機能を導入する中、統一されたアーキテクチャを持つPDFライブラリを選択することで、依存関係の管理が簡素化され、一貫した機能の利用が可能になります。 IronPdfのシングルパッケージのアプローチは、プロジェクトが2025年や2026年に拡張されても、複数のアドオンバージョンの互換性を追跡する必要がないことを意味します。

その他のリソース


BitMiracle Docotic PDFからIronPDFに移行することで、ChromiumベースのHTMLレンダリング機能を提供しながら、複数のアドオンパッケージを管理する複雑さを解消できます。 キャンバスベースの描画からHTML/CSSポジショニングへの移行は、ほとんど for .NET開発者がすでに持っているWeb開発スキルを活用し、より保守性の高いPDF生成コードを実現します。

カーティス・チャウ
テクニカルライター

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

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

アイアンサポートチーム

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