A Comparison between IronPDF and PDFNet

1. Introduction

Looking for the perfect PDF tools for the .NET Framework?

In this article, we will take a look at how to work with PDF files in C# (one of the most popular programming languages). We will discuss two industry-leading PDF tools for C# on the .NET Framework, using code samples to compare them based on their performance and features. In the end, we will examine their licensing details and learn how to obtain license keys.

The two PDF libraries are:

  • PDFNet
  • IronPDF

2. IronPDF

IronPDF is a C# .NET library developed by Iron Software to solve all PDF problems for C# .NET developers using a single library. IronPDF is powered by a chromium engine and has a variety of helpful and powerful capabilities such as the conversion of HTML5, JavaScript, CSS, and image files to PDF, creating custom headers and footers, and displaying PDFs precisely as they appear in a browser. IronPDF allows you to read data from PDF files and insert it into your .NET applications and data storage systems automatically. You can import, move, and index content from old PDF document storage into your document management and business applications.

2.1. IronPDF Features

2.1.1. PDF Conversions

This functionality allows you to generate PDF files from various formats such as HTML, MVC views, Web Forms, HTML Strings, and URLs.

2.1.2. Extraction of PDF Content

In many circumstances, you can easily extract embedded text from PDFs. However, if that fails, your text is most likely embedded in an image. To scan documents for visual text, rather than plain text, use the IronOCR library.

2.1.3 Headers and footers

Headers and footers can be added while creating a PDF or to existing PDFs. Using the Print Options property, you may create a header and footer for each document page. These parameters are available on the ChromePdfRenderer object. This example runs within a .NET Core console app.

2.1.4. PDF Image Processing

This enables users to generate photos from PDFs as well as PDFs from photographs. It supports image extraction, various image extensions, and PDF printing.

2.1.5. PDF Documents IO

IronPDF also includes 128-bit PDF encryption, password-protected PDF locking, and the digital signing of PDFs.

2.1.6. PDF Editing

IronPDF tool allows you to add watermarks, add pages, remove pages, backgrounds, foregrounds, and much more to your PDFs.

2.1.7. Compatibility

IronPDF supports almost all operating systems and frameworks compatible with C#, such as:

  • Windows
  • .NET Core 2.1, 3.0, 3.1, .NET 6 & 5
  • .NET Standard 2.0 Compliance for Universal Compatibility
  • Azure
  • AWS
  • Docker
  • Linux

3. PDFNet

PDFNet .NET SDK by PDFTron brings precise PDF processing, annotation, editing, and creation to any framework or application on the web, mobile, desktop, or server. It manages the entire document and information management process with your infrastructure and eliminates the need for third-party server dependencies. PDFTron's web platform comes with a JS version with the supported platform and a demo license key for all the PDF SDKs.

One of the most significant benefits of PDFNet is that it is genuinely cross-platform, allowing our users to simply add PDF compatibility and relevant business functionality to their workflows and apps across many distinct mobile and desktop contexts, all while using virtually the same interface.

3.1. PDFNet SDK features

3.1.1. Compatibility

The PDFNet SDK is compatible with many platforms and frameworks. To ensure platform consistency, the JavaScript API is utilized in the same way as the PDFNet API. Node.js and Electron versions of the SDK are also available. This package requires unmanaged add-on binaries.

3.1.2. Editing and viewing

Brings safe, scalable, and high-fidelity reading and editing abilities for PDFs to users across online, mobile, and desktop platforms.

3.1.3. Signing

Create customized signing procedures. Digitally signed papers can be certified, validated, and sealed.

3.1.4. True Redaction

Remove sensitive data from documents, such as personal information or personal health information, while leaving the document searchable.

3.1.5. Manipulation of the Page

Pages can be added, removed, or rearranged. Documents may be assembled, merged, or divided into parts. View several documents simultaneously in the same reader or beside each other.

4. Creating a New Project in Visual Studio

In this article, we are going to use a console application to generate PDF documents.

Open the Visual Studio software and go to the File menu. Select "new project" and then select console application.

Enter the project name and select the path in the appropriate text box. Then, click the create button. Select the required .NET framework, as in the screenshot below:

A Comparison Between IronPDF and PDFNet, Figure 1

The Visual Studio project will now generate the structure for the console application. Once finished, it will open the program.cs file, in which you can write and execute source code.

A Comparison Between IronPDF and PDFNet, Figure 2

Now we can add the library and test the program.

5. Install the IronPDF Library

The IronPDF library can be downloaded and installed in four different ways. These are:

  • Using the Visual Studio NuGet Package Manager
  • Using the Visual Studio Command Line.
  • Direct Download from the NuGet Webpage.
  • Direct Download from the IronPDF webpage.

5.1 Using the Visual Studio NuGet Package Manager

The Visual Studio software provides the NuGet Package Manager option to install the package directly to the solution. The below screenshot shows how to open the NuGet Package Manager.

A Comparison Between IronPDF and PDFNet, Figure 3

With the Package Manager GUI open, click on the Browse tab and search for "IronPDF:"

A Comparison Between IronPDF and PDFNet, Figure 4

In the above image, we can see the list of related packages from the search. Select the IronPDF option and install the package to our solution.

5.2 Using the Visual Studio Command-Line

  • In the Visual Studio menu, Go to Tools > NuGet Package manager > Package manager console
A Comparison Between IronPDF and PDFNet, Figure 5

  • Enter the following line in the package manager console tab:
```shell
:ProductInstall

The IronPDF package will now be installed in the project.

<div class="content-img-align-center">
    <div class="center-image-wrapper">
         <img src="/static-assets/pdf/blog/pdfnet-alternatives/pdfnet-alternatives-6.webp" alt="A Comparison Between IronPDF and PDFNet, Figure 6" class="img-responsive add-shadow">
         <p></p>
    </div>
</div>

### 5.3 Direct Download from the NuGet Webpage

The third way is to download the NuGet package directly from the webpage.

- Navigate to the <a href="https://www.nuget.org/packages/IronPdf/" target="_blank" rel="nofollow noopener noreferrer">IronPDF</a> NuGet Gallary page"
- Select the download package option from the menu on the right-hand side.
- Double-click the downloaded package; it will be installed automatically.
- Next, reload the solution and begin using it in the project.

### 5.4 Direct Download from the IronPDF Webpage

Click [here](https://ironpdf.com/packages/IronPdf.zip) to download the latest package directly from the webpage. After the download, follow the steps below to add the package to the project.

- Right-click the project from the solution window.
- Then, select the options reference and browse the location of the downloaded reference.
- Next, click OK to add the reference.

## 6. Install the PDFNet SDK

The PDFNet SDK can be downloaded and installed in four different ways.

- Using the Visual Studio NuGet Package Manager.
- Using the Visual Studio Command Line.
- Direct Download from the NuGet Webpage.
- Using PDFNetLoader.dll

### 6.1. Using the Visual Studio NuGet Package Manager

As explained above, go to tools in Visual Studio and open the NuGet package manager. A list will appear --- click on manage NuGet package for solutions.

<div class="content-img-align-center">
    <div class="center-image-wrapper">
         <img src="/static-assets/pdf/blog/pdfnet-alternatives/pdfnet-alternatives-7.webp" alt="A Comparison Between IronPDF and PDFNet, Figure 7" class="img-responsive add-shadow">
         <p></p>
    </div>
</div>

A window will appear with a search bar. Search for PDFNet and install it in the project.

### 6.2. Using the Visual Studio Command Line

- In the Visual Studio menu, Go to **Tools > NuGet Package manager > Package manager console**
- Enter the following line in the package manager console tab:

```console
Install-Package PDFNet ---Version 9.2.0
A Comparison Between IronPDF and PDFNet, Figure 8

6.3. Direct Download from the NuGet Webpage

The third way is to download the NuGet package directly from the webpage.

  • Navigate to the PDFNet NuGet Package web page.
  • Choose the download package choice from the right-hand menu.
  • Double-click the downloaded package to start the installation process.

6.4. Using PDFNetLoader.dll

You can also install the PDFNet API using the PDFNetLoader.dll file. Download it from GitHub.

Download the package, place it in the bin file of the project, and run it. In your Visual Studio project, add PDFNetLoader.dll as a reference.

7. Printing a PDF file (code samples)

Printing a PDF file is a must-have feature for modern applications that deal with PDFs. Here, we will discuss how to print PDF files using both tools.

7.1. Printing a PDF file using IronPDF

IronPDF prints a PDF by sending it to the computer's default printer. This will open the Windows print interface --- just click print to make it happen.

using IronPdf;

// Create a new PDF and print it
var Renderer = new IronPdf.ChromePdfRenderer();
PdfDocument Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Send the PDF to the default printer to print
Pdf.Print(300, false);
using IronPdf;

// Create a new PDF and print it
var Renderer = new IronPdf.ChromePdfRenderer();
PdfDocument Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");

// Send the PDF to the default printer to print
Pdf.Print(300, false);
Imports IronPdf

' Create a new PDF and print it
Private Renderer = New IronPdf.ChromePdfRenderer()
Private Pdf As PdfDocument = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")

' Send the PDF to the default printer to print
Pdf.Print(300, False)
VB   C#

7.2. Printing a PDF file Using PDFNet

PDFTron's PDFNet SDK also provides a printing feature. Below is the source code snippet for printing a PDF file in PDFNet.

using System;
using System. Drawing;
using System.Drawing.Printing;

using pdftron;
using pdftron.PDF;
using pdftron.Common;
using pdftron.Filters;

namespace PDFPrintTestCS
{
    Console.WriteLine("Opening the input file...");
    using (pdfdoc = new PDFDoc(input_path + "tiger.pdf"))
    {
        pdfdoc.InitSecurityHandler();
        Console.WriteLine("Printing the input file using PDF.Print.StartPrintJob...");
        PrinterMode printerMode = new PrinterMode();
        printerMode.SetAutoCenter(true);
        printerMode.SetAutoRotate(true);
        printerMode.SetCollation(true);
        printerMode.SetCopyCount(1);
        printerMode.SetDPI(300); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
        printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto);
        printerMode.SetNUp(PrinterMode.NUp.e_NUp_1_1, PrinterMode.NUpPageOrder.e_PageOrder_LeftToRightThenTopToBottom);
        printerMode.SetOrientation(PrinterMode.Orientation.e_Orientation_Portrait);
        printerMode.SetOutputAnnot(PrinterMode.PrintContentTypes.e_PrintContent_DocumentAndAnnotations);
        printerMode.SetOutputColor(PrinterMode.OutputColor.e_OutputColor_Grayscale);
        printerMode.SetOutputPageBorder(false);
        printerMode.SetOutputQuality(PrinterMode.OutputQuality.e_OutputQuality_Medium);
        printerMode.SetPaperSize(new Rect(0, 0, 612, 792));
        PageSet pagesToPrint = new PageSet(1, pdfdoc.GetPageCount(), PageSet.Filter.e_all);
        Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", pagesToPrint, printerMode, null);
    }
}
using System;
using System. Drawing;
using System.Drawing.Printing;

using pdftron;
using pdftron.PDF;
using pdftron.Common;
using pdftron.Filters;

namespace PDFPrintTestCS
{
    Console.WriteLine("Opening the input file...");
    using (pdfdoc = new PDFDoc(input_path + "tiger.pdf"))
    {
        pdfdoc.InitSecurityHandler();
        Console.WriteLine("Printing the input file using PDF.Print.StartPrintJob...");
        PrinterMode printerMode = new PrinterMode();
        printerMode.SetAutoCenter(true);
        printerMode.SetAutoRotate(true);
        printerMode.SetCollation(true);
        printerMode.SetCopyCount(1);
        printerMode.SetDPI(300); // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
        printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto);
        printerMode.SetNUp(PrinterMode.NUp.e_NUp_1_1, PrinterMode.NUpPageOrder.e_PageOrder_LeftToRightThenTopToBottom);
        printerMode.SetOrientation(PrinterMode.Orientation.e_Orientation_Portrait);
        printerMode.SetOutputAnnot(PrinterMode.PrintContentTypes.e_PrintContent_DocumentAndAnnotations);
        printerMode.SetOutputColor(PrinterMode.OutputColor.e_OutputColor_Grayscale);
        printerMode.SetOutputPageBorder(false);
        printerMode.SetOutputQuality(PrinterMode.OutputQuality.e_OutputQuality_Medium);
        printerMode.SetPaperSize(new Rect(0, 0, 612, 792));
        PageSet pagesToPrint = new PageSet(1, pdfdoc.GetPageCount(), PageSet.Filter.e_all);
        Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", pagesToPrint, printerMode, null);
    }
}
Imports System
Imports System.Drawing
Imports System.Drawing.Printing

Imports pdftron
Imports pdftron.PDF
Imports pdftron.Common
Imports pdftron.Filters

Namespace PDFPrintTestCS
	Console.WriteLine("Opening the input file...")
	pdfdoc = New PDFDoc(input_path & "tiger.pdf")
	Using pdfdoc
		pdfdoc.InitSecurityHandler()
		Console.WriteLine("Printing the input file using PDF.Print.StartPrintJob...")
		Dim printerMode As New PrinterMode()
		printerMode.SetAutoCenter(True)
		printerMode.SetAutoRotate(True)
		printerMode.SetCollation(True)
		printerMode.SetCopyCount(1)
		printerMode.SetDPI(300) ' regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
		printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto)
		printerMode.SetNUp(PrinterMode.NUp.e_NUp_1_1, PrinterMode.NUpPageOrder.e_PageOrder_LeftToRightThenTopToBottom)
		printerMode.SetOrientation(PrinterMode.Orientation.e_Orientation_Portrait)
		printerMode.SetOutputAnnot(PrinterMode.PrintContentTypes.e_PrintContent_DocumentAndAnnotations)
		printerMode.SetOutputColor(PrinterMode.OutputColor.e_OutputColor_Grayscale)
		printerMode.SetOutputPageBorder(False)
		printerMode.SetOutputQuality(PrinterMode.OutputQuality.e_OutputQuality_Medium)
		printerMode.SetPaperSize(New Rect(0, 0, 612, 792))
		Dim pagesToPrint As New PageSet(1, pdfdoc.GetPageCount(), PageSet.Filter.e_all)
		Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", pagesToPrint, printerMode, Nothing)
	End Using
End Namespace
VB   C#

8. Make PDFs From HTML

Both libraries possess HTML to PDF conversion capabilities, but the methods are slightly different.

8.1. Make PDFs from HTML using IronPDF

IronPDF does not require the use of JSON or encryption mechanisms. IronPDF supports a wide range of methods. For example:

HTML files to PDF

using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");
Imports IronPdf
Private Renderer = New IronPdf.ChromePdfRenderer()
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf")
VB   C#

URL to PDF

using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
Imports IronPdf
Private Renderer As New IronPdf.ChromePdfRenderer()
Private Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
Pdf.SaveAs("url.pdf")
VB   C#
A Comparison Between IronPDF and PDFNet, Figure 9

8.2. Make PDFs from HTML using PDFNet

PDFNet also provides HTML-to-PDF conversion features using both page conversion and URL conversion. Due to the lengthy code, we will only give you one example here.

class HTML2PDFSample
{
    private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance();
    static HTML2PDFSample() {}

    static void Main(string[] args)
    {
        string output_path = "../../../../TestFiles/Output/html2pdf_example";
        string host = "https://www.pdftron.com";
        string page0 = "/";
        string page1 = "/support";
        string page2 = "/blog";
        HTML2PDF.SetModulePath("../../../../../Lib");

        if (!HTML2PDF.IsModuleAvailable())
        {
            Console.WriteLine();
            Console.WriteLine("Unable to run HTML2PDFTest: PDFTron SDK HTML2PDF module not available.");
            Console.WriteLine("-------------------------------");
            Console.WriteLine("The HTML2PDF module is an optional add-on, available for download");
            Console.WriteLine("at http://www.pdftron.com/. If you have already downloaded this");
            Console.WriteLine("module, ensure that the SDK is able to find the required files");
            Console.WriteLine("using the HTML2PDF.SetModulePath() function.");
            Console.WriteLine();
            return;
        }
        try
        {
            using (PDFDoc doc = new PDFDoc())
            {
                if ( HTML2PDF.Convert(doc, host + page0) )
                    doc.Save(output_path + "_01.pdf", SDFDoc.SaveOptions.e_linearized);
                else
                    Console.WriteLine("Conversion failed.");
            }
        }
        catch (PDFNetException e)
        {
            Console.WriteLine(e.Message);
        }
    }
}
class HTML2PDFSample
{
    private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance();
    static HTML2PDFSample() {}

    static void Main(string[] args)
    {
        string output_path = "../../../../TestFiles/Output/html2pdf_example";
        string host = "https://www.pdftron.com";
        string page0 = "/";
        string page1 = "/support";
        string page2 = "/blog";
        HTML2PDF.SetModulePath("../../../../../Lib");

        if (!HTML2PDF.IsModuleAvailable())
        {
            Console.WriteLine();
            Console.WriteLine("Unable to run HTML2PDFTest: PDFTron SDK HTML2PDF module not available.");
            Console.WriteLine("-------------------------------");
            Console.WriteLine("The HTML2PDF module is an optional add-on, available for download");
            Console.WriteLine("at http://www.pdftron.com/. If you have already downloaded this");
            Console.WriteLine("module, ensure that the SDK is able to find the required files");
            Console.WriteLine("using the HTML2PDF.SetModulePath() function.");
            Console.WriteLine();
            return;
        }
        try
        {
            using (PDFDoc doc = new PDFDoc())
            {
                if ( HTML2PDF.Convert(doc, host + page0) )
                    doc.Save(output_path + "_01.pdf", SDFDoc.SaveOptions.e_linearized);
                else
                    Console.WriteLine("Conversion failed.");
            }
        }
        catch (PDFNetException e)
        {
            Console.WriteLine(e.Message);
        }
    }
}
Friend Class HTML2PDFSample
	Private Shared pdfNetLoader As pdftron.PDFNetLoader = pdftron.PDFNetLoader.Instance()
	Shared Sub New()
	End Sub

	Shared Sub Main(ByVal args() As String)
		Dim output_path As String = "../../../../TestFiles/Output/html2pdf_example"
		Dim host As String = "https://www.pdftron.com"
		Dim page0 As String = "/"
		Dim page1 As String = "/support"
		Dim page2 As String = "/blog"
		HTML2PDF.SetModulePath("../../../../../Lib")

		If Not HTML2PDF.IsModuleAvailable() Then
			Console.WriteLine()
			Console.WriteLine("Unable to run HTML2PDFTest: PDFTron SDK HTML2PDF module not available.")
			Console.WriteLine("-------------------------------")
			Console.WriteLine("The HTML2PDF module is an optional add-on, available for download")
			Console.WriteLine("at http://www.pdftron.com/. If you have already downloaded this")
			Console.WriteLine("module, ensure that the SDK is able to find the required files")
			Console.WriteLine("using the HTML2PDF.SetModulePath() function.")
			Console.WriteLine()
			Return
		End If
		Try
			Using doc As New PDFDoc()
				If HTML2PDF.Convert(doc, host & page0) Then
					doc.Save(output_path & "_01.pdf", SDFDoc.SaveOptions.e_linearized)
				Else
					Console.WriteLine("Conversion failed.")
				End If
			End Using
		Catch e As PDFNetException
			Console.WriteLine(e.Message)
		End Try
	End Sub
End Class
VB   C#
A Comparison Between IronPDF and PDFNet, Figure 10

9. Licensing

IronPDF is a library that offers a free developer license. IronPDF also offers a special price structure: the light package begins at $749 with no hidden costs. It is also possible to redistribute SaaS and OEM products. All licenses include a 30-day money-back guarantee, a year of software support and upgrades, development/testing/staging/production validity, and a perpetual license (one-time purchase). IronPDF licenses provide maximal performance for users' needs. Go to this link to see IronPDF's whole pricing structure and license.

A Comparison Between IronPDF and PDFNet, Figure 9

The PDFTron PDFNet SDK comes with several license choices that are tailored to your business needs. Three types of licenses come with enterprise and OEM redistributions. Enterprise licenses are only for organization use and can not be used in app distribution. Additional APIs requiring filesystem access is also included with the licenses. All licenses come with a license key. The three types of licenses are

  • Viewer
  • Viewer & Annotation
  • Core SDK

For further information on their license structures, visit this link.

10. Conclusion

IronPDF offers a lot of features and functionality for processing PDF files and converting them to different formats. Conversions from HTML to PDF are produced in a vector format that is appropriate for high-quality commercial printing. As a result, you'll receive a clear, high-quality PDF. License and pricing information can be found on the website.

Similar to IronPDF, PDFNet aids with the transition, annotation, signature, filling, conversion, and editing of PDF files. It supports multiple platforms, including Windows, IOS, Android, WEB, and Linux. For production use, PDFNet SDKs need a product key.

IronPDF's licenses are developer-centric, meaning that you have to get a license based on how many developers are going to use the product. On the other hand, PDFNet licenses don't work in the same manner, operating instead on a feature-based license. This means that you have to get the license that supports the features that are required. IronPDF licenses include all features out of the box. With PDFNet, some features, such as document conversion, need to be bought as add-ons.

The IronPDF library offers features in an organized manner, making it easy to write code that performs big tasks using a few lines of code. Iron Software is currently offering a five-tool package for the price of just two. The tools included in the IronSuite are:

Please visit this link to explore the IronSuite