IRONSOFTWAREHOME
MIGRATION GUIDES

Migrate from Foxit PDF SDK to IronPDF: (.NET Guide)

Curtis Chau
Curtis Chau
Updated: August 1, 2026

Migrating from Foxit PDF SDK to IronPDF simplifies your .NET PDF generation workflow by replacing complex enterprise-focused APIs with modern, developer-friendly patterns. This guide provides a full, step-by-step migration path that removes unnecessary code and makes PDF operations easier across your codebase.

Why Migrate from Foxit PDF SDK to IronPDF

The Foxit PDF Challenges

Foxit PDF SDK is a strong enterprise-level library, but it comes with significant complexity that can slow down development:

  1. Complex Licensing System: Multiple products, SKUs, and license types (per-developer, per-server, OEM, etc.) make it difficult to choose the right option for your project.
  2. Enterprise Pricing: Pricing is tailored for large organizations and can be prohibitive for smaller teams or individual developers.
  3. Heavy Native Package: The public NuGet package (Foxit.SDK.Dotnet) is large (~240 MB), and older projects may still carry direct DLL references or private feed configurations.
  4. Verbose API: Library initialization with Library.Initialize(), error code checking, and explicit Library.Release() calls add boilerplate to every operation.
  5. Separate HTML2PDF Engine: HTML to PDF conversion requires the HTML2PDF engine binaries, distributed separately from Foxit support/sales rather than bundled in the NuGet package.
  6. Complex Configuration: Settings require detailed object configuration (e.g., HTML2PDFSettingData) with multiple properties.
  7. C++ Heritage: API patterns reflect C++ origins, feeling less natural in modern C# applications.

Foxit PDF vs IronPDF Comparison

AspectFoxit PDF SDKIronPDF
InstallationFoxit.SDK.Dotnet (~240 MB) + separate HTML2PDF engineSimple NuGet package
LicensingSales-led, per-developer per-platformTransparent, suitable for all sizes
InitializationLibrary.Initialize(sn, key)Set license key once
Error HandlingErrorCode enumsStandard .NET exceptions
HTML to PDFSeparate engine downloadBuilt-in Chromium engine
API StyleC++ heritage, verboseModern .NET patterns
Resource CleanupManual Close()/Release()IDisposable/automatic
DocumentationEnterprise docs portalPublic tutorials

Cost-Benefit Analysis

Moving from Foxit PDF to IronPDF offers tangible development benefits: reduced complexity through simpler APIs, faster development with intuitive methods, modern .NET compatibility including async/await and LINQ support, an HTML-first approach that uses existing web skills, and HTML conversion included without a separate engine download. IronPDF runs on current .NET versions and pairs cleanly with modern C# patterns.


Before You Start

Prerequisites

  1. .NET Environment: IronPDF supports .NET Framework 4.6.2+, .NET Core 3.1+, .NET 5/6/7/8/9+
  2. NuGet Access: Ensure you can install packages from NuGet
  3. License Key: Obtain your IronPDF license key for production use from ironpdf.com

Backup Your Project

# Create a backup branch
git checkout -b pre-ironpdf-migration
git add .
git commit -m "Backup before Foxit PDF SDK to IronPDF migration"
SHELL

Identify All Foxit PDF Usage

# Find all Foxit PDF SDK references
grep -r "foxit\|PDFDoc\|PDFPage\|Library.Initialize\|Library.Release" --include="*.cs" --include="*.csproj" .

# Find Foxit DLL references
find . -name "*.csproj" | xargs grep -l "Foxit\|fsdk"
SHELL

Document Current Functionality

Before migration, catalog:

  • Which Foxit PDF features you use (HTML conversion, annotations, forms, security)
  • License key locations and initialization code
  • Custom configurations and settings
  • Error handling patterns using ErrorCode enums

Quick Start Migration

Step 1: Update NuGet Packages

# Remove the Foxit NuGet package
dotnet remove package Foxit.SDK.Dotnet

# Install IronPDF
dotnet add package IronPdf
SHELL

If you have older direct Foxit DLL references in .csproj (older builds), remove them manually:

<!-- Remove these manually -->
<Reference Include="fsdk_dotnet">
    <HintPath>..\libs\Foxit\fsdk_dotnet.dll</HintPath>
</Reference>
XML

Also delete any HTML2PDF engine folders that were unpacked separately.

Step 2: Update Namespaces

// Before (Foxit PDF)
using foxit;
using foxit.common;
using foxit.common.fxcrt;
using foxit.pdf;
using foxit.pdf.annots;
using foxit.addon.conversion;

// After (IronPDF)
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;

Step 3: Initialize IronPDF

One of the most significant improvements in this Foxit PDF migration is eliminating the complex initialization and cleanup pattern:

// Before (Foxit PDF)
string sn = "YOUR_SERIAL_NUMBER";
string key = "YOUR_LICENSE_KEY";
ErrorCode error_code = Library.Initialize(sn, key);
if (error_code != ErrorCode.e_ErrSuccess)
{
    throw new Exception("Failed to initialize Foxit PDF SDK");
}
// ... your code ...
Library.Release();  // Don't forget this!

// After (IronPDF)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// That's it! No Release() needed

Step 4: Basic Conversion Pattern

// Before (Foxit PDF)
Library.Initialize(sn, key);
HTML2PDFSettingData settings = new HTML2PDFSettingData();
settings.page_width = 612.0f;
settings.page_height = 792.0f;
Convert.FromHTML(htmlContent, @"C:\Foxit\html2pdf_engine", "",
                 settings, "output.pdf", 30);
Library.Release();

// After (IronPDF)
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");

Complete API Reference

Namespace Mapping

Foxit PDF NamespaceIronPDF Equivalent
foxitIronPdf
foxit.commonIronPdf
foxit.common.fxcrtN/A
foxit.pdfIronPdf
foxit.pdf.annotsIronPdf.Editing
foxit.addon.conversionIronPdf.Rendering

Core Class Mapping

Foxit PDF SDK ClassIronPDF Equivalent
LibraryN/A
PDFDocPdfDocument
PDFPagePdfDocument.Pages[i]
HTML2PDFChromePdfRenderer
TextPagepdf.ExtractTextFromPage(i)
WatermarkTextStamper / ImageStamper
SecuritySecuritySettings
Formpdf.Form
Metadatapdf.MetaData

PDFDoc Methods

Foxit PDFDocIronPDF PdfDocument
new PDFDoc(path)PdfDocument.FromFile(path)
doc.LoadW(password)PdfDocument.FromFile(path, password)
doc.GetPageCount()pdf.PageCount
doc.GetPage(index)pdf.Pages[index]
doc.SaveAs(path, flags)pdf.SaveAs(path)
doc.Close()pdf.Dispose() or using statement
doc.InsertDocument()PdfDocument.Merge()

HTML2PDF / Conversion

Foxit HTML2PDFIronPDF Equivalent
new HTML2PDFSettingData()new ChromePdfRenderer()
settings.page_widthRenderingOptions.PaperSize
settings.page_heightRenderingOptions.SetCustomPaperSize()
Convert.FromHTML(html, engine, ...)renderer.RenderHtmlAsPdf(html)
Convert.FromHTML(url, engine, ...)renderer.RenderUrlAsPdf(url)

Watermark Settings

Foxit WatermarkIronPDF Equivalent
new Watermark(doc, text, font, size, color)new TextStamper()
WatermarkSettings.positionVerticalAlignment + HorizontalAlignment
WatermarkSettings.rotationRotation
WatermarkSettings.opacityOpacity
watermark.InsertToAllPages()pdf.ApplyStamp(stamper)

Code Examples

Example 1: HTML to PDF Conversion

Before (Foxit PDF SDK):

// NuGet: Install-Package Foxit.SDK.Dotnet
// HTML-to-PDF requires the separate Foxit HTML2PDF engine (engine_path),
// obtained from Foxit support/sales — not in the NuGet package.
using foxit;
using foxit.common;
using foxit.addon.conversion;
using System;

class Program
{
    static void Main()
    {
        Library.Initialize("sn", "key");

        HTML2PDFSettingData settingData = new HTML2PDFSettingData();
        settingData.page_width = 612.0f;
        settingData.page_height = 792.0f;
        settingData.page_mode = HTML2PDFPageMode.e_HTML2PDFPageModeSinglePage;

        Convert.FromHTML(
            "<html><body><h1>Hello World</h1></body></html>",
            @"C:\Foxit\html2pdf_engine",   // engine_path (separate download)
            "",                              // cookies path
            settingData,
            "output.pdf",
            30);                             // timeout (seconds)

        Library.Release();
    }
}

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<html><body><h1>Hello World</h1></body></html>");
        pdf.SaveAs("output.pdf");
    }
}

The IronPDF approach reduces 15+ lines of configuration code to just 4 lines. No library initialization, no explicit cleanup, no complex settings objects. For more HTML rendering options, see the HTML to PDF documentation.

Example 2: URL to PDF Conversion

Before (Foxit PDF SDK):

// NuGet: Install-Package Foxit.SDK.Dotnet
// Convert.FromHTML accepts either a URL or a literal HTML string in the
// first argument; the URL form is what does URL-to-PDF.
using foxit;
using foxit.common;
using foxit.addon.conversion;
using System;

class Program
{
    static void Main()
    {
        Library.Initialize("sn", "key");

        HTML2PDFSettingData settingData = new HTML2PDFSettingData();
        settingData.page_width = 612.0f;
        settingData.page_height = 792.0f;
        settingData.page_mode = HTML2PDFPageMode.e_HTML2PDFPageModeSinglePage;

        Convert.FromHTML(
            "https://www.example.com",
            @"C:\Foxit\html2pdf_engine",   // engine_path (separate download)
            "",                              // cookies path
            settingData,
            "output.pdf",
            30);                             // timeout (seconds)

        Library.Release();
    }
}

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
        pdf.SaveAs("output.pdf");
    }
}

IronPDF's built-in Chromium engine handles JavaScript execution, CSS rendering, and dynamic content automatically. Learn more about URL to PDF conversion.

Example 3: Adding Watermarks

Before (Foxit PDF SDK):

// NuGet: Install-Package Foxit.SDK.Dotnet
using foxit;
using foxit.common;
using foxit.pdf;
using System;

class Program
{
    static void Main()
    {
        Library.Initialize("sn", "key");

        using (PDFDoc doc = new PDFDoc("input.pdf"))
        {
            doc.Load("");

            WatermarkSettings settings = new WatermarkSettings();
            settings.flags = (int)Watermark.Flags.e_FlagASPageContents;
            settings.position = Position.e_PosCenter;
            settings.rotation = -45.0f;
            settings.opacity = 50;     // 0-100 in newer SDKs

            WatermarkTextProperties props = new WatermarkTextProperties();
            props.font = new Font(Font.StandardID.e_StdIDHelvetica);
            props.font_size = 48.0f;
            props.color = 0xFF0000;
            props.alignment = Alignment.e_AlignmentCenter;

            Watermark watermark = new Watermark(doc, "Confidential", props, settings);

            // No InsertToAllPages helper — iterate pages explicitly.
            for (int i = 0; i < doc.GetPageCount(); i++)
            {
                using (PDFPage page = doc.GetPage(i))
                {
                    watermark.InsertToPage(page);
                }
            }

            doc.SaveAs("output.pdf", (int)PDFDoc.SaveFlags.e_SaveFlagNoOriginal);
        }

        Library.Release();
    }
}

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;
using System;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("input.pdf");
        pdf.ApplyWatermark(new TextStamper()
        {
            Text = "Confidential",
            FontSize = 48,
            Opacity = 50,
            Rotation = -45,
            VerticalAlignment = VerticalAlignment.Middle,
            HorizontalAlignment = HorizontalAlignment.Center
        });
        pdf.SaveAs("output.pdf");
    }
}

IronPDF's TextStamper provides intuitive property-based configuration instead of separate settings objects and manual page iteration. See the complete watermarking documentation for additional options.

Example 4: URL to PDF with Headers and Footers

Before (Foxit PDF SDK):

using foxit;
using foxit.addon.conversion;

class Program
{
    static void Main()
    {
        Library.Initialize("sn", "key");

        try
        {
            HTML2PDFSettingData settings = new HTML2PDFSettingData();
            settings.page_width = 595.0f;  // A4
            settings.page_height = 842.0f;
            settings.page_margin_top = 100.0f;
            settings.page_margin_bottom = 100.0f;

            // Foxit PDF SDK has limited header/footer support
            // Often requires post-processing or additional code

            Convert.FromHTML(
                "https://www.example.com",
                @"C:\Foxit\html2pdf_engine",  // engine_path (separate download)
                "",                            // cookies path
                settings,
                "webpage.pdf",
                30);                           // timeout (seconds)
        }
        finally
        {
            Library.Release();
        }
    }
}

After (IronPDF):

using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
        renderer.RenderingOptions.PrintHtmlBackgrounds = true;
        renderer.RenderingOptions.WaitFor.RenderDelay(3000);  // Wait for JS

        // Built-in header/footer support
        renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
        {
            HtmlFragment = "<div style='text-align:center; font-size:12pt;'>Company Report</div>",
            DrawDividerLine = true
        };

        renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter()
        {
            HtmlFragment = "<div style='text-align:right; font-size:10pt;'>Page {page} of {total-pages}</div>",
            DrawDividerLine = true
        };

        var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
        pdf.SaveAs("webpage.pdf");
    }
}

IronPDF provides native headers and footers support with HTML styling and dynamic page number placeholders.

Example 5: PDF Security and Encryption

Before (Foxit PDF SDK):

using foxit;
using foxit.pdf;

class Program
{
    static void Main()
    {
        Library.Initialize("sn", "key");

        try
        {
            using (PDFDoc doc = new PDFDoc("input.pdf"))
            {
                doc.LoadW("");

                // Build the encryption data (cipher, key length, permissions)
                using (StdEncryptData encryptData = new StdEncryptData(
                    true,                                    // is_encrypt_metadata
                    (int)(PDFDoc.UserPermissions.e_PermPrint |
                          PDFDoc.UserPermissions.e_PermModify),
                    SecurityHandler.CipherType.e_CipherAES,
                    16))                                     // key length (bytes) -> AES-128
                using (StdSecurityHandler securityHandler = new StdSecurityHandler())
                {
                    securityHandler.Initialize(encryptData, "user_password", "owner_password");
                    doc.SetSecurityHandler(securityHandler);
                }

                doc.SaveAs("encrypted.pdf", (int)PDFDoc.SaveFlags.e_SaveFlagNoOriginal);
            }
        }
        finally
        {
            Library.Release();
        }
    }
}

After (IronPDF):

using IronPdf;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("input.pdf");

        // Set passwords
        pdf.SecuritySettings.OwnerPassword = "owner_password";
        pdf.SecuritySettings.UserPassword = "user_password";

        // Set permissions
        pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;
        pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.EditAll;
        pdf.SecuritySettings.AllowUserCopyPasteContent = true;
        pdf.SecuritySettings.AllowUserAnnotations = true;

        pdf.SaveAs("encrypted.pdf");
    }
}

Performance Considerations

Reuse ChromePdfRenderer

For optimal performance during your Foxit PDF migration, reuse the ChromePdfRenderer instance - it's thread-safe:

// GOOD - Reuse renderer (thread-safe)
public class PdfService
{
    private static readonly ChromePdfRenderer _renderer = new ChromePdfRenderer();

    public byte[] Generate(string html) => _renderer.RenderHtmlAsPdf(html).BinaryData;
}

// BAD - Creates new instance each time
public byte[] GenerateBad(string html)
{
    var renderer = new ChromePdfRenderer();  // Wasteful
    return renderer.RenderHtmlAsPdf(html).BinaryData;
}

Unit Conversion Helper

Foxit PDF SDK uses points; IronPDF uses millimeters. Use this helper during migration:

public static class UnitConverter
{
    public static double PointsToMm(double points) => points * 0.352778;
    public static double MmToPoints(double mm) => mm / 0.352778;
    public static double InchesToMm(double inches) => inches * 25.4;
}

// Usage: Convert Foxit's 72 points (1 inch) to IronPDF millimeters
renderer.RenderingOptions.MarginTop = UnitConverter.PointsToMm(72); // ~25.4mm

Proper Resource Disposal

// GOOD - Using statement for automatic cleanup
using (var pdf = PdfDocument.FromFile("large.pdf"))
{
    string text = pdf.ExtractAllText();
}  // pdf is disposed automatically

Troubleshooting

Issue 1: Library.Initialize() Not Found

Problem: Library.Initialize() doesn't exist in IronPDF.

Solution: IronPDF uses a simpler initialization pattern:

// Foxit PDF
Library.Initialize(sn, key);

// IronPDF - just set license key once at startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

Issue 2: ErrorCode Handling

Problem: Code checks ErrorCode.e_ErrSuccess but IronPDF doesn't have this.

Solution: Use standard .NET exception handling:

// Foxit PDF
ErrorCode err = doc.LoadW("");
if (err != ErrorCode.e_ErrSuccess) { /* handle error */ }

// IronPDF
try
{
    var pdf = PdfDocument.FromFile("input.pdf");
}
catch (IOException ex)
{
    Console.WriteLine($"Failed to load PDF: {ex.Message}");
}

Issue 3: PDFDoc.Close() Not Found

Problem: doc.Close() method doesn't exist in IronPDF.

Solution: Use Dispose() or using statements:

// Foxit PDF
doc.Close();

// IronPDF
pdf.Dispose();
// or better: wrap in using statement

Migration Checklist

Pre-Migration

  • Inventory all Foxit PDF SDK features used
  • Document license key locations
  • Note all Library.Initialize() and Library.Release() calls
  • List custom settings (page sizes, margins, etc.)
  • Identify error handling patterns using ErrorCode
  • Backup project to version control
  • Obtain IronPDF license key

Package Migration

  • Remove Foxit PDF SDK DLL references from .csproj
  • Remove any private NuGet feed configurations
  • Install IronPDF NuGet package: dotnet add package IronPdf
  • Update namespace imports
  • Set IronPDF license key at startup

Code Migration

  • Remove Library.Initialize() and Library.Release() calls
  • Replace ErrorCode checks with try/catch
  • Replace PDFDoc with PdfDocument
  • Replace Convert.FromHTML(...) with ChromePdfRenderer
  • Update page access from GetPage(i) to Pages[i]
  • Replace SaveAs(path, flags) with SaveAs(path)
  • Replace Close() with Dispose() or using statements
  • Update watermark code to use TextStamper
  • Convert units from points to millimeters

Testing

  • Verify HTML to PDF output matches expectations
  • Test PDF loading and text extraction
  • Verify merge functionality
  • Check watermark appearance
  • Test security/encryption features
  • Validate form field operations
  • Performance testing

Post-Migration

  • Delete Foxit PDF SDK DLLs
  • Remove Foxit-related configuration files
  • Update documentation
  • Clean up unused helper code

Please note: Foxit PDF SDK and Foxit are registered trademarks of Foxit Software Incorporated. This site is not affiliated with, endorsed by, or sponsored by Foxit Software. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing.
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

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required