A Comparison between IronPDF and SelectPDF
Photo from Unsplash
Originally Posted On: https://ironpdf.com/blog/compare-to-other-components/selectpdf-net-core-alternatives-html-to-pdf/
Working with PDF files in C# has proved difficult for developers over the years. There is a wide variety of factors to take into account when rendering content from PDF files, and even more so when converting content from different formats to PDF. These issues have now been solved with the completion of numerous libraries designed to read, write, create, and convert to PDF from different formats.
This article will compare two of the most popular PDF libraries for .NET and .NET Core developers. These two libraries are:
- IronPDF
- SelectPDF
IronPDF and Select PDF 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 PDFs. 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. This all in one package attracts developers for free as well as the deployment of commercial applications.
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 URLs
- 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 form-field data
- Extract images and texts from PDFs
- Stamp new HTML Content onto any existing PDF page
- Add logical or HTML headers and footers
Manipulate Existing PDF Documents
- Load and parse existing PDF documents
- Merge and split content in PDF documents
- Add headers, footers, annotations, bookmarks, watermarks, text, and image 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) 5 Licenses for the price of 2 making it a standout feature among its competitors.
SelectPDF
Select PDF for .NET is a professional PDF library that can be used for creating, writing, editing, handling and reading PDF files without any external dependencies within .NET applications. Using this .NET PDF library, you can implement rich capabilities to create PDFs from scratch, or process existing PDF documents entirely through C#/VB.NET without installing Adobe Acrobat.
Select PDF provides versions for .NET and .NET Core 2.0 and above (through .NET Standard 2.0). Select PDF only works on Windows. Select PDF works on Azure cloud, including Azure Web Apps (Basic Plan or above) with some limitations.
Select Pdf for .NET free version contains ready-to-use samples for Windows Forms, ASP.NET, ASP.NET MVC with Razor and ASPX engines.
Note: Select Pdf works online and currently works only on Windows systems. There is no support for Linux, Xamarin, or other platforms.
SelectPDF Library Features
Here are some of the most important Select PDF Features:
General Features
- Support for .NET Framework and .NET Core on Windows systems
- Generate PDF documents from scratch
- Load and modify existing PDF documents
- Custom headers and footers for PDF documents
- Extract pages from existing documents
- Digital signatures
- Compressed PDF documents
- Advanced PDF document security settings (RC4 or AES encryption algorithms, up to 256 bits encryption keys)
HTML to PDF Converter Features
- Convert any web page to PDF
- Convert any raw HTML string to PDF
- Set PDF page settings (page size, page orientation, page margins)
- Resize content during conversion to fit the PDF page
- Set PDF document properties
- Set PDF viewer preferences
- Set PDF security (passwords, permissions)
- Convert multiple web pages into the same PDF document
- Full HTML5/CSS3/JavaScript support
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 Framework) and click OK as shown in the below screenshot
Figure 1 – New Project Dialog Box
- From the next screen, choose “Web Forms” as shown in the screenshot below.
Figure 2 – Web 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. They are as follows:
- Using Visual Studio
- The Developer Command Prompt
- Download the NuGet Package directly
- 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. Both these options are shown below in screenshots as Figures 3 and 4.
Figure 3 – Project Menu > Manage NuGet Packages
Figure 4 – Right Click Solution Explorer
Once selected, browse for the IronPDF package and install it, as shown in the screenshot below.
Figure 5 – Install IronPDF from NuGet Package
2.2. Using the Developer Command Prompt
Another way to download and install 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 under 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 start 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 https://www.nuget.org/packages/IronPdf/
- Select “Download Package”
- Double-click the downloaded package
- The package will get installed
- Reload your Visual Studio project and start 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 DLL download.
Figure 6 – Direct Download IronPDF C# Library
Reference the library in your project by using the following 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, we should first download and set up the EVO HTML to PDF Converter.
3. SelectPDF Installation
The Select PDF Library for .NET – 2021 Vol 2 is now available.
There are two ways to install the Select PDF library:
- Using a NuGet package (.NET Framework, .NET Core and .NET 5)
- Downloading assemblies
Let’s have a closer look at each one.
3.1. Installation using NuGet Packages
The easiest way to install Select Pdf is by using a Nuget Package, go to NuGet Package Manager and install one of the following packages:
- .NET version – AnyCPU (.NET 2.0 and .NET 4.0-4.5) Select.Pdf: https://www.nuget.org/packages/Select.Pdf/.
- .NET version – x64 optimized version Select.Pdf.x64: https://www.nuget.org/packages/Select.Pdf.x64/.
- .NET Core and .NET 5 version – Windows only (and .NET 4.6.1 and .NET 4.7.2) – Select.Pdf.NetCore: https://www.nuget.org/packages/Select.Pdf.NetCore/.
- .NET Core and .NET 5 version with Blink rendering engine – Windows only (and .NET 4.6.1 and .NET 4.7.2) Select.Pdf.NetCore.Blink: https://www.nuget.org/packages/Select.Pdf.NetCore.Blink/.
Note 1: If the x64 version is used, the application needs to target x64 platform and it needs to run in an x64 worker process.
Note 2: The .NET Core version is for .NET Core 2.0 or above through .NET Standard 2.0 (with with .NET Core 2.x, 3.x, .NET 5). Currently it requires a Windows system to run. It does not work on Linux or Mac or Xamarin.
Note 3: Blink rendering engine only works with .NET Core version and with .NET Framework (starting with 4.6.1). Blink rendering engine was introduced with Select Pdf v19.1.
3.2. Installation using Downloaded Assemblies
SelectPdf can be downloaded from the product site: https://selectpdf.com. The free trial product archive download page can be found at this link: https://selectpdf.com/downloads/. SelectPdf is shipped as a product archive with the following structure:
Assemblies
It contains the assemblies and related files needed by SelectPdf Library for .NET.
- Select.Pdf Library is shipped with different versions for CLR 2.0 (.NET 2.0, 3.5) and for CLR 4.0 (.NET 4.0 and above) and for .NET Core.
Note: The .NET Core version and .NET versions (targeting 4.6.1 or above) have additional dependencies that need to be installed via Nuget.
Documentation
- It contains the product documentation in CHM format.
Project Setup
- To use SelectPdf in a .NET project, a reference needs to be added to Select.Pdf.dll.
- Two additional files are also required: Select.Html.dep used by the HTML to PDF converter and Select.Tools.dep used by the PDF to text and PDF to image converter. These files need to be copied into the bin folder of the application, next to Select.Pdf.dll.
4. Create a PDF from an Existing URL
Both libraries provide the facility to convert an HTML webpage to PDF. Let’s have a look at the code for each library one-by-one.
4.1. Existing URL to PDF using IronPDF
IronPDF makes it very straightforward to render HTML from existing URLs as PDF documents. There is a very high level of support for Javascript, Images, Forms, and CSS.
The following code uses IronPDF to create a PDF document directly from a website address:
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
4.2. Existing URL to PDF using SelectPDF
Converting from HTML to PDF with SelectPDF is very easy. The following code uses SelectPDF to generate a PDF file directly from a website address.
// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();
// create a new pdf document converting an url
PdfDocument doc = converter.ConvertUrl("https://selectpdf.com/");
// save pdf document
doc.Save(file);
// close pdf document
doc.Close();
5. Create a PDF from HTML Input Strings
IronPDF and SelectPDF both provide the facility to generate PDF from a string containing HTML. Both use only two lines of code to accomplish this task.
5.1. HTML Input String using IronPDF
The following code shows that a PDF document can be rendered using an HTML input string. You can choose simple HTML, or also incorporate CSS, images, and JavaScript.
var Renderer = new IronPdf.ChromePdfRenderer();
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:siteassets' is set as the file location to load assets from
var PDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:siteassets");
PDF.SaveAs("html-with-assets.pdf");
5.2. HTML Input String using SelectPDF
Using SelectPDF Html to Pdf Converter for .NET any raw HTML code can be converted to PDF. SelectPDF supports the latest HTML5 with CSS3 style sheets. The following code shows that a PDF can be generated using a string containing HTML.
// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();
// create a new pdf document converting an html string
PdfDocument doc = converter.ConvertHtmlString("<h1>Html with CSS and Images</h1>", baseUrl);
// save pdf document
doc.Save(Response, false, "Sample.pdf");
// close pdf document
doc.Close();
6. Convert ASPX Web Pages to PDF
The next code for both IronPDF and SelectPDF creates a PDF from an ASP.NET web page.
6.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();
}
6.2. ASPX Page to PDF using SelectPDF
Sometimes, there is a need in an ASP.NET application to convert a web page to PDF. SelectPDF Html to Pdf Converter and an ASP.NET trick can be used to achieve this task. Take a look at the sample code below.
protected override void Render(HtmlTextWriter writer)
{
if (startConversion)
{
// get html of the page
TextWriter myWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(myWriter);
base.Render(htmlWriter);
// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();
// create a new pdf document converting the html string of the page
PdfDocument doc = converter.ConvertHtmlString(
myWriter.ToString(), Request.Url.AbsoluteUri);
// save pdf document
doc.Save(Response, false, "Sample.pdf");
// close pdf document
doc.Close();
}
else
{
// render web page in browser
base.Render(writer);
}
}
7. Convert Images to PDF
Conversion from PDF to images is only provided by IronPDF. SelectPDF does not provide this facility to convert images to PDF. Instead, it allows the conversion from PDF to images. In the IronPDF library, PDF can be easily constructed from 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:projectassets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));
// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:projectcomposite.pdf");
//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
8. Licensing
SelectPdf Library for .NET is provided as a free trial product that can be tested without any limitations for 30 days. The free trial is fully functional, but without a license key; a watermark will be displayed on each page of the PDF files generated with the library. A license key is needed to unlock the product and remove the demo watermark. A Single Developer License starts from$499. Licenses are available for multiple developers as well. A complete list can be checked from the product website: https://selectpdf.com/pricing.
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.
9. Summary and Conclusion
Summary
IronPDF 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.
SelectPDF is an HTML To PDF Online REST API. It implies the rendering of the web page being converted. Because of the support to run complex HTML/CSS/JavaScript, a number of things need to be taken into consideration when using SelectPDF to make sure your application remains secure. The generated PDFs are perfect, featuring different PDF file security settings and PDF page settings. The API is easy to use and the integration takes only a few lines of code. Licensing and pricing details are fully published on the website.
Conclusion
Here, IronPDF has an advantage over SelectPDF as it can work offline once installed. In comparison to SelectPDF, IronPDF provides conversion from different formats to PDF: e.g. XML to PDF, images to PDF, and Angular JS to PDF. IronPDF is highly recommended for pragmatic coders seeking to work effectively and efficiently. Most importantly, it is time-saving. SelectPDF can be useful when dealing with PDF documents in different server-side languages. Moreover, IronPDF packages provide a lifetime license, and there are no ongoing costs, while the SelectPDF Online REST API does have ongoing costs. Now you can buy IronPDF 5 .Net products just for the price of 2. This makes IronPDF proven winners among its competitors and yes it also saves production costs!