How to Migrate from Apryse PDF to IronPDF in C#
Full Comparison
Looking for a detailed feature-by-feature breakdown? See how IronPDF stacks up against Apryse PDF on pricing, HTML support, and licensing.
Apryse (rebranded from PDFTron on February 8, 2023) is an enterprise PDF SDK known for its comprehensive document processing capabilities. The NuGet packages and .NET namespaces continue to ship under the historical PDFTron.* / pdftron.* IDs after the rebrand. Apryse uses sales-led pricing — public price points are not published on apryse.com, and third-party marketplaces (Vendr, G2) report entry quotes from roughly $1,500/developer/year. Combined with module-path setup and C++-heritage APIs, that can create barriers for teams seeking straightforward PDF functionality. This guide provides a step-by-step migration path from Apryse to IronPDF — a native .NET PDF library with modern C# conventions, simpler integration, and one-time perpetual licensing.
Why Migrate Away from Apryse PDF?
While Apryse PDF delivers robust functionality, several factors drive development teams to seek alternatives for their PDF generation needs.
Premium Pricing and Subscription Model
Apryse targets enterprise customers with sales-led pricing that can be prohibitive for small to medium-sized projects. Public price points are not published on apryse.com; the figures below come from third-party aggregators (Vendr, G2) and should be confirmed with Apryse sales:
| Aspect | Apryse (PDFTron) | IronPDF |
|---|---|---|
| Entry-level | ~$1,500/developer/year (reported by Vendr) | $749 one-time (Lite) |
| Typical range | ~$9,275–$35,816/year (per Vendr marketplace data) | Tiered Lite/Plus/Professional |
| License Model | Annual subscription, sales-led quote | Perpetual license |
| Viewer License | WebViewer/PDFViewCtrl priced separately | N/A (use standard viewers) |
| Server License | Enterprise pricing required | Included in license tiers |
Complexity of Integration
Apryse's C++ heritage shapes the .NET surface, which can add setup steps relative to a managed-only package:
| Feature | Apryse PDF | IronPDF |
|---|---|---|
| Setup | Module paths, external binaries | Single NuGet package |
| Initialization | PDFNet.Initialize() with license |
Simple property assignment |
| HTML Rendering | External html2pdf module required | Built-in Chromium engine |
| API Style | C++ heritage, complex | Modern C# conventions |
| Dependencies | Multiple DLLs, platform-specific | Self-contained package |
When to Consider Migration
Migrate to IronPDF if:
- You primarily need HTML/URL to PDF conversion
- You want simpler API with less boilerplate
- Premium pricing isn't justified for your use case
- You don't need PDFViewCtrl viewer controls
- You prefer one-time licensing over subscriptions
Stay with Apryse PDF if:
- You need their native viewer controls (PDFViewCtrl)
- You use XOD or proprietary formats extensively
- You require specific enterprise features (advanced redaction, etc.)
- Your organization already has enterprise licenses
Pre-Migration Preparation
Prerequisites
Ensure your environment meets these requirements:
- .NET Framework 4.6.2+, .NET Core 3.1+, or .NET 5/6/7/8/9
- Visual Studio 2019+ or VS Code with C# extension
- NuGet Package Manager access
- IronPDF license key (free trial available at ironpdf.com)
Audit Apryse PDF Usage
Run these commands in your solution directory to identify all Apryse references:
# Find all pdftron using statements
grep -r "using pdftron" --include="*.cs" .
# Find PDFNet initialization
grep -r "PDFNet.Initialize\|PDFNet.SetResourcesPath" --include="*.cs" .
# Find PDFDoc usage
grep -r "new PDFDoc\|PDFDoc\." --include="*.cs" .
# Find HTML2PDF usage
grep -r "HTML2PDF\|InsertFromURL\|InsertFromHtmlString" --include="*.cs" .
# Find ElementReader/Writer usage
grep -r "ElementReader\|ElementWriter\|ElementBuilder" --include="*.cs" .
# Find all pdftron using statements
grep -r "using pdftron" --include="*.cs" .
# Find PDFNet initialization
grep -r "PDFNet.Initialize\|PDFNet.SetResourcesPath" --include="*.cs" .
# Find PDFDoc usage
grep -r "new PDFDoc\|PDFDoc\." --include="*.cs" .
# Find HTML2PDF usage
grep -r "HTML2PDF\|InsertFromURL\|InsertFromHtmlString" --include="*.cs" .
# Find ElementReader/Writer usage
grep -r "ElementReader\|ElementWriter\|ElementBuilder" --include="*.cs" .
Breaking Changes to Anticipate
| Apryse PDF Pattern | Change Required |
|---|---|
PDFNet.Initialize() |
Replace with IronPdf.License.LicenseKey |
HTML2PDF module |
Built-in ChromePdfRenderer |
ElementReader/ElementWriter |
IronPDF handles content internally |
SDFDoc.SaveOptions |
Simple SaveAs() method |
PDFViewCtrl |
Use external PDF viewers |
| XOD format | Convert to PDF or images |
| Module path configuration | Not needed |
Step-by-Step Migration Process
Step 1: Update NuGet Packages
Apryse publishes the .NET SDK under several PDFTron.* package IDs depending on target framework and architecture (the brand changed in 2023, but the package IDs did not). Common ones:
PDFTron.NET.x64— primary .NET / .NET Core x64 package (current 11.x)PDFTron.NetFramework.x64— .NET Framework 4.5.1+ x64 onlyPDFTron.NETCore.Windows.x64— .NET Core on Windows x64PDFNet— legacy combined Windows .NET Framework 32/64-bit package
# Remove whichever Apryse/PDFTron package(s) you have installed
dotnet remove package PDFTron.NET.x64
dotnet remove package PDFTron.NetFramework.x64
dotnet remove package PDFTron.NETCore.Windows.x64
dotnet remove package PDFNet
# Install IronPDF
dotnet add package IronPdf
# Remove whichever Apryse/PDFTron package(s) you have installed
dotnet remove package PDFTron.NET.x64
dotnet remove package PDFTron.NetFramework.x64
dotnet remove package PDFTron.NETCore.Windows.x64
dotnet remove package PDFNet
# Install IronPDF
dotnet add package IronPdf
Or via Package Manager Console:
Uninstall-Package PDFTron.NET.x64
Install-Package IronPdf
Step 2: Update Namespace References
Replace Apryse namespaces with IronPDF:
// Remove these
using pdftron;
using pdftron.PDF;
using pdftron.PDF.Convert;
using pdftron.SDF;
using pdftron.Filters;
// Add these
using IronPdf;
using IronPdf.Rendering;
// Remove these
using pdftron;
using pdftron.PDF;
using pdftron.PDF.Convert;
using pdftron.SDF;
using pdftron.Filters;
// Add these
using IronPdf;
using IronPdf.Rendering;
Imports IronPdf
Imports IronPdf.Rendering
Step 3: Remove Initialization Boilerplate
Apryse PDF requires complex initialization. IronPDF eliminates this entirely.
Apryse PDF Implementation:
// Complex initialization
PDFNet.Initialize("YOUR_LICENSE_KEY");
PDFNet.SetResourcesPath("path/to/resources");
// Plus module path for HTML2PDF...
// Complex initialization
PDFNet.Initialize("YOUR_LICENSE_KEY");
PDFNet.SetResourcesPath("path/to/resources");
// Plus module path for HTML2PDF...
' Complex initialization
PDFNet.Initialize("YOUR_LICENSE_KEY")
PDFNet.SetResourcesPath("path/to/resources")
' Plus module path for HTML2PDF...
IronPDF Implementation:
// Simple license assignment (optional for development)
IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY";
// Simple license assignment (optional for development)
IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY";
' Simple license assignment (optional for development)
IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY"
No PDFNet.Terminate() call is needed with IronPDF—resources are managed automatically.
Complete API Migration Reference
Core Class Mapping
| Apryse PDF Class | IronPDF Equivalent |
|---|---|
PDFDoc |
PdfDocument |
HTML2PDF |
ChromePdfRenderer |
TextExtractor |
PdfDocument.ExtractAllText() |
Stamper |
PdfDocument.ApplyWatermark() |
PDFDraw |
PdfDocument.ToBitmap() |
SecurityHandler |
PdfDocument.SecuritySettings |
PDFNet |
IronPdf.License |
Document Operations
| Apryse PDF Method | IronPDF Method |
|---|---|
new PDFDoc() |
new PdfDocument() |
new PDFDoc(path) |
PdfDocument.FromFile(path) |
new PDFDoc(buffer) |
PdfDocument.FromBinaryData(bytes) |
doc.Save(path, options) |
pdf.SaveAs(path) |
doc.Save(buffer) |
pdf.BinaryData |
doc.Close() |
pdf.Dispose() |
doc.GetPageCount() |
pdf.PageCount |
doc.AppendPages(doc2, start, end) |
PdfDocument.Merge(pdfs) |
HTML to PDF Conversion
| Apryse PDF Method | IronPDF Method |
|---|---|
HTML2PDF.Convert(doc) |
renderer.RenderHtmlAsPdf(html) |
converter.InsertFromURL(url) |
renderer.RenderUrlAsPdf(url) |
converter.InsertFromHtmlString(html) |
renderer.RenderHtmlAsPdf(html) |
converter.SetModulePath(path) |
Not needed |
converter.SetPaperSize(width, height) |
RenderingOptions.PaperSize |
converter.SetLandscape(true) |
RenderingOptions.PaperOrientation |
Code Migration Examples
HTML String to PDF
The most common operation demonstrates the dramatic reduction in boilerplate code.
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize("YOUR_LICENSE_KEY");
PDFNet.SetResourcesPath("path/to/resources");
string html = "<html><body><h1>Hello World</h1><p>Content here</p></body></html>";
using (PDFDoc doc = new PDFDoc())
{
HTML2PDF converter = new HTML2PDF();
converter.SetModulePath("path/to/html2pdf");
converter.InsertFromHtmlString(html);
HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
settings.SetPrintBackground(true);
settings.SetLoadImages(true);
if (converter.Convert(doc))
{
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
Console.WriteLine("PDF created successfully");
}
else
{
Console.WriteLine($"Conversion failed: {converter.GetLog()}");
}
}
PDFNet.Terminate();
}
}
using pdftron;
using pdftron.PDF;
class Program
{
static void Main()
{
PDFNet.Initialize("YOUR_LICENSE_KEY");
PDFNet.SetResourcesPath("path/to/resources");
string html = "<html><body><h1>Hello World</h1><p>Content here</p></body></html>";
using (PDFDoc doc = new PDFDoc())
{
HTML2PDF converter = new HTML2PDF();
converter.SetModulePath("path/to/html2pdf");
converter.InsertFromHtmlString(html);
HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
settings.SetPrintBackground(true);
settings.SetLoadImages(true);
if (converter.Convert(doc))
{
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
Console.WriteLine("PDF created successfully");
}
else
{
Console.WriteLine($"Conversion failed: {converter.GetLog()}");
}
}
PDFNet.Terminate();
}
}
Imports pdftron
Imports pdftron.PDF
Class Program
Shared Sub Main()
PDFNet.Initialize("YOUR_LICENSE_KEY")
PDFNet.SetResourcesPath("path/to/resources")
Dim html As String = "<html><body><h1>Hello World</h1><p>Content here</p></body></html>"
Using doc As New PDFDoc()
Dim converter As New HTML2PDF()
converter.SetModulePath("path/to/html2pdf")
converter.InsertFromHtmlString(html)
Dim settings As New HTML2PDF.WebPageSettings()
settings.SetPrintBackground(True)
settings.SetLoadImages(True)
If converter.Convert(doc) Then
doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized)
Console.WriteLine("PDF created successfully")
Else
Console.WriteLine($"Conversion failed: {converter.GetLog()}")
End If
End Using
PDFNet.Terminate()
End Sub
End Class
IronPDF Implementation:
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim html As String = "<html><body><h1>Hello World</h1></body></html>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf")
End Sub
End Class
IronPDF eliminates initialization, module paths, and cleanup code—reducing 35+ lines to 5 lines.
URL to PDF Conversion
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc())
{
HTML2PDF converter = new HTML2PDF();
converter.SetModulePath("path/to/html2pdf");
HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
settings.SetLoadImages(true);
settings.SetAllowJavaScript(true);
settings.SetPrintBackground(true);
converter.InsertFromURL("https://example.com", settings);
if (converter.Convert(doc))
{
doc.Save("webpage.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
PDFNet.Terminate();
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc())
{
HTML2PDF converter = new HTML2PDF();
converter.SetModulePath("path/to/html2pdf");
HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
settings.SetLoadImages(true);
settings.SetAllowJavaScript(true);
settings.SetPrintBackground(true);
converter.InsertFromURL("https://example.com", settings);
if (converter.Convert(doc))
{
doc.Save("webpage.pdf", SDFDoc.SaveOptions.e_linearized);
}
}
PDFNet.Terminate();
Imports pdftron
Imports pdftron.PDF
PDFNet.Initialize("YOUR_LICENSE_KEY")
Using doc As New PDFDoc()
Dim converter As New HTML2PDF()
converter.SetModulePath("path/to/html2pdf")
Dim settings As New HTML2PDF.WebPageSettings()
settings.SetLoadImages(True)
settings.SetAllowJavaScript(True)
settings.SetPrintBackground(True)
converter.InsertFromURL("https://example.com", settings)
If converter.Convert(doc) Then
doc.Save("webpage.pdf", SDFDoc.SaveOptions.e_linearized)
End If
End Using
PDFNet.Terminate()
IronPDF Implementation:
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string url = "https://www.example.com";
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("webpage.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string url = "https://www.example.com";
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("webpage.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim url As String = "https://www.example.com"
Dim pdf = renderer.RenderUrlAsPdf(url)
pdf.SaveAs("webpage.pdf")
End Sub
End Class
Merging Multiple PDFs
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc mainDoc = new PDFDoc())
{
string[] files = { "doc1.pdf", "doc2.pdf", "doc3.pdf" };
foreach (string file in files)
{
using (PDFDoc doc = new PDFDoc(file))
{
mainDoc.AppendPages(doc, 1, doc.GetPageCount());
}
}
mainDoc.Save("merged.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc mainDoc = new PDFDoc())
{
string[] files = { "doc1.pdf", "doc2.pdf", "doc3.pdf" };
foreach (string file in files)
{
using (PDFDoc doc = new PDFDoc(file))
{
mainDoc.AppendPages(doc, 1, doc.GetPageCount());
}
}
mainDoc.Save("merged.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
Imports pdftron
Imports pdftron.PDF
PDFNet.Initialize("YOUR_LICENSE_KEY")
Using mainDoc As New PDFDoc()
Dim files As String() = {"doc1.pdf", "doc2.pdf", "doc3.pdf"}
For Each file As String In files
Using doc As New PDFDoc(file)
mainDoc.AppendPages(doc, 1, doc.GetPageCount())
End Using
Next
mainDoc.Save("merged.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
PDFNet.Terminate()
IronPDF Implementation:
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
merged.SaveAs("merged.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
merged.SaveAs("merged.pdf");
}
}
Imports IronPdf
Imports System.Collections.Generic
Class Program
Shared Sub Main()
Dim pdf1 = PdfDocument.FromFile("document1.pdf")
Dim pdf2 = PdfDocument.FromFile("document2.pdf")
Dim merged = PdfDocument.Merge(New List(Of PdfDocument) From {pdf1, pdf2})
merged.SaveAs("merged.pdf")
End Sub
End Class
IronPDF's static Merge method accepts multiple documents directly, eliminating the page iteration pattern.
Text Extraction
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
TextExtractor extractor = new TextExtractor();
for (int i = 1; i <= doc.GetPageCount(); i++)
{
Page page = doc.GetPage(i);
extractor.Begin(page);
string pageText = extractor.GetAsText();
Console.WriteLine($"Page {i}:");
Console.WriteLine(pageText);
}
}
PDFNet.Terminate();
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
TextExtractor extractor = new TextExtractor();
for (int i = 1; i <= doc.GetPageCount(); i++)
{
Page page = doc.GetPage(i);
extractor.Begin(page);
string pageText = extractor.GetAsText();
Console.WriteLine($"Page {i}:");
Console.WriteLine(pageText);
}
}
PDFNet.Terminate();
Imports pdftron
Imports pdftron.PDF
PDFNet.Initialize("YOUR_LICENSE_KEY")
Using doc As New PDFDoc("document.pdf")
Dim extractor As New TextExtractor()
For i As Integer = 1 To doc.GetPageCount()
Dim page As Page = doc.GetPage(i)
extractor.Begin(page)
Dim pageText As String = extractor.GetAsText()
Console.WriteLine($"Page {i}:")
Console.WriteLine(pageText)
Next
End Using
PDFNet.Terminate()
IronPDF Implementation:
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// Extract all text at once
string allText = pdf.ExtractAllText();
Console.WriteLine(allText);
// Extract from specific page
string page1Text = pdf.ExtractTextFromPage(0); // 0-indexed
Console.WriteLine($"Page 1: {page1Text}");
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// Extract all text at once
string allText = pdf.ExtractAllText();
Console.WriteLine(allText);
// Extract from specific page
string page1Text = pdf.ExtractTextFromPage(0); // 0-indexed
Console.WriteLine($"Page 1: {page1Text}");
Imports IronPdf
Dim pdf = PdfDocument.FromFile("document.pdf")
' Extract all text at once
Dim allText As String = pdf.ExtractAllText()
Console.WriteLine(allText)
' Extract from specific page
Dim page1Text As String = pdf.ExtractTextFromPage(0) ' 0-indexed
Console.WriteLine($"Page 1: {page1Text}")
Adding Watermarks
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
Stamper stamper = new Stamper(Stamper.SizeType.e_relative_scale, 0.5, 0.5);
stamper.SetAlignment(Stamper.HorizontalAlignment.e_horizontal_center,
Stamper.VerticalAlignment.e_vertical_center);
stamper.SetOpacity(0.3);
stamper.SetRotation(45);
stamper.SetFontColor(new ColorPt(1, 0, 0));
stamper.SetTextAlignment(Stamper.TextAlignment.e_align_center);
stamper.StampText(doc, "CONFIDENTIAL",
new PageSet(1, doc.GetPageCount()));
doc.Save("watermarked.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
using pdftron;
using pdftron.PDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
Stamper stamper = new Stamper(Stamper.SizeType.e_relative_scale, 0.5, 0.5);
stamper.SetAlignment(Stamper.HorizontalAlignment.e_horizontal_center,
Stamper.VerticalAlignment.e_vertical_center);
stamper.SetOpacity(0.3);
stamper.SetRotation(45);
stamper.SetFontColor(new ColorPt(1, 0, 0));
stamper.SetTextAlignment(Stamper.TextAlignment.e_align_center);
stamper.StampText(doc, "CONFIDENTIAL",
new PageSet(1, doc.GetPageCount()));
doc.Save("watermarked.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
Imports pdftron
Imports pdftron.PDF
PDFNet.Initialize("YOUR_LICENSE_KEY")
Using doc As New PDFDoc("document.pdf")
Dim stamper As New Stamper(Stamper.SizeType.e_relative_scale, 0.5, 0.5)
stamper.SetAlignment(Stamper.HorizontalAlignment.e_horizontal_center, Stamper.VerticalAlignment.e_vertical_center)
stamper.SetOpacity(0.3)
stamper.SetRotation(45)
stamper.SetFontColor(New ColorPt(1, 0, 0))
stamper.SetTextAlignment(Stamper.TextAlignment.e_align_center)
stamper.StampText(doc, "CONFIDENTIAL", New PageSet(1, doc.GetPageCount()))
doc.Save("watermarked.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
PDFNet.Terminate()
IronPDF Implementation:
using IronPdf;
using IronPdf.Editing;
var pdf = PdfDocument.FromFile("document.pdf");
// HTML-based watermark with full styling control
string watermarkHtml = @"
<div style='
color: red;
opacity: 0.3;
font-size: 72px;
font-weight: bold;
text-align: center;
'>CONFIDENTIAL</div>";
pdf.ApplyWatermark(watermarkHtml,
rotation: 45,
verticalAlignment: VerticalAlignment.Middle,
horizontalAlignment: HorizontalAlignment.Center);
pdf.SaveAs("watermarked.pdf");
using IronPdf;
using IronPdf.Editing;
var pdf = PdfDocument.FromFile("document.pdf");
// HTML-based watermark with full styling control
string watermarkHtml = @"
<div style='
color: red;
opacity: 0.3;
font-size: 72px;
font-weight: bold;
text-align: center;
'>CONFIDENTIAL</div>";
pdf.ApplyWatermark(watermarkHtml,
rotation: 45,
verticalAlignment: VerticalAlignment.Middle,
horizontalAlignment: HorizontalAlignment.Center);
pdf.SaveAs("watermarked.pdf");
Imports IronPdf
Imports IronPdf.Editing
Dim pdf = PdfDocument.FromFile("document.pdf")
' HTML-based watermark with full styling control
Dim watermarkHtml As String = "
<div style='
color: red;
opacity: 0.3;
font-size: 72px;
font-weight: bold;
text-align: center;
'>CONFIDENTIAL</div>"
pdf.ApplyWatermark(watermarkHtml,
rotation:=45,
verticalAlignment:=VerticalAlignment.Middle,
horizontalAlignment:=HorizontalAlignment.Center)
pdf.SaveAs("watermarked.pdf")
IronPDF uses HTML/CSS-based watermarking, providing full styling control through familiar web technologies.
Password Protection
Apryse PDF Implementation:
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
SecurityHandler handler = new SecurityHandler();
handler.ChangeUserPassword("user123");
handler.ChangeMasterPassword("owner456");
handler.SetPermission(SecurityHandler.Permission.e_print, false);
handler.SetPermission(SecurityHandler.Permission.e_extract_content, false);
doc.SetSecurityHandler(handler);
doc.Save("protected.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
using pdftron;
using pdftron.PDF;
using pdftron.SDF;
PDFNet.Initialize("YOUR_LICENSE_KEY");
using (PDFDoc doc = new PDFDoc("document.pdf"))
{
SecurityHandler handler = new SecurityHandler();
handler.ChangeUserPassword("user123");
handler.ChangeMasterPassword("owner456");
handler.SetPermission(SecurityHandler.Permission.e_print, false);
handler.SetPermission(SecurityHandler.Permission.e_extract_content, false);
doc.SetSecurityHandler(handler);
doc.Save("protected.pdf", SDFDoc.SaveOptions.e_linearized);
}
PDFNet.Terminate();
Imports pdftron
Imports pdftron.PDF
Imports pdftron.SDF
PDFNet.Initialize("YOUR_LICENSE_KEY")
Using doc As New PDFDoc("document.pdf")
Dim handler As New SecurityHandler()
handler.ChangeUserPassword("user123")
handler.ChangeMasterPassword("owner456")
handler.SetPermission(SecurityHandler.Permission.e_print, False)
handler.SetPermission(SecurityHandler.Permission.e_extract_content, False)
doc.SetSecurityHandler(handler)
doc.Save("protected.pdf", SDFDoc.SaveOptions.e_linearized)
End Using
PDFNet.Terminate()
IronPDF Implementation:
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// Set passwords
pdf.SecuritySettings.UserPassword = "user123";
pdf.SecuritySettings.OwnerPassword = "owner456";
// Set permissions
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserEdits = PdfEditSecurity.NoEdit;
pdf.SaveAs("protected.pdf");
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf");
// Set passwords
pdf.SecuritySettings.UserPassword = "user123";
pdf.SecuritySettings.OwnerPassword = "owner456";
// Set permissions
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserEdits = PdfEditSecurity.NoEdit;
pdf.SaveAs("protected.pdf");
Imports IronPdf
Dim pdf = PdfDocument.FromFile("document.pdf")
' Set passwords
pdf.SecuritySettings.UserPassword = "user123"
pdf.SecuritySettings.OwnerPassword = "owner456"
' Set permissions
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserEdits = PdfEditSecurity.NoEdit
pdf.SaveAs("protected.pdf")
Headers and Footers
IronPDF Implementation:
using IronPdf;
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:12px;'>Company Header</div>",
DrawDividerLine = true,
MaxHeight = 30
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
DrawDividerLine = true,
MaxHeight = 25
};
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");
pdf.SaveAs("with_headers.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:12px;'>Company Header</div>",
DrawDividerLine = true,
MaxHeight = 30
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
DrawDividerLine = true,
MaxHeight = 25
};
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");
pdf.SaveAs("with_headers.pdf");
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter With {
.HtmlFragment = "<div style='text-align:center; font-size:12px;'>Company Header</div>",
.DrawDividerLine = True,
.MaxHeight = 30
}
renderer.RenderingOptions.HtmlFooter = New HtmlHeaderFooter With {
.HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
.DrawDividerLine = True,
.MaxHeight = 25
}
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>")
pdf.SaveAs("with_headers.pdf")
IronPDF supports placeholder tokens like {page} and {total-pages} for dynamic page numbering. For more options, see the headers and footers documentation.
ASP.NET Core Integration
Apryse PDF's initialization requirements complicate web application integration. IronPDF simplifies this pattern.
IronPDF Pattern:
[ApiController]
[Route("[controller]")]
public class PdfController : ControllerBase
{
[HttpGet("generate")]
public IActionResult GeneratePdf()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}
[HttpGet("generate-async")]
public async Task<IActionResult> GeneratePdfAsync()
{
var renderer = new ChromePdfRenderer();
var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>");
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}
}
[ApiController]
[Route("[controller]")]
public class PdfController : ControllerBase
{
[HttpGet("generate")]
public IActionResult GeneratePdf()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}
[HttpGet("generate-async")]
public async Task<IActionResult> GeneratePdfAsync()
{
var renderer = new ChromePdfRenderer();
var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>");
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}
}
Imports Microsoft.AspNetCore.Mvc
<ApiController>
<Route("[controller]")>
Public Class PdfController
Inherits ControllerBase
<HttpGet("generate")>
Public Function GeneratePdf() As IActionResult
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>")
Return File(pdf.BinaryData, "application/pdf", "report.pdf")
End Function
<HttpGet("generate-async")>
Public Async Function GeneratePdfAsync() As Task(Of IActionResult)
Dim renderer = New ChromePdfRenderer()
Dim pdf = Await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>")
Return File(pdf.BinaryData, "application/pdf", "report.pdf")
End Function
End Class
Dependency Injection Configuration
// Program.cs
public void ConfigureServices(IServiceCollection services)
{
// Set license once
IronPdf.License.LicenseKey = Configuration["IronPdf:LicenseKey"];
// Register renderer as scoped service
services.AddScoped<ChromePdfRenderer>();
// Or create a wrapper service
services.AddScoped<IPdfService, IronPdfService>();
}
// IronPdfService.cs
public class IronPdfService : IPdfService
{
private readonly ChromePdfRenderer _renderer;
public IronPdfService()
{
_renderer = new ChromePdfRenderer();
_renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
_renderer.RenderingOptions.PrintHtmlBackgrounds = true;
}
public PdfDocument GenerateFromHtml(string html) =>
_renderer.RenderHtmlAsPdf(html);
public Task<PdfDocument> GenerateFromHtmlAsync(string html) =>
_renderer.RenderHtmlAsPdfAsync(html);
}
// Program.cs
public void ConfigureServices(IServiceCollection services)
{
// Set license once
IronPdf.License.LicenseKey = Configuration["IronPdf:LicenseKey"];
// Register renderer as scoped service
services.AddScoped<ChromePdfRenderer>();
// Or create a wrapper service
services.AddScoped<IPdfService, IronPdfService>();
}
// IronPdfService.cs
public class IronPdfService : IPdfService
{
private readonly ChromePdfRenderer _renderer;
public IronPdfService()
{
_renderer = new ChromePdfRenderer();
_renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
_renderer.RenderingOptions.PrintHtmlBackgrounds = true;
}
public PdfDocument GenerateFromHtml(string html) =>
_renderer.RenderHtmlAsPdf(html);
public Task<PdfDocument> GenerateFromHtmlAsync(string html) =>
_renderer.RenderHtmlAsPdfAsync(html);
}
' Program.vb
Public Sub ConfigureServices(services As IServiceCollection)
' Set license once
IronPdf.License.LicenseKey = Configuration("IronPdf:LicenseKey")
' Register renderer as scoped service
services.AddScoped(Of ChromePdfRenderer)()
' Or create a wrapper service
services.AddScoped(Of IPdfService, IronPdfService)()
End Sub
' IronPdfService.vb
Public Class IronPdfService
Implements IPdfService
Private ReadOnly _renderer As ChromePdfRenderer
Public Sub New()
_renderer = New ChromePdfRenderer()
_renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
_renderer.RenderingOptions.PrintHtmlBackgrounds = True
End Sub
Public Function GenerateFromHtml(html As String) As PdfDocument Implements IPdfService.GenerateFromHtml
Return _renderer.RenderHtmlAsPdf(html)
End Function
Public Function GenerateFromHtmlAsync(html As String) As Task(Of PdfDocument) Implements IPdfService.GenerateFromHtmlAsync
Return _renderer.RenderHtmlAsPdfAsync(html)
End Function
End Class
Performance Comparison
| Metric | Apryse PDF | IronPDF |
|---|---|---|
| Cold start | Fast (native code) | ~2s (Chromium init) |
| Subsequent renders | Fast | Fast |
| Complex HTML | Variable (html2pdf module) | Excellent (Chromium) |
| CSS support | Limited | Full CSS3 |
| JavaScript | Limited | Supported |
Performance Optimization Tips
// 1. Reuse renderer instance
private static readonly ChromePdfRenderer SharedRenderer = new ChromePdfRenderer();
// 2. Disable unnecessary features for speed
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.EnableJavaScript = false; // If not needed
renderer.RenderingOptions.WaitFor.RenderDelay(0); // No delay
renderer.RenderingOptions.Timeout = 30000; // 30s max
// 3. Proper disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
pdf.SaveAs("output.pdf");
}
// 1. Reuse renderer instance
private static readonly ChromePdfRenderer SharedRenderer = new ChromePdfRenderer();
// 2. Disable unnecessary features for speed
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.EnableJavaScript = false; // If not needed
renderer.RenderingOptions.WaitFor.RenderDelay(0); // No delay
renderer.RenderingOptions.Timeout = 30000; // 30s max
// 3. Proper disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
pdf.SaveAs("output.pdf");
}
' 1. Reuse renderer instance
Private Shared ReadOnly SharedRenderer As New ChromePdfRenderer()
' 2. Disable unnecessary features for speed
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.EnableJavaScript = False ' If not needed
renderer.RenderingOptions.WaitFor.RenderDelay(0) ' No delay
renderer.RenderingOptions.Timeout = 30000 ' 30s max
' 3. Proper disposal
Using pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf")
End Using
Troubleshooting Common Migration Issues
Issue: Module Path Errors
Remove all module path configuration—IronPDF's Chromium engine is built-in:
// Remove this
converter.SetModulePath("path/to/html2pdf");
// Just use the renderer
var renderer = new ChromePdfRenderer();
// Remove this
converter.SetModulePath("path/to/html2pdf");
// Just use the renderer
var renderer = new ChromePdfRenderer();
Issue: PDFNet.Initialize() Not Found
Replace with IronPDF license setup:
// Remove this
PDFNet.Initialize("KEY");
PDFNet.SetResourcesPath("path");
// Use this (optional for development)
IronPdf.License.LicenseKey = "YOUR-KEY";
// Remove this
PDFNet.Initialize("KEY");
PDFNet.SetResourcesPath("path");
// Use this (optional for development)
IronPdf.License.LicenseKey = "YOUR-KEY";
' Remove this
PDFNet.Initialize("KEY")
PDFNet.SetResourcesPath("path")
' Use this (optional for development)
IronPdf.License.LicenseKey = "YOUR-KEY"
Issue: PDFViewCtrl Replacement
IronPDF doesn't include viewer controls. Options:
- Use PDF.js for web viewers
- Use system PDF viewers
- Consider third-party viewer components
Post-Migration Checklist
After completing the code migration, verify the following:
- Verify PDF output quality matches expectations
- Test all edge cases (large documents, complex CSS)
- Compare performance metrics
- Update Docker configurations if applicable
- Remove Apryse license and related configurations
- Document any IronPDF-specific configurations
- Train team on new API patterns
- Update CI/CD pipelines if needed
Additional Resources
Migrating from Apryse PDF to IronPDF transforms your PDF codebase from complex C++ patterns to idiomatic C#. The elimination of initialization boilerplate, module path configuration, and subscription-based licensing delivers immediate productivity gains while reducing long-term costs.

