How to Get Started with the IronPDF C# PDF Library

IronPDF is a comprehensive and versatile software library that gives you full granular control over generating, editing, and exporting PDF files in your project or workflow. With this powerful tool having support in a variety of languages such as C#, F#, VB.NET, Java, and more, it is the best solution for your PDF problems. This article will walk you through the C# IronPDF Installation method.

The software is available for free for development via NuGet and direct download. Follow the instructions below to start converting HTML to PDF in your .NET project.

How to Install IronPDF: Choosing the Right Mode: Native vs Remote

IronPDF offers two modes for rendering PDFs -- Native Mode and Remote Mode -- tailored to fit different development environments:

Native Mode: Best for developers looking to run everything locally, suitable for modern Windows, macOS, and Linux deployments. Simply install the following package:

Remote Mode (IronPdfEngine): Ideal for cloud and containerized environments like Azure, AWS, and Docker, where dependencies can be managed centrally. Also great for natively unsupported or legacy OSes such as Windows Server 2012 and less popular Linux distros. Simply install the following package in your project and connect to the IronPdfEngine container:

Use IronPDF with Remote Engine

IronPDF has some performance-intensive functions that you may choose to run remotely. While IronPDF does not require IronPdfEngine to run, setting up IronPdfEngine as a remote service is an optional way to avoid platform-specific Chrome compatibility issues on older operating systems and mobile environments.

How does using Engine change the way I code with IronPDF?

When using the Engine configuration, we recommend installing IronPdf.Slim instead of the full IronPdf package from NuGet, as the Engine manages all the extra bulk included in the Native package.

Install-Package IronPdf.Slim

After installing IronPdf.Slim, configure the connection settings by pointing IronPDF to your IronPdfEngine instance. Add the following code at the startup of your application (or before calling any IronPDF method):

// Assuming that IronPdfEngine runs remotely at 123.456.7.8:33350.
Installation.ConnectToIronPdfHost(
    new IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
);
// Assuming that IronPdfEngine runs remotely at 123.456.7.8:33350.
Installation.ConnectToIronPdfHost(
    new IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
);
' Assuming that IronPdfEngine runs remotely at 123.456.7.8:33350.
Installation.ConnectToIronPdfHost(New IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350"))
$vbLabelText   $csharpLabel

How to Install the IronPDF Library to a .NET Project (Native)

Installing the C# PDF library is simple and takes less than 5 minutes.

The software is available for free for development via NuGet and direct download, and we will get you up and running in Visual Studio. Follow the instructions below to start converting HTML to PDF in your .NET project.

Step-by-Step C# PDF Library Installation

  1. Install via NuGet
  2. Install by direct download
  3. Grant access to the right path or folder
  4. Set the installation path
  5. Get support for Docker, Linux, and more

How to Tutorial

Method 1: Install IronPDF via NuGet

Use the next few steps to install the IronPDF NuGet library from within Visual Studio.

  1. In Solution Explorer, right-click on References then select 'Manage NuGet Packages'
  2. Select 'Browse' and search for IronPdf
  3. Select the package and install.

There are also IronPDF NuGet Packages available for specific deployments such as Mac, Linux, Azure, Docker and AWS documented in our IronPDF advanced NuGet installation guide.

Method 2: Install IronPDF by DLL Download

The second way to install IronPDF is by downloading it. Follow these quick and easy steps:

  • Download and unzip the correct ZIP file for your operating system to a location such as ~/Libs within your Solution directory

  • In Visual Studio Solution Explorer, right-click on 'Dependencies' and 'Add Project Reference'. Select 'Browse' and include all the DLLs extracted from the zip.

Apply License Key

Include this code at the startup of your application, before using IronPDF. This approach is universally effective and easy to implement.

IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY"
$vbLabelText   $csharpLabel

If you prefer not to apply the license key using inline code, please visit the 'IronPDF License Keys' article to explore alternative methods.

2. Grant Necessary Access to File or Folder

It may sometimes be necessary to add permissions to certain users or roles on your PC.

For instance, each AppDomain requires its own TempFolderPath and applications in the same AppPool cannot share a TempFolderPath.

An AppDomain provides a layer of isolation within a certain process. Each application pool requires its own temporary folder to function fully independently.

To set permissions:

  1. Right-click on a file or folder
  2. Select 'Properties'
  3. Select 'Security'
  4. Click 'Edit...'
  5. Select the desired permissions.

3. Set Installation Path

To render HTML as a PDF, IronPDF must embed Chromium. This process is entirely automated.

If IronPDF's HTML to PDF throws a "failed rendering" exception, unpack the native browser binaries to an appropriate location. The Temp folder is ideal.

Note: 'Program Files' is never an appropriate location.

Setting IronPdf.Installation.TempFolderPath

Set the TempFolderPath property of the IronPdf.Installation object:

IronPdf.Installation.TempFolderPath = @"C:\My\Safe\Path";
IronPdf.Installation.TempFolderPath = @"C:\My\Safe\Path";
IronPdf.Installation.TempFolderPath = "C:\My\Safe\Path"
$vbLabelText   $csharpLabel

Always clear all temp and cache folders on your development and servers, then redeploy a CLEAN version of your application after updating a path.

Setting The Temp Folder Environment Variable at Application Scope

IronPDF may generate temporary files while rendering and editing PDF documents into a system temp folder. To control the location of these files, set the TempPath environmental variable application-wide during startup.

using IronPdf;

// Set Application scope Temp Files Path
// Adjusts System.IO.Path.GetTempFileName and System.IO.Path.GetTempPath behavior for the application
var MyTempPath = @"C:\Safe\Path\";
Environment.SetEnvironmentVariable("TEMP", MyTempPath, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("TMP", MyTempPath, EnvironmentVariableTarget.Process);

// Set IronPDF Temp Path
IronPdf.Installation.TempFolderPath = System.IO.Path.Combine(MyTempPath, "IronPdf");

// Your PDF Generation and editing code
var Renderer = new IronPdf.ChromePdfRenderer();
using var Doc = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
Doc.SaveAs("example.pdf");
using IronPdf;

// Set Application scope Temp Files Path
// Adjusts System.IO.Path.GetTempFileName and System.IO.Path.GetTempPath behavior for the application
var MyTempPath = @"C:\Safe\Path\";
Environment.SetEnvironmentVariable("TEMP", MyTempPath, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("TMP", MyTempPath, EnvironmentVariableTarget.Process);

// Set IronPDF Temp Path
IronPdf.Installation.TempFolderPath = System.IO.Path.Combine(MyTempPath, "IronPdf");

// Your PDF Generation and editing code
var Renderer = new IronPdf.ChromePdfRenderer();
using var Doc = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
Doc.SaveAs("example.pdf");
Imports IronPdf

' Set Application scope Temp Files Path
' Adjusts System.IO.Path.GetTempFileName and System.IO.Path.GetTempPath behavior for the application
Private MyTempPath = "C:\Safe\Path\"
Environment.SetEnvironmentVariable("TEMP", MyTempPath, EnvironmentVariableTarget.Process)
Environment.SetEnvironmentVariable("TMP", MyTempPath, EnvironmentVariableTarget.Process)

' Set IronPDF Temp Path
IronPdf.Installation.TempFolderPath = System.IO.Path.Combine(MyTempPath, "IronPdf")

' Your PDF Generation and editing code
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim Doc = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
Doc.SaveAs("example.pdf")
$vbLabelText   $csharpLabel

4. Permissions and IIS

On a locked down server, give the IIS user (IUSER) read and write permissions to your installation path folder, as well as to your Windows and Temp Folder.

5. Microsoft Visual C++ and Windows Compatibility

IronPDF requires Microsoft Visual C++ on the target Windows machine. It can be included with an application installer such as an MSI.

The .NET Framework can run as 32-bit (even on 64-bit platforms), so it is necessary to install Visual C++ in both 32 and 64-bit versions.

You can download Microsoft Visual C++.

6. Linux Compatibility

7. Docker Compatibility

8. Azure Compatibility

9. Amazon AWS Lambda Compatibility

10. macOS Compatibility