PDFコンバータ .NET(開発者向けチュートリアル)
1.0 はじめに
AdobeのPortable Document Format(PDF)は、文書の表示と交換に広く使用されています。 開発者はクライアントのニーズを満たすためにしばしばPDFを作成する必要があり、現代のライブラリはこのプロセスを簡素化しました。 プロジェクトのライブラリを選ぶ際には、ビルド、読み取り、変換機能などの特長を考慮することが重要です。
2.0 IronPDFの特徴
IronPDFは、PDFドキュメントの作成、読み取り、編集に対応した多機能ライブラリで、Chromeエンジンを使用してHTMLをPDFに変換する機能を備えています。ASP.NETウェブアプリケーションおよび従来のWindowsアプリケーションの両方で使用できます。 このライブラリは、HTML5、JavaScript、CSS、画像を使用して視覚的に魅力的なPDFを作成でき、強力なHTML-to-PDFコンバーターを含んでいます。
- IronPDFライブラリは、画像ファイルからPDFへの変換、HTML5からPDFへの変換、ASPXからPDFへの変換、およびRazor/MVCビューの変換を含む、PDF生成のためのさまざまな入力をサポートしています。
- ライブラリにはインタラクティブフォームの編集と送信、PDFファイルの分割、テキストと画像の抽出、テキスト検索、およびPDFページを画像にラスタライズする機能があります。
- ライブラリは、HTMLログインフォームの認証のために、ユーザーエージェント、プロキシ、クッキー、HTTPヘッダー、フォーム変数を使用して、URLをPDFドキュメントの基礎として使用することを許可します。
- IronPDFは、ユーザー名とパスワードを提供することで、パスワード保護されたPDFファイルへのアクセスを可能にします。
- ライブラリは既存のPDFドキュメントの読み取りと編集をサポートしています。
- ユーザーはIronPDFを使用して、テキスト、グラフィックス、ブックマークを整理、PDFドキュメントにウォーターマークを追加し、ヘッダーとフッターをカスタマイズし、PDFファイルから画像を抽出できます。
- IronPDFは、新規または既存のPDFドキュメントのページを分割およびマージし、Adobe Acrobat Readerを必要とせずにテキストからPDFオブジェクトを生成できます。
- CSSメディアファイルおよびCSSファイルのPDF変換がサポートされています。
- ユーザーはIronPDFを使用して新しい記入可能なPDFフォームを追加または既存のものを完成させることができます。
- IronPDFはまた、JPEG、PNGなどのさまざまな画像形式にPDFページを変換することができます。
3.0 URLからPDFドキュメントを作成
IronPDFの組み込みChromeブラウザとAPIライブラリを使用すると、ウェブページからPDFファイルを簡単に生成できます。 単にURLを提供し、IronPDF APIライブラリを使用してそれをPDFファイルに変換します。 ドキュメントの変換は、わずか数行のコードで迅速に完了できます。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified URL to a PDF
var pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified URL to a PDF
var pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified URL to a PDF
Dim pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")RenderUrlAsPdfメソッドを使用して、URLをPDFドキュメントに迅速に変換できます。 単にURLと希望の保存場所を提供し、IronPDFは上記の情報に基づいてPDFファイルを生成します。 これにより、わずか数行のコードでウェブページをPDFドキュメントに変換することが容易になります。
Google URLから生成されたPDFファイル
4.0 HTML文字列からPDFを作成
HTML文字列はIronPDF APIライブラリを使用して迅速にPDFファイルに変換できます。 次のコードスニペットはHTML文字列をドキュメントに変換し、任意のHTMLタグをPDFファイルに変換できます。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML string to a PDF
var pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML string to a PDF
var pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified HTML string to a PDF
Dim pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")このコードスニペットは、RenderHtmlAsPdf関数を使用してHTMLテキストをPDFに変換する方法を示しています。 HTMLを文字列に変換する関数は、必要なだけのHTMLコードを受け入れます。 その後、SaveAs機能を使用してドキュメントを保存することで、プロセスを迅速かつ簡単に完了できます。
HTML文字列から生成された出力PDFファイル
5.0 HTMLファイルからPDFを作成
IronPDF APIライブラリは、HTMLファイルをPDFファイルに迅速に変換することを可能にします。 次のサンプルコードを使用して、任意のHTMLタグをPDFファイルに変換できます。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML file to a PDF
var pdf = renderer.RenderHtmlFileAsPdf("test.html");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML file to a PDF
var pdf = renderer.RenderHtmlFileAsPdf("test.html");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified HTML file to a PDF
Dim pdf = renderer.RenderHtmlFileAsPdf("test.html")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")HTMLテキストは以下の通りです。
<p style="color:red">Hello world</p><p style="color:red">Hello world</p>
HTMLファイルからの出力PDFファイル
6.0 リッチテキストファイルからPDFを作成
IronPDF APIライブラリはまた、リッチテキストファイル(RTF)から迅速にPDFを作成することを可能にします。 RTFからPDFへの変換のためのサンプルコードを使用して、任意の数のRTFを単一のPDFファイルに変換することができます。コードは以下の通りです。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF file to a PDF
var pdf = renderer.RenderRtfFileAsPdf("test.rtf");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF file to a PDF
var pdf = renderer.RenderRtfFileAsPdf("test.rtf");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified RTF file to a PDF
Dim pdf = renderer.RenderRtfFileAsPdf("test.rtf")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
RTFファイルからの出力PDFファイル
上の画像では、左側にソースドキュメントが表示され、右側に変換後のPDFファイルが表示されています。 また、以下のコードを使用して、RTF文字列をPDFに変換できます。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF string to a PDF
var pdf = renderer.RenderRtfStringAsPdf("{\\rtf1...}");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF string to a PDF
var pdf = renderer.RenderRtfStringAsPdf("{\\rtf1...}");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified RTF string to a PDF
Dim pdf = renderer.RenderRtfStringAsPdf("{\rtf1...}")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")7.0 MarkdownファイルからPDFを作成
IronPDF APIモジュールにより、Markdownファイルからの迅速なPDF生成が可能です。 以下に示す変換用サンプルコードを使用して、MarkdownファイルをPDFファイルに変換できます。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown file to a PDF
var pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown file to a PDF
var pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified Markdown file to a PDF
Dim pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md")
' Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf")
Markdownファイルからの出力PDFファイル
上の画像に示されているように、ソースドキュメントは左側にあり、変換されたPDFファイルは右側にあります。 以下に提供されているコードにより、MD文字列をPDFに変換できます。 HTMLの変換に関する詳細情報については、HTML to PDF Conversion Tutorialをご覧ください。
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown string to a PDF
var pdf = renderer.RenderMarkdownStringAsPdf("# Hello world\n\nHello world");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown string to a PDF
var pdf = renderer.RenderMarkdownStringAsPdf("# Hello world\n\nHello world");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");Imports Microsoft.VisualBasic
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified Markdown string to a PDF
Dim pdf = renderer.RenderMarkdownStringAsPdf("# Hello world" & vbLf & vbLf & "Hello world")
' Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf")IronPDF APIライブラリの使用方法を知りたい場合は、開発者ドキュメントIronPDF Documentation Resourceを参照してください。
8.0 結論
IronPDFライブラリは開発用の無料ライセンスを提供しており、開発者の必要に応じて、製品環境での使用のために購入可能な複数のライセンスがあります。 The Lite bundle has an initial price of $799 and has no ongoing costs. ライセンスには、永久ライセンス、30日間の返金保証、1年間の製品サポートとアップグレード、およびSaaSとOEMの再配布の可能性があります。 それらは、一度の購入で、開発、ステージング、プロダクションに使用できます。 IronPDFは、再配布保護のための期間限定の無料ライセンスおよび無料ライセンスも提供しています。 IronPDFの価格とライセンス情報の完全な概要については、IronPDF Licensing Information Pageをご覧ください。
よくある質問
.NET でフォーマットを失わずに HTML を PDF に変換するにはどうすればよいですか?
IronPDF を使用して HTML を PDF に変換することで、Chrome エンジンを使用することによりフォーマットを失わずに変換可能です。ライブラリは HTML5、JavaScript、CSS をサポートし、PDF が元のレイアウトとデザインを保持することを保証します。
URL を PDF に変換するための方法は何がありますか?
IronPDF は、ChromePdfRenderer クラスを使用して URL を PDF ドキュメントに簡単に変換するための RenderUrlAsPdf メソッドを提供します。
C# で Markdown を PDF に変換する方法はありますか?
はい、IronPDF は RenderMarkdownFileAsPdf メソッドを使用して Markdown ファイルを PDF に変換できます。これにより、開発者が効率的に Markdown コンテンツを PDF フォーマットに変換できます。
.NET を使用して RTF ファイルを PDF ドキュメントに変換するにはどうすればよいですか?
IronPDF は、RenderRtfFileAsPdf メソッドを使用して RTF ファイルを PDF に変換することができ、リッチテキストファイルを迅速かつ正確に PDF フォーマットに変換します。
PDF ファイルからテキストや画像を抽出できますか?
はい、IronPDF は PDF ドキュメントからテキストと画像を簡単に抽出することができ、PDF 内のテキストや画像を検索し操作する機能を提供します。
インタラクティブ PDF フォームを作成するためのオプションは何がありますか?
IronPDF はインタラクティブ PDF フォームの作成と編集をサポートし、開発者が PDF ドキュメントにフォームフィールド、グラフィックス、ブックマーク、ウォーターマークを追加することができます。
.NET で PDF ドキュメントを結合または分割するにはどうすればよいですか?
IronPDF は PDF ドキュメントの結合および分割の機能を提供し、開発者が複数の PDF を1つに結合したり、1つの PDF を複数のドキュメントに分割したりすることができます。
IronPDF は本番用でどのようなライセンスオプションを提供していますか?
IronPDF は本番用に複数のライセンス オプションを提供しており、中には継続的なコストがない Lite バンドルも含まれています。ライセンスには永久使用権、30 日間の返金保証、1 年間の製品の更新およびサポートが含まれています。
IronPDF は ASP.NET Web および Windows アプリケーションで使用できますか?
はい、IronPDF は ASP.NET Web アプリケーションと伝統的な Windows アプリケーションの両方に対応しており、異なる環境で作業する開発者に柔軟性を提供します。
IronPDF はパスワード保護された PDF ファイルをサポートしていますか?
IronPDF は、必要な資格情報を提供することでパスワード保護された PDF ファイルを読み取りおよび編集できるようにします。
.NET 10: IronPDF は .NET 10 を対象とするプロジェクトを完全にサポートしていますか?
はい。IronPDFは、デスクトップ、Web、マイクロサービス、クラウド/コンテナ環境において、新しいランタイムとC#言語の機能強化を含む.NET 10と完全な互換性があります。特別な回避策やカスタムAPIを必要とせず、.NET 10プロジェクトですぐに使用できます。






