HTML to PDF

C# + VB.Net: HTML to PDF HTML to PDF
// Install IronPdf with Nuget:  PM> Install-Package IronPdf
using IronPdf;

var Renderer = new IronPdf.HtmlToPdf();
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("example.pdf");

 


// Advanced:  Load external html assets: images, css and javascript.
// An optional "base" asset locading path can be set as a url or local directory. 
var PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
PDF.SaveAs("html-with-assets.pdf");
' Install IronPdf with Nuget:  PM> Install-Package IronPdf
Imports IronPdf

Private Renderer = New IronPdf.HtmlToPdf()
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("example.pdf")




' Advanced:  Load external html assets: images, css and javascript.
' An optional "base" asset locading path can be set as a url or local directory. 
Dim PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
PDF.SaveAs("html-with-assets.pdf")

IronPDF allows developers to create PDF documents easily in C#, F#, and VB.Net for .NET Core and .NET Framework. In this example we show that a PDF document can be rendered using HTML. You can choose simple HTML like the above, or incorporate CSS, images and Javascript. IronPDF rendering closely follows Google Chrome.