A Comparison between IronPDF and GemBox.Pdf

To create, read, write and convert PDF files from different formats has always been a challenging task for developers. With the completion of numerous libraries, these issues have now been solved. Moreover, the easy integration of such libraries makes them even more popular and easy to use in C# applications.

This article will compare two of the most popular PDF libraries for .NET and .NET Core developers. These two libraries are:

  • IronPDF
  • GemBox

IronPDF and GemBox are both libraries that provide methods to create, manipulate and print PDFs in .NET and .NET Core. The next question is to decide which C# PDF Library is best suited for your .NET project. You can weigh up your decision as you read the following comparison between the two libraries and their respective standout features for converting and manipulating PDFs.

Let's look firstly at what both libraries have to offer, and then move on to the comparison itself.

The IronPDF Library

The IronPDF .NET PDF Library solution is a dream for developers, especially software engineers who use C#. You can easily create a core PDF library for .NET with this excellent tool.

IronPDF uses a .NET Chromium engine to render HTML pages to PDF files. With HTML to PDF there is no need to use complex APIs to position or design PDFs. IronPDF supports standard web documents: HTML, ASPX, JS, CSS, and images.

It also enables you to create a .NET PDF library using HTML5, CSS, JavaScript, and images. You can effortlessly edit, stamp, and add headers and footers to a PDF. Further, it makes it very easy to read PDF text and extract images.

Stand-out features of the IronPDF library include:

Create PDFs (HTML to PDF)

  • Create PDF documents from HTML 4 and 5, CSS, and JavaScript
  • Generate PDF documents from URL
  • Load URLs with custom-network login credentials, user-agents, proxies, cookies, HTTP headers, and form variables allowing login behind HTML login forms

Edit Existing PDF Documents Without Adobe Acrobat

  • Read and fill PDF form-field data
  • Extract images and texts from PDFs
  • Stamp new HTML Content onto any existing page
  • Add logical or HTML headers and footers
  • Digitally Sign

Manipulate Existing PDF Documents

  • Load and parse existing documents
  • Merge and split content in documents
  • Add headers, footers, annotations, bookmarks, watermarks, text, and assets

Convert from Multiple Formats

  • ASPX WebForms — convert, with 3 lines of code, ASP.NET webforms to downloadable PDFs viewable in the browser
  • HTML Document — convert HTML to PDF
  • Custom ‘base URL’ to allow accessible asset files across the web
  • Responsive layouts through Virtual Viewport (width and height)
  • Accept HTML encoded in any major file encoding (Default to UTF-8)

Save and Print

  • Save and load from file, binary data, or MemoryStreams
  • Screen or Print CSS media types
  • Turn PDF files into a PrintDocument object and print without Adobe (with minimal code)
  • Export official log files with details about API success and debug errors in source code

Note: Now you can purchase Iron Suite for .NET (IronPDF, IronOCR, IronXL, IronBarcode, IronWebscraper). These five licenses for the price of just two ensure that this product stands out among its competitors.

You can download the software product from this link.

GemBox.Pdf Library

GemBox offers fast and easy–to–use .NET components for developers, with a strong focus on file formats and well–documented APIs. The GemBox Bundle is a package of .NET components that enable you to process PDF files, spreadsheet files, documents, presentations, and emails simply and efficiently in .NET applications.

For working with PDF files, GemBox provides the GemBox.Pdf library. With GemBox.Pdf, developers can read, write, merge, split and perform other low-level operations on PDFs efficiently. GemBox.Pdf doesn’t require Adobe Acrobat, so you can deploy your application easily without having to think about other licenses.

Standout features of GemBox.Pdf include:

  • View PDF files in WPF applications
  • Print, merge, split PDF files
  • Create, fill in, flatten, read, and export PDF interactive forms
  • Extract a Unicode representation of a PDF page and individual text elements with their bounds and font
  • Extract images from PDF files
  • Extract text from images or scanned PDF files with optical character recognition (OCR)
  • Encrypt and digitally sign PDF files
  • Get and set document properties
  • Add watermarks, headers and footers to PDF pages
  • Get, create, remove or reorder pages
  • Add text, images, shapes (paths), form XObjects, content groups, and marked content to pages and format (fill, stroke, and clip) the content
  • Annotate PDF pages with hyperlinks
  • Medium trust support
  • Use private fonts to bypass medium trust environment restrictions

GemBox.Pdf works with .NET Framework 3.5+, .NET Core 3.1+, and .NET Standard 2.0.

Note: GemBox.Pdf can only convert images to PDFs. Use GemBox.Spreadsheet to convert Microsoft Excel spreadsheet files(csv, xls, xlsx) to PDF; for converting Word and HTML documents to PDFs, use Gembox.Document; and use Gembox.Presentation for converting PowerPoint presentations to PDF files.

Overview

The rest of this article will look at the following topics:

  1. Creating a Project
  2. IronPDF C# Library Installation
  3. GemBox Installation
  4. Create a PDF from an Existing URL or HTML Input String
  5. Convert ASPX Pages to PDF
  6. Convert Images to PDF
  7. Licensing
  8. Summary and Conclusion

1. Creating an ASP.NET Project

Use the following steps to create an ASP.NET website:

  • Open Visual Studio
  • Click on File from the menu and then click on "New Project" to create a new project
  • Select Web under Visual C# in the project type list box
  • Select ASP.NET Web Application (.NET) and click OK as shown in the below screenshot

Figure 1New Project Dialog Box

  • From the next screen, choose "Web Forms" as shown in the screenshot below.

Figure 2Web Forms

  • Once selected, click OK.

Now the project is created, and we are almost ready to test the libraries. However, we still need to install them into our project. Let's install IronPDF first.

2. IronPDF C# Library Installation

There are four ways to download and install the IronPDF library. These are as follows:

  1. Using Visual Studio
  2. The Developer Command Prompt
  3. Download the NuGet Package directly
  4. Download the IronPDF .DLL Library

Let’s take a closer look at each one.

2.1. Using Visual Studio

Visual Studio provides the NuGet Package Manager for installing NuGet packages in your projects. You can access it through the Project Menu, or by right-clicking your project in the Solution Explorer.

Figure 3Solution Explorer

Figure 4Project Menu > Manage NuGet Packages

Once selected, browse for the IronPDF package and install it, as shown in the screenshot below.

Figure 5Install IronPDF from NuGet Package

2.2. Using the Developer Command Prompt

Another way to download and install the IronPDF C# Library is to make use of the following steps to install the IronPDF NuGet package through the Developer Command Prompt.

  • Open the Developer Command Prompt — usually found in the Visual Studio folder.

Type the following command: PM > Install-Package IronPDF

  • Press Enter
  • This will download and install the package
  • Reload your Visual Studio project and begin using it

2.3. Download the NuGet Package Directly

The third way to download and install IronPDF is to follow the steps below. This can be done by visiting the NuGet site directly and downloading the package. The steps are:

  • Navigate to the IronPDF NuGet Gallery Page.
  • Select "Download Package"
  • Double-click the downloaded package
  • The package will be installed
  • Reload your Visual Studio project and begin using it

2.4. Install IronPDF by Downloading the Library

You can directly download the IronPDF .DLL file directly from the website. It can be directly downloaded from the IronPDF website.

Figure 6Download IronPDF Library

Follow the steps below to include the DLL as a reference in your project:

  • Right-click the Solution in the Solution Explorer
  • Select "References"
  • Browse for the IronPDF.dll library
  • Click OK

All done! IronPDF is downloaded, installed and ready to use.

3. GemBox.Pdf Installation

You can install the GemBox.Pdf library by either:

  1. Using the NuGet Package Manager
  2. Including its DLL as a project reference
  3. Using the GemBox.Pdf Installer

3.1. Using the NuGet Package Manager

Most .NET developers choose to start with the NuGet package, and then often revert to using its free trial.

From the NuGet Package Manager Console, enter the following command:

Install-Package GemBox.Pdf

Alternatively, you can add GemBox.Pdf from the NuGet Package Manager GUI within Visual Studio.

3.3. Adding the GemBox.Pdf DLL as a Project Reference

  1. Download the GemBox.Pdf.dll from the offical Downloads page page.
  2. Right click the project within the Visual Studio Solution Explorer and selecting Add Project Reference.
  3. Click the Browse button within the window that opens and navigate to the location of the DLL that you downloaded in step 1 and select it.
  4. Click OK to add the DLL to the project

3.4. Using the GemBox.Pdf Installer

Download and install the GemBox.Pdf Setup installer from the GemBox.Pdf Free Version installation page.

Using GemBox.Pdf

Before you can start using GemBox.Pdf in your projects, you must first include the GemBox.Pdf namespace in your project source files:

using GemBox.Pdf;
using GemBox.Pdf;
Imports GemBox.Pdf
VB   C#

Additionally, you must configure the GemBox.Pdf component with a valid license key. We will be using the Free version of the library for this tutorial, so we will use the line of code below to set the library to "Free Mode."

ComponentInfo.SetLicense("FREE-LIMITED-KEY");
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
VB   C#

4. Create a PDF from an Existing URL or HTML String

IronPDF can convert web pages to PDFs from URLs, file locations, and from raw HTML strings. GemBox.Pdf can convert web pages from URLs and local files, but cannot convert them from strings.

4.1. Existing URL and HTML String to PDF using IronPDF

IronPDF makes it very straightforward to render HTML from existing URLs as PDF. There is a very high level of support for JavaScript, images, forms, and CSS. Moreover, IronPDF is capable of rendering complex web page content that makes heavy use of JavaScript, CSS, and other assets.

The following code uses IronPDF to create a PDF document directly from a website address and HTML string

using IronPdf;

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
// Using URL
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf");

// Using HTML String
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");

// Load external html assets: images, css and javascript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from 
var PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
PDF.SaveAs("html-with-assets.pdf");
using IronPdf;

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
// Using URL
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf");

// Using HTML String
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");

// Load external html assets: images, css and javascript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from 
var PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
PDF.SaveAs("html-with-assets.pdf");
Imports IronPdf

Private Renderer As New IronPdf.ChromePdfRenderer()
' Using URL
Private Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")

Pdf.SaveAs("url.pdf")

' Using HTML String
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf")

' Load external html assets: images, css and javascript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from 
Dim PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
PDF.SaveAs("html-with-assets.pdf")
VB   C#

4.2. HTML File to PDF using GemBox.Document

using GemBox.Document;

// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Load input HTML file.
DocumentModel document = DocumentModel.Load("Input.html");

// When reading any HTML content a single Section element is created.
// We can use that Section element to specify various page options.
Section section = document.Sections[0];
PageSetup pageSetup = section.PageSetup;
PageMargins pageMargins = pageSetup.PageMargins;
pageMargins.Top = pageMargins.Bottom = pageMargins.Left = pageMargins.Right = 0;

// Save output PDF file.
document.Save("Output.pdf");
using GemBox.Document;

// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Load input HTML file.
DocumentModel document = DocumentModel.Load("Input.html");

// When reading any HTML content a single Section element is created.
// We can use that Section element to specify various page options.
Section section = document.Sections[0];
PageSetup pageSetup = section.PageSetup;
PageMargins pageMargins = pageSetup.PageMargins;
pageMargins.Top = pageMargins.Bottom = pageMargins.Left = pageMargins.Right = 0;

// Save output PDF file.
document.Save("Output.pdf");
Imports GemBox.Document

' If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")

' Load input HTML file.
Dim document As DocumentModel = DocumentModel.Load("Input.html")

' When reading any HTML content a single Section element is created.
' We can use that Section element to specify various page options.
Dim section As Section = document.Sections(0)
Dim pageSetup As PageSetup = section.PageSetup
Dim pageMargins As PageMargins = pageSetup.PageMargins
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: pageMargins.Top = pageMargins.Bottom = pageMargins.Left = pageMargins.Right = 0;
pageMargins.Right = 0
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: pageMargins.Top = pageMargins.Bottom = pageMargins.Left = pageMargins.Right
pageMargins.Left = pageMargins.Right
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: pageMargins.Top = pageMargins.Bottom = pageMargins.Left
pageMargins.Bottom = pageMargins.Left
pageMargins.Top = pageMargins.Bottom

' Save output PDF file.
document.Save("Output.pdf")
VB   C#

5. Convert ASPX Web Pages to PDF

IronPDF can easily convert ASPX web pages in .NET Framework to PDF with one line of code, while GemBox components lack this feature.

5.1. ASPX Page to PDF using IronPDF

The source code below renders the ASPX web page file to PDF using IronPDF. This is a one-liner that is very easy to use. More options can be added to the PDF settings while rendering.

protected void Page_Load(object sender, EventArgs e)
{
    IronPdf.AspxToPdf.RenderThisPageAsPdf();
}
protected void Page_Load(object sender, EventArgs e)
{
    IronPdf.AspxToPdf.RenderThisPageAsPdf();
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
	IronPdf.AspxToPdf.RenderThisPageAsPdf()
End Sub
VB   C#

6. Convert Images to PDF

6.1. Images to PDF using IronPDF

Build documents containing one or more image files using the IronPdf.ImageToPdfConverter class.

// One or more images as IEnumerable.  This example selects all JPEG images in a specific folder.
var ImageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));

// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");

//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
// One or more images as IEnumerable.  This example selects all JPEG images in a specific folder.
var ImageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));

// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");

//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
' One or more images as IEnumerable.  This example selects all JPEG images in a specific folder.
Dim ImageFiles = System.IO.Directory.EnumerateFiles("C:\project\assets").Where(Function(f) f.EndsWith(".jpg") OrElse f.EndsWith(".jpeg"))

' Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs("C:\project\composite.pdf")

'Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
VB   C#

6.2. Images to PDF using GemBox

With GemBox.Pdf, you can easily convert images in different file formats such as JPG, GIF, TIFF, and PNG to PDF documents programmatically using C#. Gembox.Pdf can convert images in either of these formats: BMP, GIF, JPEG, PNG, TIFF, WMP.

// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Create new document.
using (var document = new PdfDocument())
{
    // Add new page.
    var page = document.Pages.Add();

    // Add image from PNG file.
    var image = PdfImage.Load("parrot.png");
    page.Content.DrawImage(image, new PdfPoint(0, 0));

    // Set page size.
    page.SetMediaBox(image.Width, image.Height);

    // Save as PDF file.
    document.Save("converted-png-image.pdf");
}
// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

// Create new document.
using (var document = new PdfDocument())
{
    // Add new page.
    var page = document.Pages.Add();

    // Add image from PNG file.
    var image = PdfImage.Load("parrot.png");
    page.Content.DrawImage(image, new PdfPoint(0, 0));

    // Set page size.
    page.SetMediaBox(image.Width, image.Height);

    // Save as PDF file.
    document.Save("converted-png-image.pdf");
}
' If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")

' Create new document.
Using document = New PdfDocument()
	' Add new page.
	Dim page = document.Pages.Add()

	' Add image from PNG file.
	Dim image = PdfImage.Load("parrot.png")
	page.Content.DrawImage(image, New PdfPoint(0, 0))

	' Set page size.
	page.SetMediaBox(image.Width, image.Height)

	' Save as PDF file.
	document.Save("converted-png-image.pdf")
End Using
VB   C#

7. Licensing

GemBox.Pdf can be used as a free version or as a professional version depending on user needs. Download the free version of GemBox.Pdf using the instructions stated above.

The professional version comes with 18 months of free bug fixes, new releases, and technical support. Furthermore, the use of the professional version requires a developer license for each user. All licenses include a no-risk money-back guarantee for 30 days. There is no need for a subscription and no need for server or OEM licenses. Detailed licensing is available here. Individual developer licensing starts from $680.

IronPDF is an openly commercial C# PDF library. It is free for development and can be licensed for commercial deployment. Licenses are available for single-project use, single developers, agencies, and global corporations, as well as for SaaS and OEM redistribution. All licenses include a 30-day money-back guarantee, one year of product support and updates, validity for dev/staging/production, and also a permanent license (one-time purchase). The Lite package starts from $749.

8. Summary and Conclusion

Summary

IronPDF provides a comprehensive collection of functions for performing all kinds of tasks on PDF documents. It provides the ability to convert from different formats to PDF. Its key feature is its ability to convert HTML into PDFs. Unlike other libraries, this HTML-to-PDF conversion feature does not require involvement from a remote server. Instead, it actually spins up an instance of a real, standards-compliant web browser behind the scenes. The HTML is rendered with complete accuracy — and in a vector format suitable for the highest standards of commercial printing. The output is a clean and high-quality PDF. It is openly commercial, with licensing and pricing details all published on the website.

GemBox is a collection of .NET components for processing office productivity files — spreadsheets, documents, presentations, and emails. The GemBox.Pdf library reads, writes, creates and updates PDF files in .NET 6, .NET Core, .NET Framework, Mono, and Xamarin. If you want to create complex PDF documents, use GemBox.Document, GemBox.Spreadsheet, and GemBox.Presentation, which all have PDF exporting capability. It is free to use and can also be licensed for commercial use.

Conclusion

Here, after a comprehensive comparison, IronPDF enjoys significant advantages over GemBox.Pdf. IronPDF provides a single solution to all PDF-related tasks. When you purchase IronPDF, you get all the conversions in one single library, plus tasks related to PDF documents only, requiring no additional dependencies. GemBox.Pdf can only modify PDF files and lack the robust processing options; converting to PDFs from formats other than images and HTML requires developers to purchase additional GemBox libraries. For commercial purposes, this can be costly. Moreover, Gembox.Pdf is more expensive than IronPDF and with limited functionality.

Currently, you can buy five IronPDF products for the price of just two. This special offer confirms that IronPDF stands first among competitors.

All trademarks in this article are properties of their respective owners.