URL を PDF に変換
Web URL から PDF へのレンダリングは、 fromUrlメソッドに URL を指定するだけで簡単に行えます。 これにより、エクスポートしたり、PDF ドキュメントをさらに強化したりできる PDF オブジェクトが返されます。 IronPDF を使用して Web ページを PDF に変換する方法の詳細については、" IronPDF HTML から PDF への変換ガイド"を参照してください。
// Import necessary namespace
using IronPdf;
class Program
{
static void Main()
{
// Define the URL of the web page you want to convert to a PDF
var url = "https://example.com";
// Create an instance of IronPdf.HtmlToPdf
var renderer = new HtmlToPdf();
// Render the URL to a PDF document
// The fromUrl method takes the web page URL and returns a PdfDocument object
PdfDocument pdf = renderer.RenderUrlAsPdf(url);
// Export the PDF document to a file
// Specify the file path where the PDF will be saved
pdf.SaveAs("WebPageToPdf.pdf");
// Output success message
System.Console.WriteLine("Web page has been successfully converted to PDF.");
}
}// Import necessary namespace
using IronPdf;
class Program
{
static void Main()
{
// Define the URL of the web page you want to convert to a PDF
var url = "https://example.com";
// Create an instance of IronPdf.HtmlToPdf
var renderer = new HtmlToPdf();
// Render the URL to a PDF document
// The fromUrl method takes the web page URL and returns a PdfDocument object
PdfDocument pdf = renderer.RenderUrlAsPdf(url);
// Export the PDF document to a file
// Specify the file path where the PDF will be saved
pdf.SaveAs("WebPageToPdf.pdf");
// Output success message
System.Console.WriteLine("Web page has been successfully converted to PDF.");
}
}$vbLabelText $csharpLabel
準備はできましたか?
バージョン: 2025.12 リリース




