PRODUCT COMPARISONS

A Comparison between IronPDF and Apitron PDF Kit

Published December 11, 2022
Share:

In C#, working with PDF files can be a challenge for developers. There are many factors to consider while creating content for such files, and even more so when converting content from different formats to PDF. Automation is now the key to software development processes. These issues have now been resolved with the construction of libraries designed to help read, write, create, and modify PDF documents, as well as to edit their attributes and to convert them from other formats.

Two PDF libraries will be compared for .NET and .NET Core in this blog post. These two libraries are:

  • The IronPDF library
  • The Apitron PDF Kit

IronPDF and Apitron PDF Kit are two libraries that provide PDF-manipulation functions for .NET and .NET Core. They can both be used for document fields conversion and manipulation tasks. They both can also create bookmarks. The next question is deciding which C# PDF .NET library is best for our .NET projects. This comparison article will help you decide between these two PDF libraries.

First, let's take a look at what the two libraries have to offer, and then move on to the comparison itself.

The Apitron PDF Kit Library and its Features

Apitron PDF Kit is a .NET component that allows you to manipulate or convert PDF files in whatever way you want. You can add images, drawings and texts, sign documents, and much more. You can also edit existing content. The Apitron PDF Kit .NET component can be used to create mobile, desktop, web, Windows, and Cloud applications across multiple platforms.

Using this PDF SDK, you'll be able to:

  • Extract, modify and add graphics (text, images, drawings)
  • Split or merge PDF documents
  • Fill or create password-protected PDF forms, FDF support
  • Create multi-layer PDF document with optional content groups ( OCG )
  • Add or remove fields from document
  • Use right-to-left or bidirectional text to create page content
  • Examine resources within a document - fonts defined, embedded files
  • Digitally sign and check existing signatures on PDF documents

The Main Features of IronPDF

Developers, especially C# programmers, will adore the IronPDF .NET library. With this amazing tool, you can construct a .NET Core PDF processing application easily.

IronPDF uses the .NET Chromium engine to change HTML pages (in code or in URL form) to PDF files. There is absolutely no need to use complex APIs to position navigation objects or to design PDFs from HTML. Standard web documents are supported by IronPDF, including HTML, ASPX, JS, CSS, and pictures.

IronPDF can be created using HTML5, CSS, JS, and images. A PDF can be easily edited, stamped, and added with headers and footers. It also makes reading PDF text and extracting graphics a breeze.

Standout features of IronPDF include:

  • Creation of PDF documents using HTML4/5, CSS, and JavaScript
  • Loading of URLs with custom network login credentials, user agents, proxies, cookies, HTTP headers, and form variables (enabling login behind HTML login forms)
  • Reading and completion of PDF form fields
  • Extraction of text and graphics from PDFs
  • Updating PDF pages with new HTML content
  • Creation of text-based or HTML-based headers and footers
  • Merging and separation of PDF document content
  • Conversion of ASP.NET webforms into printable PDFs
  • Printing PDF files without Adobe Acrobat software

IronPDF is available in almost all operating systems and frameworks compatible with C#, including the following:

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

The rest of the article goes as follows:

  1. IronPDF Installation
  2. Apitron PDF Kit Installation
  3. Create a PDF Document
  4. Create Header and Footer in PDF
  5. Digitally Sign PDF
  6. Pricing and Licensing
  7. Conclusion

1. IronPDF Installation

There are four methods to download and install the IronPDF library. These are as follows:

  1. Using NuGet Package Manager
  2. The Developer Command Prompt
  3. Download the NuGet Package directly
  4. Download the IronPDF .DLL library

1.1. Using NuGet Package Manager

To install IronPDF, simply right-click on your project in Solution Explorer. This will open NuGet Package Manager.

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 1: Accessing the NuGet Package Manager using the Solution Explorer

Accessing the NuGet Package Manager using the Solution Explorer

Once selected, browse for the IronPDF package and install it, as shown in the screenshot below.

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 2: Installing the IronPDF library using the NuGet Package Manager

Installing the IronPDF library using the NuGet Package Manager

1.2. Using the Developer Command Prompt

You can also install IronPDF through the Developer Command Prompt.

  • Open the Developer Command Prompt --- usually found under the Visual Studio folder
  • Type the following command:
Install-Package IronPdf
  • Press Enter
  • This will download and install the package
  • Reload your project and begin using it

1.3. Download the NuGet Package Directly

IronPDF can also be installed by visiting the NuGet site directly and downloading the package. The steps are:

IronPDF is downloaded and is ready to use. However, before that, we should install the Apitron PDF library.

2. Apitron PDF Kit Installation

For .NET Core applications, we can install Apitron using NuGet Package Manager, or we can download and install Apitron from NuGet website directly.

  • Open NuGet packages in Visual Studio as we did in IronPDF.
  • Search for Apitron.PDF.Kit.
  • Click on install in your current project.
A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 3: Apitron PDF Kit Search

Apitron PDF Kit Search

You can also use the NuGet Package Manager Console to install Apitron. Follow the "Use Developer Command Prompt" step as mentioned in IronPDF and type the following command:

Install-Package Apitron.PDF.Kit

Press ENTER. It will download and install Apitron.PDF.Kit.

Add the following namespaces:

using Apitron.PDF.Kit;
using Apitron.PDF.Kit.FixedLayout.Resources;
using Apitron.PDF.Kit.FixedLayout.Resources.Fonts;
using Apitron.PDF.Kit.FlowLayout.Content;
using Apitron.PDF.Kit.Styles;
using Apitron.PDF.Kit.Styles.Appearance;
using Font = Apitron.PDF.Kit.Styles.Text.Font;
using Apitron.PDF.Kit;
using Apitron.PDF.Kit.FixedLayout.Resources;
using Apitron.PDF.Kit.FixedLayout.Resources.Fonts;
using Apitron.PDF.Kit.FlowLayout.Content;
using Apitron.PDF.Kit.Styles;
using Apitron.PDF.Kit.Styles.Appearance;
using Font = Apitron.PDF.Kit.Styles.Text.Font;
Imports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.FixedLayout.Resources
Imports Apitron.PDF.Kit.FixedLayout.Resources.Fonts
Imports Apitron.PDF.Kit.FlowLayout.Content
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Styles.Appearance
Imports Font = Apitron.PDF.Kit.Styles.Text.Font
VB   C#

Now, let's move into the comparison between IronPDF and Apitron PDF.

3. Creating PDF Document

3.1. Using IronPDF

IronPDF has multiple methods for creating PDFs. Let's have a look at two important ones.

Existing URL to PDF

IronPDF makes it easy to convert any URL to PDF. The following code helps convert URL to PDF.

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
Pdf.SaveAs("url.pdf")
VB   C#

HTML Input String to PDF

The below code explains how to render a PDF document from an HTML string. You can use just HTML, or combine it with CSS, pictures, and JavaScript.

var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf")

' 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 AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")
VB   C#

The output is as follows:

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 4: IronPDF Generate PDF from URL and HTML CSS String

IronPDF Generate PDF from URL and HTML CSS String

3.2. Using Apitron PDF Kit

Apitron PDF does not provide facility to convert a URL or HTML to PDF. It allows converting PDF to HTML. However, it also converts XML file to PDF. The XML file used is:

<?xml version="1.0" encoding="utf-8"?>
<FlowDocument xmlns="Apitron.PDF.Kit.FlowLayout.v1">
  <Resources>
    <Image resourceId="logo" fileName="../../images/logo.png" />
  </Resources>
  <Styles>
    <Style selector="flowdocument">
      <Color value="Black" />
    </Style>
    <Style selector="grid">
      <InnerBorder thickness="1" />
      <InnerBorderColor value="Black" />
    </Style>
  </Styles>
  <Elements>
    <Image>
      <Properties>
        <Class value="logo" />
        <ResourceId value="logo" />
      </Properties>
    </Image>
    <TextBlock>
      <Properties>
        <Class value="header" />
        <Text value="Sample Interview Questions for Candidates" />
      </Properties>
    </TextBlock>
    <Br />
    <TextBlock>
      <Properties>
        <Class value="headerNote" />
        <Text value="To help facilitate the interview process, the Human Resources Department has compiled a list of questions that might be used during the phone and/or on-campus interviews. Some of the questions deal with the same content, but are phrased differently while other questions may not pertain to a specific discipline; however all of the questions are unbiased and appropriate to ask. We hope you'll find this helpful." />
      </Properties>
    </TextBlock>
  </Elements>
  <Properties>
    <Margin value="30,20,30,20" />
  </Properties>
</FlowDocument>
XML

The code for converting this XML template to PDF is as follows:

using (Stream stream = File.OpenRead("C:\\PLACE YOUR EXACT PATH HERE\\template.xml"), outputStream = File.Create("fromTemplate.pdf"))
{
    ResourceManager resourceManager = new ResourceManager();

    FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);

    doc.Write(outputStream, resourceManager);
}
using (Stream stream = File.OpenRead("C:\\PLACE YOUR EXACT PATH HERE\\template.xml"), outputStream = File.Create("fromTemplate.pdf"))
{
    ResourceManager resourceManager = new ResourceManager();

    FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);

    doc.Write(outputStream, resourceManager);
}
Using stream As Stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"), outputStream As Stream = File.Create("fromTemplate.pdf")
	Dim resourceManager As New ResourceManager()

	Dim doc As FlowDocument = FlowDocument.LoadFromXml(stream, resourceManager)

	doc.Write(outputStream, resourceManager)
End Using
VB   C#

The output is as follows:

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 5: Apitron PDF Document

Apitron PDF Document

If we compare the output of IronPDF and Apitron, we can clearly see that IronPDF creates stunning documents using HTML rendering and without even scaling the image size. On the other hand, Apitron gives a similar output to IronPDF but only if the XML file has registered styles.

4. Add Headers and Footers to PDF Documents

4.1. Using IronPDF

Adding header and footers is fairly easy with IronPDF. IronPDF allows you to add page numbers and page breaks, attach a cover page, margin etc.

The code for adding headers and footers is below:

var Renderer = new ChromePdfRenderer();

// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // use 2 if a cover page  will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; //create 25mm space for header

// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; //create 25mm space for footer

using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
var Renderer = new ChromePdfRenderer();

// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // use 2 if a cover page  will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; //create 25mm space for header

// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; //create 25mm space for footer

using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
Dim Renderer = New ChromePdfRenderer()

' Add a header
Renderer.RenderingOptions.FirstPageNumber = 1 ' use 2 if a cover page  will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = True
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text"
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica
Renderer.RenderingOptions.TextHeader.FontSize = 12
Renderer.RenderingOptions.MarginTop = 25 'create 25mm space for header

' Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = True
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial
Renderer.RenderingOptions.TextFooter.FontSize = 12
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}"
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}"
Renderer.RenderingOptions.MarginTop = 25 'create 25mm space for footer

Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")
VB   C#

The output is as follows:

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 6: IronPDF Header and Footer

IronPDF Header and Footer

4.2. Using Apitron PDF Kit

Apitron PDF Kit creates PDFs by converting content in an XML structure format into to a PDF. In Apitron PDF Fit, headers and Footers can be added using the PageHeader and PageFooter properties. The code for doing this is as follows:

// register doc's resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo","../../data/logo.png"));

// create document
FlowDocument doc = new FlowDocument(){Margin = new Thickness(10)};

// register styles
doc.StyleManager.RegisterStyle(".pageHeader",new Style(){Font = new Font(StandardFonts.TimesBold, 20)});
doc.StyleManager.RegisterStyle(".pageFooter",new Style(){Align = Align.Right});
doc.StyleManager.RegisterStyle("hr",new Style(){Height = 2, Margin = new Thickness(0,5,0,5)});
doc.StyleManager.RegisterStyle(".content",new Style(){Align = Align.Left, Display = Display.InlineBlock});

// fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo"){Width = 100, Height = 50});
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only"){TextIndent = 20});
doc.PageHeader.Add(new Hr());

// fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx)=>string.Format("Page {0} from&nbsp;",ctx.CurrentPage+1)));
doc.PageFooter.Add(new PageCount(3){Display = Display.Inline});

// add pages
for (int i = 0; i < 2; ++i)
{
    doc.Add(new TextBlock("This is header and footer generation pdf file.") {Class = "content"});
    doc.Add(new PageBreak());
}

// generate PDF
using (Stream stream = File.Create("out.pdf"))
{
    doc.Write(stream, resourceManager);
}

Process.Start("out.pdf");
// register doc's resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo","../../data/logo.png"));

// create document
FlowDocument doc = new FlowDocument(){Margin = new Thickness(10)};

// register styles
doc.StyleManager.RegisterStyle(".pageHeader",new Style(){Font = new Font(StandardFonts.TimesBold, 20)});
doc.StyleManager.RegisterStyle(".pageFooter",new Style(){Align = Align.Right});
doc.StyleManager.RegisterStyle("hr",new Style(){Height = 2, Margin = new Thickness(0,5,0,5)});
doc.StyleManager.RegisterStyle(".content",new Style(){Align = Align.Left, Display = Display.InlineBlock});

// fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo"){Width = 100, Height = 50});
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only"){TextIndent = 20});
doc.PageHeader.Add(new Hr());

// fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx)=>string.Format("Page {0} from&nbsp;",ctx.CurrentPage+1)));
doc.PageFooter.Add(new PageCount(3){Display = Display.Inline});

// add pages
for (int i = 0; i < 2; ++i)
{
    doc.Add(new TextBlock("This is header and footer generation pdf file.") {Class = "content"});
    doc.Add(new PageBreak());
}

// generate PDF
using (Stream stream = File.Create("out.pdf"))
{
    doc.Write(stream, resourceManager);
}

Process.Start("out.pdf");
' register doc's resources first
Dim resourceManager As New ResourceManager()
resourceManager.RegisterResource(New Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo","../../data/logo.png"))

' create document
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}

' register styles
doc.StyleManager.RegisterStyle(".pageHeader",New Style() With {.Font = New Font(StandardFonts.TimesBold, 20)})
doc.StyleManager.RegisterStyle(".pageFooter",New Style() With {.Align = Align.Right})
doc.StyleManager.RegisterStyle("hr",New Style() With {
	.Height = 2,
	.Margin = New Thickness(0,5,0,5)
})
doc.StyleManager.RegisterStyle(".content",New Style() With {
	.Align = Align.Left,
	.Display = Display.InlineBlock
})

' fill the header section
doc.PageHeader.Class = "pageHeader"
doc.PageHeader.Add(New Image("logo") With {
	.Width = 100,
	.Height = 50
})
doc.PageHeader.Add(New TextBlock("This document is intended for internal use only") With {.TextIndent = 20})
doc.PageHeader.Add(New Hr())

' fill the footer section
doc.PageFooter.Class = "pageFooter"
doc.PageFooter.Add(New Hr())
doc.PageFooter.Add(New TextBlock(Function(ctx) String.Format("Page {0} from&nbsp;",ctx.CurrentPage+1)))
doc.PageFooter.Add(New PageCount(3) With {.Display = Display.Inline})

' add pages
For i As Integer = 0 To 1
	doc.Add(New TextBlock("This is header and footer generation pdf file.") With {.Class = "content"})
	doc.Add(New PageBreak())
Next i

' generate PDF
Using stream As Stream = File.Create("out.pdf")
	doc.Write(stream, resourceManager)
End Using

Process.Start("out.pdf")
VB   C#

The output is as follows:

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 7: Apitron Header and Footer

Apitron Header and Footer

5. Digitally Sign PDF

5.1. Using IronPDF

One of the most important PDF processing features is the ability to sign a PDF document digitally. IronPDF provides all the tools necessary to do this.

using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");
using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");
Imports IronPdf

' Cryptographically sign an existing PDF in 1 line of code!
Call (New IronPdf.Signing.PdfSignature("Iron.p12", "123456")).SignPdfFile("any.pdf")

'''*** Advanced example for more control ****

' 1. Create a PDF
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")

' 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456")

' 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png")

' 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature)

' 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf")
VB   C#

5.2 Using Apitron PDF Kit

Stamping a signature to a PDF using Apitron PDF Kit is both a lengthy and technical process.

static void Main(string [] args)
{
    string fileName = "signedTwice.pdf";

    using (Stream stream = File.Create(fileName))
   {
        FlowDocument doc = new FlowDocument(){Margin = new Thickness(10)};
        doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
        doc.Write(stream,new ResourceManager());
   }

    // save
    Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}

// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
    // open existing document and sign once
    using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
    {
        using (FixedDocument doc = new FixedDocument(inputStream))
        {
            string imageResourceId = Guid.NewGuid().ToString("N");
            string signatureFieldId = Guid.NewGuid().ToString("N");

            // register signature image resource
            doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));

            // create first signature field and initialize it using a stored certificate
            SignatureField signatureField = new SignatureField(signatureFieldId);
            using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
            {
                signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream,password));
            }

            // add signature fields to the document
            doc.AcroForm.Fields.Add(signatureField);

            // create first signature view using the image resource
            SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
            signatureView.ViewSettings.Graphic = Graphic.Image;
            signatureView.ViewSettings.GraphicResourceID = imageResourceId;
            signatureView.ViewSettings.Description = Description.None;

            // add views to page annotations collection
            doc.Pages [0].Annotations.Add(signatureView);

            // save as incremental update
            doc.Save();
        }
    }
}
static void Main(string [] args)
{
    string fileName = "signedTwice.pdf";

    using (Stream stream = File.Create(fileName))
   {
        FlowDocument doc = new FlowDocument(){Margin = new Thickness(10)};
        doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
        doc.Write(stream,new ResourceManager());
   }

    // save
    Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}

// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
    // open existing document and sign once
    using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
    {
        using (FixedDocument doc = new FixedDocument(inputStream))
        {
            string imageResourceId = Guid.NewGuid().ToString("N");
            string signatureFieldId = Guid.NewGuid().ToString("N");

            // register signature image resource
            doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));

            // create first signature field and initialize it using a stored certificate
            SignatureField signatureField = new SignatureField(signatureFieldId);
            using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
            {
                signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream,password));
            }

            // add signature fields to the document
            doc.AcroForm.Fields.Add(signatureField);

            // create first signature view using the image resource
            SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
            signatureView.ViewSettings.Graphic = Graphic.Image;
            signatureView.ViewSettings.GraphicResourceID = imageResourceId;
            signatureView.ViewSettings.Description = Description.None;

            // add views to page annotations collection
            doc.Pages [0].Annotations.Add(signatureView);

            // save as incremental update
            doc.Save();
        }
    }
}
Shared Sub Main(ByVal args() As String)
	Dim fileName As String = "signedTwice.pdf"

	Using stream As Stream = File.Create(fileName)
		Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
		doc.Add(New TextBlock("Signed using Apitron PDF Kit for .NET"))
		doc.Write(stream,New ResourceManager())
	End Using

	' save
	Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", New Boundary(10, 750, 110, 800))
End Sub

' Implementation of Sign Method
Private Shared Sub Sign(ByVal pathToDocument As String, ByVal pathToCertificate As String, ByVal password As String, ByVal pathToSignatureImage As String, ByVal signatureViewLocation As Boundary)
	' open existing document and sign once
	Using inputStream As Stream = New FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite)
		Using doc As New FixedDocument(inputStream)
			Dim imageResourceId As String = Guid.NewGuid().ToString("N")
			Dim signatureFieldId As String = Guid.NewGuid().ToString("N")

			' register signature image resource
			doc.ResourceManager.RegisterResource(New Image(imageResourceId, pathToSignatureImage))

			' create first signature field and initialize it using a stored certificate
			Dim signatureField As New SignatureField(signatureFieldId)
			Using signatureDataStream As Stream = File.OpenRead(pathToCertificate)
				signatureField.Signature = Signature.Create(New Pkcs12Store(signatureDataStream,password))
			End Using

			' add signature fields to the document
			doc.AcroForm.Fields.Add(signatureField)

			' create first signature view using the image resource
			Dim signatureView As New SignatureFieldView(signatureField, signatureViewLocation)
			signatureView.ViewSettings.Graphic = Graphic.Image
			signatureView.ViewSettings.GraphicResourceID = imageResourceId
			signatureView.ViewSettings.Description = Description.None

			' add views to page annotations collection
			doc.Pages (0).Annotations.Add(signatureView)

			' save as incremental update
			doc.Save()
		End Using
	End Using
End Sub
VB   C#

The output is pretty much the same for the libraries. You can clearly see that IronPDF is easier and more convenient for manipulating PDF content. The output PDF is signed with the certificate and signature printed on it.

6. Pricing and Licensing

IronPDF Pricing and Licensing

IronPDF is a C# library that is free to use for development and can be licensed for commercial use any time. Project licenses for single developers, agencies, and multinational organizations, as well for as SaaS and OEM redistribution, are all accessible. All licenses provide a 30 day money back guarantee, one year support and upgrades, development/staging/production validity, and a perpetual license (one-time purchase).

The Lite package is available for $749 with no recurring expenses. More details and assistance for choosing the best license is available on the product licensing page.

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 8: IronPDF Licensing

IronPDF Licensing

Apitron PDF Kit Pricing and Licensing

There are two licensing schemes currently in use - Modern and Legacy. If you already have a license, then the legacy license scheme remains active for you until your license expires. Afterward, you have to contact customer support for the transition. The modern licensing scheme applies to you only if you are a new customer.

Under the modern scheme, there are three licensing tiers:

  • Evaluation - three-month evaluation period to use a fully functional product. Just download the package from NuGet and start developing.
  • Community - Use fully functional product without any fees in your non-commercial projects. Approval is required.
  • Commercial - any use case not described above. Pricing depends on the usage pattern.

For further details regarding the purchase, you can contact the Apitron Sales Representative.

Conclusion

The IronPDF library creates pixel-perfect PDFs from document types like HTML, JS, CSS, JPG, PNG, GIF, and SVG. The Chromium engine helps to render the HTML files or URLs to give perfect PDFs as output.

Apitron lets you create PDF using a Fixed layout API, implemented to be 100% PDF specification compatible. As a style-driven content generation method that is similar to HTML and CSS, this fixed-layout API provides you with the ability to create stunning reports, bills, catalogues and more in minutes. It also supports the creation of XML templates.

Licensing prices for Apitron PDF is not available on their website. You have to contact support and get a quote based on your usage. On the other hand, IronPDF has a very clear licensing package displayed on their website. This makes IronPDF standout from its competitors and allows users to choose wisely according to their needs.

With IronPDF, you can work with PDF files more easily than with Apitron PDF. IronPDF allows its users to write fewer lines of code for challenging PDF jobs. IronPDF provides multiple methods to produce PDFs from multiple file types, while Apitron can only convert XML documents to PDF documents. A perfect output is achieved without adding any technical options in IronPDF as compared to Apitron.

All Iron Software customers have the option of purchasing all five of company's products for the price of two of them. Try the free, 30 day trial to test its full functionality. Purchase the full suite of Iron Software products here.

< PREVIOUS
Telerik HTML to PDF Generator vs IronPDF
NEXT >
A Comparison between IronPDF and GroupDocs

Ready to get started? Version: 2024.10 just released

Free NuGet Download Total downloads: 11,308,499 View Licenses >