IRONSOFTWAREHOME
IronPDF

Create PDF Files in C#

  1. Create PDFs from HTML in C#
  2. Use in .NET Core, Standard or Framework Apps
  3. Also supports ASPX, PDF Parsing, PDF Printing

Or download the DLL directly here

using IronPdf;

var renderer = new ChromePdfRenderer();

var pdfFromUrl = renderer.RenderUrlAsPdf("https://ironpdf.com/");
pdfFromUrl.SaveAs("website.pdf");

var pdfFromHtmlFile = renderer.RenderHtmlFileAsPdf("design.html");
pdfFromHtmlFile.SaveAs("markup.pdf");

var pdfFromHtmlString = renderer.RenderHtmlAsPdf("<p>Hello World</p>", "C:/assets/");
pdfFromHtmlString.SaveAs("markup_with_assets.pdf");
NuGet Downloads Badge
PM >Install-Package IronPdf
Explore the code and run it to see the sample PDFs

Generating PDF Documents in C# .NET

Did you know that creating a PDF with C# is as simple as using a NuGet package?

C#, pronounced as "C#," is a popular programming language that people use for many things. PDF creation is often done with C# because it's versatile and gives developers a lot of control over the final result.

Whether you're a seasoned C# developer or an entrepreneur that needs to create a document for a business, you can create a PDF with C# without having to learn the language.

Here at Iron Software, we provide our users with a plethora of tools to simplify various processes. To save you time, we'll outline how you can create a PDF with C# as quickly as possible.

Keep on reading to learn how to create a PDF with C#.

Download IronPDF

When it comes to creating a PDF, you can take several approaches. One of the simplest ways to create a PDF is to download our software, IronPDF, which can be used for many things.

What makes IronPDF beneficial to those that don't know how to create a PDF is its simplicity. Within the program, you can create and edit PDFs from scratch. Not only can you use C# to create them, but you can also convert HTML, URL, ASPX, and images to PDFs.

Explore Its Many Features

Shortly after downloading IronPDF, you should explore its features to learn more about how to use it. Getting a better understanding of how the program works will make it easier to create a PDF with C#.

One feature that makes IronPDF stand out from other programs is its PDF content extraction tool. After creating a PDF, you can extract the text and images to place them elsewhere. This can also be used on imported PDFs if you're looking to create a new PDF with existing data.

When using C#, you won't have a problem getting accurate headers and footers in your PDFs. You'll have full control over text sizes, images, titles, and more.

Check out our code examples to see how versatile IronPDF is with PDF creation.

Use Our C# Code to Create a PDF

Instead of having to learn C#, we provide our users with a simple C# code they can use to quickly create PDFs. Using our code will prevent you from having to come up with everything yourself.

Example C# Code to Create a PDF

// Import the IronPdf namespace to access PDF functionalities
using IronPdf;

public class PdfCreator
{
    public static void Main()
    {
        // Create a Render object from IronPdf
        var renderer = new HtmlToPdf();

        // Convert an HTML string to a PDF document
        var htmlContent = "<h1>Hello, IronPDF!</h1><p>This is a PDF document generated from HTML content.</p>";
        var pdfDocument = renderer.RenderHtmlAsPdf(htmlContent);

        // Save the generated PDF to a file
        pdfDocument.SaveAs("output.pdf");

        // Output a confirmation to the console
        Console.WriteLine("PDF generated successfully!");
    }
}
  • This code demonstrates how to generate a PDF from HTML content using IronPDF in C#.
  • It creates a new instance of the HtmlToPdf class to render a PDF.
  • The HTML content given as a string is converted into a PDF document.
  • The resulting PDF is saved to a file named output.pdf.
  • Finally, a message is displayed to confirm the successful creation of the PDF.

After downloading IronPDF, you can insert any code you'd like and test run it. You'll then see how your PDF will look after finalizing the code.

Whenever you have a problem creating a PDF with C#, you can reach out to our support team. We can answer any questions you have about IronPDF and coding.

Start Using IronPDF Today

Now that you know about IronPDF, all you need to do is start using it. No matter what kind of PDF you'd like to create, IronPDF has all the most important tools to help you get the job done with C#.

Before you get involved with PDF creation, ensure that you browse our existing codes to find one that can be used for your project. This will make the entire process simpler when you create a PDF with C#.

IronPDF is a developer's dream come true, with over 2 million engineers worldwide trusting it. Our C# PDF maker is free to download and use.

Contact us to learn more about IronPDF and our other solutions!

Aetna logo
NASA logo
WWF logo
United States of America, Department of State seal
Tesla logo
3M logo
gsk logo
Hertz logo
Pizza Hut logo
Qualcom logo
ge logo
Porsche logo

[Try it with NuGet]

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999