How to Migrate from Apryse PDF to IronPDF

Apryse PDF to IronPDFPhoto from Pexels

Originally Posted On: https://ironpdf.com/blog/migration-guides/migrate-from-apryse-pdf-to-ironpdf/

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:

Aspect Apryse PDF (PDFTron) IronPDF
Starting Price $1,500+/developer/year (reported) $749 one-time (Lite)
License Model Annual subscription Perpetual license
Viewer License Separate, additional cost N/A (use standard viewers)
Server License Enterprise pricing required Included 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:

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+ 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:

  1. # Find all pdftron using statements
  2. grep -r "using pdftron" --include="*.cs" .
  3. # Find PDFNet initialization
  4. grep -r "PDFNet.Initialize|PDFNet.SetResourcesPath" --include="*.cs" .
  5. # Find PDFDoc usage
  6. grep -r "new PDFDoc|PDFDoc." --include="*.cs" .
  7. # Find HTML2PDF usage
  8. grep -r "HTML2PDF|InsertFromURL|InsertFromHtmlString" --include="*.cs" .
  9. # Find ElementReader/Writer usage
  10. grep -r "ElementReader|ElementWriter|ElementBuilder" --include="*.cs" .
SHELL

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

Remove Apryse/PDFTron packages and install IronPDF:

  1. # Remove Apryse/PDFTron packages
  2. dotnet remove package PDFTron.NET.x64
  3. dotnet remove package PDFTron.NET.x86
  4. dotnet remove package pdftron
  5. # Install IronPDF
  6. 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:

  1. // Remove these
  2. using pdftron;
  3. using pdftron.PDF;
  4. using pdftron.PDF.Convert;
  5. using pdftron.SDF;
  6. using pdftron.Filters;
  7. // Add these
  8. using IronPdf;
  9. using IronPdf.Rendering;

Step 3: Remove Initialization Boilerplate

Apryse PDF requires complex initialization. IronPDF eliminates this entirely.

Apryse PDF Implementation:

  1. // Complex initialization
  2. PDFNet.Initialize("YOUR_LICENSE_KEY");
  3. PDFNet.SetResourcesPath("path/to/resources");
  4. // Plus module path for HTML2PDF...

IronPDF Implementation:

  1. // Simple license assignment (optional for development)
  2. 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:

  1. using pdftron;
  2. using pdftron.PDF;
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. PDFNet.Initialize("YOUR_LICENSE_KEY");
  8. PDFNet.SetResourcesPath("path/to/resources");
  9. string html = "<html><body><h1>Hello World</h1><p>Content here</p></body></html>";
  10. using (PDFDoc doc = new PDFDoc())
  11. {
  12. HTML2PDF converter = new HTML2PDF();
  13. converter.SetModulePath("path/to/html2pdf");
  14. converter.InsertFromHtmlString(html);
  15. HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
  16. settings.SetPrintBackground(true);
  17. settings.SetLoadImages(true);
  18. if (converter.Convert(doc))
  19. {
  20. doc.Save("output.pdf", SDFDoc.SaveOptions.e_linearized);
  21. Console.WriteLine("PDF created successfully");
  22. }
  23. else
  24. {
  25. Console.WriteLine($"Conversion failed: {converter.GetLog()}");
  26. }
  27. }
  28. PDFNet.Terminate();
  29. }
  30. }

IronPDF Implementation:

  1. // NuGet: Install-Package IronPdf
  2. using IronPdf;
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. var renderer = new ChromePdfRenderer();
  8. string html = "<html><body><h1>Hello World</h1></body></html>";
  9. var pdf = renderer.RenderHtmlAsPdf(html);
  10. pdf.SaveAs("output.pdf");
  11. }
  12. }

IronPDF eliminates initialization, module paths, and cleanup code—reducing 35+ lines to 5 lines.

URL to PDF Conversion

Apryse PDF Implementation:

  1. using pdftron;
  2. using pdftron.PDF;
  3. PDFNet.Initialize("YOUR_LICENSE_KEY");
  4. using (PDFDoc doc = new PDFDoc())
  5. {
  6. HTML2PDF converter = new HTML2PDF();
  7. converter.SetModulePath("path/to/html2pdf");
  8. HTML2PDF.WebPageSettings settings = new HTML2PDF.WebPageSettings();
  9. settings.SetLoadImages(true);
  10. settings.SetAllowJavaScript(true);
  11. settings.SetPrintBackground(true);
  12. converter.InsertFromURL("https://example.com", settings);
  13. if (converter.Convert(doc))
  14. {
  15. doc.Save("webpage.pdf", SDFDoc.SaveOptions.e_linearized);
  16. }
  17. }
  18. PDFNet.Terminate();

IronPDF Implementation:

  1. // NuGet: Install-Package IronPdf
  2. using IronPdf;
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. var renderer = new ChromePdfRenderer();
  8. string url = "https://www.example.com";
  9. var pdf = renderer.RenderUrlAsPdf(url);
  10. pdf.SaveAs("webpage.pdf");
  11. }
  12. }

Merging Multiple PDFs

Apryse PDF Implementation:

  1. using pdftron;
  2. using pdftron.PDF;
  3. PDFNet.Initialize("YOUR_LICENSE_KEY");
  4. using (PDFDoc mainDoc = new PDFDoc())
  5. {
  6. string[] files = { "doc1.pdf", "doc2.pdf", "doc3.pdf" };
  7. foreach (string file in files)
  8. {
  9. using (PDFDoc doc = new PDFDoc(file))
  10. {
  11. mainDoc.AppendPages(doc, 1, doc.GetPageCount());
  12. }
  13. }
  14. mainDoc.Save("merged.pdf", SDFDoc.SaveOptions.e_linearized);
  15. }
  16. PDFNet.Terminate();

IronPDF Implementation:

  1. // NuGet: Install-Package IronPdf
  2. using IronPdf;
  3. using System.Collections.Generic;
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. var pdf1 = PdfDocument.FromFile("document1.pdf");
  9. var pdf2 = PdfDocument.FromFile("document2.pdf");
  10. var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
  11. merged.SaveAs("merged.pdf");
  12. }
  13. }

IronPDF’s static Merge method accepts multiple documents directly, eliminating the page iteration pattern.

Text Extraction

Apryse PDF Implementation:

  1. using pdftron;
  2. using pdftron.PDF;
  3. PDFNet.Initialize("YOUR_LICENSE_KEY");
  4. using (PDFDoc doc = new PDFDoc("document.pdf"))
  5. {
  6. TextExtractor extractor = new TextExtractor();
  7. for (int i = 1; i <= doc.GetPageCount(); i++)
  8. {
  9. Page page = doc.GetPage(i);
  10. extractor.Begin(page);
  11. string pageText = extractor.GetAsText();
  12. Console.WriteLine($"Page {i}:");
  13. Console.WriteLine(pageText);
  14. }
  15. }
  16. PDFNet.Terminate();

IronPDF Implementation:

  1. using IronPdf;
  2. var pdf = PdfDocument.FromFile("document.pdf");
  3. // Extract all text at once
  4. string allText = pdf.ExtractAllText();
  5. Console.WriteLine(allText);
  6. // Extract from specific page
  7. string page1Text = pdf.ExtractTextFromPage(0); // 0-indexed
  8. Console.WriteLine($"Page 1: {page1Text}");

Adding Watermarks

Apryse PDF Implementation:

  1. using pdftron;
  2. using pdftron.PDF;
  3. PDFNet.Initialize("YOUR_LICENSE_KEY");
  4. using (PDFDoc doc = new PDFDoc("document.pdf"))
  5. {
  6. Stamper stamper = new Stamper(Stamper.SizeType.e_relative_scale, 0.5, 0.5);
  7. stamper.SetAlignment(Stamper.HorizontalAlignment.e_horizontal_center,
  8. Stamper.VerticalAlignment.e_vertical_center);
  9. stamper.SetOpacity(0.3);
  10. stamper.SetRotation(45);
  11. stamper.SetFontColor(new ColorPt(1, 0, 0));
  12. stamper.SetTextAlignment(Stamper.TextAlignment.e_align_center);
  13. stamper.StampText(doc, "CONFIDENTIAL",
  14. new PageSet(1, doc.GetPageCount()));
  15. doc.Save("watermarked.pdf", SDFDoc.SaveOptions.e_linearized);
  16. }
  17. PDFNet.Terminate();

IronPDF Implementation:

  1. using IronPdf;
  2. using IronPdf.Editing;
  3. var pdf = PdfDocument.FromFile("document.pdf");
  4. // HTML-based watermark with full styling control
  5. string watermarkHtml = @"
  6. <div style='
  7. color: red;
  8. opacity: 0.3;
  9. font-size: 72px;
  10. font-weight: bold;
  11. text-align: center;
  12. '>CONFIDENTIAL</div>";
  13. pdf.ApplyWatermark(watermarkHtml,
  14. rotation: 45,
  15. verticalAlignment: VerticalAlignment.Middle,
  16. horizontalAlignment: HorizontalAlignment.Center);
  17. pdf.SaveAs("watermarked.pdf");

IronPDF uses HTML/CSS-based watermarking, providing full styling control through familiar web technologies.

Password Protection

Apryse PDF Implementation:

  1. using pdftron;
  2. using pdftron.PDF;
  3. using pdftron.SDF;
  4. PDFNet.Initialize("YOUR_LICENSE_KEY");
  5. using (PDFDoc doc = new PDFDoc("document.pdf"))
  6. {
  7. SecurityHandler handler = new SecurityHandler();
  8. handler.ChangeUserPassword("user123");
  9. handler.ChangeMasterPassword("owner456");
  10. handler.SetPermission(SecurityHandler.Permission.e_print, false);
  11. handler.SetPermission(SecurityHandler.Permission.e_extract_content, false);
  12. doc.SetSecurityHandler(handler);
  13. doc.Save("protected.pdf", SDFDoc.SaveOptions.e_linearized);
  14. }
  15. PDFNet.Terminate();

IronPDF Implementation:

  1. using IronPdf;
  2. var pdf = PdfDocument.FromFile("document.pdf");
  3. // Set passwords
  4. pdf.SecuritySettings.UserPassword = "user123";
  5. pdf.SecuritySettings.OwnerPassword = "owner456";
  6. // Set permissions
  7. pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;
  8. pdf.SecuritySettings.AllowUserCopyPasteContent = false;
  9. pdf.SecuritySettings.AllowUserEdits = PdfEditSecurity.NoEdit;
  10. pdf.SaveAs("protected.pdf");

Headers and Footers

IronPDF Implementation:

  1. using IronPdf;
  2. var renderer = new ChromePdfRenderer();
  3. renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
  4. {
  5. HtmlFragment = "<div style='text-align:center; font-size:12px;'>Company Header</div>",
  6. DrawDividerLine = true,
  7. MaxHeight = 30
  8. };
  9. renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
  10. {
  11. HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
  12. DrawDividerLine = true,
  13. MaxHeight = 25
  14. };
  15. var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");
  16. 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:

  1. [ApiController]
  2. [Route("[controller]")]
  3. public class PdfController : ControllerBase
  4. {
  5. [HttpGet("generate")]
  6. public IActionResult GeneratePdf()
  7. {
  8. var renderer = new ChromePdfRenderer();
  9. var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");
  10. return File(pdf.BinaryData, "application/pdf", "report.pdf");
  11. }
  12. [HttpGet("generate-async")]
  13. public async Task<IActionResult> GeneratePdfAsync()
  14. {
  15. var renderer = new ChromePdfRenderer();
  16. var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Report</h1>");
  17. return File(pdf.Stream, "application/pdf", "report.pdf");
  18. }
  19. }

Dependency Injection Configuration

  1. // Program.cs
  2. public void ConfigureServices(IServiceCollection services)
  3. {
  4. // Set license once
  5. IronPdf.License.LicenseKey = Configuration["IronPdf:LicenseKey"];
  6. // Register renderer as scoped service
  7. services.AddScoped<ChromePdfRenderer>();
  8. // Or create a wrapper service
  9. services.AddScoped<IPdfService, IronPdfService>();
  10. }
  11. // IronPdfService.cs
  12. public class IronPdfService : IPdfService
  13. {
  14. private readonly ChromePdfRenderer _renderer;
  15. public IronPdfService()
  16. {
  17. _renderer = new ChromePdfRenderer();
  18. _renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
  19. _renderer.RenderingOptions.PrintHtmlBackgrounds = true;
  20. }
  21. public PdfDocument GenerateFromHtml(string html) =>
  22. _renderer.RenderHtmlAsPdf(html);
  23. public Task<PdfDocument> GenerateFromHtmlAsync(string html) =>
  24. _renderer.RenderHtmlAsPdfAsync(html);
  25. }

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. // 1. Reuse renderer instance
  2. private static readonly ChromePdfRenderer SharedRenderer = new ChromePdfRenderer();
  3. // 2. Disable unnecessary features for speed
  4. var renderer = new ChromePdfRenderer();
  5. renderer.RenderingOptions.EnableJavaScript = false; // If not needed
  6. renderer.RenderingOptions.WaitFor.RenderDelay(0); // No delay
  7. renderer.RenderingOptions.Timeout = 30000; // 30s max
  8. // 3. Proper disposal
  9. using (var pdf = renderer.RenderHtmlAsPdf(html))
  10. {
  11. pdf.SaveAs("output.pdf");
  12. }

Troubleshooting Common Migration Issues

Issue: Module Path Errors

Remove all module path configuration—IronPDF’s Chromium engine is built-in:

  1. // Remove this
  2. converter.SetModulePath("path/to/html2pdf");
  3. // Just use the renderer
  4. var renderer = new ChromePdfRenderer();

Issue: PDFNet.Initialize() Not Found

Replace with IronPDF license setup:

  1. // Remove this
  2. PDFNet.Initialize("KEY");
  3. PDFNet.SetResourcesPath("path");
  4. // Use this (optional for development)
  5. 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

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.