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.

The IronPDF C# Library — Standout Features

Some of the important features 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 Library

GemBox offers fast and easy–to–use .NET components for developers, with a strong focus on file formats and well–documented APIs. The Gem Box 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.

GemBox.Pdf is a .NET component that enables developers to read, write, merge and split PDF files or execute low-level object manipulations from .NET applications in a simple and efficient way. With GemBox.Pdf, you get a fast and reliable component that’s easy to use. It requires only the .NET, and it doesn’t require Adobe Acrobat, so you can deploy your application easily without having to think about other licenses.

GemBoxPdf Components and Standout Features

Here we are going to have a look at standout features of GemBox.Pdf components.

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

Note: GemBox.Pdf components only allow conversion from images to PDF. Use GemBox.Spreadsheet for Microsoft Excel spreadsheet files(csv, xls, xlsx) to PDF; use Gembox.Document for Word and HTML to PDF, and use Gembox.Presentation for PowerPoint.

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 2019
  • 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 and integrate 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 to install 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:

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 DLL download.

Figure 6Download IronPDF Library

Reference the library in your project by following these steps:

  • 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. However, before that we should install GemBox.Pdf.

3. GemBox Library Installation

The following steps will help you to set up GemBox.Pdf for C# applications.

3.1. Prerequisites

GemBox.PDF requires only .NET — it doesn't have any other dependency.

You can use it on:

  • .NET Framework 3.5 - 4.8
  • .NET Core 3.1 (.NET 6 & 5 for Windows)
  • .NET Standard 2.0 (.NET 6 & 5 for Linux, macOS, Android, iOS, …)

3.2. Add from NuGet Package

You can add GemBox.Pdf as a package by using the following command from the NuGet Package Manager Console:

Install-Package GemBox.Pdf

Or you can search and add GemBox.Pdf from the NuGet Package Manager.

Figure 7Add Gembox PDF from NuGet

3.3. Add from a DLL file

You can download a GemBox.Pdf.dll file from this page and add a reference by browsing to it.

Figure 8Add GemBox PDF from dll

3.4. Add from Setup

You can download the GemBox.Pdf Setup from this page. After installing the setup, you can add a reference to GemBox.PDF.dll from the Global Assembly Cache (GAC).

Figure 9Add GemBox PDF from GAC

Now add a directive for the GemBox.Pdf namespace.

For a C# project, use:

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

Finally, set the license key to use GemBox.Pdf in one of its working modes.

To use a "Free" mode in a C# project, use:

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 provides a complete solution to convert a web page either through base URL or HTML string input to PDF. While GemBox only accepts input as an HTML file either from a local storage or remote server.

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. For HTML string you can also choose simple HTML, or also incorporate CSS, images, and JavaScript. 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

You need to add the following namespace to your application in order to convert to PDF. Follow the same procedure as GemBox.Pdf to install GemBox.Document.

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

The following example shows how you can convert an HTML file to a PDF using Gembox.

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 following code renders the ASPX web page file to PDF using IronPDF. This is a one-line code and 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

In the IronPDF library, PDF solid documents can be easily constructed from one or more image files using the IronPdf.ImageToPdfConverter class. You can load the images from the assets in your PDF generation software applications.

// 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#. These are all the image formats that GemBox.Pdf supports for PDF conversion: BMP, GIF, JPEG, PNG, TIFF, WMP. The following example shows how to convert a PNG image to a PDF document.

// 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 a professional version depending on user needs. Download your free version or the trial version as mentioned above. For the professional version, which comes with 18 months of free bug fixes, new releases, and technical support, each developer needs a developer license. 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. The single developer package starts from $680.

IronPDF is an openly commercial C# PDF library. It is free for development and can always be licensed for commercial deployment. Licenses are available for single-project use, single developers, agencies, and global corporations, as well as 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 $499.

8. Summary and Conclusion

Summary

IronPDF is a complete solution for working with PDF documents. It provides the ability to convert from different formats to PDF. Its main highlight is the HTML converter, and it does not render HTML to PDF from a remote server. It actually spins up an instance of a real standard compliant web browser behind the scenes (without any additional software needing to be installed). 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 package of .NET components for processing office files — spreadsheets, documents, presentations, and emails. The GemBox.Pdf components read, write, create and update 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 problems. 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 components only provide for the manipulation of PDF files and lack multiple format converting options, except for images. For commercial purposes, this can be costly as other GemBox components then need to be purchased. 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.