Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
PDF files are used in a variety of industries for invoicing and document generation. When generating documents, developers use the PDF format to fulfill their client's requirements. With the libraries on the market today, creating PDFs has never been easier. When using this type of library in a project, we must evaluate factors such as building, reading, and converting to determine which library is the best on the market.
In this article, we will compare the two most popular PDF libraries for .NET components. These two libraries are:
IronPDF and NReco are two libraries that can be used to create, read, update and manipulate PDF files in your .NET application, whether it be it a desktop, a web or a mobile application. We will first compare the two libraries' features, then we'll look at their performance in converting and manipulating PDF files. Microsoft's .NET frameworks support both libraries.
The next question is to decide which C# PDF Library is best suited to your .NET project. You can weigh up your decision as you read the following comparison between the two libraries.
Let's first have a look at what both libraries have to offer, and then move on to the comparison itself.
The IronPDF .NET PDF library solution is a dream for developers, especially C# software engineers. You can easily create a .NET Core PDF processing application with this excellent tool.
IronPDF uses a .NET Chromium engine to render HTML pages to PDF files. There is no need to use complex APIs to render or manipulate PDFs. IronPDF supports standard web technologies: 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, watermark, and add headers and footers to a PDF. Furthermore, it makes it very easy to read PDF text and extract images.
Some of the important features include:
NReco provides a library for .NET and .NET Core for HTML-to-PDF conversion. It can generate PDF documents from HTML templates or from web page URLs.
In most cases (99% of the time), PDFs generated from NReco looks very similar it would appear as a web page displayed in a web browser. The engine supports page headers/footers, page numbering, custom fonts, and JavaScript execution.
The NReco library is based on the WkHtmlToPdf command line tool, which uses the WebKit engine to render HTML content as PDFs. The library makes use of wkhtmltoPdf binaries (win-x86) during execution. There is not need to install these manually. The NReco library extracts and executes the wkHtmlToPdf binaries automatically during runtime for convenience.
We will create a new project in Visual Studio to demonstrate how these two libraries carry out PDF generation.
Open Visual Studio. Click on Create New Project => Select Template (Console Application) => Click on Next => Name the Project => Select .NET Framework Version => Click on Create Button.
A new project will be created.
Let's install both libraries one by one.
There are four ways to download and install the IronPDF library. These are as follows:
Let’s take a closer look at each one.
Follow the following steps to download IronPDF from NuGet Package Manager.
From the menu bar, click on Tools > NuGet Package Manager > Manage NuGet Package for Solutions.
A new window will appear. Click on Browse => Search for IronPDF=> click on the Install button, as shown below.
This will install IronPDF Library in our project.
In Visual Studio, go to Tools > NuGet Package manager > Package Manager console
Enter the following line in the package manager console tab:
Install-Package IronPdf
The third way is to download the NuGet package directly from the website.
Click this link to download the latest package directly from the website. After downloading, follow the steps below to add the package to the project.
Next, click OK to add the reference.
The NReco library can be downloaded by using one of the following four ways.
As above, just go to the NuGet package manager and search for the keyword "NReco".
In Visual Studio, go to Tools > NuGet Package Manager > Package manager console
Enter the following line in the package manager console tab:
Install-Package NReco.PdfGenerator -Version 1.2.0
The third way is to download the NuGet package directly from the website.
Click this link to view a list of available DLLs. Download the latest package for various .NET Frameworks After downloading, follow the steps below to add the package to the project.
Let's explore the functionalities of both libaries.
Both libraries support the generation of PDF documents, but they do so in different ways.
ChromePdfRenderer chromePdfRenderer = new ChromePdfRenderer();
var file = chromePdfRenderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/PDF");
file.SaveAs(@"D:\urlToPdfIronPDF.pdf");
ChromePdfRenderer chromePdfRenderer = new ChromePdfRenderer();
var file = chromePdfRenderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/PDF");
file.SaveAs(@"D:\urlToPdfIronPDF.pdf");
Dim chromePdfRenderer As New ChromePdfRenderer()
Dim file = chromePdfRenderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/PDF")
file.SaveAs("D:\urlToPdfIronPDF.pdf")
The above code will generate a PDF from a provided URL. The output of the source code is below.
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter(); htmlToPdf.GeneratePdfFromFile("https://en.wikipedia.org/wiki/PDF", null, @"D:\urlToPDFNreco.pdf");
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter(); htmlToPdf.GeneratePdfFromFile("https://en.wikipedia.org/wiki/PDF", null, @"D:\urlToPDFNreco.pdf");
Dim htmlToPdf = New NReco.PdfGenerator.HtmlToPdfConverter()
htmlToPdf.GeneratePdfFromFile("https://en.wikipedia.org/wiki/PDF", Nothing, "D:\urlToPDFNreco.pdf")
Generating PDFs from URL using NReco requires the use of another library: NReco.PDFGenerator.LT Additionally, PDF generation requires a commercial license. Without it, the above code will throw the exception shown below:
string htmlstring = "<h1> This is sample pdf generated by IronPDF</h1>";
ChromePdfRenderer chromePdfRenderer = new ChromePdfRenderer();
var file = chromePdfRenderer.RenderHtmlAsPdf(htmlstring);
file.SaveAs(@"D:\HTMLToPdfIronPDF.pdf");
string htmlstring = "<h1> This is sample pdf generated by IronPDF</h1>";
ChromePdfRenderer chromePdfRenderer = new ChromePdfRenderer();
var file = chromePdfRenderer.RenderHtmlAsPdf(htmlstring);
file.SaveAs(@"D:\HTMLToPdfIronPDF.pdf");
Dim htmlstring As String = "<h1> This is sample pdf generated by IronPDF</h1>"
Dim chromePdfRenderer As New ChromePdfRenderer()
Dim file = chromePdfRenderer.RenderHtmlAsPdf(htmlstring)
file.SaveAs("D:\HTMLToPdfIronPDF.pdf")
See below for output:
string htmlstring = "<h1> This is sample pdf generated by NReco</h1>";
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.GeneratePdf(htmlstring,null, @"D:\HTMLToPdfIronPDF.pdf");
string htmlstring = "<h1> This is sample pdf generated by NReco</h1>";
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.GeneratePdf(htmlstring,null, @"D:\HTMLToPdfIronPDF.pdf");
Dim htmlstring As String = "<h1> This is sample pdf generated by NReco</h1>"
Dim htmlToPdf = New NReco.PdfGenerator.HtmlToPdfConverter()
htmlToPdf.GeneratePdf(htmlstring,Nothing, "D:\HTMLToPdfIronPDF.pdf")
The source code above generates PDFs using the NReco C# WkHtmlToPdf wrapper.Executing this code sucessfully also a commercial license. Therefore, running this code above will throw an exception: "This feature requires commercial license."
The following sample code demonstrates the PDF Text Extractiou feature.
var pdfFile = @"D:\SamplePDF.pdf";
PdfDocument pdfDocument = PdfDocument.FromFile(pdfFile);
string ConvertedText = pdfDocument.ExtractAllText();
Console.WriteLine(ConvertedText);
var pdfFile = @"D:\SamplePDF.pdf";
PdfDocument pdfDocument = PdfDocument.FromFile(pdfFile);
string ConvertedText = pdfDocument.ExtractAllText();
Console.WriteLine(ConvertedText);
Dim pdfFile = "D:\SamplePDF.pdf"
Dim pdfDocument As PdfDocument = PdfDocument.FromFile(pdfFile)
Dim ConvertedText As String = pdfDocument.ExtractAllText()
Console.WriteLine(ConvertedText)
Generated output is shown below:
We need to add one more additional library, Nreco.PdfRenderer, to extract text.
var pdfFile = @"D:\SamplePDF.pdf";
var pdfToText = new NReco.PdfRenderer.PdfToTextConverter();
string generatedText = pdfToText.GenerateText(pdfFile);
Console.WriteLine(generatedText);
var pdfFile = @"D:\SamplePDF.pdf";
var pdfToText = new NReco.PdfRenderer.PdfToTextConverter();
string generatedText = pdfToText.GenerateText(pdfFile);
Console.WriteLine(generatedText);
Dim pdfFile = "D:\SamplePDF.pdf"
Dim pdfToText = New NReco.PdfRenderer.PdfToTextConverter()
Dim generatedText As String = pdfToText.GenerateText(pdfFile)
Console.WriteLine(generatedText)
Output is shown below:
The output generated by NReco is correct, but it contains an additional symbol which should not be there.
We have discussed the core features provided by both libraries. Now, let's compare them.
NReco uses the C# wkHtmlToPdf tool in many different use cases. We don't need to install the wkHtmltoPdf separately, but we do need to install separate NuGet Packages to create and read PDF documents. Hence, this increases the complexity in manageing a project's library dependencies. On the other hand, IronPDF needs only a one-time installation. IronPDF's full set of features require no additional libraries.
IronPDF renders HTML content into PDFs accurately, both from URls and from raw HTML strings. These same features cannot be used in NReco without first obtaining a commercial license.
Both Libraries can extract text from PDF files pretty well, but NReco includes an extra, unnecessary symbol in its output.
NReco is a web service that creates PDF files from HTML documents. It has a variety of price structures, the lowest being $75/month. You can also sign up for a free trial, but the free trial has limited features. The detailed pricing can be checked here on the NReco page.
IronPDF is a C# PDF library. It is free for development and can always be licensed for commercial deployment. Licenses are available for single-project use, individual 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). Pricing for the Lite package starts from $749.
IronPDF does not render HTML to PDF from a remote server. Rather, it spins up an instance of a real, standards-compliant web browser behind the scenes (no additional software needs to be installed manually). 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.
NReco also converts HTML to PDF and runs on cloud servers at multiple locations. NReco provides libraries for .NET and .NET Core with the fastest and most accurate HTML-to-PDF conversion. NReco can generate PDF files from HTML content (source code, template files, or URLs) by HTML template or web page URL. Web pages are rendered using a Qt WebKit engine, and the resulting output is nearly identical to web browser renderings.
After a comprehensive comparison, it can be seen that IronPDF enjoys significant advantages over NReco. IronPDF provides a comprehensive coverage for many PDF-processsing needs. When purchasing IronPDF, you get all the conversions in one single library. It supports standard web documents: HTML, ASPX, JS, CSS, and images.
NReco is a web service that creates PDF files from HTML formats. It comes with a variety of price structures, the lowest being $75/month. IronPDF, on the other hand, 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. All licenses include a 30-day money-back guarantee and one year of product support and updates. The Lite package starts from $749. IronPDF packages are permanent and there are no ongoing costs.
If you purchase the complete IronSuite, you will be eligible to receive all five products for the price of just two. For more details, please click here.
In closing, we choose IronPDF because of its high-performance and the large feature set. IronPDF also provides good support and documentation, which ensures that users can make full and effective use of the impressive array of features on offer.
9 .NET API products for your office documents