IRONSOFTWAREHOME
MIGRATION GUIDES

How to Migrate from Pdfium to IronPDF in C#

Curtis Chau
Curtis Chau
Updated: August 1, 2026

Migrating from a PDFium .NET wrapper to IronPDF moves your .NET PDF workflow from a rendering-focused engine with native binary dependencies to a comprehensive PDF solution that handles creation, manipulation, and rendering without platform-specific complexity. This guide provides a step-by-step migration path that eliminates native dependency management while adding capabilities PDFium itself does not provide.

Why Migrate from a PDFium Wrapper to IronPDF

Understanding the PDFium .NET Wrappers

PDFium is Google's BSD-3-Clause C++ PDF rendering and parsing engine - the same engine that powers Chrome's built-in PDF viewer. There is no official Google-supplied .NET binding; instead, the .NET ecosystem consumes PDFium through community wrappers. The four most commonly cited NuGet packages are PdfiumViewer (pvginkel; Apache 2.0; archived August 2019, last release 2.13.0 in November 2017, .NET Framework 2.0+), PdfiumViewer.Updated (a maintained fork ported to .NET Core / .NET 6), PDFiumCore (Dtronix; .NET Standard 2.1 P/Invoke bindings), and Pdfium.Net.SDK (Patagames; commercial, perpetual-license SDK).

Their APIs differ, but they share one trait: PDFium itself is a rendering and parsing engine, not an HTML-to-PDF or document-authoring engine. PDFium has no HTML parser, so no wrapper can convert HTML to PDF on its own. This guide uses PdfiumViewer as the representative wrapper for "before" snippets because its API is the most widely cited; the migration approach is the same for any of the four.

Critical PDFium Wrapper Limitations

  1. Rendering-First: PDFium has no HTML parser, so no wrapper can create PDFs from HTML, URLs, or arbitrary images.
  2. Limited Manipulation in Open-Source Wrappers: PdfiumViewer / PDFiumCore expose viewing and per-page text extraction; merge / split / form-edit is partial in Patagames Pdfium.Net.SDK and largely absent in the free wrappers.
  3. Native Binary Dependencies: Requires platform-specific PDFium binaries (pdfium.dll / .so / .dylib) per RID.
  4. Deployment Complexity: Must bundle and manage native binaries per platform with x86, x64, and runtimes folders.
  5. Basic Text Extraction: PdfiumViewer exposes per-page raw text via GetPdfText(int); layout / format metadata is not exposed.
  6. No HTML to PDF: PDFium has no HTML parser; web content cannot be converted directly.
  7. No Built-in Headers/Footers: No high-level page-overlay API.
  8. No Built-in Watermarks: No stamping primitive.
  9. Forms: Read-only or absent in the free wrappers; available in Patagames Pdfium.Net.SDK.
  10. Security: Encryption / permissions not exposed by the free wrappers; available in Patagames Pdfium.Net.SDK.

PDFium Wrappers vs IronPDF Comparison

AspectPDFium .NET wrappersIronPDF
Primary FocusRendering/viewingComplete PDF solution
Rendering FidelityHigh-fidelity renderingHigh, especially for HTML/CSS/JS
PDF Creation from HTMLNoneYes (HTML, URL, images)
PDF ManipulationFree wrappers: none; Patagames: partialYes (merge, split, edit)
HTML to PDFNoneYes (Chromium engine)
WatermarksNot built-inYes
Headers/FootersNot built-inYes
Form FillingFree wrappers: none; Patagames: yesYes
SecurityFree wrappers: none; Patagames: yesYes
Native DependenciesRequiredBundled / NuGet-managed
Cross-PlatformManual native binary managementAutomatic
Ease of DeploymentComplicated by native dependenciesEasier; less dependency complication

For teams targeting modern .NET, IronPDF provides a fully managed foundation that eliminates native binary management while adding comprehensive PDF creation and manipulation capabilities.


Before You Start

Prerequisites

  1. .NET Environment: .NET Framework 4.6.2+ or .NET Core 3.1+ / .NET 5/6/7/8/9+
  2. NuGet Access: Ability to install NuGet packages
  3. IronPDF License: Obtain your license key from ironpdf.com

NuGet Package Changes

# Remove whichever PDFium wrapper you used:
#   PdfiumViewer            (Apache 2.0 - archived 2019, .NET Framework only)
#   PdfiumViewer.Updated    (community fork, .NET Core / .NET 6)
#   PDFiumCore              (Dtronix - .NET Standard 2.1 P/Invoke bindings)
#   Pdfium.Net.SDK          (Patagames - commercial, perpetual license)
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Updated
dotnet remove package PDFiumCore
dotnet remove package Pdfium.Net.SDK

# Install IronPDF
dotnet add package IronPdf
SHELL

License Configuration

// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

Identify PDFium Wrapper Usage

# Find PDFium wrapper usage
grep -rE "PdfiumViewer|PDFiumCore|Patagames\.Pdf|PdfDocument\.Load|\.Render\(" --include="*.cs" .

# Find native binary references
grep -rE "pdfium\.dll|libpdfium\.(so|dylib)" --include="*.csproj" --include="*.config" .

# Find platform-specific code
grep -rE "#if.*64|WIN32|WIN64|LINUX|OSX" --include="*.cs" .
SHELL

Complete API Reference

Namespace Changes

// PDFium wrappers (use the one you installed)
using PdfiumViewer;             // PdfiumViewer / PdfiumViewer.Updated
using PDFiumCore;               // Dtronix PDFiumCore (P/Invoke bindings)
using Patagames.Pdf;            // Patagames Pdfium.Net.SDK
using Patagames.Pdf.Net;        // Patagames Pdfium.Net.SDK

// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;

Core Class Mappings

PdfiumViewerIronPDFNotes
PdfiumViewer.PdfDocumentIronPdf.PdfDocumentSame simple name in different namespaces
PdfRenderer (WinForms control)(not applicable)PdfiumViewer also ships UI controls; IronPDF is headless
(not available)ChromePdfRendererHTML / URL → PDF
(not available)HtmlHeaderFooterHeaders/footers

Document Loading Mappings

PdfiumViewerIronPDFNotes
PdfDocument.Load(path)PdfDocument.FromFile(path)Load from file
PdfDocument.Load(stream)PdfDocument.FromStream(stream)Load from stream
(wrap bytes in MemoryStream)PdfDocument.FromBinaryData(bytes)Load from bytes

Document Properties Mappings

PdfiumViewerIronPDFNotes
document.PageCountdocument.PageCountSame
document.PageSizes (IList<SizeF>)document.Pages[index].Width / HeightPdfiumViewer exposes sizes; pages are not first-class objects
document.PageSizes[i].Widthdocument.Pages[i].WidthPer-page width in points

Text Extraction Mappings

PdfiumViewerIronPDFNotes
document.GetPdfText(pageIndex)document.Pages[index].TextPer-page
(manual loop)document.ExtractAllText()All pages

Saving Documents Mappings

PdfiumViewerIronPDFNotes
document.Save(stream)document.SaveAs(path)PdfiumViewer takes a Stream; IronPDF takes a path
(not available)document.StreamAccess raw stream
(not available)document.BinaryDataGet bytes

Page Rendering Mappings

PdfiumViewerIronPDFNotes
document.Render(page, width, height, dpiX, dpiY, flags)pdf.RasterizeToImageFiles(path, DPI)Rasterize
Manual loop over document.Render(i, ...)pdf.RasterizeToImageFiles("page_*.png")Batch render across all pages
Manual scale mathDPI = 72 * scaleScale-to-DPI conversion

New Features Not Available in PDFium Wrappers

IronPDF FeatureDescription
ChromePdfRenderer.RenderHtmlAsPdf()Create from HTML
ChromePdfRenderer.RenderUrlAsPdf()Create from URL
ChromePdfRenderer.RenderHtmlFileAsPdf()Create from HTML file
PdfDocument.Merge()Combine PDFs
pdf.CopyPages()Extract pages
pdf.RemovePages()Delete pages
pdf.InsertPdf()Insert PDF at position
pdf.ApplyWatermark()Add watermarks
pdf.AddHtmlHeaders()Add headers
pdf.AddHtmlFooters()Add footers
pdf.SecuritySettingsPassword protection
pdf.SignWithDigitalSignature()Digital signatures
pdf.FormForm filling

Code Migration Examples

Example 1: Text Extraction from PDF

Before (PdfiumViewer):

// NuGet: Install-Package PdfiumViewer  (Apache 2.0; archived Aug 2019, .NET Framework 2.0+)
//        or Install-Package PdfiumViewer.Updated  (maintained fork, .NET Core / .NET 6)
//        or Install-Package PDFiumCore             (Dtronix, .NET Standard 2.1 P/Invoke)
//        or Install-Package Pdfium.Net.SDK         (Patagames, commercial perpetual license)
using PdfiumViewer;
using System;
using System.IO;
using System.Text;

class Program
{
    static void Main()
    {
        string pdfPath = "document.pdf";

        using (var document = PdfDocument.Load(pdfPath))
        {
            StringBuilder text = new StringBuilder();

            for (int i = 0; i < document.PageCount; i++)
            {
                // PdfiumViewer's text extraction is per-page raw text via GetPdfText(int).
                // No layout / format metadata is exposed.
                string pageText = document.GetPdfText(i);
                text.AppendLine(pageText);
            }

            Console.WriteLine(text.ToString());
        }
    }
}

After (IronPDF):

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

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        string pdfPath = "document.pdf";

        var pdf = PdfDocument.FromFile(pdfPath);
        string text = pdf.ExtractAllText();

        Console.WriteLine(text);
    }
}

The difference here is significant. PdfiumViewer requires a manual loop through each page with GetPdfText(int), building a StringBuilder and managing the using statement for proper disposal - and the returned text is raw per-page text with no layout / format metadata.

IronPDF simplifies this to a few lines: load with PdfDocument.FromFile(), extract with ExtractAllText(), and output. The ExtractAllText() method handles all pages automatically. If you need per-page extraction, you can use pdf.Pages[index].Text. See the text extraction documentation for additional options.

Example 2: PDF Merging

Before (PdfiumViewer):

// NuGet: Install-Package PdfiumViewer  (representative open-source PDFium wrapper)
// PdfiumViewer and PDFiumCore do not expose PDF merge APIs - PDFium itself
// is a rendering / parsing engine, not a document-authoring engine.
// (Patagames Pdfium.Net.SDK exposes some document-edit operations but is commercial.)
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // To merge PDFs from a PDFium wrapper you must reach for another library
        // (PdfSharp, iText, IronPDF) or, with Patagames Pdfium.Net.SDK, use its
        // document-edit APIs.

        Console.WriteLine("PDF merging is not supported by PdfiumViewer / PDFiumCore.");
    }
}

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // PdfDocument.Merge accepts an IEnumerable<PdfDocument>, so load each file first.
        var docs = pdfFiles.Select(path => PdfDocument.FromFile(path)).ToList();
        var merged = PdfDocument.Merge(docs);
        merged.SaveAs("merged.pdf");

        Console.WriteLine("PDFs merged successfully");
    }
}

This example highlights a capability gap. Free PDFium wrappers (PdfiumViewer, PDFiumCore) do not expose merge APIs; Patagames Pdfium.Net.SDK exposes some document-edit operations but is commercial.

IronPDF provides native merging with the static PdfDocument.Merge() method, which takes an IEnumerable<PdfDocument> - load each input file with PdfDocument.FromFile() first, then merge the resulting documents. The result is a new PdfDocument that you save with SaveAs(). Learn more about merging and splitting PDFs.

Example 3: HTML to PDF Conversion

Before (PdfiumViewer):

// NuGet: Install-Package PdfiumViewer  (representative PDFium wrapper)
// PDFium is a PDF rendering / parsing engine. It has NO HTML parser, so no
// PDFium .NET wrapper (PdfiumViewer, PdfiumViewer.Updated, PDFiumCore,
// Pdfium.Net.SDK) can convert HTML to PDF on its own.
using PdfiumViewer;
using System;
using System.IO;
using System.Drawing.Printing;

class Program
{
    static void Main()
    {
        // PDFium has no native HTML-to-PDF capability.
        // Produce the PDF with another engine (wkhtmltopdf, headless Chromium,
        // IronPDF, etc.) and then load it with PdfDocument.Load(...) for rendering.
        string htmlContent = "<h1>Hello World</h1>";

        Console.WriteLine("HTML to PDF conversion is not supported by PDFium.");
    }
}

After (IronPDF):

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

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        var renderer = new ChromePdfRenderer();
        string htmlContent = "<h1>Hello World</h1>";

        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");

        Console.WriteLine("PDF created successfully");
    }
}

This example demonstrates the most significant capability difference. PDFium has no HTML parser, so no .NET wrapper around it can convert HTML to PDF on its own.

IronPDF provides native HTML to PDF conversion through ChromePdfRenderer, which uses a Chromium engine internally for accurate rendering of HTML, CSS, and JavaScript. The RenderHtmlAsPdf() method converts HTML strings directly to PDF documents. IronPDF can also render URLs with RenderUrlAsPdf() and HTML files with RenderHtmlFileAsPdf(). See the HTML to PDF documentation for comprehensive examples.


Native Dependency Removal

One of the most significant benefits of migrating from a PDFium wrapper to IronPDF is eliminating native binary management.

Before (PDFium wrapper) - Complex Deployment

MyApp/
├── bin/
│   ├── MyApp.dll
│   ├── PdfiumViewer.dll      # or PDFiumCore.dll / Patagames.Pdf.dll
│   ├── x86/
│   │   └── pdfium.dll
│   └── x64/
│       └── pdfium.dll
├── runtimes/
│   ├── win-x86/native/
│   │   └── pdfium.dll
│   ├── win-x64/native/
│   │   └── pdfium.dll
│   ├── linux-x64/native/
│   │   └── libpdfium.so
│   └── osx-x64/native/
│       └── libpdfium.dylib
Text

After (IronPDF) - Clean Deployment

MyApp/
├── bin/
│   ├── MyApp.dll
│   └── IronPdf.dll  # Everything included
Text

Remove Native Binary References

# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/

# Remove from .csproj
# Delete any <Content Include="pdfium.dll" /> entries
# Delete any <None Include="x86/pdfium.dll" /> entries
SHELL

Critical Migration Notes

Scale to DPI Conversion

PdfiumViewer's Render(...) takes explicit dpiX/dpiY and PDFium's underlying rendering is scale-driven (1.0 = 72 DPI). IronPDF uses DPI directly:

// Formula: IronPDF DPI = 72 × PDFium scale
// PDFium scale 2.0 → IronPDF DPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);

Document Loading Method Change

// PdfiumViewer
PdfDocument.Load(path)

// IronPDF
PdfDocument.FromFile(path)

Save Method Change

// PdfiumViewer (takes a Stream)
document.Save(stream)

// IronPDF (takes a path)
pdf.SaveAs(path)

Disposal Pattern Simplification

// PdfiumViewer: explicit disposal of document and the rendered Image
using (var document = PdfDocument.Load(path))
using (var bitmap = document.Render(0, 1024, 768, 96, 96, PdfRenderFlags.None))
{
    bitmap.Save("output.png");
}

// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");

Platform-Specific Code Removal

// PDFium wrapper: required platform detection / RID-specific binaries
#if WIN64
    // Load x64 pdfium.dll
#else
    // Load x86 pdfium.dll
#endif

// IronPDF: Remove all platform-specific code
// Just use the API directly

Feature Comparison Summary

FeaturePDFium .NET wrappersIronPDF
Load PDFYesYes
Render to ImageYesYes
Extract TextYes (basic, per-page)Yes (logical / visual order)
Page InfoYesYes
Create from HTMLNoneYes
Create from URLNoneYes
Merge PDFsFree wrappers: no; Patagames: partialYes
Split PDFsFree wrappers: no; Patagames: partialYes
Add WatermarksNot built-inYes
Headers/FootersNot built-inYes
Form FillingFree wrappers: no; Patagames: yesYes
Digital SignaturesFree wrappers: no; Patagames: yesYes
Password ProtectionFree wrappers: no; Patagames: yesYes
Native DependenciesRequiredBundled / NuGet-managed
Cross-PlatformComplex (per-RID native binaries)Automatic
Memory ManagementManual disposalSimplified

Migration Checklist

Pre-Migration

  • Identify which PDFium wrapper is in use (PdfiumViewer / PdfiumViewer.Updated / PDFiumCore / Pdfium.Net.SDK)
  • Document current rendering dimensions / DPI / scales used
  • List native binary locations in project (per RID)
  • Check for platform-specific loading code
  • Identify PDF creation needs (currently using separate tools?)
  • Review disposal patterns for conversion
  • Obtain IronPDF license key

Package Changes

  • Remove the PDFium wrapper NuGet package(s): PdfiumViewer, PdfiumViewer.Updated, PDFiumCore, or Pdfium.Net.SDK
  • Delete native pdfium.dll / .so / .dylib binaries from x86/, x64/, runtimes/ folders
  • Remove platform-specific conditional compilation
  • Update .csproj to remove native binary references
  • Install IronPdf NuGet package: dotnet add package IronPdf

Code Changes

  • Add license key configuration at startup
  • Replace PdfDocument.Load() with PdfDocument.FromFile()
  • Replace document.Save() with pdf.SaveAs()
  • Replace document.GetPdfText(i) loops with pdf.ExtractAllText()
  • Convert scale factors to DPI values (DPI = 72 × scale)
  • Simplify disposal patterns (remove nested using statements)
  • Remove platform-specific code

Post-Migration

  • Test rendering output quality
  • Compare text extraction results
  • Test cross-platform deployment
  • Add new capabilities (HTML to PDF, merging, watermarks, security)
  • Update documentation

Please note: PDFium is a project of Google LLC, released under BSD-3-Clause. PdfiumViewer, PDFiumCore, and Pdfium.Net.SDK are trademarks of their respective owners (pvginkel, Dtronix, and Patagames Software Ltd, respectively). This site is not affiliated with, endorsed by, or sponsored by Google, the Chromium Project, or any of the wrapper authors. 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