フッターコンテンツにスキップ
IRONPDFの使用

C#およびIronPDFを使用してASP.NETでPDFファイルを表示する方法

ほとんどの人は専用のデスクトップアプリケーションを使用してコンピュータでPDFを開きますが、ソフトウェアエンジニアはIronPDFを使用してC#でPDFコンテンツをプログラム的に作成、表示、開く、読む、編集することができます。

IronPDFはASP.NETとC#でPDFファイルを読むときに非常に便利なプラグインです。

ASP.NET PDFデモプロジェクトをダウンロードできます。

C#とIronPDFを使用してPDFドキュメントを迅速かつ簡単に作成することができます。

PDFドキュメントのデザインとレイアウトの多くは、既存のHTMLアセットを使用するか、ウェブデザインの担当者に業務を委任することで達成できます。 アプリケーションへのPDF生成の統合という時間のかかる作業を処理し、準備されたドキュメントのPDFへの自動変換を行います。 .NETでは、次のことが可能です:

  • ウェブフォーム、ローカルHTMLページ、その他のウェブサイトをPDF形式に変換します。
  • ドキュメントをダウンロード、他者とメールで共有、またはクラウドに保存できるようにします。
  • 見積書を発行し、顧客に請求します。 レポートを準備します。 契約書や他の書類を取り扱います。
  • ASP.NET、ASP.NET Core、Webフォーム、MVC、Web APIを.NET Frameworkおよび.NET Core、および他のプログラミング言語で使用します。

IronPDFライブラリのセットアップ

ライブラリをインストールするには2つの方法があります。

NuGetパッケージマネージャーでインストールする

IronPDFはVisual StudioアドインまたはコマンドラインからNuGetパッケージマネージャーでインストールできます。コンソールに移動し、以下のコマンドをVisual Studioに入力してください:

Install-Package IronPdf

DLLファイルをウェブサイトから直接ダウンロードする

または、DLLをウェブサイトから直接取得できます。

IronPDFを使用するすべてのcsクラスファイルの先頭に次の指令を必ず含めてください:

using IronPdf;
using IronPdf;
Imports IronPdf
$vbLabelText   $csharpLabel

IronPDFの詳細な機能概要をご覧ください。

IronPDFは必須のプラグインです。 今すぐ手に入れてIronPDFのNuGetパッケージで試してみましょう

.NET C#でHTML文字列からPDFファイルを生成する

C#でHTML文字列からPDFファイルを生成することは、C#で新しいPDFファイルを作成する効率的でやりがいのある方法です。

RenderHtmlAsPdf関数はChromePdfRendererから提供されており、IronPDF DLLに組み込まれたGoogle Chromiumエンジンのおかげで、任意のHTML(HTML5)文字列を簡単にPDFドキュメントに変換する方法を提供します。

// Create a renderer to convert HTML to PDF
var renderer = new ChromePdfRenderer();

// Convert an HTML string to a PDF
using var renderedPdf = renderer.RenderHtmlAsPdf("<h1>My First HTML to Pdf</h1>");

// Define the output path for the PDF
var outputPath = "My_First_Html.pdf";

// Save the rendered PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Automatically open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
// Create a renderer to convert HTML to PDF
var renderer = new ChromePdfRenderer();

// Convert an HTML string to a PDF
using var renderedPdf = renderer.RenderHtmlAsPdf("<h1>My First HTML to Pdf</h1>");

// Define the output path for the PDF
var outputPath = "My_First_Html.pdf";

// Save the rendered PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Automatically open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
' Create a renderer to convert HTML to PDF
Dim renderer = New ChromePdfRenderer()

' Convert an HTML string to a PDF
Dim renderedPdf = renderer.RenderHtmlAsPdf("<h1>My First HTML to Pdf</h1>")

' Define the output path for the PDF
Dim outputPath = "My_First_Html.pdf"

' Save the rendered PDF to the specified path
renderedPdf.SaveAs(outputPath)

' Automatically open the newly created PDF
System.Diagnostics.Process.Start(outputPath)
$vbLabelText   $csharpLabel

RenderHtmlAsPdfは、CSS、JavaScript、および画像をすべてサポートする強力なツールです。 これらの素材がハードディスクに保存されている場合、RenderHtmlAsPdfの第2引数を設定する必要があるかもしれません。

以下のコードはPDFファイルを生成します:

// Render HTML to PDF with a base path for local assets
var renderPdf = renderer.RenderHtmlAsPdf("<img src='image_1.png'/>", @"C:\Newproject");
// Render HTML to PDF with a base path for local assets
var renderPdf = renderer.RenderHtmlAsPdf("<img src='image_1.png'/>", @"C:\Newproject");
' Render HTML to PDF with a base path for local assets
Dim renderPdf = renderer.RenderHtmlAsPdf("<img src='image_1.png'/>", "C:\Newproject")
$vbLabelText   $csharpLabel

参照されたすべてのCSSスタイルシート、画像、JavaScriptファイルはBaseUrlPathを基準にして相対的に扱われ、より整然かな構造が維持されるようになります。 たとえば、Webフォント、Googleフォント、さらにはjQueryなど、インターネットで利用可能な画像、スタイルシート、資産をもちろん使用することもできます。

既存のHTML URLを使用してPDFドキュメントを作成する

既存のURLをC#で効率的にPDFにレンダリングできます。 これにより、PDFデザインとバックエンドPDFレンダリング作業をさまざまなセクションに分けることができるため、チームにとって有益です。

以下のコードは、endeavorcreative.comページをそのURLからレンダリングする方法を示しています:

// Create a renderer for converting URLs to PDF
var renderer = new ChromePdfRenderer();

// Convert the specified URL to a PDF
using var renderedPdf = renderer.RenderUrlAsPdf("https://endeavorcreative.com/setting-up-wordpress-website-from-scratch/");

// Specify the output path for the PDF
var outputPath = "Url_pdf.pdf";

// Save the PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
// Create a renderer for converting URLs to PDF
var renderer = new ChromePdfRenderer();

// Convert the specified URL to a PDF
using var renderedPdf = renderer.RenderUrlAsPdf("https://endeavorcreative.com/setting-up-wordpress-website-from-scratch/");

// Specify the output path for the PDF
var outputPath = "Url_pdf.pdf";

// Save the PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
' Create a renderer for converting URLs to PDF
Dim renderer = New ChromePdfRenderer()

' Convert the specified URL to a PDF
Dim renderedPdf = renderer.RenderUrlAsPdf("https://endeavorcreative.com/setting-up-wordpress-website-from-scratch/")

' Specify the output path for the PDF
Dim outputPath = "Url_pdf.pdf"

' Save the PDF to the specified path
renderedPdf.SaveAs(outputPath)

' Open the newly created PDF
System.Diagnostics.Process.Start(outputPath)
$vbLabelText   $csharpLabel

その結果として、生成されたPDFにはすべてのハイパーリンク(HTMLリンク)およびHTMLフォームが保持されます。

既存のHTMLドキュメントからPDFドキュメントを作成する

このセクションでは、任意のローカルHTMLファイルをレンダリングする方法を示しています。

// Create a renderer for existing HTML files
var renderer = new ChromePdfRenderer();

// Render an HTML file to PDF
using var renderedPdf = renderer.RenderHtmlFileAsPdf("Assets/test1.html");

// Specify the output path for the PDF
var outputPath = "test1_pdf.pdf";

// Save the PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
// Create a renderer for existing HTML files
var renderer = new ChromePdfRenderer();

// Render an HTML file to PDF
using var renderedPdf = renderer.RenderHtmlFileAsPdf("Assets/test1.html");

// Specify the output path for the PDF
var outputPath = "test1_pdf.pdf";

// Save the PDF to the specified path
renderedPdf.SaveAs(outputPath);

// Open the newly created PDF
System.Diagnostics.Process.Start(outputPath);
' Create a renderer for existing HTML files
Dim renderer = New ChromePdfRenderer()

' Render an HTML file to PDF
Dim renderedPdf = renderer.RenderHtmlFileAsPdf("Assets/test1.html")

' Specify the output path for the PDF
Dim outputPath = "test1_pdf.pdf"

' Save the PDF to the specified path
renderedPdf.SaveAs(outputPath)

' Open the newly created PDF
System.Diagnostics.Process.Start(outputPath)
$vbLabelText   $csharpLabel

CSS、画像、JavaScriptなどのすべての相対資産に対して、ファイル:/プロトコルを使用した場合のように表示されます。 この戦略の利点は、開発者がコンテンツを作成する際にHTMLコンテンツをブラウザでテストできることです。 IronPDFのレンダリングエンジンはChromeウェブブラウザに基づいています。

したがって、XMLからPDFへの変換を使用することをお勧めします。XMLコンテンツをPDFに印刷する場合はXSLTテンプレートを使用して実施できます。

ASP.NET WebフォームをPDFファイルに変換する コード1行で、ASP.NETオンラインフォームをHTMLではなくPDF形式に変換することができます。

コードをページのコードビハインドファイルのPage_Loadメソッドに配置して、ページに表示されるようにします。

ASP.NET Webフォームアプリケーションは、ゼロから作成することも、以前のバージョンから開くこともできます。

NuGetパッケージがまだインストールされていない場合はインストールしてください。

usingキーワードを使用してIronPdf名前空間をインポートする必要があります。 PDFに変換したいページのコードビハインドに移動します。

たとえば、ASP.NETを使用したDefault.aspx.csファイル。

using IronPdf;
using System;
using System.Web.UI;

namespace WebApplication7
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Render the current page as a PDF in the browser
            AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.InBrowser);
        }
    }
}
using IronPdf;
using System;
using System.Web.UI;

namespace WebApplication7
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Render the current page as a PDF in the browser
            AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.InBrowser);
        }
    }
}
Imports IronPdf
Imports System
Imports System.Web.UI

Namespace WebApplication7
	Partial Public Class _Default
		Inherits Page

		Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
			' Render the current page as a PDF in the browser
			AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.InBrowser)
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

RenderThisPageAsPdfAspxToPdfクラスのメソッドです。 IronPdf.Extensions.ASPX NuGetパッケージをインストールする必要があります。

ASPXはMVCモデルに置き換えられているため、.NET Coreでは利用できません。

HTMLテンプレートの適用

イントラネットとウェブサイト開発者にとって、テンプレートを作成またはPDFを「バッチ生成」する能力は一般的な必需品です。

PDFドキュメントにテンプレートを作成する代わりに、IronPDFライブラリは既存の、十分にテスト済みの技術を活用してHTMLのテンプレートを生成する方法を提供します。

クエリ文字列やデータベースからのデータがHTMLテンプレートに追加されると、動的に生成されたPDFファイルが作成されます、以下のように例示されています。 たとえば、C# Stringクラスとそのプロパティを考えてみてください。

// Basic HTML String Formatting
string formattedString = String.Format("<h1>Hello {0}!</h1>", "World");
// Basic HTML String Formatting
string formattedString = String.Format("<h1>Hello {0}!</h1>", "World");
' Basic HTML String Formatting
Dim formattedString As String = String.Format("<h1>Hello {0}!</h1>", "World")
$vbLabelText   $csharpLabel

Formatメソッドは基本的な「メールマージ」操作に非常に適しています。

HTMLファイルは非常に大きい場合があるため、任意のプレースホルダー、例えば[[NAME]]を使用し、それらを実際のデータと置き換えるのが一般的です。

// Define an HTML template with a placeholder
var htmlTemplate = "<p>[[NAME]]</p>";

// Sample data to replace placeholders
var names = new[] { "John", "James", "Jenny" };

// Create a new PDF for each name
foreach (var name in names)
{
    // Replace placeholder with actual name
    var htmlInstance = htmlTemplate.Replace("[[NAME]]", name);

    // Create a renderer and render the HTML as PDF
    var renderer = new ChromePdfRenderer();
    using var pdf = renderer.RenderHtmlAsPdf(htmlInstance);

    // Save the PDF with the name in the filename
    pdf.SaveAs($"{name}.pdf");
}
// Define an HTML template with a placeholder
var htmlTemplate = "<p>[[NAME]]</p>";

// Sample data to replace placeholders
var names = new[] { "John", "James", "Jenny" };

// Create a new PDF for each name
foreach (var name in names)
{
    // Replace placeholder with actual name
    var htmlInstance = htmlTemplate.Replace("[[NAME]]", name);

    // Create a renderer and render the HTML as PDF
    var renderer = new ChromePdfRenderer();
    using var pdf = renderer.RenderHtmlAsPdf(htmlInstance);

    // Save the PDF with the name in the filename
    pdf.SaveAs($"{name}.pdf");
}
' Define an HTML template with a placeholder
Dim htmlTemplate = "<p>[[NAME]]</p>"

' Sample data to replace placeholders
Dim names = { "John", "James", "Jenny" }

' Create a new PDF for each name
For Each name In names
	' Replace placeholder with actual name
	Dim htmlInstance = htmlTemplate.Replace("[[NAME]]", name)

	' Create a renderer and render the HTML as PDF
	Dim renderer = New ChromePdfRenderer()
	Dim pdf = renderer.RenderHtmlAsPdf(htmlInstance)

	' Save the PDF with the name in the filename
	pdf.SaveAs($"{name}.pdf")
Next name
$vbLabelText   $csharpLabel

次の例は、異なるユーザーそれぞれに合わせてカスタマイズされた3つのPDFドキュメントを生成します。

ASP.NET MVCルーティング: このページのPDF版をダウンロードする

ASP.NET MVCフレームワークを使って、ユーザーをPDFファイルへ誘導できます。 新しいASP.NET MVCアプリケーションを作成する際、または既存のMVCコントローラーを既存のアプリケーションに追加する際にこのオプションを選択します。 ASP.NET Webアプリケーション(.NET Framework) > MVCからドロップダウンメニューを選択して、Visual Studioの新しいプロジェクトウィザードを開始します。 あるいは、既存のMVCプロジェクトを開くこともできます。

ControllersフォルダーのHomeControllerファイルのIndexメソッドを置き換えるか、またはControllersフォルダーに新しいコントローラーを作成します。

using IronPdf;
using System;
using System.Web.Mvc;

namespace WebApplication8.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            // Render a URL as PDF and return it in the response
            using var pdf = HtmlToPdf.StaticRenderUrlAsPdf(new Uri("https://en.wikipedia.org"));
            return File(pdf.BinaryData, "application/pdf", "Wiki.Pdf");
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
            return View();
        }
    }
}
using IronPdf;
using System;
using System.Web.Mvc;

namespace WebApplication8.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            // Render a URL as PDF and return it in the response
            using var pdf = HtmlToPdf.StaticRenderUrlAsPdf(new Uri("https://en.wikipedia.org"));
            return File(pdf.BinaryData, "application/pdf", "Wiki.Pdf");
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
            return View();
        }
    }
}
Imports IronPdf
Imports System
Imports System.Web.Mvc

Namespace WebApplication8.Controllers
	Public Class HomeController
		Inherits Controller

		Public Function Index() As ActionResult
			' Render a URL as PDF and return it in the response
			Dim pdf = HtmlToPdf.StaticRenderUrlAsPdf(New Uri("https://en.wikipedia.org"))
			Return File(pdf.BinaryData, "application/pdf", "Wiki.Pdf")
		End Function

		Public Function About() As ActionResult
			ViewBag.Message = "Your application description page."
			Return View()
		End Function

		Public Function Contact() As ActionResult
			ViewBag.Message = "Your contact page."
			Return View()
		End Function
	End Class
End Namespace
$vbLabelText   $csharpLabel

コードがどのように書かれるべきかの例は以下のとおりです:

PDFドキュメントにカバーページを追加する

ASP.NETでC#およびIronPDFを使用してPDFファイルを表示する方法、図1: PDFドキュメントにカバーページを追加する PDFドキュメントにカバーページを追加する IronPDFはPDFドキュメントをマージするプロセスを簡素化します。

この技法の最も一般的な適用は、すでにレンダリングされたPDFドキュメントにカバーページや裏表紙を追加することです。

これを達成するためには、カバーページを用意して、PdfDocument機能を使用します。

// Create a renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/");

// Merge the cover page with the rendered PDF
using var merged = PdfDocument.Merge(new PdfDocument("CoverPage.pdf"), pdf);

// Save the merged document
merged.SaveAs("Combined.Pdf");
// Create a renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/");

// Merge the cover page with the rendered PDF
using var merged = PdfDocument.Merge(new PdfDocument("CoverPage.pdf"), pdf);

// Save the merged document
merged.SaveAs("Combined.Pdf");
' Create a renderer and render a PDF from a URL
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/")

' Merge the cover page with the rendered PDF
Dim merged = PdfDocument.Merge(New PdfDocument("CoverPage.pdf"), pdf)

' Save the merged document
merged.SaveAs("Combined.Pdf")
$vbLabelText   $csharpLabel

2つのドキュメントを結合するには、Merge PDF Documents Methodを使用します。

ドキュメントに透かしを追加する 最後に、C#コードを使用してPDFドキュメントに透かしを追加することができます;

// Prepare a stamper with HTML content for the watermark
HtmlStamper stamper = new HtmlStamper("<h2 style='color:red'>SAMPLE</h2>")
{
    HorizontalOffset = new Length(-3, MeasurementUnit.Inch),
    VerticalAlignment = VerticalAlignment.Bottom
};

// Create a renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Apply the watermark to the PDF
pdf.ApplyStamp(stamper);

// Save the watermarked PDF
pdf.SaveAs(@"C:\PathToWatermarked.pdf");
// Prepare a stamper with HTML content for the watermark
HtmlStamper stamper = new HtmlStamper("<h2 style='color:red'>SAMPLE</h2>")
{
    HorizontalOffset = new Length(-3, MeasurementUnit.Inch),
    VerticalAlignment = VerticalAlignment.Bottom
};

// Create a renderer and render a PDF from a URL
var renderer = new ChromePdfRenderer();
using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Apply the watermark to the PDF
pdf.ApplyStamp(stamper);

// Save the watermarked PDF
pdf.SaveAs(@"C:\PathToWatermarked.pdf");
' Prepare a stamper with HTML content for the watermark
Dim stamper As New HtmlStamper("<h2 style='color:red'>SAMPLE</h2>") With {
	.HorizontalOffset = New Length(-3, MeasurementUnit.Inch),
	.VerticalAlignment = VerticalAlignment.Bottom
}

' Create a renderer and render a PDF from a URL
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")

' Apply the watermark to the PDF
pdf.ApplyStamp(stamper)

' Save the watermarked PDF
pdf.SaveAs("C:\PathToWatermarked.pdf")
$vbLabelText   $csharpLabel

これを使用して、書類の各ページに「機密」または「サンプル」であることを示す免責事項を追加できます。

あなたのPDFファイルはパスワードで保護することができます PDF書類のパスワードプロパティを設定すると、暗号化され、ユーザーは書類を読むために正しいパスワードを提供する必要があります。

using IronPdf;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a renderer and render a PDF from HTML
            var renderer = new ChromePdfRenderer();
            using var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");

            // Set password to protect the PDF
            pdfDocument.Password = "strong!@#pass&^%word";

            // Save the secured PDF
            pdfDocument.SaveAs("secured.pdf");
        }
    }
}
using IronPdf;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a renderer and render a PDF from HTML
            var renderer = new ChromePdfRenderer();
            using var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");

            // Set password to protect the PDF
            pdfDocument.Password = "strong!@#pass&^%word";

            // Save the secured PDF
            pdfDocument.SaveAs("secured.pdf");
        }
    }
}
Imports IronPdf

Namespace ConsoleApp
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			' Create a renderer and render a PDF from HTML
			Dim renderer = New ChromePdfRenderer()
			Dim pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")

			' Set password to protect the PDF
			pdfDocument.Password = "strong!@#pass&^%word"

			' Save the secured PDF
			pdfDocument.SaveAs("secured.pdf")
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

この例は.NET Coreコンソールアプリケーションで使用できます。

上記の利点がなくても、IronPDFを使って以下もできます:

その結果、IronPDFは非常に役立ちます、それはPDFの作成を簡素化し、その結果、PDFおよびHTMLから作成されたドキュメントの元のプレゼンテーションを向上させます。

ドキュメントから提供された情報および競合分析に基づいて:IronPDFはPDFを作成する際に最も効果的なツールであり、オフィスや学校で働く人を含む誰もが効率的にタスクを完了することを簡単にする。

ASP.NETでC#およびIronPDFを使用してPDFファイルを表示する方法、図2: ASP.NETでC#およびIronPDFを使用してPDFファイルを表示する方法 ASP.NETでC#およびIronPDFを使用してPDFファイルを表示する方法 今すぐ手に入れてIronPDFのNuGetパッケージで試してみましょう

よくある質問

C#を使用してASP.NETアプリケーションでPDFファイルを表示するにはどうすればいいですか?

PDFを画像またはウェブページ内に埋め込めるHTML要素としてレンダリングすることで、ASP.NETアプリケーションでIronPDFを使用してPDFファイルを表示することができます。

ASP.NETでHTMLページをPDFに変換するためのステップは何ですか?

ASP.NETでHTMLページをPDFに変換するには、IronPDFのRenderHtmlAsPdfメソッドを使用できます。このメソッドは正確なレンダリングのためにCSSとJavaScriptをサポートしています。

C#で複数のPDF文書を結合するにはどうすればいいですか?

IronPDFは、異なるPDFファイルを単一の文書に結合するPdfDocument.Mergeメソッドを使用して、複数のPDF文書を結合することができます。

ASP.NETでPDF文書に透かしを追加することは可能ですか?

はい、IronPDFを使用してASP.NETでPDF文書に透かしを追加することができます。HtmlStamperクラスを使用してカスタムHTMLコンテンツをオーバーレイします。

C#を使ってPDFファイルにパスワード保護を実装するにはどうすればいいですか?

IronPDFを使用して、ファイルを暗号化するためにPdfDocumentPasswordプロパティを設定することで、PDFファイルにパスワード保護を実装することができます。

IronPDFを使用してASP.NET WebフォームをPDFに変換することはできますか?

はい、IronPDFはRenderThisPageAsPdfメソッドのようなメソッドを使用してASP.NET WebフォームをPDFに変換し、Webフォーム全体をPDF文書としてキャプチャします。

ASP.NETでのPDF生成においてIronPDFが提供する利点は何ですか?

IronPDFは、組み込みのGoogle Chromiumエンジンを使用してHTML、CSS、JavaScriptを正確にレンダリングするなど、ASP.NETでのPDF生成における柔軟なツールです。

ASP.NETプロジェクトにIronPDFをインストールするにはどうすればいいですか?

IronPDFは、NuGetパッケージマネージャーを使用するか、IronPDFウェブサイトからDLLファイルを直接ダウンロードすることでASP.NETプロジェクトにインストールできます。

IronPDFがソフトウェア開発者にとって貴重な資産である理由は何ですか?

IronPDFは複雑なPDF生成タスクを簡素化し、ASP.NETアプリケーションでの効率的なPDF操作を可能にすることで、ソフトウェア開発者にとって貴重な資産です。

C#でIronPDFを使用してURLからPDFを作成するにはどうすればいいですか?

IronPDF のRenderUrlAsPdfメソッドを使用して C# で URL から PDF を作成できます。このメソッドは URL からコンテンツを取得し、それを PDF ドキュメントに変換します。

.NET 10 サポート: IronPDF は、ASP.NET で PDF ファイルを表示するために .NET 10 と互換性がありますか?

はい。IronPDFは、ASP.NETまたはASP.NET Coreを使用したWebアプリケーションを含む、.NET 10を完全にサポートしています。特別な設定を必要とせず、.NET 10プロジェクト間でシームレスに動作します。以前の.NETバージョンと同様に、 RenderUrlAsPdfなどの使い慣れたメソッドや、MIMEタイプapplication/pdfFileStreamResult返すメソッドも引き続き使用できます。IronPDFはクロスプラットフォーム対応として設計されており、.NET 10はサポート対象フレームワークに明示的に含まれています。([ironpdf.com](https://ironpdf.com/?utm_source=openai))

Curtis Chau
テクニカルライター

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

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