COMPARAISON DES PRODUITS

iTextSharp C# HTML to PDF Alternative pour .NET Core

Publié octobre 23, 2024
Partager:

IronPDF etiText 7 (anciennement connu sous le nom de iTextSharp) ces deux outils permettent de générer, de manipuler et d'analyser des donnéesimprimer des PDF dans .NET et .NET Core.

QuiBibliothèque PDF C# est le mieux adapté à votre projet .NET ? L'objectif de cet article est d'aider les lecteurs à prendre une décision correcte et éclairée.

IronPDF est une bibliothèque PDF .NET de premier plan qui permet aux développeurs de créer, de modifier et d'interagir facilement avec des documents PDF. Il prend en charge divers environnements .NET, notamment .NET Core, .NET 8, 7, 6 et Framework, ce qui le rend très polyvalent. Les principales fonctionnalités d'IronPDF comprennent la conversion de HTML en PDF, la fusion de PDF, le chiffrement et les signatures numériques. La documentation est conviviale et l'assistance technique est solide.

iTextSharp est une puissante bibliothèque PDF pour la plateforme .NET, dérivée à l'origine d'iText(qui est basé sur Java). Il fournit des solutions d'entreprise pour la création et la manipulation de PDF et est disponible sous les deux formes suivantes : open-source et open-source(AGPL) et les licences commerciales. La bibliothèque de base iTextSharp offre un haut degré de flexibilité, permettant aux développeurs de créer des PDF à partir de zéro, de gérer des formulaires, d'appliquer des signatures numériques, d'ajouter des fonctionnalités PDF, et bien plus encore.

Compatibilité multiplateforme

IronPDF est:

  • .NET d'abord
  • Une démarche commerciale ouverte, avec des prix publiés
  • L'accent est mis sur le rendu des PDF à partir de HTML, de sorte que les développeurs n'ont pas besoin d'apprendre le fonctionnement des PDF
  • Un excellent choix pour les codeurs pragmatiques qui essaient de faire leur travail.

    iText(iTextSharp) est:

  • Java d'abord
  • Il s'agit d'une source très ouverte. Nous pouvons les appeler, pour un devis, pour une utilisation autre que dans les projets AGLP strictement open source.
  • L'accent est mis sur le rendu des PDF à l'aide d'une API programmatique basée sur le fonctionnement interne des PDF
  • Un excellent choix pour les projets libres et académiques

    IronPDFprend en charge un large éventail de plateformes et d'environnements, assurant une intégration et un déploiement transparents dans divers systèmes :

    iTextSharp le logiciel iText existe depuis au moins 6 ans, il est basé sur une base de code Java open-source appelée iText, et a toujours un peu la saveur de Java. Les développeurs qui ont appris Java pour la première fois peuvent trouver cette bibliothèque familière.

    IronPDF est une bibliothèque .NET avec une API conçue pour faciliter l'utilisation de Visual Studio. .NET existe depuis près de 20 ans, se développe et s'étend continuellement, et ouvre de nombreuses possibilités, dont IronPDF est conçu pour tirer parti. Il nous permet de créer et de manipuler des documents PDF dans des projets .NET framework. Vous pouvez télécharger IronPDF en tant quebibliothèque PDF alternative pour les utilisateurs d'iTextSharp.

    • .NET Core(8, 7, 6, 5 et 3.1+)

    • standard .NET(2.0+)
  • framework .NET(4.6.2+)
  • Environnements d'application : IronPDF fonctionne dans des environnements d'application comprenant Windows, Linux, Mac, Docker, Azure et AWS
  • IDEs : Fonctionne avec des IDEs tels que Microsoft Visual Studio et JetBrains Rider & ReSharper
  • Systèmes d'exploitation et processeurs : Prend en charge plusieurs systèmes d'exploitation et processeurs différents, y compris Windows, Mac, Linux, x64, x86, ARM

iTextSharp :

  • Versions .NET : Prend en charge .NET Core(2.x, 3.x), Framework .NET(4.6.1+)lA TRADUCTION DOIT ÊTRE RÉALISÉE EN ANGLAIS, EN FRANÇAIS ET EN ESPAGNOL, EN .NET 5+.
  • Environnements d'application : Fonctionne sous Windows, macOS, Linux et Docker.
  • Open Source: Disponible sous licence AGPL.

Comparaison des principales fonctionnalités : IronPDF vs. iTextSharp

IronPDF et iTextSharp offrent tous deux une gamme de fonctionnalités et d'outils qui peuvent être utilisés pour travailler avec des fichiers PDF ; L’accent de cette prochaine section sera mis sur un examen plus approfondi de certaines de ces fonctionnalités et sur la comparaison des deux bibliothèques en ce qui concerne l'exécution de diverses tâches liées aux PDF.

IronPDF

  • Conversion de HTML en PDF : Prend en charge HTML, CSS, JavaScript et les images.
  • Manipulation de fichiers PDF : Diviser puis fusionner des documents, modifier la mise en forme et éditer des documents PDF existants
  • Sécurité : chiffrement et déchiffrement des PDF.
  • Édition: Ajoutez des annotations, des signets et des contours.
  • Modèles : Appliquer des en-têtes, pieds de page et numéros de page.
  • Filigrane : Appliquez facilement des filigranes texte et image aux fichiers PDF; profitez de son utilisation de HTML/CSS pour obtenir un contrôle total sur le processus.
  • PDF Stamping : Appliquez des images et du texte sur vos documents PDF en utilisant IronPDF.

    Pour plus d'informations sur l'ensemble des fonctionnalités offertes par IronPDF, visitez lePage des fonctionnalités d'IronPDF.

iTextSharp :

  • Création de PDF : Prend en charge la création de documents PDF à partir de zéro.
  • Formulaires : Créez et modifiez des formulaires PDF.
  • Signatures numériques : Signez des documents PDF.
  • Compression : Optimisez les tailles de fichier PDF.
  • Extraction de contenu : Extraire du texte et des images des PDFs.
  • Open Source: Disponible sous licence AGPL.
  • Personnalisation : Niveau élevé de personnalisation pour des cas d'utilisation avancés.

Comparaison des fonctionnalités PDF entre IronPdf et iTextSharp

Conversion de HTML en PDF

ConversionContenu HTML en PDFest une tâche très simple qui est effectuée dans de nombreux bureaux et espaces de travail différents. Vous trouverez ci-dessous des exemples de code comparant la façon dont IronPDF et iText abordent ce processus.

IronPDF

using IronPdf;

// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
using IronPdf;

// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");

// Advanced Example with HTML Assets
// Load external html assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Imports IronPdf

' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()

' Create a PDF from an HTML string using C#
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
pdf.SaveAs("output.pdf")

' Advanced Example with HTML Assets
' Load external html assets: images, CSS and JavaScript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
VB   C#

iTextSharp

using iText.Html2pdf;

static void Main(string[] args)
  {
    using (FileStream htmlSource = File.Open("input.html", FileMode.Open))
    using (FileStream pdfDest = File.Open("output.pdf", FileMode.Create))
    {
        ConverterProperties converterProperties = new ConverterProperties();
        HtmlConverter.ConvertToPdf(htmlSource, pdfDest, converterProperties);
    }
  }
using iText.Html2pdf;

static void Main(string[] args)
  {
    using (FileStream htmlSource = File.Open("input.html", FileMode.Open))
    using (FileStream pdfDest = File.Open("output.pdf", FileMode.Create))
    {
        ConverterProperties converterProperties = new ConverterProperties();
        HtmlConverter.ConvertToPdf(htmlSource, pdfDest, converterProperties);
    }
  }
Imports iText.Html2pdf

Shared Sub Main(ByVal args() As String)
	Using htmlSource As FileStream = File.Open("input.html", FileMode.Open)
	Using pdfDest As FileStream = File.Open("output.pdf", FileMode.Create)
		Dim converterProperties As New ConverterProperties()
		HtmlConverter.ConvertToPdf(htmlSource, pdfDest, converterProperties)
	End Using
	End Using
End Sub
VB   C#

Lors de la conversion de HTML en PDF, IronPDF offre un outil concis et pratique pour effectuer cette tâche. En utilisant le ChromePdfRenderer pour convertir du contenu HTML en PDF, IronPDF excelle à fournir aux utilisateurs des documents PDF précis au pixel près. Les utilisateurs peuvent créer des fichiers PDF directement à partir de chaînes HTML, comme montré dans le premier exemple, ou inclure des ressources externes telles que des images avec un chemin de base optionnel, comme démontré dans l'exemple avancé. iTextSharp, quant à lui, utilise HtmlConverter pour convertir les fichiers HTML, mais le processus nécessite davantage de configuration.

Chiffrement des fichiers PDF

Cryptageet le déchiffrement des documents PDF sont essentiels dans de nombreux lieux de travail. Pour gérer cette tâche facilement, il est nécessaire d'avoir un outil qui peut le faire de manière pratique. Dans le code ci-dessous, nous verrons comment iTextSharp et IronPDF s'attaquent au chiffrement des PDF.

IronPDF

using IronPdf;
using System;

// Open an Encrypted File, alternatively create a new PDF from Html
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings
// The following code makes a PDF read only and will disallow copy & paste and printing
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
using IronPdf;
using System;

// Open an Encrypted File, alternatively create a new PDF from Html
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");

// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;

// Edit file security settings
// The following code makes a PDF read only and will disallow copy & paste and printing
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;

// change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports System

' Open an Encrypted File, alternatively create a new PDF from Html
Private pdf = PdfDocument.FromFile("encrypted.pdf", "password")

' Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = DateTime.Now

' Edit file security settings
' The following code makes a PDF read only and will disallow copy & paste and printing
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key")
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = False
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights

' change or set the document encryption password
pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
VB   C#

iTextSharp

using System;
using System.IO;
using System.Text;
using iText.Kernel.Pdf;

public class EncryptPdf
    {
        public static readonly String DEST = "results/sandbox/security/encrypt_pdf.pdf";
        public static readonly String SRC = "../../../resources/pdfs/hello.pdf";

        public static readonly String OWNER_PASSWORD = "World";
        public static readonly String USER_PASSWORD = "Hello";

        public static void Main(String[] args)
        {
            FileInfo file = new FileInfo(DEST);
            file.Directory.Create();

            new EncryptPdf().ManipulatePdf(DEST);
        }

        protected void ManipulatePdf(String dest)
        {
            PdfDocument document = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest,
                new WriterProperties().SetStandardEncryption(
                    Encoding.UTF8.GetBytes(USER_PASSWORD),
                    Encoding.UTF8.GetBytes(OWNER_PASSWORD),
                    EncryptionConstants.ALLOW_PRINTING,
                    EncryptionConstants.ENCRYPTION_AES_128 
 EncryptionConstants.DO_NOT_ENCRYPT_METADATA
                )));
            document.Close();
        }
    }
using System;
using System.IO;
using System.Text;
using iText.Kernel.Pdf;

public class EncryptPdf
    {
        public static readonly String DEST = "results/sandbox/security/encrypt_pdf.pdf";
        public static readonly String SRC = "../../../resources/pdfs/hello.pdf";

        public static readonly String OWNER_PASSWORD = "World";
        public static readonly String USER_PASSWORD = "Hello";

        public static void Main(String[] args)
        {
            FileInfo file = new FileInfo(DEST);
            file.Directory.Create();

            new EncryptPdf().ManipulatePdf(DEST);
        }

        protected void ManipulatePdf(String dest)
        {
            PdfDocument document = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest,
                new WriterProperties().SetStandardEncryption(
                    Encoding.UTF8.GetBytes(USER_PASSWORD),
                    Encoding.UTF8.GetBytes(OWNER_PASSWORD),
                    EncryptionConstants.ALLOW_PRINTING,
                    EncryptionConstants.ENCRYPTION_AES_128 
 EncryptionConstants.DO_NOT_ENCRYPT_METADATA
                )));
            document.Close();
        }
    }
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

IronPDF offre aux utilisateurs un moyen simple de crypter des fichiers PDF tout en leur donnant beaucoup de contrôle sur le processus, y compris l'édition des métadonnées et le réglage des paramètres de sécurité, tels que rendre les documents en lecture seule ou restreindre des actions utilisateur comme le copier-coller. D'autre part, iTextSharp offre un contrôle plus granulaire mais nécessite une configuration supplémentaire, telle que la spécification des normes de cryptage et des permissions.

Rédiger le contenu PDF

Parfois, lorsqu'on manipule des informations confidentielles ou privées, il peut être nécessaire derédiger parties d'un fichier PDF. Les exemples suivants montrent comment vous pouvez expurger du texte en utilisant IronPDF par rapport à iTextSharp.

IronPDF

using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");

pdf.SaveAs("redacted.pdf");
using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("novel.pdf");

// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");

pdf.SaveAs("redacted.pdf");
Imports IronPdf

Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")

' Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are")

pdf.SaveAs("redacted.pdf")
VB   C#

iTextSharp

using System;
using System.IO;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
using iText.Kernel.Colors;

string src = "input.pdf";
string dest = "output_redacted.pdf";

using (PdfReader reader = new PdfReader(src))
            {
                using (PdfWriter writer = new PdfWriter(dest))
                {
                    using (PdfDocument pdfDoc = new PdfDocument(reader, writer))
                    {
                        // Iterate through each page
                        for (int pageNum = 1; pageNum <= pdfDoc.GetNumberOfPages(); pageNum++)
                        {
                            PdfPage page = pdfDoc.GetPage(pageNum);
                            PdfCanvas canvas = new PdfCanvas(page);
                            Rectangle[] rectanglesToRedact = { new Rectangle(100, 100, 200, 50) }; // Example: Define rectangles to redact

                            // Overlay black rectangles to simulate redaction
                            foreach (Rectangle rect in rectanglesToRedact)
                            {
                                canvas.SetFillColor(ColorConstants.BLACK)
                                    .Rectangle(rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight())
                                    .Fill();
                            }
                        }
                    }
                }
using System;
using System.IO;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
using iText.Kernel.Colors;

string src = "input.pdf";
string dest = "output_redacted.pdf";

using (PdfReader reader = new PdfReader(src))
            {
                using (PdfWriter writer = new PdfWriter(dest))
                {
                    using (PdfDocument pdfDoc = new PdfDocument(reader, writer))
                    {
                        // Iterate through each page
                        for (int pageNum = 1; pageNum <= pdfDoc.GetNumberOfPages(); pageNum++)
                        {
                            PdfPage page = pdfDoc.GetPage(pageNum);
                            PdfCanvas canvas = new PdfCanvas(page);
                            Rectangle[] rectanglesToRedact = { new Rectangle(100, 100, 200, 50) }; // Example: Define rectangles to redact

                            // Overlay black rectangles to simulate redaction
                            foreach (Rectangle rect in rectanglesToRedact)
                            {
                                canvas.SetFillColor(ColorConstants.BLACK)
                                    .Rectangle(rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight())
                                    .Fill();
                            }
                        }
                    }
                }
Imports System
Imports System.IO
Imports iText.Kernel.Pdf
Imports iText.Layout
Imports iText.Layout.Element
Imports iText.Layout.Properties
Imports iText.Kernel.Colors

Private src As String = "input.pdf"
Private dest As String = "output_redacted.pdf"

Using reader As New PdfReader(src)
				Using writer As New PdfWriter(dest)
					Using pdfDoc As New PdfDocument(reader, writer)
						' Iterate through each page
						Dim pageNum As Integer = 1
						Do While pageNum <= pdfDoc.GetNumberOfPages()
							Dim page As PdfPage = pdfDoc.GetPage(pageNum)
							Dim canvas As New PdfCanvas(page)
							Dim rectanglesToRedact() As Rectangle = { New Rectangle(100, 100, 200, 50) } ' Example: Define rectangles to redact

							' Overlay black rectangles to simulate redaction
							For Each rect As Rectangle In rectanglesToRedact
								canvas.SetFillColor(ColorConstants.BLACK).Rectangle(rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()).Fill()
							Next rect
							pageNum += 1
						Loop
					End Using
				End Using
VB   C#

L'outil de rédaction d'IronPDF est concis et facile à utiliser, nécessitant seulement quelques lignes de code pour simplifier le processus de rédaction. Cela aide à améliorer l'efficacité des tâches de rédaction de PDF et offre aux utilisateurs un moyen facile de protéger leurs données sensibles et privées.

D'autre part, iTextSharp ne dispose pas d'une fonction de rédaction intégrée, ce qui vous oblige à dessiner manuellement des rectangles noirs sur le contenu que vous souhaitez expurger. Toutefois, cette approche peut laisser le texte sous le rectangle accessible, permettant aux utilisateurs de copier-coller les données cachées, ce qui ne constitue pas une véritable rédaction.

Signature de documents PDF

Être capable designeles documents numériques tels que les fichiers PDF, puis en faisant un processus automatisé, cela pourrait faire gagner du temps. Les extraits de code suivants comparent la manière dont IronPDF et iTextSharp gèrent les signatures numériques.

IronPDF

using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create PdfSignature object
var sig = new PdfSignature(cert);

// Sign PDF document
PdfDocument pdf = PdfDocument.FromFile("document.pdf");
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;

// Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);

// Create PdfSignature object
var sig = new PdfSignature(cert);

// Sign PDF document
PdfDocument pdf = PdfDocument.FromFile("document.pdf");
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates

' Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
Private cert As New X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable)

' Create PdfSignature object
Private sig = New PdfSignature(cert)

' Sign PDF document
Private pdf As PdfDocument = PdfDocument.FromFile("document.pdf")
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
VB   C#

iTextSharp

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

class Program
{
    static void Main(string[] args)
    {
        string src = "input.pdf";
        string dest = "output_signed.pdf";
        string pfxFile = "your_certificate.pfx";
        string pfxPassword = "your_password";

        try
        {
            // Load your certificate
            Pkcs12Store ks = new Pkcs12Store(new FileStream(pfxFile, FileMode.Open), pfxPassword.ToCharArray());
            string alias = null;
            foreach (string al in ks.Aliases)
            {
                if (ks.IsKeyEntry(al))
                {
                    alias = al;
                    break;
                }
            }
            ICipherParameters pk = ks.GetKey(alias).Key;
            X509CertificateEntry[] chain = ks.GetCertificateChain(alias);
            X509Certificate2 cert = new X509Certificate2(chain[0].Certificate.GetEncoded());

            // Create output PDF with signed content
            using (PdfReader reader = new PdfReader(src))
            {
                using (PdfWriter writer = new PdfWriter(dest))
                {
                    using (PdfDocument pdfDoc = new PdfDocument(reader, writer))
                    {
                        // Create the signer
                        PdfSigner signer = new PdfSigner(pdfDoc, writer, new StampingProperties().UseAppendMode());

                        // Configure signature appearance
                        PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
                        appearance.SetReason("Digital Signature");
                        appearance.SetLocation("Your Location");
                        appearance.SetContact("Your Contact");

                        // Create signature
                        IExternalSignature pks = new PrivateKeySignature(pk, "SHA-256");
                        signer.SignDetached(pks, chain, null, null, null, 0, PdfSigner.CryptoStandard.CMS);
                    }
                }
            }
            Console.WriteLine($"PDF digitally signed successfully: {dest}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error signing PDF: {ex.Message}");
        }
    }
}
using System;
using System.IO;
using iText.Kernel.Pdf;
using iText.Signatures;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Pkcs;
using Org.BouncyCastle.X509;

class Program
{
    static void Main(string[] args)
    {
        string src = "input.pdf";
        string dest = "output_signed.pdf";
        string pfxFile = "your_certificate.pfx";
        string pfxPassword = "your_password";

        try
        {
            // Load your certificate
            Pkcs12Store ks = new Pkcs12Store(new FileStream(pfxFile, FileMode.Open), pfxPassword.ToCharArray());
            string alias = null;
            foreach (string al in ks.Aliases)
            {
                if (ks.IsKeyEntry(al))
                {
                    alias = al;
                    break;
                }
            }
            ICipherParameters pk = ks.GetKey(alias).Key;
            X509CertificateEntry[] chain = ks.GetCertificateChain(alias);
            X509Certificate2 cert = new X509Certificate2(chain[0].Certificate.GetEncoded());

            // Create output PDF with signed content
            using (PdfReader reader = new PdfReader(src))
            {
                using (PdfWriter writer = new PdfWriter(dest))
                {
                    using (PdfDocument pdfDoc = new PdfDocument(reader, writer))
                    {
                        // Create the signer
                        PdfSigner signer = new PdfSigner(pdfDoc, writer, new StampingProperties().UseAppendMode());

                        // Configure signature appearance
                        PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
                        appearance.SetReason("Digital Signature");
                        appearance.SetLocation("Your Location");
                        appearance.SetContact("Your Contact");

                        // Create signature
                        IExternalSignature pks = new PrivateKeySignature(pk, "SHA-256");
                        signer.SignDetached(pks, chain, null, null, null, 0, PdfSigner.CryptoStandard.CMS);
                    }
                }
            }
            Console.WriteLine($"PDF digitally signed successfully: {dest}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error signing PDF: {ex.Message}");
        }
    }
}
Imports System
Imports System.IO
Imports iText.Kernel.Pdf
Imports iText.Signatures
Imports Org.BouncyCastle.Crypto
Imports Org.BouncyCastle.Pkcs
Imports Org.BouncyCastle.X509

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		Dim src As String = "input.pdf"
		Dim dest As String = "output_signed.pdf"
		Dim pfxFile As String = "your_certificate.pfx"
		Dim pfxPassword As String = "your_password"

		Try
			' Load your certificate
			Dim ks As New Pkcs12Store(New FileStream(pfxFile, FileMode.Open), pfxPassword.ToCharArray())
			Dim [alias] As String = Nothing
			For Each al As String In ks.Aliases
				If ks.IsKeyEntry(al) Then
					[alias] = al
					Exit For
				End If
			Next al
			Dim pk As ICipherParameters = ks.GetKey([alias]).Key
			Dim chain() As X509CertificateEntry = ks.GetCertificateChain([alias])
			Dim cert As New X509Certificate2(chain(0).Certificate.GetEncoded())

			' Create output PDF with signed content
			Using reader As New PdfReader(src)
				Using writer As New PdfWriter(dest)
					Using pdfDoc As New PdfDocument(reader, writer)
						' Create the signer
						Dim signer As New PdfSigner(pdfDoc, writer, (New StampingProperties()).UseAppendMode())

						' Configure signature appearance
						Dim appearance As PdfSignatureAppearance = signer.GetSignatureAppearance()
						appearance.SetReason("Digital Signature")
						appearance.SetLocation("Your Location")
						appearance.SetContact("Your Contact")

						' Create signature
						Dim pks As IExternalSignature = New PrivateKeySignature(pk, "SHA-256")
						signer.SignDetached(pks, chain, Nothing, Nothing, Nothing, 0, PdfSigner.CryptoStandard.CMS)
					End Using
				End Using
			End Using
			Console.WriteLine($"PDF digitally signed successfully: {dest}")
		Catch ex As Exception
			Console.WriteLine($"Error signing PDF: {ex.Message}")
		End Try
	End Sub
End Class
VB   C#

Lors de l'application de signatures numériques aux fichiers PDF, IronPDF présente un outil compact mais puissant pour compléter ce processus. Sa simplicité permet de mener le processus rapidement, économisant ainsi du temps pour tout développeur qui l'implémente pour ses besoins de signature. En revanche, iTextSharp nécessite plus d'installation et implique des étapes supplémentaires pour gérer les signatures numériques, ce qui le rend plus complexe, bien que potentiellement plus flexible pour les utilisateurs avancés.

Application de filigranes aux documents PDF

La capacité d'ajouter et de personnaliserfiligranessur les PDF via un logiciel peut grandement aider à la confidentialité, à la protection des droits d'auteur, à la marque ou à toute autre tâche impliquant des informations sensibles. Ce qui suit est une comparaison de la façon dont IronPDF et iTextSharp appliquent des filigranes aux fichiers PDF.

IronPDF

using IronPdf;

// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();

var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
using IronPdf;

// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();

var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
Imports IronPdf

' Stamps a Watermark onto a new or existing PDF
Private renderer = New ChromePdfRenderer()

Private pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
pdf.SaveAs("C:\Path\To\Watermarked.pdf")
VB   C#

iTextSharp

using iText.IO.Font;
using iText.IO.Font.Constants;
using iText.Kernel.Colors;
using iText.Kernel.Font;
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas;
using iText.Kernel.Pdf.Extgstate;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;

public class TransparentWatermark 
    {
        public static readonly String DEST = "results/sandbox/stamper/transparent_watermark.pdf";
        public static readonly String SRC = "../../../resources/pdfs/hero.pdf";

        public static void Main(String[] args) 
        {
            FileInfo file = new FileInfo(DEST);
            file.Directory.Create();

            new TransparentWatermark().ManipulatePdf(DEST);
        }

        protected void ManipulatePdf(String dest) 
        {
            PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest));
            PdfCanvas under = new PdfCanvas(pdfDoc.GetFirstPage().NewContentStreamBefore(), new PdfResources(), pdfDoc);
            PdfFont font = PdfFontFactory.CreateFont(FontProgramFactory.CreateFont(StandardFonts.HELVETICA));
            Paragraph paragraph = new Paragraph("This watermark is added UNDER the existing content")
                    .SetFont(font)
                    .SetFontSize(15);

            Canvas canvasWatermark1 = new Canvas(under, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 550, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark1.Close();
            PdfCanvas over = new PdfCanvas(pdfDoc.GetFirstPage());
            over.SetFillColor(ColorConstants.BLACK);
            paragraph = new Paragraph("This watermark is added ON TOP OF the existing content")
                    .SetFont(font)
                    .SetFontSize(15);

            Canvas canvasWatermark2 = new Canvas(over, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 500, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark2.Close();
            paragraph = new Paragraph("This TRANSPARENT watermark is added ON TOP OF the existing content")
                    .SetFont(font)
                    .SetFontSize(15);
            over.SaveState();

            // Creating a dictionary that maps resource names to graphics state parameter dictionaries
            PdfExtGState gs1 = new PdfExtGState();
            gs1.SetFillOpacity(0.5f);
            over.SetExtGState(gs1);
            Canvas canvasWatermark3 = new Canvas(over, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 450, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark3.Close();
            over.RestoreState();

            pdfDoc.Close();
        }
    }
using iText.IO.Font;
using iText.IO.Font.Constants;
using iText.Kernel.Colors;
using iText.Kernel.Font;
using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas;
using iText.Kernel.Pdf.Extgstate;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;

public class TransparentWatermark 
    {
        public static readonly String DEST = "results/sandbox/stamper/transparent_watermark.pdf";
        public static readonly String SRC = "../../../resources/pdfs/hero.pdf";

        public static void Main(String[] args) 
        {
            FileInfo file = new FileInfo(DEST);
            file.Directory.Create();

            new TransparentWatermark().ManipulatePdf(DEST);
        }

        protected void ManipulatePdf(String dest) 
        {
            PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest));
            PdfCanvas under = new PdfCanvas(pdfDoc.GetFirstPage().NewContentStreamBefore(), new PdfResources(), pdfDoc);
            PdfFont font = PdfFontFactory.CreateFont(FontProgramFactory.CreateFont(StandardFonts.HELVETICA));
            Paragraph paragraph = new Paragraph("This watermark is added UNDER the existing content")
                    .SetFont(font)
                    .SetFontSize(15);

            Canvas canvasWatermark1 = new Canvas(under, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 550, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark1.Close();
            PdfCanvas over = new PdfCanvas(pdfDoc.GetFirstPage());
            over.SetFillColor(ColorConstants.BLACK);
            paragraph = new Paragraph("This watermark is added ON TOP OF the existing content")
                    .SetFont(font)
                    .SetFontSize(15);

            Canvas canvasWatermark2 = new Canvas(over, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 500, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark2.Close();
            paragraph = new Paragraph("This TRANSPARENT watermark is added ON TOP OF the existing content")
                    .SetFont(font)
                    .SetFontSize(15);
            over.SaveState();

            // Creating a dictionary that maps resource names to graphics state parameter dictionaries
            PdfExtGState gs1 = new PdfExtGState();
            gs1.SetFillOpacity(0.5f);
            over.SetExtGState(gs1);
            Canvas canvasWatermark3 = new Canvas(over, pdfDoc.GetDefaultPageSize())
                    .ShowTextAligned(paragraph, 297, 450, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0);
            canvasWatermark3.Close();
            over.RestoreState();

            pdfDoc.Close();
        }
    }
Imports iText.IO.Font
Imports iText.IO.Font.Constants
Imports iText.Kernel.Colors
Imports iText.Kernel.Font
Imports iText.Kernel.Pdf
Imports iText.Kernel.Pdf.Canvas
Imports iText.Kernel.Pdf.Extgstate
Imports iText.Layout
Imports iText.Layout.Element
Imports iText.Layout.Properties

Public Class TransparentWatermark
		Public Shared ReadOnly DEST As String = "results/sandbox/stamper/transparent_watermark.pdf"
		Public Shared ReadOnly SRC As String = "../../../resources/pdfs/hero.pdf"

		Public Shared Sub Main(ByVal args() As String)
			Dim file As New FileInfo(DEST)
			file.Directory.Create()

			Call (New TransparentWatermark()).ManipulatePdf(DEST)
		End Sub

		Protected Sub ManipulatePdf(ByVal dest As String)
			Dim pdfDoc As New PdfDocument(New PdfReader(SRC), New PdfWriter(dest))
			Dim under As New PdfCanvas(pdfDoc.GetFirstPage().NewContentStreamBefore(), New PdfResources(), pdfDoc)
			Dim font As PdfFont = PdfFontFactory.CreateFont(FontProgramFactory.CreateFont(StandardFonts.HELVETICA))
			Dim paragraph As Paragraph = (New Paragraph("This watermark is added UNDER the existing content")).SetFont(font).SetFontSize(15)

			Dim canvasWatermark1 As Canvas = (New Canvas(under, pdfDoc.GetDefaultPageSize())).ShowTextAligned(paragraph, 297, 550, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0)
			canvasWatermark1.Close()
			Dim over As New PdfCanvas(pdfDoc.GetFirstPage())
			over.SetFillColor(ColorConstants.BLACK)
			paragraph = (New Paragraph("This watermark is added ON TOP OF the existing content")).SetFont(font).SetFontSize(15)

			Dim canvasWatermark2 As Canvas = (New Canvas(over, pdfDoc.GetDefaultPageSize())).ShowTextAligned(paragraph, 297, 500, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0)
			canvasWatermark2.Close()
			paragraph = (New Paragraph("This TRANSPARENT watermark is added ON TOP OF the existing content")).SetFont(font).SetFontSize(15)
			over.SaveState()

			' Creating a dictionary that maps resource names to graphics state parameter dictionaries
			Dim gs1 As New PdfExtGState()
			gs1.SetFillOpacity(0.5F)
			over.SetExtGState(gs1)
			Dim canvasWatermark3 As Canvas = (New Canvas(over, pdfDoc.GetDefaultPageSize())).ShowTextAligned(paragraph, 297, 450, 1, TextAlignment.CENTER, VerticalAlignment.TOP, 0)
			canvasWatermark3.Close()
			over.RestoreState()

			pdfDoc.Close()
		End Sub
End Class
VB   C#

L'API facile et intuitive de IronPDF permet aux utilisateurs d'appliquer rapidement des filigranes personnalisés à leurs fichiers PDF, tout en leur donnant un contrôle total sur le processus. Son utilisation de HTML/CSS simplifie davantage le processus sans perdre aucun contrôle sur la personnalisation. l'approche de iTextSharp** pour ajouter des filigranes aux PDF nécessite plus de travail manuel pour effectuer la tâche, ce qui peut ralentir le processus.

Ajouter des images et du texte à un PDF

Il y a des moments où les pages PDF ont besoin d'êtretamponnéavec du contenu, similaire à la manière dont on pourrait avoir besoin d'appliquer des filigranes à leurs fichiers PDF. Voyons comment IronPDF se compare à iTextSharp :

IronPDF

using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create text stamper
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");

// Create image stamper
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top,
};

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
using IronPdf;
using IronPdf.Editing;

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");

// Create text stamper
TextStamper textStamper = new TextStamper()
{
    Text = "Text Stamper!",
    FontFamily = "Bungee Spice",
    UseGoogleFont = true,
    FontSize = 30,
    IsBold = true,
    IsItalic = true,
    VerticalAlignment = VerticalAlignment.Top,
};

// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");

// Create image stamper
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
    VerticalAlignment = VerticalAlignment.Top,
};

// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
Imports IronPdf
Imports IronPdf.Editing

Private renderer As New ChromePdfRenderer()

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")

' Create text stamper
Private textStamper As New TextStamper() With {
	.Text = "Text Stamper!",
	.FontFamily = "Bungee Spice",
	.UseGoogleFont = True,
	.FontSize = 30,
	.IsBold = True,
	.IsItalic = True,
	.VerticalAlignment = VerticalAlignment.Top
}

' Stamp the text stamper
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")

' Create image stamper
Dim imageStamper As New ImageStamper(New Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}

' Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
VB   C#

iTextSharp

using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;

public void StampPDF(string inputPdfPath, string outputPdfPath, string stampText)
{
    PdfDocument pdfDoc = new PdfDocument(new PdfReader(inputPdfPath), new PdfWriter(outputPdfPath));

    var document = new Document(pdfDoc);

By quickly glancing at the code, you can see that IronPDF is pragmatic, based on common end-user requirements.

iText is a lower-level library that focuses on a drawing API where we add objects, shapes, and text to pages.

iTextSharp.dll uses a primarily programmatic model to render PDFs. When using the iTextSharp PDF library, each piece of PDF text, graphic, table, or line is “plotted” or drawn onto a PDF. The API appears low-level and is focused on the PDF document standard. This model allows precision but may require developers to learn a little about how PDFs work. Closely matching an existing design style or web assets may take some iteration and reading the [iTextSharp documentation](https://itextpdf.com/en/resources/api-documentation). In keeping with its heritage, the methodology and programmatic interface have a distinct Java flavor.

In contrast, IronPDF uses a full embedded web browser renderer to [convert HTML to PDF](/tutorials/html-to-pdf/). Following short (1- and 2-line) [C# code examples for HTML to PDF conversion](/examples/using-html-to-create-a-pdf/), developers can generate PDFs from existing or new HTML, images, and CSS. This allows developers to work closely with existing web assets and also work in parallel with designers during a project. iText does include **HTML to PDF** functionality for C# .NET, though it is not, apparently, the library's dominant feature.

Read on for more comparative details on the different ways that IronPDF and iTextSharp can help developers achieve the following goals:

- [Create a PDF from an Existing URL](/examples/converting-a-url-to-a-pdf/)
- [Create a PDF Document from an HTML input string](/tutorials/html-to-pdf/#anchor-create-a-pdf-with-an-html-string-in-net-c)
- [Convert ASPX Pages to PDF](/how-to/aspx-to-pdf/)
- [Convert XML to PDF](/how-to/xml-to-pdf/)
- Live Data (chart)

## 1. Licensing

Licensing options are also an important factor in developer projects. iTextSharp is Open Source under the AGPL license agreement. When licensed under AGLP, anyone who uses any part of an application that contains iTextSharp (even across a company network or the internet) may be entitled to a full copy of the app's full source code. This is excellent for academic work. If we wish to use iTextSharp in commercial applications it is best practice to contact iText and [ask them for a quote on the pricing for iText commercial usage](https://itextpdf.com/en/how-buy).

IronPDF is [free for development](/#download-modal), and can then be [licensed for commercial deployment](/licensing/) at publicly published, reasonable prices starting at $749.

<h2>IronPDF and iTextSharp</h2>

This is how the two libraries stack up:

<div class="content-table itextsharp-table">
    <table>
        <tbody>
            <tr class="tr-head">
                <th class="tcol1"><img src="/img/svgs/iron-pdf-logo.svg" alt="IronPDF" class="iron-pdf"></th>
                <th class="tcol2"><img src="/img/svgs/i-text-sharp.svg" alt="iTextSharp" class="iron-pdf"></th>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i>Convert HTML to PDF via a full built-in web browser</td>
                <td><i class="fa fa-times"></i>Basic HTML to PDF via a pdfHTML add-on </td>
            </tr>

            <tr>
                <td><i class="fa fa-check"></i>Rendering focus: Embedded web browser</td>
                <td><i class="fa fa-check"></i>Rendering focus: Programmatic drawing model</td>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i>IronPDF has explicit licenses with published prices</td>
                <td><i class="fa fa-times"></i>AGPL! Commercial use pricing not published.</td>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i> Easy to Code with .NET First Design</td>
                <td><i class="fa fa-times"></i>Based on a Java API</td>
            </tr>
            <tr>
                <td><i class="fa fa-times"></i> Not suited to academic assignments and coursework </td>
                <td><i class="fa fa-check"></i> Excellent for academic assignments and research </td>
            </tr>
        </tbody>
    </table>
</div>

<hr class="separator">

<h4 class="tutorial-segment-title">Key Differences</h4>

<h2>Generate PDF from HTML using IronPDF</h2>

IronPDF enables .NET and .NET Core developers to generate, merge, split, edit, and extract PDF content easily in C#, F#, and VB.NET for .NET Core and .NET Framework, as well as [create PDFs from HTML, ASPX, CSS, JS, and image files](/blog/using-ironpdf/csharp-create-pdf-tutorial/).

It makes use of a fully embedded web browser to convert HTML to PDF. This allows developers to generate PDFs from HTML, images, and CSS, and to work closely with existing web assets and also work in parallel with designers during a project.

### 2. IronPDF Features ###

IronPDF really focuses on developer productivity. The library simplifies many common complex PDF code tasks into convenient C# methods to extract text and images, sign PDFs, edit PDFs with new HTML, and more, without the developer needing to study the PDF document standard to understand how to achieve their best result.

- Generating PDF documents from HTML, images, and ASPX files
- Reading PDF text
- Extracting data and images from PDFs
- Merging PDF documents
- Splitting PDFs
- Manipulating PDFs

<h3>2. iTextSharp Documentation Features</h3>

The [iTextSharp.dll](https://github.com/itext/itextsharp/releases) uses a primarily programmatic model to render PDFs, and it has advanced PDF manipulation APIs that are powerful and follow the PDF standard closely.

- AGLP strict open source licensing
- Programmatic drawing model
- Edit and Read PDFs
- Solid functionality for PDF manipulation
- Based on a Java library

Let's compare by creating an example project utilizing both libraries: 

<hr class="separator">
<h4 class="tutorial-segment-title">Example Project</h4>
<h2>Create an ASP.NET Project</h2>

Make use of the following steps to create an ASP.NET website:

1. Open Visual Studio
2. Click File > New Project
3. Select Web under Visual C# in the Project type listbox
4. Select ASP.NET Web Application

<div class="content-img-align-center">
    <div class="center-image-wrapper">
        <a rel="nofollow" href="/img/faq/itextsharp/new-project.png" target="_blank"><img src="/img/faq/itextsharp/new-project.png" alt="" class="img-responsive add-shadow"></a>
        <p><strong>Figure 1</strong> – <em>New Project</em></p>
    </div>
</div>

- Click OK
- On the next screen, select Web Forms as shown in Figure 2 underneath

<div class="content-img-align-center">
    <div class="center-image-wrapper">
        <a rel="nofollow" href="/img/faq/itextsharp/web-form.png" target="_blank"><img src="/img/faq/itextsharp/web-form.png" alt="" class="img-responsive add-shadow"></a>
        <p><strong>Figure 2</strong> – <em>Web Forms</em></p>
    </div>
</div>

- Click OK

Now we have something to work with. Let’s Install IronPDF.

<hr class="separator">
<h4 class="tutorial-segment-title">Get Started</h4>

## 3. IronPDF Library Installation ##

In order to make use of IronPDF, you first need to install it (free). There are two options:

- NuGet
- Download the library

Let’s have a closer look.

Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Commencez à utiliser IronPDF dans votre projet dès aujourd'hui avec un essai gratuit.

Première étape :
green arrow pointer

Découvrez IronPDF sur NuGet pour une installation et un déploiement rapides. Avec plus de 8 millions de téléchargements, il transforme PDF avec C#.

Bibliothèque NuGet C# pour PDF nuget.org/packages/IronPdf/
Install-Package IronPdf

Envisagez d'installer le IronPDF DLL directement. Téléchargez et installez-le manuellement pour votre projet ou sous forme de GAC : {{lienDllAfficher}}

Installation manuelle dans votre projet

Télécharger la DLL
### 3.1. Install using NuGet ### There are three ways to install the IronPDF NuGet package: 1. Visual Studio 2. Developer Command Prompt 3. Download the NuGet Package directly Let’s do them one-by-one. ### 3.2. Visual Studio ### Visual Studio provides the NuGet Package Manager for you to install NuGet packages in your projects. You can access it via the Project Menu, or by right-clicking your project in the Solution Explorer. Both these options are shown below in Figures 3 and 4 <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/project-menu.png" target="_blank"><img src="/img/faq/itextsharp/project-menu.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 3</strong> – <em>Project menu</em></p> </div> </div> <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/solution-explorer.png" target="_blank"><img src="/img/faq/itextsharp/solution-explorer.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 4</strong> – <em>Right-click Solution Explorer</em></p> </div> </div> After you have clicked Manage NuGet Packages from either option, Browse for the IronPDF package and install it as shown in Figure 5. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/install-ironpdf-nuget-package.png" target="_blank"><img src="/img/faq/itextsharp/install-ironpdf-nuget-package.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 5</strong> – <em>Install IronPDF NuGet Package</em></p> </div> </div> ### 3.3. Developer Command Prompt ### The following steps open the Developer Command Prompt and installs the **IronPDF NuGet** package 1. Search for your **Developer Command Prompt** – it is usually under your Visual Studio folder 2. Type in the following command: *PM > Install-Package IronPdf* 3. Press Enter 4. The package will be installed 5. Reload your Visual Studio project ### 3.4. Download the NuGet Package directly ### In order to download the NuGet package: 1. Navigate to [https://www.nuget.org/packages/IronPdf/](https://www.nuget.org/packages/IronPdf/) 2. Click on Download Package 3. After the package has downloaded, double click it 4. Reload your Visual Studio project ### 3.5. Download the .DLL Library ### The second way to install IronPDF is by [direct download](/#download-modal). <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/download-ironpdf-library.png" target="_blank"><img src="/img/faq/itextsharp/download-ironpdf-library.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 6</strong> – <em>Download IronPDF library</em></p> </div> </div> Reference the Library in your project by using the next steps: 1. Right-click the Solution in the Solution Explorer 2. Select References 3. Browse for the IronPDF.dll library 4. Click OK Now that you’re set up, we can start playing with the awesome features in the IronPDF library after the setup for iTextSharp. <h3>Install iTextSharp by using NuGet</h3> There are three ways to [install the iTextSharp NuGet package](https://www.nuget.org/packages/iTextSharp/), they are: - Visual Studio - Developer Command Prompt - Download the NuGet Package directly Let’s do them one-by-one. For Visual Studio, search for iText and install the relevant packages, as shown next. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/itext.png" target="_blank"><img src="/img/faq/itextsharp/itext.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 7</strong> – <em>iText</em></p> </div> </div> Or, in the Developer Command Prompt (as shown previously, enter the following command) - *PM > Install-Package itext7* Or, download [iText 7](https://itextpdf.com/en/products/itext-7) directly from their website. Now that you have created the necessary projects, let’s compare these two libraries in code. <hr class="separator"> <h4 class="tutorial-segment-title">Compare the Code</h4> ## 4. Create a PDF from an Existing URL ## The following code downloads a webpage and converts it to a PDF document. ### 4.1. IronPDF Website to PDF ### The following code uses IronPDF to create a PDF document directly from a website address. Custom Headers and Footers are also included. ```cs /** IronPDF URL to PDF anchor-ironpdf-website-to-pdf **/ private void ExistingWebURL() { // Create a PDF from any existing web page var Renderer = new IronPdf.ChromePdfRenderer(); // Create a PDF from an existing HTML Renderer.RenderingOptions.MarginTop = 50; //millimetres Renderer.RenderingOptions.MarginBottom = 50; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.TextHeader = new TextHeaderFooter() { CenterText = "{pdf-title}", DrawDividerLine = true, FontSize = 16 }; Renderer.RenderingOptions.TextFooter = new TextHeaderFooter() { LeftText = "{date} {time}", RightText = "Page {page} of {total-pages}", DrawDividerLine = true, FontSize = 14 }; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.EnableJavaScript = true; Renderer.RenderingOptions.RenderDelay = 500; //milliseconds using var PDF = Renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Portable_Document_Format"); PDF.SaveAs("wikipedia.pdf"); }
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;

public void StampPDF(string inputPdfPath, string outputPdfPath, string stampText)
{
    PdfDocument pdfDoc = new PdfDocument(new PdfReader(inputPdfPath), new PdfWriter(outputPdfPath));

    var document = new Document(pdfDoc);

By quickly glancing at the code, you can see that IronPDF is pragmatic, based on common end-user requirements.

iText is a lower-level library that focuses on a drawing API where we add objects, shapes, and text to pages.

iTextSharp.dll uses a primarily programmatic model to render PDFs. When using the iTextSharp PDF library, each piece of PDF text, graphic, table, or line is “plotted” or drawn onto a PDF. The API appears low-level and is focused on the PDF document standard. This model allows precision but may require developers to learn a little about how PDFs work. Closely matching an existing design style or web assets may take some iteration and reading the [iTextSharp documentation](https://itextpdf.com/en/resources/api-documentation). In keeping with its heritage, the methodology and programmatic interface have a distinct Java flavor.

In contrast, IronPDF uses a full embedded web browser renderer to [convert HTML to PDF](/tutorials/html-to-pdf/). Following short (1- and 2-line) [C# code examples for HTML to PDF conversion](/examples/using-html-to-create-a-pdf/), developers can generate PDFs from existing or new HTML, images, and CSS. This allows developers to work closely with existing web assets and also work in parallel with designers during a project. iText does include **HTML to PDF** functionality for C# .NET, though it is not, apparently, the library's dominant feature.

Read on for more comparative details on the different ways that IronPDF and iTextSharp can help developers achieve the following goals:

- [Create a PDF from an Existing URL](/examples/converting-a-url-to-a-pdf/)
- [Create a PDF Document from an HTML input string](/tutorials/html-to-pdf/#anchor-create-a-pdf-with-an-html-string-in-net-c)
- [Convert ASPX Pages to PDF](/how-to/aspx-to-pdf/)
- [Convert XML to PDF](/how-to/xml-to-pdf/)
- Live Data (chart)

## 1. Licensing

Licensing options are also an important factor in developer projects. iTextSharp is Open Source under the AGPL license agreement. When licensed under AGLP, anyone who uses any part of an application that contains iTextSharp (even across a company network or the internet) may be entitled to a full copy of the app's full source code. This is excellent for academic work. If we wish to use iTextSharp in commercial applications it is best practice to contact iText and [ask them for a quote on the pricing for iText commercial usage](https://itextpdf.com/en/how-buy).

IronPDF is [free for development](/#download-modal), and can then be [licensed for commercial deployment](/licensing/) at publicly published, reasonable prices starting at $749.

<h2>IronPDF and iTextSharp</h2>

This is how the two libraries stack up:

<div class="content-table itextsharp-table">
    <table>
        <tbody>
            <tr class="tr-head">
                <th class="tcol1"><img src="/img/svgs/iron-pdf-logo.svg" alt="IronPDF" class="iron-pdf"></th>
                <th class="tcol2"><img src="/img/svgs/i-text-sharp.svg" alt="iTextSharp" class="iron-pdf"></th>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i>Convert HTML to PDF via a full built-in web browser</td>
                <td><i class="fa fa-times"></i>Basic HTML to PDF via a pdfHTML add-on </td>
            </tr>

            <tr>
                <td><i class="fa fa-check"></i>Rendering focus: Embedded web browser</td>
                <td><i class="fa fa-check"></i>Rendering focus: Programmatic drawing model</td>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i>IronPDF has explicit licenses with published prices</td>
                <td><i class="fa fa-times"></i>AGPL! Commercial use pricing not published.</td>
            </tr>
            <tr>
                <td><i class="fa fa-check"></i> Easy to Code with .NET First Design</td>
                <td><i class="fa fa-times"></i>Based on a Java API</td>
            </tr>
            <tr>
                <td><i class="fa fa-times"></i> Not suited to academic assignments and coursework </td>
                <td><i class="fa fa-check"></i> Excellent for academic assignments and research </td>
            </tr>
        </tbody>
    </table>
</div>

<hr class="separator">

<h4 class="tutorial-segment-title">Key Differences</h4>

<h2>Generate PDF from HTML using IronPDF</h2>

IronPDF enables .NET and .NET Core developers to generate, merge, split, edit, and extract PDF content easily in C#, F#, and VB.NET for .NET Core and .NET Framework, as well as [create PDFs from HTML, ASPX, CSS, JS, and image files](/blog/using-ironpdf/csharp-create-pdf-tutorial/).

It makes use of a fully embedded web browser to convert HTML to PDF. This allows developers to generate PDFs from HTML, images, and CSS, and to work closely with existing web assets and also work in parallel with designers during a project.

### 2. IronPDF Features ###

IronPDF really focuses on developer productivity. The library simplifies many common complex PDF code tasks into convenient C# methods to extract text and images, sign PDFs, edit PDFs with new HTML, and more, without the developer needing to study the PDF document standard to understand how to achieve their best result.

- Generating PDF documents from HTML, images, and ASPX files
- Reading PDF text
- Extracting data and images from PDFs
- Merging PDF documents
- Splitting PDFs
- Manipulating PDFs

<h3>2. iTextSharp Documentation Features</h3>

The [iTextSharp.dll](https://github.com/itext/itextsharp/releases) uses a primarily programmatic model to render PDFs, and it has advanced PDF manipulation APIs that are powerful and follow the PDF standard closely.

- AGLP strict open source licensing
- Programmatic drawing model
- Edit and Read PDFs
- Solid functionality for PDF manipulation
- Based on a Java library

Let's compare by creating an example project utilizing both libraries: 

<hr class="separator">
<h4 class="tutorial-segment-title">Example Project</h4>
<h2>Create an ASP.NET Project</h2>

Make use of the following steps to create an ASP.NET website:

1. Open Visual Studio
2. Click File > New Project
3. Select Web under Visual C# in the Project type listbox
4. Select ASP.NET Web Application

<div class="content-img-align-center">
    <div class="center-image-wrapper">
        <a rel="nofollow" href="/img/faq/itextsharp/new-project.png" target="_blank"><img src="/img/faq/itextsharp/new-project.png" alt="" class="img-responsive add-shadow"></a>
        <p><strong>Figure 1</strong> – <em>New Project</em></p>
    </div>
</div>

- Click OK
- On the next screen, select Web Forms as shown in Figure 2 underneath

<div class="content-img-align-center">
    <div class="center-image-wrapper">
        <a rel="nofollow" href="/img/faq/itextsharp/web-form.png" target="_blank"><img src="/img/faq/itextsharp/web-form.png" alt="" class="img-responsive add-shadow"></a>
        <p><strong>Figure 2</strong> – <em>Web Forms</em></p>
    </div>
</div>

- Click OK

Now we have something to work with. Let’s Install IronPDF.

<hr class="separator">
<h4 class="tutorial-segment-title">Get Started</h4>

## 3. IronPDF Library Installation ##

In order to make use of IronPDF, you first need to install it (free). There are two options:

- NuGet
- Download the library

Let’s have a closer look.

Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Commencez à utiliser IronPDF dans votre projet dès aujourd'hui avec un essai gratuit.

Première étape :
green arrow pointer

Découvrez IronPDF sur NuGet pour une installation et un déploiement rapides. Avec plus de 8 millions de téléchargements, il transforme PDF avec C#.

Bibliothèque NuGet C# pour PDF nuget.org/packages/IronPdf/
Install-Package IronPdf

Envisagez d'installer le IronPDF DLL directement. Téléchargez et installez-le manuellement pour votre projet ou sous forme de GAC : {{lienDllAfficher}}

Installation manuelle dans votre projet

Télécharger la DLL
### 3.1. Install using NuGet ### There are three ways to install the IronPDF NuGet package: 1. Visual Studio 2. Developer Command Prompt 3. Download the NuGet Package directly Let’s do them one-by-one. ### 3.2. Visual Studio ### Visual Studio provides the NuGet Package Manager for you to install NuGet packages in your projects. You can access it via the Project Menu, or by right-clicking your project in the Solution Explorer. Both these options are shown below in Figures 3 and 4 <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/project-menu.png" target="_blank"><img src="/img/faq/itextsharp/project-menu.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 3</strong> – <em>Project menu</em></p> </div> </div> <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/solution-explorer.png" target="_blank"><img src="/img/faq/itextsharp/solution-explorer.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 4</strong> – <em>Right-click Solution Explorer</em></p> </div> </div> After you have clicked Manage NuGet Packages from either option, Browse for the IronPDF package and install it as shown in Figure 5. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/install-ironpdf-nuget-package.png" target="_blank"><img src="/img/faq/itextsharp/install-ironpdf-nuget-package.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 5</strong> – <em>Install IronPDF NuGet Package</em></p> </div> </div> ### 3.3. Developer Command Prompt ### The following steps open the Developer Command Prompt and installs the **IronPDF NuGet** package 1. Search for your **Developer Command Prompt** – it is usually under your Visual Studio folder 2. Type in the following command: *PM > Install-Package IronPdf* 3. Press Enter 4. The package will be installed 5. Reload your Visual Studio project ### 3.4. Download the NuGet Package directly ### In order to download the NuGet package: 1. Navigate to [https://www.nuget.org/packages/IronPdf/](https://www.nuget.org/packages/IronPdf/) 2. Click on Download Package 3. After the package has downloaded, double click it 4. Reload your Visual Studio project ### 3.5. Download the .DLL Library ### The second way to install IronPDF is by [direct download](/#download-modal). <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/download-ironpdf-library.png" target="_blank"><img src="/img/faq/itextsharp/download-ironpdf-library.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 6</strong> – <em>Download IronPDF library</em></p> </div> </div> Reference the Library in your project by using the next steps: 1. Right-click the Solution in the Solution Explorer 2. Select References 3. Browse for the IronPDF.dll library 4. Click OK Now that you’re set up, we can start playing with the awesome features in the IronPDF library after the setup for iTextSharp. <h3>Install iTextSharp by using NuGet</h3> There are three ways to [install the iTextSharp NuGet package](https://www.nuget.org/packages/iTextSharp/), they are: - Visual Studio - Developer Command Prompt - Download the NuGet Package directly Let’s do them one-by-one. For Visual Studio, search for iText and install the relevant packages, as shown next. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/itext.png" target="_blank"><img src="/img/faq/itextsharp/itext.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 7</strong> – <em>iText</em></p> </div> </div> Or, in the Developer Command Prompt (as shown previously, enter the following command) - *PM > Install-Package itext7* Or, download [iText 7](https://itextpdf.com/en/products/itext-7) directly from their website. Now that you have created the necessary projects, let’s compare these two libraries in code. <hr class="separator"> <h4 class="tutorial-segment-title">Compare the Code</h4> ## 4. Create a PDF from an Existing URL ## The following code downloads a webpage and converts it to a PDF document. ### 4.1. IronPDF Website to PDF ### The following code uses IronPDF to create a PDF document directly from a website address. Custom Headers and Footers are also included. ```cs /** IronPDF URL to PDF anchor-ironpdf-website-to-pdf **/ private void ExistingWebURL() { // Create a PDF from any existing web page var Renderer = new IronPdf.ChromePdfRenderer(); // Create a PDF from an existing HTML Renderer.RenderingOptions.MarginTop = 50; //millimetres Renderer.RenderingOptions.MarginBottom = 50; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.TextHeader = new TextHeaderFooter() { CenterText = "{pdf-title}", DrawDividerLine = true, FontSize = 16 }; Renderer.RenderingOptions.TextFooter = new TextHeaderFooter() { LeftText = "{date} {time}", RightText = "Page {page} of {total-pages}", DrawDividerLine = true, FontSize = 14 }; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.EnableJavaScript = true; Renderer.RenderingOptions.RenderDelay = 500; //milliseconds using var PDF = Renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Portable_Document_Format"); PDF.SaveAs("wikipedia.pdf"); }
Imports iText.Kernel.Pdf
Imports iText.Layout
Imports iText.Layout.Element

Public Sub StampPDF(ByVal inputPdfPath As String, ByVal outputPdfPath As String, ByVal stampText As String)
	Dim pdfDoc As New PdfDocument(New PdfReader(inputPdfPath), New PdfWriter(outputPdfPath))

	Dim document As New Document(pdfDoc)

## 1. Licensing
### 2. IronPDF Features ###
## 3. IronPDF Library Installation ##
### 3.1. Install using NuGet ###
### 3.2. Visual Studio ###
### 3.3. Developer Command Prompt ###
### 3.4. Download the NuGet Package directly ###
### 3.5. Download the .DLL Library ###
## 4. Create a PDF from an Existing URL ##
### 4.1. IronPDF Website to PDF ###
'INSTANT VB TODO TASK: Local functions are not converted by Instant VB:
'By quickly glancing at the code, you can see that IronPDF is pragmatic, based on common @end-user requirements.iText is a lower-level library that focuses on a drawing API where we add objects, shapes, @and text @to pages.iTextSharp.dll uses a primarily programmatic model @to render PDFs.@When using the iTextSharp PDF library, @each piece @of PDF text, graphic, table, @or line is "plotted” or drawn onto a PDF. The API appears low-level and is focused on the PDF document standard. This model allows precision but may require developers to learn a little about how PDFs work. Closely matching an existing design style or web assets may take some iteration and reading the [iTextSharp documentation](https://itextpdf.com/en/resources/api-documentation). In keeping with its heritage, the methodology and programmatic interface have a distinct Java flavor. In contrast, IronPDF uses a full embedded web browser renderer to [convert HTML to PDF](/tutorials/html-to-pdf/). Following short (1- and 2-line) [C# code examples for HTML to PDF conversion](/examples/using-html-to-create-a-pdf/), developers can generate PDFs from existing or new HTML, images, and CSS. This allows developers to work closely with existing web assets and also work in parallel with designers during a project. iText does include **HTML to PDF** functionality for C# .NET, though it is not, apparently, the library's dominant feature. Read on for more comparative details on the different ways that IronPDF and iTextSharp can help developers achieve the following goals: - [Create a PDF from an Existing URL](/examples/converting-a-url-to-a-pdf/) - [Create a PDF Document from an HTML input string](/tutorials/html-to-pdf/#anchor-create-a-pdf-with-an-html-string-in-net-c) - [Convert ASPX Pages to PDF](/how-to/aspx-to-pdf/) - [Convert XML to PDF](/how-to/xml-to-pdf/) - Live Data (chart) Licensing options are also an important factor in developer projects. iTextSharp is Open Source under the AGPL license agreement. When licensed under AGLP, anyone who uses any part of an application that contains iTextSharp (even across a company network or the internet) may be entitled to a full copy of the app's full source code. This is excellent for academic work. If we wish to use iTextSharp in commercial applications it is best practice to contact iText and [ask them for a quote on the pricing for iText commercial usage](https: IronPDF is [free for development](/#download-modal), and can then be [licensed for commercial deployment](/licensing/) at publicly published, reasonable prices starting at $749. <h2>IronPDF and iTextSharp</h2> This is how the two libraries stack up: <div class="content-table itextsharp-table"> <table> <tbody> <tr class="tr-head"> <th class="tcol1"><img src="/img/svgs/iron-pdf-logo.svg" alt="IronPDF" class="iron-pdf"></th> <th class="tcol2"><img src="/img/svgs/i-text-sharp.svg" alt="iTextSharp" class="iron-pdf"></th> </tr> <tr> <td><i class="fa fa-check"></i>Convert HTML to PDF via a full built-in web browser</td> <td><i class="fa fa-times"></i>Basic HTML to PDF via a pdfHTML add-on </td> </tr> <tr> <td><i class="fa fa-check"></i>Rendering focus: Embedded web browser</td> <td><i class="fa fa-check"></i>Rendering focus: Programmatic drawing model</td> </tr> <tr> <td><i class="fa fa-check"></i>IronPDF has explicit licenses with published prices</td> <td><i class="fa fa-times"></i>AGPL! Commercial use pricing not published.</td> </tr> <tr> <td><i class="fa fa-check"></i> Easy to Code with .NET First Design</td> <td><i class="fa fa-times"></i>Based on a Java API</td> </tr> <tr> <td><i class="fa fa-times"></i> Not suited to academic assignments and coursework </td> <td><i class="fa fa-check"></i> Excellent for academic assignments and research </td> </tr> </tbody> </table> </div> <hr class="separator"> <h4 class="tutorial-segment-title">Key Differences</h4> <h2>Generate PDF from HTML using IronPDF</h2> IronPDF enables .NET and .NET Core developers to generate, merge, split, edit, and extract PDF content easily in C#, F#, and VB.NET for .NET Core and .NET Framework, as well as [create PDFs from HTML, ASPX, CSS, JS, and image files](/blog/using-ironpdf/csharp-create-pdf-tutorial/). It makes use of a fully embedded web browser to convert HTML to PDF. This allows developers to generate PDFs from HTML, images, and CSS, and to work closely with existing web assets and also work in parallel with designers during a project. IronPDF really focuses on developer productivity. The library simplifies many common complex PDF code tasks into convenient C# methods to extract text and images, sign PDFs, edit PDFs with new HTML, and more, without the developer needing to study the PDF document standard to understand how to achieve their best result. - Generating PDF documents from HTML, images, and ASPX files - Reading PDF text - Extracting data and images from PDFs - Merging PDF documents - Splitting PDFs - Manipulating PDFs <h3>2. iTextSharp Documentation Features</h3> The [iTextSharp.dll](https: - AGLP strict open source licensing - Programmatic drawing model - Edit and Read PDFs - Solid functionality for PDF manipulation - Based on a Java library Let's compare by creating an example project utilizing both libraries: <hr class="separator"> <h4 class="tutorial-segment-title">Example Project</h4> <h2>Create an ASP.NET Project</h2> Make use of the following steps to create an ASP.NET website: 1. Open Visual Studio 2. Click File > New Project 3. Select Web under Visual C# in the Project type listbox 4. Select ASP.NET Web Application <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/New-project.png" target="_blank"><img src="/img/faq/itextsharp/New-project.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 1</strong> – <em>New Project</em></p> </div> </div> - Click OK - On the next screen, select Web Forms as shown in Figure 2 underneath <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/web-form.png" target="_blank"><img src="/img/faq/itextsharp/web-form.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 2</strong> – <em>Web Forms</em></p> </div> </div> - Click OK Now we have something to work with. Let's Install IronPDF. <hr class="separator"> <h4 class="tutorial-segment-title">Get Started</h4> In order to make use of IronPDF, you first need to install it (free). There are two options: - NuGet - Download the library Let's have a closer look. 
Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Bibliothèque NuGet C# pour PDF

Installer avec NuGet

Install-Package IronPdf
ou
Java PDF JAR

Télécharger DLL

Télécharger la DLL

Installation manuelle dans votre projet

Commencez à utiliser IronPDF dans votre projet dès aujourd'hui avec un essai gratuit.

Première étape :
green arrow pointer

Découvrez IronPDF sur NuGet pour une installation et un déploiement rapides. Avec plus de 8 millions de téléchargements, il transforme PDF avec C#.

Bibliothèque NuGet C# pour PDF nuget.org/packages/IronPdf/
Install-Package IronPdf

Envisagez d'installer le IronPDF DLL directement. Téléchargez et installez-le manuellement pour votre projet ou sous forme de GAC : {{lienDllAfficher}}

Installation manuelle dans votre projet

Télécharger la DLL
There are three ways to install the IronPDF NuGet package: 1. Visual Studio 2. Developer Command Prompt 3. Download the NuGet Package directly Let's do them one-by-one. Visual Studio provides the NuGet Package Manager for you to install NuGet packages in your projects. You can access it via the Project Menu, or by right-clicking your project in the Solution Explorer. Both these options are shown below in Figures 3 and 4 <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/project-menu.png" target="_blank"><img src="/img/faq/itextsharp/project-menu.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 3</strong> – <em>Project menu</em></p> </div> </div> <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/solution-explorer.png" target="_blank"><img src="/img/faq/itextsharp/solution-explorer.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 4</strong> – <em>Right-click Solution Explorer</em></p> </div> </div> After you have clicked Manage NuGet Packages from either option, Browse for the IronPDF package and install it as shown in Figure 5. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/install-ironpdf-nuget-package.png" target="_blank"><img src="/img/faq/itextsharp/install-ironpdf-nuget-package.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 5</strong> – <em>Install IronPDF NuGet Package</em></p> </div> </div> The following steps open the Developer Command Prompt and installs the **IronPDF NuGet** package 1. Search for your **Developer Command Prompt** – it is usually under your Visual Studio folder 2. Type in the following command: *PM > Install-Package IronPdf* 3. Press Enter 4. The package will be installed 5. Reload your Visual Studio project In order to download the NuGet package: 1. Navigate to [https: 2. Click on Download Package 3. After the package has downloaded, double click it 4. Reload your Visual Studio project The second way to install IronPDF is by [direct download](/#download-modal). <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/download-ironpdf-library.png" target="_blank"><img src="/img/faq/itextsharp/download-ironpdf-library.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 6</strong> – <em>Download IronPDF library</em></p> </div> </div> Reference the Library in your project by using the next steps: 1. Right-click the Solution in the Solution Explorer 2. Select References 3. Browse for the IronPDF.dll library 4. Click OK Now that you're set up, we can start playing with the awesome features in the IronPDF library after the setup for iTextSharp. <h3>Install iTextSharp by using NuGet</h3> There are three ways to [install the iTextSharp NuGet package](https: - Visual Studio - Developer Command Prompt - Download the NuGet Package directly Let's do them one-by-one. For Visual Studio, search for iText and install the relevant packages, as shown next. <div class="content-img-align-center"> <div class="center-image-wrapper"> <a rel="nofollow" href="/img/faq/itextsharp/itext.png" target="_blank"><img src="/img/faq/itextsharp/itext.png" alt="" class="img-responsive add-shadow"></a> <p><strong>Figure 7</strong> – <em>iText</em></p> </div> </div> Or, in the Developer Command Prompt (as shown previously, enter the following command) - *PM > Install-Package itext7* Or, download [iText 7](https: Now that you have created the necessary projects, let's compare these two libraries in code. <hr class="separator"> <h4 class="tutorial-segment-title">Compare the Code</h4> The following code downloads a webpage and converts it to a PDF document. The following code uses IronPDF to create a PDF document directly from a website address. Custom Headers and Footers are also included. ```cs private void ExistingWebURL() { var Renderer = new IronPdf.ChromePdfRenderer(); Renderer.RenderingOptions.MarginTop = 50; Renderer.RenderingOptions.MarginBottom = 50; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.TextHeader = new TextHeaderFooter() { CenterText = " '{ ' pdf-title '} 'INSTANT VB TODO TASK: Local functions are not converted by Instant VB: '", DrawDividerLine = true, FontSize = 16 }; Renderer.RenderingOptions.TextFooter = new TextHeaderFooter() { LeftText = " '{ ' @date '} If True Then time End If 'INSTANT VB TODO TASK: Local functions are not converted by Instant VB: '", RightText = "Page '{ ' page '} [of] If True Then total-pages End If 'INSTANT VB TODO TASK: The following line uses invalid syntax: '", DrawDividerLine = true, FontSize = 14 }; Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print; Renderer.RenderingOptions.EnableJavaScript = true; Renderer.RenderingOptions.RenderDelay = 500; var PDF = Renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Portable_Document_Format"); PDF.SaveAs("wikipedia.pdf"); }
VB   C#

IronPDF peut vous aider à ajouter du texte ou des images sur des PDF de manière très polyvalente et personnalisable. cela vous permet de prendre le contrôle complet. Il est facile de comprendre et de travailler avec l'API, surtout pour les développeurs familiers avec HTML/CSS. iTextSharp utilise ses outils d'estampillage d'images et de texte pour donner aux utilisateurs plus de contrôle sur le contenu affiché dans leurs fichiers PDF, bien que le processus puisse finir par être plus manuel.

Convertir DOCX en PDF

Parfois, vous devrez peut-être convertir des PDF d'un format à un autre. Dans ce cas, nous regardonsConversion de DOCX en PDF et en comparant la façon dont IronPDF et iTextSharp gèrent ce processus différemment.

IronPDF

using IronPdf;

// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render from DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the PDF
pdf.SaveAs("pdfFromDocx.pdf");
using IronPdf;

// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();

// Render from DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");

// Save the PDF
pdf.SaveAs("pdfFromDocx.pdf");
Imports IronPdf

' Instantiate Renderer
Private renderer As New DocxToPdfRenderer()

' Render from DOCX file
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx")

' Save the PDF
pdf.SaveAs("pdfFromDocx.pdf")
VB   C#

iTextSharp

Malheureusement, iTextSharp ne fournit pas de fonctionnalité intégrée de conversion de DOCX en PDF, et les développeurs doivent s'appuyer sur des bibliothèques externes comme Aspose.Words pour cette tâche.

IronPDF fournit aux développeurs un outil simple et concis pour gérer les tâches de conversion de DOCX en PDF, facilitant ainsi la conversion des fichiers DOCX en format PDF sans avoir besoin de bibliothèques externes. iTextSharp, quant à lui, s'appuie sur des bibliothèques externes pour mener à bien cette tâche.

Résumé de la comparaison des exemples de code

Itextsharp 1 related to Résumé de la comparaison des exemples de code

Pour des exemples plus détaillés, veuillez visiterExemples IronPDF.

Prix et licences : IronPDF vs. iTextSharp Library

Prix et licences d'IronPDF

IronPDFa différents niveaux et fonctionnalités supplémentaires pour l'achat d'une licence. Les développeurs peuvent également acheterIronSuitece qui vous donne accès à tous les produits d'Iron Software au prix de deux. Si vous n'êtes pas prêt à acheter une licence, IronPDF propose unessai gratuitqui dure 30 jours.

  • Licences perpétuelles : Offre une gamme de licences perpétuelles en fonction de la taille de votre équipe, de vos besoins de projet et du nombre de sites. Chaque type de licence inclut le support par email.
  • Lite License : Cette licence coûte 749 $ et prend en charge un développeur, un site et un projet.

    Avec ce segment de code, nous avons transformé le Tiger Wikipediapage web au format PDF avec les deux bibliothèques.

  • Professional License : Cette licence convient aux équipes plus importantes, supportant dix développeurs, dix emplacements et dix projets pour 2 999 $. Elle offre les mêmes canaux de support que les niveaux précédents mais propose également un support par partage d'écran.
  • Redistribution libre de droits : La licence d'IronPDF offre également une couverture de redistribution libre de droits pour un supplément de 1 999 $.
  • Assistance produit ininterrompue : IronPDF offre un accès aux mises à jour continues du produit, aux améliorations des fonctionnalités de sécurité et au support de leur équipe d'ingénieurs pour 999 $/an ou un achat unique de 1 999 $ pour une couverture de 5 ans.
  • IronSuite: Pour 1 498 $, vous avez accès à tous les produits Iron Software, y compris IronPDF, IronOCR, IronWord, IronXL, IronBarcode, IronQR, IronZIP, IronPrint, et IronWebScraper.

    Itextsharp 2 related to Prix et licences d'IronPDF

licence iTextSharp

  • Licence AGPL: iTextSharp est disponible gratuitement sous licence AGPL(Licence publique générale Affero). Cette licence exige que tout logiciel utilisant iTextSharp soit open-source sous la même licence s'il est redistribué.
  • Licence commerciale: Pour les projets qui ne répondent pas aux conditions de l'AGPL, iTextSharp offre une licence commerciale pour permettre son utilisation dans des logiciels propriétaires. Le prix de cette licence est basé sur un modèle de devis et varie en fonction de l'utilisation et de l'étendue du projet.

Documentation et support : IronPDF vs. iText

IronPDF

  • Documentation complète: Documentation exhaustive et conviviale couvrant toutes les fonctionnalités qu'elle a à offrir.
  • Support 24/5: Le support actif des ingénieurs est disponible.
  • Tutoriels Vidéo : Des guides vidéo pas à pas sont disponibles sur YouTube.
  • Forum Communautaire : Une communauté engagée pour un support supplémentaire.
  • Mises à jour régulières : Mises à jour mensuelles du produit pour garantir les dernières fonctionnalités et correctifs de sécurité.

iTextSharp

  • Documentation: iTextSharp propose une documentation détaillée couvrant ses principales fonctionnalités.
  • Exemples et tutoriels: Une variété de tutoriels et d'exemples de code sont fournis pour aider les développeurs à démarrer.
  • GitHub: Les développeurs peuvent soumettre des problèmes ou des bogues au dépôt GitHub d'iTextSharp et interagir avec la communauté iTextSharp pour obtenir de l'aide.
  • Mises à jour: Des mises à jour régulières sont fournies pour améliorer les fonctionnalités et corriger les bogues.

    Pour plus de détails sur la documentation et le support d'IronPDF, visitezDocumentation IronPDF et leChaîne YouTube Iron Software.

Conclusion

Les deuxIronPDFet iTextSharp sont des options solides pour la manipulation de PDF dans les projets .NET. IronPDF se distingue par son intégration intuitive à la plateforme et ses fonctionnalités telles que la conversion HTML en PDF et des options de sécurité avancées. iTextSharp, bien qu'ancré dans la bibliothèque open-source iText, offre un ensemble d'outils puissant et flexible sous les licences AGPL et commerciales, ce qui le rend idéal pour les projets pouvant bénéficier de la flexibilité de l'open source ou nécessitant le respect strict des licences.

Choisir le bon outil dépend des exigences de licence de votre projet, des besoins de support technique et des demandes spécifiques de fonctionnalités. Que vous préfériez la simplicité et le support complet de IronPDF ou la robustesse open-source de iTextSharp, les deux bibliothèques offrent aux développeurs des ressources abondantes pour améliorer les flux de travail PDF dans leurs applications.

Vous pouvez essayer le essai gratuit de 30 jours pour découvrir leurs fonctionnalités disponibles.

< PRÉCÉDENT
IronPDF et EvoPdf : Une comparaison
SUIVANT >
Comparaison de Syncfusion PDF Viewer pour la conversion de HTML en PDF