Create and Edit PDF documents in C# & VB.Net

The easiest way to install IronPdf is using NuGet Package Manager for Visual-Studio: The package name is “IronPdf”.

 PM > Install-Package IronPdf

Why IronPdf

Adding PDF file generation in .Net project is cumbersome; converting web forms, HTML and/or online web pages to Pdf is a very hard and complex problem.

IronPdf works with ASP.NET web forms, MVC, Web services, WPF, and secure internet. By using IronPdf you will be able add lots of features and capability to your projects, and produce PDF files as reports or as documents.

HTML String to PDF Example

This example shows just how easy it can be to create a PDF file from .Net.

using IronPdf;

IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
Renderer.RenderHtmlAsPdf("<h1>Hello World<h1>").SaveAs("html-string.pdf");
Imports IronPdf

Private Renderer As New IronPdf.HtmlToPdf()
Renderer.RenderHtmlAsPdf("<h1>Hello World<h1>").SaveAs("html-string.pdf")
VB   C#

HTML File to PDF Example

HTML files with images, CSS, forms, hyperlinks and even JavaScript may be rendered into PDF documents.

using IronPdf;

// Create a PDF from an existing HTML using C#
 var Renderer = new IronPdf.HtmlToPdf();
 var PDF = Renderer.RenderHTMLFileAsPdf("Assets/MyHTML.html");
Imports IronPdf

' Create a PDF from an existing HTML using C#
 Private Renderer = New IronPdf.HtmlToPdf()
 Private PDF = Renderer.RenderHTMLFileAsPdf("Assets/MyHTML.html")
VB   C#

URL to PDF Example

Existing web pages may also be rendered as PDFs in a few lines of C# or VB.Net code

using IronPdf;

// Create a PDF from any existing web page
var Renderer = new IronPdf.HtmlToPdf();
var PDF = Renderer.RenderUrlAsPdf("");
Imports IronPdf

' Create a PDF from any existing web page
Private Renderer = New IronPdf.HtmlToPdf()
Private PDF = Renderer.RenderUrlAsPdf("")
VB   C#

ASP.Net Example

ASP.Net webpages may be marked to be rendered as PDF rather than HTML by using a single of code in the Page_Load code-behind method.

protected void Page_Load(object sender, EventArgs e)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
VB   C#

C# PDF Cheat Sheet

We have compiled a PDF document that explains in full how to create and edit PDFs in C# and VB.Net using the IronPDF library.

You can download it and use it as a develop guide for your .Net projects, or print it as a handy companion for IronPDF development. This saves time and effort in getting started adding PDF features to any .Net project.

Learn More

To learn more about HTML to PDF in C# or VB.Net applications please read the C# HTML to PDF Tutorial. The tutorial clearly explains the use of advanced PDF settings, HTML templating and the use of CSS, Images and Javascript.

You can also use IronPDF to dynamically render ASPX pages in ASP.Net applications as PDFs in the ASPX to PDF Tutorial

A full object reference for .NET developers is also available.