Skip to footer content
MIGRATION GUIDES

How to Migrate from Apryse PDF to IronPDF in C#

Apryse PDF (formerly PDFTron) is a premium enterprise PDF SDK known for its comprehensive document processing capabilities. However, its premium pricing model ($1,500+ per developer annually), complex integration requirements, and C++ heritage create barriers for development teams seeking straightforward PDF functionality. This comprehensive guide provides a step-by-step migration path from Apryse PDF 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 PDF targets enterprise customers with pricing that can be prohibitive for small to medium-sized projects:

AspectApryse PDF (PDFTron)IronPDF
Starting Price$1,500+/developer/year (reported)$749 one-time (Lite)
License ModelAnnual subscriptionPerpetual license
Viewer LicenseSeparate, additional costN/A (use standard viewers)
Server LicenseEnterprise pricing requiredIncluded in license tiers
Total 3-Year Cost$4,500+ per developer$749 one-time

Complexity of Integration

Apryse PDF's C++ heritage introduces complexity that impacts development velocity:

FeatureApryse PDFIronPDF
SetupModule paths, external binariesSingle NuGet package
InitializationPDFNet.Initialize() with licenseSimple property assignment
HTML RenderingExternal html2pdf module requiredBuilt-in Chromium engine
API StyleC++ heritage, complexModern C# conventions
DependenciesMultiple DLLs, platform-specificSelf-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+ or .NET Core 3.1 / .NET 5-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" .
SHELL

Breaking Changes to Anticipate

Apryse PDF PatternChange Required
PDFNet.Initialize()Replace with IronPdf.License.LicenseKey
HTML2PDF moduleBuilt-in ChromePdfRenderer
ElementReader/ElementWriterIronPDF handles content internally
SDFDoc.SaveOptionsSimple SaveAs() method
PDFViewCtrlUse external PDF viewers
XOD formatConvert to PDF or images
Module path configurationNot needed

Step-by-Step Migration Process

Step 1: Update NuGet Packages

Remove Apryse/PDFTron packages and install IronPDF:

# Remove Apryse/PDFTron packages
dotnet remove package PDFTron.NET.x64
dotnet remove package PDFTron.NET.x86
dotnet remove package pdftron

# Install IronPDF
dotnet add package IronPdf
# Remove Apryse/PDFTron packages
dotnet remove package PDFTron.NET.x64
dotnet remove package PDFTron.NET.x86
dotnet remove package pdftron

# Install IronPDF
dotnet add package IronPdf
SHELL

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;
$vbLabelText   $csharpLabel

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...
$vbLabelText   $csharpLabel

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";
$vbLabelText   $csharpLabel

No PDFNet.Terminate() call is needed with IronPDF—resources are managed automatically.

Complete API Migration Reference

Core Class Mapping

Apryse PDF ClassIronPDF EquivalentNotes
PDFDocPdfDocumentMain document class
HTML2PDFChromePdfRendererHTML to PDF conversion
TextExtractorPdfDocument.ExtractAllText()Text extraction
StamperPdfDocument.ApplyWatermark()Watermarks and stamps
PDFDrawPdfDocument.ToBitmap()Rasterization
SecurityHandlerPdfDocument.SecuritySettingsEncryption/passwords
PDFNetIronPdf.LicenseLicensing and config

Document Operations

Apryse PDF MethodIronPDF MethodNotes
new PDFDoc()new PdfDocument()Empty document
new PDFDoc(path)PdfDocument.FromFile(path)Load from file
new PDFDoc(buffer)PdfDocument.FromBinaryData(bytes)Load from bytes
doc.Save(path, options)pdf.SaveAs(path)Save to file
doc.Save(buffer)pdf.BinaryDataGet as bytes
doc.Close()pdf.Dispose()Cleanup (or use using)
doc.GetPageCount()pdf.PageCountPage count
doc.AppendPages(doc2, start, end)PdfDocument.Merge(pdfs)Merge documents

HTML to PDF Conversion

Apryse PDF MethodIronPDF MethodNotes
HTML2PDF.Convert(doc)renderer.RenderHtmlAsPdf(html)Returns PdfDocument
converter.InsertFromURL(url)renderer.RenderUrlAsPdf(url)URL conversion
converter.InsertFromHtmlString(html)renderer.RenderHtmlAsPdf(html)HTML string
converter.SetModulePath(path)Not neededBuilt-in engine
converter.SetPaperSize(width, height)RenderingOptions.PaperSizePaper size
converter.SetLandscape(true)RenderingOptions.PaperOrientationOrientation

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();
    }
}
$vbLabelText   $csharpLabel

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");
    }
}
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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");
    }
}
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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");
    }
}
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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}");
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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");
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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");
$vbLabelText   $csharpLabel

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");
$vbLabelText   $csharpLabel

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.Stream, "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.Stream, "application/pdf", "report.pdf");
    }
}
$vbLabelText   $csharpLabel

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);
}
$vbLabelText   $csharpLabel

Performance Comparison

MetricApryse PDFIronPDF
Cold startFast (native code)~2s (Chromium init)
Subsequent rendersFastFast
Complex HTMLVariable (html2pdf module)Excellent (Chromium)
CSS supportLimitedFull CSS3
JavaScriptLimitedFull support

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");
}
$vbLabelText   $csharpLabel

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();
$vbLabelText   $csharpLabel

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";
$vbLabelText   $csharpLabel

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

Future-Proofing Your PDF Infrastructure

With .NET 10 on the horizon and C# 14 introducing new language features, choosing a native .NET PDF library with modern conventions ensures compatibility with evolving runtime capabilities. IronPDF's commitment to supporting the latest .NET versions means your migration investment pays dividends as projects extend into 2025 and 2026—without annual subscription renewals.

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.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More