IronPDF and Docraptor - A Comprehensive Comparison

1. Introduction

If you wish to convert your HTML site to other formats, you are in the right place. This article will discuss how to transform your HTML, CSS, and JS to PDF. Nowadays, everything is technology-based, and those who engineer these technologies need time-saving solutions — in one of the most-used programming languages, .NET's C#. In C#, the traditional ways to tackle PDF files and manipulate them are complex and time-consuming. The most common uses for PDF files are:

  • PDF rendering
  • HTML to PDF generation

Many tools have been developed to handle these PDF conversions and deal with any problems that arise. This article will compare the two most-praised C# libraries for PDF conversions among developers. The relevant tools are as follows:

  • DocRaptor
  • IronPDF

You can download the software product from this link.

2. IronPDF

IronPDF is the dream tool for HTML site conversion in .NET and .NET core development. It not only converts HTML, but also provides numerous other features. Within .NET Core and framework projects, IronPDF allows developers to generate, modify, and extract PDF documents. Developers can quickly create or transform PDFs from HTML documents using the IronPDF library.

IronPDF allows you to automatically read information from PDF files and inject it into your .NET apps and data storage systems. Content from old PDF document storage may be imported, migrated and indexed into your document management and business process applications.

2.1. IronPDF Features

2.1.1. PDF Conversions

This feature includes PDF creations from different formats such as HTML, HTML Strings, MVC views, Web Forms, and URLs.

2.1.2. PDF Imaging

This allows users to create images from PDFs and create PDFs from images. It includes image extraction, support for different image extensions, and PDF printing.

2.1.3. PDF Files IO

IronPDF also provides the features of 128 bit-encryption for PDFs, locking PDFs with passwords, and digitally signing PDFs.

2.1.4. Editing PDFs

This feature of IronPDF provides all types of PDF formatting such as adding watermarks, adding pages, removing pages, backgrounds, foregrounds, and much more. In short, IronPDF provides all the things you can think of to do with PDFs.

2.1.5. PDF Content Extraction

In many cases, you can extract embedded text from PDFs directly. If that doesn't work, your reader is probably actually embedded in an image. Use the IronOCR library to scan documents for the visual text, not plain text.

2.1.6. Headers and Footers

Headers and footers can be added when a PDF is created or added to existing PDFs. The Print Options property allows you to craft a header and footer for each document page. Access these options on the Chrome PDF Renderer object. This sample works inside a .NET Core console app.

2.1.7. Compatibility

IronPDF supports almost all operating systems and frameworks compatible with C# such as:

  • Supports: Windows, Azure
    • .NET Core 2.1, 3.0, 3.1, .NET 6 & 5
      • .NET Standard 2.0 Compliance for Universal Compatibility
      • Azure
      • AWS
      • Docker
      • Linux

3. DocRaptor

DocRaptor is a professional solution for document conversion, but unlike IronPDF, it offers limited features for multiple programming dictionaries. It is an API-based tool and can be integrated with any language. It is high-quality and fast, thereby saving you time. It also provides a feature to convert XML Files to XLSX.

DocRaptor offers to host your documents for you. It has CSS and JS support. These are excellent features for small businesses that do not own their own servers.

3.1. DocRaptor Features

3.1.1. HTML to PDF Generation

DocRaptor makes HTML, CSS, and JS to PDF generation and XLS documents quick and straightforward. Simply post your HTML content and the needed arguments to the Docs APIs, either as a form-encoded text or as a JSON object.

3.1.2 HTML to Excel Format

Many reports and data exports require the support of both PDF and Excel. DocRaptor's HTML-based tool makes this easy!

3.1.3. Document Hosting

The document will be saved on unbranded URLs and will be accessible to anyone from anywhere. You can keep it there indefinitely or remove it after a certain date or amount of downloads.

Note:

According to data collected from the NuGet Website, IronPDF is more popular then DocRaptor, with total downloads of 3.0 M, with daily downloads averaging 1.3 K. On the other hand, DocRaptor has only 114.9 K total downloads, with a daily average of 51 downloads per day.

4. Creating a New Project in Visual Studio

Open the Visual Studio software and go to the File menu. Select "new project" and then select console application. In this article, we are going to use a console application to generate PDF documents.

Enter the project name and select the path in the appropriate text box. Then, click the create button. Select the required .NET framework, as in the screenshot below:

The Visual Studio project will now generate the structure for the selected application, and if you have selected the console, Windows, and web application, it will open the program.cs file where you can enter the code and build/run the application.

Now we can add the library and test the program.

5. Install the IronPDF Library

The IronPDF library can be downloaded and installed in four different ways. These are:

  • Using the Visual Studio NuGet Package Manager
  • Using the Visual Studio Command-Line.
  • Direct Download from the NuGet Webpage.
  • Direct Download from the IronPDF webpage.

5.1 Using the Visual Studio NuGet Package Manager

The Visual Studio software provides the NuGet Package Manager option to install the package directly to the solution. The below screenshot shows how to open the NuGet Package Manager.

It provides the search box to show the list available package libraries from the NuGet website. In the package manager, we need to search for the keyword "IronPDF", as in the below screenshot:

From the above image, we will get the list of the related packages search list. We need to select the IronPDF option and install the package our the solution.

5.2 Using the Visual Studio Command-Line

  • In Visual Studio menu, Go to Tools-> NuGet Package manager -> Package manager console
  • Enter the following line in the package manager console tab:

Install-Package IronPDF

Now the package will download/install to the current project and be ready to use.

5.3 Direct Download from the NuGet Webpage

The third way is to download the NuGet package directly from the webpage.

  • Navigate to the Link "https://www.nuget.org/packages/IronPdf/"
  • Select the download package option from the menu on the right-hand side.
  • Double-click the downloaded package; it will be installed automatically.
  • Now reload the solution and start using it in the project.

5.4 Direct Download from the IronPDF Webpage

Click the link here to download the latest package directly from the webpage. After the download, follow the steps below to add the package to the project.

  • Right-click the project from the solution window.
  • Then, select option reference and then browse the location of the downloaded reference.
  • Next, click OK to add the reference.

6. Install the DocRaptor API

The DocRaptor team offers nearly all the same methods to integrate the API. These are:

  • Using the Visual Studio NuGet Package Manager.
  • Using the Visual Studio NuGet Package Console.
  • Using the Visual Studio Command-Line.
  • Direct Download from the NuGet Website.

6.1 Using the Visual Studio NuGet Package Manager

As explained previously for IronPDF, the steps are the same for opening the NuGet Package Manager.

After opening the Package Manager, simply write DocRaptor in the search bar.

As the above image shows, there are three results for DocRaptor. Select the required option.

6.2. Using the Visual studio NuGet Package Console

In Visual Studio menu, Go to Tools-> NuGet Package manager -> Package manager Console. Enter the following line in the package manager console tab: install-Package DocRaptor. Now the package will download/install to the current project and be ready to use.

6.3. Direct Download from the NuGet Website.

The third way is to download the NuGet package directly from the webpage.

  • Navigate to the link "https://www.nuget.org/packages/DocRaptor/".
  • Select the download package option from the right-hand menu.
  • Double-click the downloaded package; it will install automatically.
  • Next, reload the solution and start using it in the project.

7. Make PDFs From HTML

Both tools include this functionality for HTML conversion, although they do so in somewhat different ways.

7.1. Make PDFs From HTML using IronPDF

The conversion of pages using IronPDF does not require the use of JSON and encryption techniques it's quite simple actually. IronPDF allows a lot of different methods. For example:

  • HTML files to PDF
var Renderer = new IronPdf.ChromePdfRenderer();
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");
var Renderer = new IronPdf.ChromePdfRenderer();
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf");
Dim Renderer = New IronPdf.ChromePdfRenderer()
Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>").SaveAs("pixel-perfect.pdf")
VB   C#
  • URL to PDF
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf"); 
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf"); 
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")

Pdf.SaveAs("url.pdf")
VB   C#
  • ASPX pages to PDF, and many more.
private void Form1_Load(object sender, EventArgs e)
{

IronPdf.AspxToPdf.RenderThisPageAsPdf();
//Changes the ASPX output into a pdf instead of HTML

}
private void Form1_Load(object sender, EventArgs e)
{

IronPdf.AspxToPdf.RenderThisPageAsPdf();
//Changes the ASPX output into a pdf instead of HTML

}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)

IronPdf.AspxToPdf.RenderThisPageAsPdf()
'Changes the ASPX output into a pdf instead of HTML

End Sub
VB   C#

7.2. Make PDFs From HTML using DocRaptor

DocRaptor handles the conversion using HTTP post requests using JSON Support, but only provides features to convert URL and HTML files to PDF.

using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System.IO;
 class Example {
   tatic void Main(string[] args) {
    DocApi docraptor = new DocApi();
    docraptor.Configuration.Username = "YOUR_API_KEY_HERE";
     Doc doc = new Doc(
      test: true,
      //documentContent: System.IO.File.ReadAllText(@"custom-fonts-    content.html"),
        documentUrl: "http://www.docraptor.com/examples/invoice.html",
        name: "docraptor-csharp.pdf",
        documentType: Doc.DocumentTypeEnum.Pdf
      );
          yte[] createResponse = docraptor.CreateDoc(doc);
    }
using DocRaptor.Client;
using DocRaptor.Model;
using DocRaptor.Api;
using System.IO;
 class Example {
   tatic void Main(string[] args) {
    DocApi docraptor = new DocApi();
    docraptor.Configuration.Username = "YOUR_API_KEY_HERE";
     Doc doc = new Doc(
      test: true,
      //documentContent: System.IO.File.ReadAllText(@"custom-fonts-    content.html"),
        documentUrl: "http://www.docraptor.com/examples/invoice.html",
        name: "docraptor-csharp.pdf",
        documentType: Doc.DocumentTypeEnum.Pdf
      );
          yte[] createResponse = docraptor.CreateDoc(doc);
    }
Imports DocRaptor.Client
Imports DocRaptor.Model
Imports DocRaptor.Api
Imports System.IO
 Friend Class Example
   Private tatic Sub Main(ByVal args() As String)
	Dim docraptor As New DocApi()
	docraptor.Configuration.Username = "YOUR_API_KEY_HERE"
	 Dim doc As New Doc(test:= True, documentUrl:= "http://www.docraptor.com/examples/invoice.html", name:= "docraptor-csharp.pdf", documentType:= Doc.DocumentTypeEnum.Pdf)
		  Dim createResponse() As yte = docraptor.CreateDoc(doc)
   End Sub
VB   C#

8. Formatting PDFs

Both IronPDF and DocRaptor support the formatting of PDFs. However, IronPDF offers single file support, whereas DocRaptor uses multiple file support.

8.1. Formatting using IronPDF

To make sure the expected behavior of output PDF we use different formatting styles in the article we will discuss some of them and compare them with DocRaptor.

  • Custom Fonts

IronPDF supports WebFonts including the incredible Google Fonts library. This gives the developer full font control without needing to depend on system typefaces.

using IronPdf;

ChromePdfRenderer myChromePdfRenderer = new IronPdf.ChromePdfRenderer();
var Renderer = new IronPdf.ChromePdfRenderer();

var html = @"<link href=""https://fonts.googleapis.com/css?family=Lobster""
rel=""stylesheet""><p style=""font-family: 'Lobster', serif; font-size:30px;"" > Hello Google Fonts</p>";

Renderer.RenderingOptions.RenderDelay = 500;
var doc = Renderer.RenderHtmlAsPdf(html);
doc.SaveAs("font.pdf");
using IronPdf;

ChromePdfRenderer myChromePdfRenderer = new IronPdf.ChromePdfRenderer();
var Renderer = new IronPdf.ChromePdfRenderer();

var html = @"<link href=""https://fonts.googleapis.com/css?family=Lobster""
rel=""stylesheet""><p style=""font-family: 'Lobster', serif; font-size:30px;"" > Hello Google Fonts</p>";

Renderer.RenderingOptions.RenderDelay = 500;
var doc = Renderer.RenderHtmlAsPdf(html);
doc.SaveAs("font.pdf");
Imports IronPdf

Private myChromePdfRenderer As ChromePdfRenderer = New IronPdf.ChromePdfRenderer()
Private Renderer = New IronPdf.ChromePdfRenderer()

Private html = "<link href=""https://fonts.googleapis.com/css?family=Lobster""
rel=""stylesheet""><p style=""font-family: 'Lobster', serif; font-size:30px;"" > Hello Google Fonts</p>"

Renderer.RenderingOptions.RenderDelay = 500
Dim doc = Renderer.RenderHtmlAsPdf(html)
doc.SaveAs("font.pdf")
VB   C#
  • Watermarks

IronPDF provides methods to 'watermark' PDF documents with HTML. Watermarks may be set to render above or below existing content, and have the built-in capacity for opacity, rotation, and hyperlinks.

using IronPdf;

// Stamps a watermark onto a new or existing PDF
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();

var Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
Pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>",   ronPdf.Editing.WaterMarkLocation.MiddleCenter, 50, -45, "https://www.nuget.org/packages/IronPdf");
Pdf.SaveAs(@"C:\Path\To\Watermarked.pdf
using IronPdf;

// Stamps a watermark onto a new or existing PDF
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();

var Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
Pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>",   ronPdf.Editing.WaterMarkLocation.MiddleCenter, 50, -45, "https://www.nuget.org/packages/IronPdf");
Pdf.SaveAs(@"C:\Path\To\Watermarked.pdf
Imports IronPdf

' Stamps a watermark onto a new or existing PDF
Private Renderer As New IronPdf.ChromePdfRenderer()

Private Pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
Pdf.WatermarkAllPages("<h2 style='color:red'>SAMPLE</h2>", ronPdf.Editing.WaterMarkLocation.MiddleCenter, 50, -45, "https://www.nuget.org/packages/IronPdf")
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'Pdf.SaveAs("TangibleTempVerbatimOpenTagC:\Path\To\Watermarked.pdf
VB   C#
  • Page numbers

The IronPDF “Header and Footer” functionality allows us to merge information about page numbering.

// PM> Install-Package IronPdf

using IronPdf;

var html = @"
<p> Hello Iron</p>
<p> This is 1st Page </p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.HtmlFooter = new IronPdf.HtmlHeaderFooter()
{

    MaxHeight = 15, //millimeters
    HtmlFragment = "<center><i>{page} of {total-pages}<i></center>",
    DrawDividerLine = true
};

var pdfdoc = Renderer.RenderHtmlAsPdf(html);
pdfdoc.SaveAs("pageNumber.pdf");
// PM> Install-Package IronPdf

using IronPdf;

var html = @"
<p> Hello Iron</p>
<p> This is 1st Page </p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.HtmlFooter = new IronPdf.HtmlHeaderFooter()
{

    MaxHeight = 15, //millimeters
    HtmlFragment = "<center><i>{page} of {total-pages}<i></center>",
    DrawDividerLine = true
};

var pdfdoc = Renderer.RenderHtmlAsPdf(html);
pdfdoc.SaveAs("pageNumber.pdf");
' PM> Install-Package IronPdf

Imports IronPdf

Private html = "
<p> Hello Iron</p>
<p> This is 1st Page </p>
<div style = 'page-break-after: always;' ></div>
<p> This is 2nd Page</p>
<div style = 'page-break-after: always;' ></div>
<p> This is 3rd Page</p>"

Private Renderer = New IronPdf.ChromePdfRenderer()

Renderer.RenderingOptions.HtmlFooter = New IronPdf.HtmlHeaderFooter() With {
	.MaxHeight = 15,
	.HtmlFragment = "<center><i>{page} of {total-pages}<i></center>",
	.DrawDividerLine = True
}

Dim pdfdoc = Renderer.RenderHtmlAsPdf(html)
pdfdoc.SaveAs("pageNumber.pdf")
VB   C#

8.2. Formatting using DocRaptor

DocRaptor supports PDF formatting in .NET API — but is quite difficult to handle. Let's examine three previous formatting examples:

  • Custom Fonts

Custom fonts are easy to use in DocRaptor. It works in the same manner as for a standard webpage. Here's a CSS example using a Google font:

CSS coding:

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: local('Open Sans Light'), local('OpenSans-Light'), url(http://themes.googleusercontent.com/static/fonts/opensans/v8/DXI1ORHCpsQm3Vp6mXoaTaRDOzjiPcYnFooOUGCOsRk.woff) format('woff');
}
p {
  font-family: Arial, Helvetica, sans-serif;
}
p.custom-font {
  font-family: 'Open Sans', sans-serif;
}
HTML

HTML coding:

<h2>Custom Fonts</h2>
<p>Hi, my name is Arial.</p>
<p class='custom-font'>I like to walk on the beach on warm Open Sans.</p>
HTML

C# coding:

class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";
         try
        {
            Doc doc = new Doc(
                name: "custom-fonts",
                test: true, // test documents are free but watermarked
                documentContent: System.IO.File.ReadAllText(@"custom-fonts-content.html"), 
                 / documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables   rocessing
            );
             byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("custom-fonts.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";
         try
        {
            Doc doc = new Doc(
                name: "custom-fonts",
                test: true, // test documents are free but watermarked
                documentContent: System.IO.File.ReadAllText(@"custom-fonts-content.html"), 
                 / documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables   rocessing
            );
             byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("custom-fonts.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
Friend Class Example
	Shared Sub Main(ByVal args() As String)
		Dim docraptor As New DocApi()
		docraptor.Configuration.Username = "YOUR_API_KEY_HERE"
		 Try
			Dim doc As New Doc(name:= "custom-fonts", test:= True, documentContent:= System.IO.File.ReadAllText("custom-fonts-content.html"), / documentUrl:= "http://docraptor.com/examples/invoice.html", documentType:= Doc.DocumentTypeEnum.Pdf)
			 Dim create_response() As Byte = docraptor.CreateDoc(doc)
			File.WriteAllBytes("custom-fonts.pdf", create_response)
		Catch [error] As DocRaptor.Client.ApiException
			Console.Write([error].ErrorContent)
		End Try
	End Sub
End Class
VB   C#

OUTPUT

  • Watermarks

Watermarks may be found on a lot of PDFs. Fortunately, DocRaptor's HTML-PDF tool helps make the creation of dynamically-produced watermarked documents a breeze!

CSS coding:

#watermark {
  flow: static(watermarkflow);
  font-size: 120px;
  opacity: 0.5;
  transform: rotate(-30deg);
  text-align: center;
}
HTML

HTML coding:

<body><div id="watermark">PREVIEW</div>
<div style="page-break-after: always;">Page 1</div>
<div style="page-break-after: always;">Page 2</div>
<div style="page-break-after: always;">Page 3</div>
</body>
HTML

C# coding:

class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "text-based-watermark",
                test: false, // test documents are free but watermarked
                documentContent: System.IO.File.ReadAllText(@"text-based-watermark-content.html"), 
                // documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables processing
            );

            byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("text-based-watermark.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "text-based-watermark",
                test: false, // test documents are free but watermarked
                documentContent: System.IO.File.ReadAllText(@"text-based-watermark-content.html"), 
                // documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables processing
            );

            byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("text-based-watermark.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
Friend Class Example
	Shared Sub Main(ByVal args() As String)
		Dim docraptor As New DocApi()
		docraptor.Configuration.Username = "YOUR_API_KEY_HERE"

		Try
			Dim doc As New Doc(name:= "text-based-watermark", test:= False, documentContent:= System.IO.File.ReadAllText("text-based-watermark-content.html"), documentType:= Doc.DocumentTypeEnum.Pdf)

			Dim create_response() As Byte = docraptor.CreateDoc(doc)
			File.WriteAllBytes("text-based-watermark.pdf", create_response)
		Catch [error] As DocRaptor.Client.ApiException
			Console.Write([error].ErrorContent)
		End Try
	End Sub
VB   C#
  • Page Numbers

With open-source HTML to PDF tools, adding page numbers to PDF documents is difficult and sometimes almost impossible, but DocRaptor makes it a breeze!

CSS coding:

@page {
  @bottom {
    content: "Page " counter(page, upper-alpha) " of " counter(pages, decimal);
  } } 
HTML

HTML coding:

<body>
<div style="page-break-after: always;">Page1</div>
<div style="page-break-after: always;">Page2</div>
<div style="page-break-after: always;">Page3</div>
<div id="page4" style="page-break-after: always;">Page4, with reset page counter</div>
</body>
HTML

C# coding:

class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "page-numbers",
                test: true, // test documents are  but watermarked
                documentContent: System.IO.File.ReadAllText(@"page-numbers-content.html"), 
                // documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables processing
            );

            byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("page-numbers.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
class Example
{
    static void Main(string[] args)
    {
        DocApi docraptor = new DocApi();
        docraptor.Configuration.Username = "YOUR_API_KEY_HERE";

        try
        {
            Doc doc = new Doc(
                name: "page-numbers",
                test: true, // test documents are  but watermarked
                documentContent: System.IO.File.ReadAllText(@"page-numbers-content.html"), 
                // documentUrl: "http://docraptor.com/examples/invoice.html", // or use a url
                documentType: Doc.DocumentTypeEnum.Pdf
                // javascript: false, // enables processing
            );

            byte[] create_response = docraptor.CreateDoc(doc);
            File.WriteAllBytes("page-numbers.pdf", create_response);
        } catch (DocRaptor.Client.ApiException error) {
            Console.Write(error.ErrorContent);
        }
    }
}
Friend Class Example
	Shared Sub Main(ByVal args() As String)
		Dim docraptor As New DocApi()
		docraptor.Configuration.Username = "YOUR_API_KEY_HERE"

		Try
			Dim doc As New Doc(name:= "page-numbers", test:= True, documentContent:= System.IO.File.ReadAllText("page-numbers-content.html"), documentType:= Doc.DocumentTypeEnum.Pdf)

			Dim create_response() As Byte = docraptor.CreateDoc(doc)
			File.WriteAllBytes("page-numbers.pdf", create_response)
		Catch [error] As DocRaptor.Client.ApiException
			Console.Write([error].ErrorContent)
		End Try
	End Sub
End Class
VB   C#

9. Licensing

DocRaptor is an API-based document converter that converts HTML files and URLs to PDFs, as well as XML to XLSX files. It supports eight different programming languages. However, it only provides monthly licensing with a document limit, starting from a free license with a five document limit per month, up to a silver package which includes a 40,000 document limit and a price tag of $1000 per month. DocRaptor is great for small organizations and offers a smaller professional package with a 325 document limit for $29. Check this link for more prices.

Note:

DocRaptor does not provide a one-time purchase or project-based licenses.

IronPDF is a library that provides a developer's license for free. IronPDF also has a distinct pricing structure: the lite bundle starts at $499 with no hidden fees. The redistribution of SaaS and OEM products is also possible. All licenses come with a 30-day money-back guarantee, a year of software support and upgrades, dev/staging/production validity, and a perpetual license (one-time purchase). To see IronPDF's entire price structure and license, go here.

Note:

IronPDF provides the option to connect and join two or more PDFs together. It also provides the option to extract pages, copy pages, remove specific pages, and multithreaded PDF-generation, something which its competitor does not offer.

10. Summary

From a remote server, IronPDF does not generate HTML to PDF. Behind the scenes, it starts an instance of a true standard-compliant browser (without any additional software needing to be installed). The HTML is rendered with total accuracy — and in a vector format suited for commercial printing to the highest standards. The result is a crisp, high-quality PDF. License and price information is readily available on the webpage.

DocRaptor also transforms HTML in any format to PDF with maximum accuracy and minimal downtime, thanks to the fact that it operates on numerous cloud servers. DocRaptor is a web-based API that provides an online PDF conversion service. The DocRaptor HTML to PDF API is straightforward to use thanks to the server-side API client libraries. These libraries may be found in a number of prominent server-side programming languages. The webpage has pricing information.

11. Conclusion

In the above article we compared both tools and concluded that, for .NET or C# document conversion, developers prefer IronPDF over DocRaptor for many reasons. IronPDF offers more features than DocRaptor. DocRaptor offers good packages for small organizations, but it is quite expensive and does not provide an ongoing license over the longer term. On the other hand, IronPDF offers more features and a single-time purchase license at a lower price. IronPDF is preferable for both small organizations and big-infrastructure organizations. DocRaptor can be useful when dealing with PDFs on different server-side platforms. Moreover, IronPDF packages provide a lifetime license, and there are no ongoing costs, while DocRaptor does have ongoing costs.