A Comparison between IronPDF & iText7

Convert your webpages into PDF documents quickly and easily using the IronPDF library for C# and Java. IronPDF supports all forms of HTML content and renders them with pixel-perfect precision. No fuss. No stress. This library just simply works.

Continue reading to learn about how IronPDF for C# stacks up against the iText7 PDF Library for .NET. For the comparison between the Java version of both libraries, refer to this blog post.

Note: This comparison article was written in 1 September 2022. Its content may not reflect current versions of both libraries accurately.


The need to generate PDFs in C# is something that arises on a fairly regular basis. However, there is nothing in C# or .NET Core that can generate PDFs for you natively. Moreover, the feature sets of many third-party libraries often lack the essential features needed to accomplish this task satisfactorily.

This article will compare two libraries reportedly capable of converting HTML content into PDFs.

IronPDF and iText 7 are two libraries that can be used in Microsoft .NET application to create, read, and edit PDF documents, whether they are online or on a desktop with better internal PDF structures.

This article will examine the two libraries to see which one is better suited for working with PDF documents under specific cases by comparing the features using code examples.

What is IronPDF?

IronPDF is a highly efficient PDF tool and capable PDF converter that can do practically anything a browser can. It's a PDF library for programmers that makes creating, reading, and manipulating PDF files a breeze using low-level programming capabilities. IronPDF converts HTML to PDF using the Chrome engine. IronPDF supports Windows forms, HTML, ASPX, Razor HTML, .NET Core, ASP.NET, Windows Forms, WPF, Xamarin, Blazor, Unity, and HoloLense apps, among other web components. Microsoft.NET and .NET Core apps are supported by IronPDF (both ASP.NET Web applications and traditional Windows applications) to make your own applications. IronPDF can also be used to create visually appealing PDFs.

IronPDF can convert HTML5, JavaScript, CSS, and pictures into PDF documents, and build custom PDF scenarios. A header and footer can also be included in the files. It can also make it easier for us to view PDF files. IronPDF comes with a robust HTML-to-PDF converter that works with PDF files. It also has a powerful PDF conversion engine. Furthermore, it has no external dependencies. IronPDF shows more benefits PDF can bring.

IronPDF Features

  • Sources that can be used to create a PDF document include HTML, HTML5, ASPX, and Razor/MVC View using IronPDF as a better document engine. Not only can we convert HTML files to PDF, but we can also convert image files.
  • The ability to create edit interactive PDF documents, fill out and submit interactive forms, combine and divide PDF documents, extract text and images from PDF documents, replace text in PDF documents, rasterize PDF pages to images, convert PDF documents, and much more.
  • As a starting point, create a document using the link. It also supports custom network login credentials, user-agents, proxies, cookies, HTTP headers, and form variables for login behind HTML login forms.
  • By specifying usernames and passwords, IronPDF allows us to open protected documents.
  • IronPDF is a program that reads and fills in the blanks in existing PDF documents even for those with low-level programming capabilities.
  • It can extract images from documents.
  • It allows us to add headers and footers to documents, as well as text, images, bookmarks, watermarks, and more.
  • It gives us the ability to split and merge pages in a new or existing document.
  • Without utilizing Acrobat Reader, we can convert documents to PDF objects.
  • A CSS file can be converted into a PDF document.
  • Media files of the CSS file type can be turned into documents.
  • Fill out existing PDF forms and add new ones.

What is iText 7

The iText 7 Suite is a comprehensive PDF SDK that comprises the open-source iText 7 Core PDF library as well as optional add-ons to meet your specific requirements. The iText 7 Core PDF library is a reworking of the popular iText 5 engine with a modular code structure, and low-level functionality, enabling future advancements and expansion as well as simplified coding.

The development of iText 7 was based on nearly a decade of lessons learned during the development of iText 5 (and iTextSharp). One add-on at a time, it's a simpler, more performant, and extensible library that's ready to manage the additional complexities of today's document processes.

iText 7 features

  • PDF creation in bulk, including tagged PDFs with metadata describing the document's structure and the order of its elements (e.g. titles, text blocks, columns and pictures)
  • Image-to-PDF conversion
  • HTML-to-PDF conversion (with the pdfHTML iText add-on)
  • iText 7 is unique in that it supports a wide range of languages, including Indic languages, Thai, Khmer, Arabi, Hebrew, Chinese, Japanese, Korean, and Cyrillic languages, among others (with the pdfCalligraph iText add-on)

Installing iText

Go to File > New > Project in Visual Studio.

Select Console App (.NET Framework) and give the project a name in the "New Project window".

Selecting the Console App(.NET Framework)

Select "Manage NuGet Packages" from the context menu when right-clicking the project name.

Selecting NuGet Packages

Select "Browse" and type itext7 in the search box. Select itext7 from the results and install it

Selecting itext7

Classic ASP.

Installing IronPDF

There are four ways to obtain and install the IronPDF Library.

These are the following:

Using the Visual Studio NuGet Package Manager, Visual Studio is a program that gives you the ability to create and edit documents.

  • Using the Command-Line in Visual Studio.
  • Download directly from the NuGet website.
  • Download directly from the IronPDF website.

Using Visual Studio

The screenshot below demonstrates how to use the NuGet Package Manager.

Search for the keyword "IronPDF" in the package manager, as shown in the screenshot below:

Using the Command-Line in Visual Studio

Navigate to Tools > NuGet Package Manager > Package Manager Console in Visual Studio.

In the package manager console tab, type the following line.

Install-Package IronPdf

Create enhanced PDF documents from URLs

Both PDF libraries assist us in converting HTML pages into attractive PDFs.

Using IronPDF

IronPDF makes it easy to create a PDF document by generating an HTML file from a URL and converting it to a PDF document. The HTML string will be downloaded using IronPDF's built-in Chrome browser.

The steps below make it easy to create PDF documents:

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://www.google.co.in/");
Pdf.SaveAs("result.pdf");
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
var Pdf = Renderer.RenderUrlAsPdf("https://www.google.co.in/");
Pdf.SaveAs("result.pdf");
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim Pdf = Renderer.RenderUrlAsPdf("https://www.google.co.in/")
Pdf.SaveAs("result.pdf")
VB   C#

Using iText 7

The example createPdf() method has a very simple implementation. Its body is made up of just one line:

public void createPdf(string html, string dest)
{
    HtmlConverter.ConvertToPdf(html, new FileStream(dest, FileMode.Create));
}
public void createPdf(string html, string dest)
{
    HtmlConverter.ConvertToPdf(html, new FileStream(dest, FileMode.Create));
}
Public Sub createPdf(ByVal html As String, ByVal dest As String)
	HtmlConverter.ConvertToPdf(html, New FileStream(dest, FileMode.Create))
End Sub
VB   C#

The HtmlConverter object provides several PDF conversion methods, each of which takes a different set of parameters based on the use case. The first parameter HTML in the first example is a string with the following value:

public static String HTML = "<h1>Test</h1><p>Hello World</p>";
public static String HTML = "<h1>Test</h1><p>Hello World</p>";
Public Shared HTML As String = "<h1>Test</h1><p>Hello World</p>"
VB   C#

Reading PDF Documents

IronPDF and iText 7 can also extract text content from PDFs. To extract the text, we can utilize one of two approaches. The first is to get a single string containing all the page data. The second is to obtain the data one page at a time.

Extracting Text from PDFs Using IronPDF

IronPDF allows us to read a PDF file that already exists. The sample source code for reading existing PDFs using IronPDF is provided below.

The first approach is to retrieve all the data as a string as shown below.

var pdfDocument = IronPdf.PdfDocument.FromFile("result.pdf");
string AllText = pdfDocument.ExtractAllText();
var pdfDocument = IronPdf.PdfDocument.FromFile("result.pdf");
string AllText = pdfDocument.ExtractAllText();
Dim pdfDocument = IronPdf.PdfDocument.FromFile("result.pdf")
Dim AllText As String = pdfDocument.ExtractAllText()
VB   C#

The Fromfile method is used to read the PDF from an existing file and transform it into a PdfDocument object in the sample code above. This object has a method called ExtractAllText, which returns the text content in a PDF document as a string.

The second approach to obtaining the text from one page or multiple pages is shown below:

var pdfDocument =IronPdf.PdfDocument.FromFile("result.pdf");
string onePageText = pdfDocument.ExtractTextFromPage(0);
string pagesText = pdfDocument.ExtractTextFromPages(new[] { 1, 2 });
var pdfDocument =IronPdf.PdfDocument.FromFile("result.pdf");
string onePageText = pdfDocument.ExtractTextFromPage(0);
string pagesText = pdfDocument.ExtractTextFromPages(new[] { 1, 2 });
Dim pdfDocument =IronPdf.PdfDocument.FromFile("result.pdf")
Dim onePageText As String = pdfDocument.ExtractTextFromPage(0)
Dim pagesText As String = pdfDocument.ExtractTextFromPages( { 1, 2 })
VB   C#

Extracting Text from PDFs Using iText 7

To read a PDF file using iText, follow the steps below.

  • Make a PDFReader object and wrap it in a PDFDocument.
  • Use the getNumberOfPages Find out how many pages there are in the PDF that need to be read.
  • Using PdfTextExtractor, iterate through the pages and extract the content of each one.
import java.io.IOException;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.kernel.pdf.canvas.parser.PdfTextExtractor;

public class ReadPDF {
  public static final String READ_PDF = "F://knpcode//result//List.pdf";
  public static void main(String[] args) {
  try {
    // PDFReader
    PdfReader reader = new PdfReader(READ_PDF);
    PdfDocument pdfDoc = new PdfDocument(reader);
    // get the number of pages in PDF
    int noOfPages = pdfDoc.getNumberOfPages();
    System.out.println("Extracted content of PDF---- ");
    for(int i = 1; i <= noOfPages; i++) {
      // Extract content of each page
      String contentOfPage = PdfTextExtractor.getTextFromPage(pdfDoc.getPage(i));
      System.out.println(contentOfPage );
    }
    pdfDoc.close();
    }catch (IOException e) {
      System.out.println("Exception occurred " + e.getMessage());
    }
  }
}
import java.io.IOException;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.kernel.pdf.canvas.parser.PdfTextExtractor;

public class ReadPDF {
  public static final String READ_PDF = "F://knpcode//result//List.pdf";
  public static void main(String[] args) {
  try {
    // PDFReader
    PdfReader reader = new PdfReader(READ_PDF);
    PdfDocument pdfDoc = new PdfDocument(reader);
    // get the number of pages in PDF
    int noOfPages = pdfDoc.getNumberOfPages();
    System.out.println("Extracted content of PDF---- ");
    for(int i = 1; i <= noOfPages; i++) {
      // Extract content of each page
      String contentOfPage = PdfTextExtractor.getTextFromPage(pdfDoc.getPage(i));
      System.out.println(contentOfPage );
    }
    pdfDoc.close();
    }catch (IOException e) {
      System.out.println("Exception occurred " + e.getMessage());
    }
  }
}
Private java As import
Private com As import
Private com As import
Private com As import

Public Class ReadPDF
  Public Shared String As final
  Public Shared Sub main(ByVal args() As String)
  Try
	' PDFReader
	Dim reader As New PdfReader(READ_PDF)
	Dim pdfDoc As New PdfDocument(reader)
	' get the number of pages in PDF
	Dim noOfPages As Integer = pdfDoc.getNumberOfPages()
	System.out.println("Extracted content of PDF---- ")
	For i As Integer = 1 To noOfPages
	  ' Extract content of each page
	  Dim contentOfPage As String = PdfTextExtractor.getTextFromPage(pdfDoc.getPage(i))
	  System.out.println(contentOfPage)
	Next i
	pdfDoc.close()
	Catch e As IOException
	  System.out.println("Exception occurred " & e.getMessage())
	End Try
  End Sub
End Class
VB   C#

Digital signatures

Creating Digital Signatures Using IronPDF

The following code example creates a C# Windows Form that allows users to sign a PDF of his choosing with a pre-defined .pfx key.

using System.Drawing;
using System.Windows.Forms;
using IronPdf;
namespace digitalsign
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent(); 
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            //select the desired pdf file
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName;
            }
        }
        private void button2_Click(object sender, System.EventArgs e)
        {
            //Here we have called an PDFSignature method to digitally sign the Existing PDF
            new PdfSignature("Ironpdf.pfx", "123456").SignPdfFile(textBox1.Text);
            //Used as confirmation
            label3.Text = "Completed !";
            label3.BackColor = Color.LightGreen;
            label3.ForeColor = Color.Black;
        }
    }
}
using System.Drawing;
using System.Windows.Forms;
using IronPdf;
namespace digitalsign
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent(); 
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            //select the desired pdf file
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = openFileDialog1.FileName;
            }
        }
        private void button2_Click(object sender, System.EventArgs e)
        {
            //Here we have called an PDFSignature method to digitally sign the Existing PDF
            new PdfSignature("Ironpdf.pfx", "123456").SignPdfFile(textBox1.Text);
            //Used as confirmation
            label3.Text = "Completed !";
            label3.BackColor = Color.LightGreen;
            label3.ForeColor = Color.Black;
        }
    }
}
Imports System.Drawing
Imports System.Windows.Forms
Imports IronPdf
Namespace digitalsign
	Partial Public Class Form1
		Inherits Form

		Public Sub New()
			InitializeComponent()
		End Sub
		Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			'select the desired pdf file
			If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
				textBox1.Text = openFileDialog1.FileName
			End If
		End Sub
		Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			'Here we have called an PDFSignature method to digitally sign the Existing PDF
			Call (New PdfSignature("Ironpdf.pfx", "123456")).SignPdfFile(textBox1.Text)
			'Used as confirmation
			label3.Text = "Completed !"
			label3.BackColor = Color.LightGreen
			label3.ForeColor = Color.Black
		End Sub
	End Class
End Namespace
VB   C#

Creating Digital Signatures Using iText 7

/*

This file is part of the iText (R) project.
Copyright (c) 1998-2019 iText Group NV

*/
/*
* This class is part of the white paper entitled
* "Digital Signatures for PDF documents"
* written by Bruno Lowagie
*
* For more info, go to: http://itextpdf.com/learn
*/

using System;
using System.IO;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.X509;
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Signatures;
using Org.BouncyCastle.Pkcs;

namespace iText.Samples.Signatures.Chapter02
{
    public class C2_01_SignHelloWorld
    {
        public static readonly string DEST = "../../results/signatures/chapter02/";

        public static readonly string KEYSTORE = "../../resources/encryption/ks";
        public static readonly string SRC = "../../resources/pdfs/hello.pdf";

        public static readonly char[] PASSWORD = "password".ToCharArray();

        public static readonly String[] RESULT_FILES =
        {
            "hello_signed1.pdf",
            "hello_signed2.pdf",
            "hello_signed3.pdf",
            "hello_signed4.pdf"
        };

        public void Sign(String src, String dest, X509Certificate[] chain, ICipherParameters pk,
            String digestAlgorithm, PdfSigner.CryptoStandard subfilter, String reason, String location)
        {
            PdfReader reader = new PdfReader(src);
            PdfSigner signer = new PdfSigner(reader, new FileStream(dest, FileMode.Create), new StampingProperties());

            // Create the signature appearance
            Rectangle rect = new Rectangle(36, 648, 200, 100);
            PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
            appearance
                .SetReason(reason)
                .SetLocation(location)

                // Specify if the appearance before field is signed will be used
                // as a background for the signed field. The "false" value is the default value.
                .SetReuseAppearance(false)
                .SetPageRect(rect)
                .SetPageNumber(1);
            signer.SetFieldName("sig");

            IExternalSignature pks = new PrivateKeySignature(pk, digestAlgorithm);

            // Sign the document using the detached mode, CMS or CAdES equivalent.
            signer.SignDetached(pks, chain, null, null, null, 0, subfilter);
        }

        public static void Main(String[] args)
        {
            DirectoryInfo directory = new DirectoryInfo(DEST);
            directory.Create();

            Pkcs12Store pk12 = new Pkcs12Store(new FileStream(KEYSTORE, FileMode.Open, FileAccess.Read), PASSWORD);
            string alias = null;
            foreach (var a in pk12.Aliases)
            {
                alias = ((string) a);
                if (pk12.IsKeyEntry(alias))
                    break;
            }

            ICipherParameters pk = pk12.GetKey(alias).Key;
            X509CertificateEntry[] ce = pk12.GetCertificateChain(alias);
            X509Certificate[] chain = new X509Certificate[ce.Length];
            for (int k = 0; k < ce.Length; ++k)
            {
                chain[k] = ce[k].Certificate;
            }

            C2_01_SignHelloWorld app = new C2_01_SignHelloWorld();
            app.Sign(SRC, DEST + RESULT_FILES[0], chain, pk, DigestAlgorithms.SHA256,
                PdfSigner.CryptoStandard.CMS, "Test 1", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[1], chain, pk, DigestAlgorithms.SHA512,
                PdfSigner.CryptoStandard.CMS, "Test 2", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[2], chain, pk, DigestAlgorithms.SHA256,
                PdfSigner.CryptoStandard.CADES, "Test 3", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[3], chain, pk, DigestAlgorithms.RIPEMD160,
                PdfSigner.CryptoStandard.CADES, "Test 4", "Ghent");
        }
    }
}
/*

This file is part of the iText (R) project.
Copyright (c) 1998-2019 iText Group NV

*/
/*
* This class is part of the white paper entitled
* "Digital Signatures for PDF documents"
* written by Bruno Lowagie
*
* For more info, go to: http://itextpdf.com/learn
*/

using System;
using System.IO;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.X509;
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Signatures;
using Org.BouncyCastle.Pkcs;

namespace iText.Samples.Signatures.Chapter02
{
    public class C2_01_SignHelloWorld
    {
        public static readonly string DEST = "../../results/signatures/chapter02/";

        public static readonly string KEYSTORE = "../../resources/encryption/ks";
        public static readonly string SRC = "../../resources/pdfs/hello.pdf";

        public static readonly char[] PASSWORD = "password".ToCharArray();

        public static readonly String[] RESULT_FILES =
        {
            "hello_signed1.pdf",
            "hello_signed2.pdf",
            "hello_signed3.pdf",
            "hello_signed4.pdf"
        };

        public void Sign(String src, String dest, X509Certificate[] chain, ICipherParameters pk,
            String digestAlgorithm, PdfSigner.CryptoStandard subfilter, String reason, String location)
        {
            PdfReader reader = new PdfReader(src);
            PdfSigner signer = new PdfSigner(reader, new FileStream(dest, FileMode.Create), new StampingProperties());

            // Create the signature appearance
            Rectangle rect = new Rectangle(36, 648, 200, 100);
            PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
            appearance
                .SetReason(reason)
                .SetLocation(location)

                // Specify if the appearance before field is signed will be used
                // as a background for the signed field. The "false" value is the default value.
                .SetReuseAppearance(false)
                .SetPageRect(rect)
                .SetPageNumber(1);
            signer.SetFieldName("sig");

            IExternalSignature pks = new PrivateKeySignature(pk, digestAlgorithm);

            // Sign the document using the detached mode, CMS or CAdES equivalent.
            signer.SignDetached(pks, chain, null, null, null, 0, subfilter);
        }

        public static void Main(String[] args)
        {
            DirectoryInfo directory = new DirectoryInfo(DEST);
            directory.Create();

            Pkcs12Store pk12 = new Pkcs12Store(new FileStream(KEYSTORE, FileMode.Open, FileAccess.Read), PASSWORD);
            string alias = null;
            foreach (var a in pk12.Aliases)
            {
                alias = ((string) a);
                if (pk12.IsKeyEntry(alias))
                    break;
            }

            ICipherParameters pk = pk12.GetKey(alias).Key;
            X509CertificateEntry[] ce = pk12.GetCertificateChain(alias);
            X509Certificate[] chain = new X509Certificate[ce.Length];
            for (int k = 0; k < ce.Length; ++k)
            {
                chain[k] = ce[k].Certificate;
            }

            C2_01_SignHelloWorld app = new C2_01_SignHelloWorld();
            app.Sign(SRC, DEST + RESULT_FILES[0], chain, pk, DigestAlgorithms.SHA256,
                PdfSigner.CryptoStandard.CMS, "Test 1", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[1], chain, pk, DigestAlgorithms.SHA512,
                PdfSigner.CryptoStandard.CMS, "Test 2", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[2], chain, pk, DigestAlgorithms.SHA256,
                PdfSigner.CryptoStandard.CADES, "Test 3", "Ghent");
            app.Sign(SRC, DEST + RESULT_FILES[3], chain, pk, DigestAlgorithms.RIPEMD160,
                PdfSigner.CryptoStandard.CADES, "Test 4", "Ghent");
        }
    }
}
'
'
'This file is part of the iText (R) project.
'Copyright (c) 1998-2019 iText Group NV
'
'
'
'* This class is part of the white paper entitled
'* "Digital Signatures for PDF documents"
'* written by Bruno Lowagie
'*
'* For more info, go to: http://itextpdf.com/learn
'

Imports System
Imports System.IO
Imports Org.BouncyCastle.Crypto
Imports Org.BouncyCastle.X509
Imports iText.Kernel.Geom
Imports iText.Kernel.Pdf
Imports iText.Signatures
Imports Org.BouncyCastle.Pkcs

Namespace iText.Samples.Signatures.Chapter02
	Public Class C2_01_SignHelloWorld
		Public Shared ReadOnly DEST As String = "../../results/signatures/chapter02/"

		Public Shared ReadOnly KEYSTORE As String = "../../resources/encryption/ks"
		Public Shared ReadOnly SRC As String = "../../resources/pdfs/hello.pdf"

		Public Shared ReadOnly PASSWORD() As Char = "password".ToCharArray()

		Public Shared ReadOnly RESULT_FILES() As String = { "hello_signed1.pdf", "hello_signed2.pdf", "hello_signed3.pdf", "hello_signed4.pdf" }

		Public Sub Sign(ByVal src As String, ByVal dest As String, ByVal chain() As X509Certificate, ByVal pk As ICipherParameters, ByVal digestAlgorithm As String, ByVal subfilter As PdfSigner.CryptoStandard, ByVal reason As String, ByVal location As String)
			Dim reader As New PdfReader(src)
			Dim signer As New PdfSigner(reader, New FileStream(dest, FileMode.Create), New StampingProperties())

			' Create the signature appearance
			Dim rect As New Rectangle(36, 648, 200, 100)
			Dim appearance As PdfSignatureAppearance = signer.GetSignatureAppearance()
			appearance.SetReason(reason).SetLocation(location).SetReuseAppearance(False).SetPageRect(rect).SetPageNumber(1)
			signer.SetFieldName("sig")

			Dim pks As IExternalSignature = New PrivateKeySignature(pk, digestAlgorithm)

			' Sign the document using the detached mode, CMS or CAdES equivalent.
			signer.SignDetached(pks, chain, Nothing, Nothing, Nothing, 0, subfilter)
		End Sub

		Public Shared Sub Main(ByVal args() As String)
			Dim directory As New DirectoryInfo(DEST)
			directory.Create()

			Dim pk12 As New Pkcs12Store(New FileStream(KEYSTORE, FileMode.Open, FileAccess.Read), PASSWORD)
			Dim [alias] As String = Nothing
			For Each a In pk12.Aliases
				[alias] = (CStr(a))
				If pk12.IsKeyEntry([alias]) Then
					Exit For
				End If
			Next a

			Dim pk As ICipherParameters = pk12.GetKey([alias]).Key
			Dim ce() As X509CertificateEntry = pk12.GetCertificateChain([alias])
			Dim chain(ce.Length - 1) As X509Certificate
			For k As Integer = 0 To ce.Length - 1
				chain(k) = ce(k).Certificate
			Next k

			Dim app As New C2_01_SignHelloWorld()
			app.Sign(SRC, DEST & RESULT_FILES(0), chain, pk, DigestAlgorithms.SHA256, PdfSigner.CryptoStandard.CMS, "Test 1", "Ghent")
			app.Sign(SRC, DEST & RESULT_FILES(1), chain, pk, DigestAlgorithms.SHA512, PdfSigner.CryptoStandard.CMS, "Test 2", "Ghent")
			app.Sign(SRC, DEST & RESULT_FILES(2), chain, pk, DigestAlgorithms.SHA256, PdfSigner.CryptoStandard.CADES, "Test 3", "Ghent")
			app.Sign(SRC, DEST & RESULT_FILES(3), chain, pk, DigestAlgorithms.RIPEMD160, PdfSigner.CryptoStandard.CADES, "Test 4", "Ghent")
		End Sub
	End Class
End Namespace
VB   C#

Pricing and Licensing

iText uses a dual-licensing model. As a result, it provides both commercial and AGPL licenses.

IronPDF provides transparent pricing with licenses from $749, with many customizable options.

IronPDF is free-to-use in development environments, but requires a commercial licenses for use in production. Obtain a trial license key to use IronPDF in production for free for 30 days. By browsing through the IronPDF licenses, you can find one that suits both your needs and your budget.