Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
This article will compare two of the most popular PDF libraries for .NET and .NET Core developers. These two libraries are:
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.
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:
MemoryStreams
PrintDocument
object and print without Adobe (with minimal code)Note: Now, you can also purchase Iron Suite for .NET (IronPDF, IronOCR, IronXL, IronBarcode, IronWebscraper, IronPrint, IronWord, IronQR, and IronZIP).
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:
GemBox.Pdf works with .NET Framework 3.5+, .NET Standard 2.0, and .NET 6.0.
Note: 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.
The rest of this article will look at the following topics:
Use the following steps to create an ASP.NET website:
Figure 1 – New Project Dialog Box
Figure 2 – Web Forms
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.
There are four ways to download and install the IronPDF library. These are as follows:
Let’s take a closer look at each one.
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 3 – Solution Explorer
Figure 4 – Project Menu > Manage NuGet Packages
Once selected, browse for the IronPDF package and install it, as shown in the screenshot below.
Figure 5 – Install IronPDF from NuGet Package
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.
Type the following command:
Install-Package IronPdf
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:
You can directly download the IronPDF .DLL file directly from the website. It can be directly downloaded from the IronPDF website.
Figure 6 – Download IronPDF Library
Follow the steps below to include the DLL as a reference in your project:
All done! IronPDF is downloaded, installed and ready to use.
You can install the GemBox.Pdf library by either:
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.
Download and install the GemBox.Pdf Setup installer from the GemBox.Pdf Free Version installation page.
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
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")
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
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.
// 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"));
// Create new document.
using (var document = new PdfDocument())
{
foreach (var imageFile in imageFiles)
{
// Load image and add new page.
var image = PdfImage.Load(imageFile);
var page = document.Pages.Add();
// Add image to the page and set page size.
page.Content.DrawImage(image, new PdfPoint(0, 0));
page.SetMediaBox(image.Size.Width, image.Size.Height);
}
// Save document.
document.Save(@"C:\project\composite.pdf");
}
// 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"));
// Create new document.
using (var document = new PdfDocument())
{
foreach (var imageFile in imageFiles)
{
// Load image and add new page.
var image = PdfImage.Load(imageFile);
var page = document.Pages.Add();
// Add image to the page and set page size.
page.Content.DrawImage(image, new PdfPoint(0, 0));
page.SetMediaBox(image.Size.Width, image.Size.Height);
}
// Save document.
document.Save(@"C:\project\composite.pdf");
}
' 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"))
' Create new document.
Using document = New PdfDocument()
For Each imageFile In imageFiles
' Load image and add new page.
Dim image = PdfImage.Load(imageFile)
Dim page = document.Pages.Add()
' Add image to the page and set page size.
page.Content.DrawImage(image, New PdfPoint(0, 0))
page.SetMediaBox(image.Size.Width, image.Size.Height)
Next imageFile
' Save document.
document.Save("C:\project\composite.pdf")
End Using
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 12 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 $890.
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.
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.
Right now, you can buy nine IronPDF products for the price of just two. Check out this exclusive special offer right here
All trademarks in this article are properties of their respective owners.
9 .NET API products for your office documents