Get Started - 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”. https://www.nuget.org/packages/IronPdf/

 PM > Install-Package IronPdf

Why IronPdf

Adding PDF file generation in .Net project is a cumbersome; and also 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, secure internet and by using IronPdf you will be able add lot of features and capability to your projects, and you will be able to produce PDF files as report or as document.

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
Dim Renderer As IronPdf.HtmlToPdf = 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 also 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");
 PDF.SaveAs("MyPdf.pdf");
Imports IronPdf
Dim Renderer As var = New IronPdf.HtmlToPdf
Dim PDF As var = Renderer.RenderHTMLFileAsPdf("Assets/MyHTML.html")
PDF.SaveAs("MyPdf.pdf")
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("https://en.wikipedia.org/wiki/Portable_Document_Format");
PDF.SaveAs("wikipedia.pdf");
Imports IronPdf
Dim Renderer As var = New IronPdf.HtmlToPdf
Dim PDF As var = Renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Portable_Document_Format")
PDF.SaveAs("wikipedia.pdf")
VB   C#

ASP.Net Example

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

protected void Page_Load(object sender, EventArgs e)
    {
        IronPdf.AspxToPdf.RenderThisPageAsPdf(IronPdf.AspxToPdf.FileBehavior.InBrowser);
    }
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        IronPdf.AspxToPdf.RenderThisPageAsPdf(IronPdf.AspxToPdf.FileBehavior.InBrowser)
    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.

We 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.