How to Migrate from Pdfium to IronPDF in C#
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
-
Rendering-First: PDFium has no HTML parser, so no wrapper can create PDFs from HTML, URLs, or arbitrary images.
-
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.
-
Native Binary Dependencies: Requires platform-specific PDFium binaries (
pdfium.dll/.so/.dylib) per RID. -
Deployment Complexity: Must bundle and manage native binaries per platform with x86, x64, and runtimes folders.
-
Basic Text Extraction: PdfiumViewer exposes per-page raw text via
GetPdfText(int); layout / format metadata is not exposed. -
No HTML to PDF: PDFium has no HTML parser; web content cannot be converted directly.
-
No Built-in Headers/Footers: No high-level page-overlay API.
-
No Built-in Watermarks: No stamping primitive.
-
Forms: Read-only or absent in the free wrappers; available in Patagames Pdfium.Net.SDK.
- Security: Encryption / permissions not exposed by the free wrappers; available in Patagames Pdfium.Net.SDK.
PDFium Wrappers vs IronPDF Comparison
| Aspect | PDFium .NET wrappers | IronPDF |
|---|---|---|
| Primary Focus | Rendering/viewing | Complete PDF solution |
| Rendering Fidelity | High-fidelity rendering | High, especially for HTML/CSS/JS |
| PDF Creation from HTML | None | Yes (HTML, URL, images) |
| PDF Manipulation | Free wrappers: none; Patagames: partial | Yes (merge, split, edit) |
| HTML to PDF | None | Yes (Chromium engine) |
| Watermarks | Not built-in | Yes |
| Headers/Footers | Not built-in | Yes |
| Form Filling | Free wrappers: none; Patagames: yes | Yes |
| Security | Free wrappers: none; Patagames: yes | Yes |
| Native Dependencies | Required | Bundled / NuGet-managed |
| Cross-Platform | Manual native binary management | Automatic |
| Ease of Deployment | Complicated by native dependencies | Easier; 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
- .NET Environment: .NET Framework 4.6.2+ or .NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGet Access: Ability to install NuGet packages
- 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
# 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
License Configuration
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Startup.vb)
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" .
# 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" .
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;
// 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;
Imports PdfiumViewer ' PdfiumViewer / PdfiumViewer.Updated
Imports PDFiumCore ' Dtronix PDFiumCore (P/Invoke bindings)
Imports Patagames.Pdf ' Patagames Pdfium.Net.SDK
Imports Patagames.Pdf.Net ' Patagames Pdfium.Net.SDK
Imports IronPdf
Imports IronPdf.Rendering
Imports IronPdf.Editing
Core Class Mappings
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
PdfiumViewer.PdfDocument |
IronPdf.PdfDocument |
Same simple name in different namespaces |
PdfRenderer (WinForms control) |
(not applicable) | PdfiumViewer also ships UI controls; IronPDF is headless |
| (not available) | ChromePdfRenderer |
HTML / URL → PDF |
| (not available) | HtmlHeaderFooter |
Headers/footers |
Document Loading Mappings
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
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
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
document.PageCount |
document.PageCount |
Same |
document.PageSizes (IList<SizeF>) |
document.Pages[index].Width / Height |
PdfiumViewer exposes sizes; pages are not first-class objects |
document.PageSizes[i].Width |
document.Pages[i].Width |
Per-page width in points |
Text Extraction Mappings
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
document.GetPdfText(pageIndex) |
document.Pages[index].Text |
Per-page |
| (manual loop) | document.ExtractAllText() |
All pages |
Saving Documents Mappings
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
document.Save(stream) |
document.SaveAs(path) |
PdfiumViewer takes a Stream; IronPDF takes a path |
| (not available) | document.Stream |
Access raw stream |
| (not available) | document.BinaryData |
Get bytes |
Page Rendering Mappings
| PdfiumViewer | IronPDF | Notes |
|---|---|---|
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 math | DPI = 72 * scale |
Scale-to-DPI conversion |
New Features Not Available in PDFium Wrappers
| IronPDF Feature | Description |
|---|---|
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.SecuritySettings |
Password protection |
pdf.SignWithDigitalSignature() |
Digital signatures |
pdf.Form |
Form 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());
}
}
}
// 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());
}
}
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Text
Module Program
Sub Main()
Dim pdfPath As String = "document.pdf"
Using document = PdfDocument.Load(pdfPath)
Dim text As New StringBuilder()
For i As Integer = 0 To document.PageCount - 1
' PdfiumViewer's text extraction is per-page raw text via GetPdfText(int).
' No layout / format metadata is exposed.
Dim pageText As String = document.GetPdfText(i)
text.AppendLine(pageText)
Next
Console.WriteLine(text.ToString())
End Using
End Sub
End Module
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);
}
}
// 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);
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim pdfPath As String = "document.pdf"
Dim pdf = PdfDocument.FromFile(pdfPath)
Dim text As String = pdf.ExtractAllText()
Console.WriteLine(text)
End Sub
End Class
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.");
}
}
// 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.");
}
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Collections.Generic
Module Program
Sub Main()
Dim pdfFiles As New List(Of String) From {
"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.")
End Sub
End Module
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");
}
}
// 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");
}
}
Imports IronPdf
Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main()
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim pdfFiles As New List(Of String) From {
"document1.pdf",
"document2.pdf",
"document3.pdf"
}
' PdfDocument.Merge accepts an IEnumerable(Of PdfDocument), so load each file first.
Dim docs = pdfFiles.Select(Function(path) PdfDocument.FromFile(path)).ToList()
Dim merged = PdfDocument.Merge(docs)
merged.SaveAs("merged.pdf")
Console.WriteLine("PDFs merged successfully")
End Sub
End Module
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.");
}
}
// 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.");
}
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Drawing.Printing
Module Program
Sub 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.
Dim htmlContent As String = "<h1>Hello World</h1>"
Console.WriteLine("HTML to PDF conversion is not supported by PDFium.")
End Sub
End Module
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");
}
}
// 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");
}
}
Imports IronPdf
Imports System
Module Program
Sub Main()
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim renderer As New ChromePdfRenderer()
Dim htmlContent As String = "<h1>Hello World</h1>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
Console.WriteLine("PDF created successfully")
End Sub
End Module
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
After (IronPDF) - Clean Deployment
MyApp/
├── bin/
│ ├── MyApp.dll
│ └── IronPdf.dll # Everything included
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
# 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
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);
// Formula: IronPDF DPI = 72 × PDFium scale
// PDFium scale 2.0 → IronPDF DPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);
' 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)
// PdfiumViewer
PdfDocument.Load(path)
// IronPDF
PdfDocument.FromFile(path)
' 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)
// PdfiumViewer (takes a Stream)
document.Save(stream)
// IronPDF (takes a path)
pdf.SaveAs(path)
' 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");
// 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");
Imports PdfiumViewer
' PdfiumViewer: explicit disposal of document and the rendered Image
Using document = PdfDocument.Load(path)
Using bitmap = document.Render(0, 1024, 768, 96, 96, PdfRenderFlags.None)
bitmap.Save("output.png")
End Using
End Using
' IronPDF: Simplified
Dim 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
// 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
| Feature | PDFium .NET wrappers | IronPDF |
|---|---|---|
| Load PDF | Yes | Yes |
| Render to Image | Yes | Yes |
| Extract Text | Yes (basic, per-page) | Yes (logical / visual order) |
| Page Info | Yes | Yes |
| Create from HTML | None | Yes |
| Create from URL | None | Yes |
| Merge PDFs | Free wrappers: no; Patagames: partial | Yes |
| Split PDFs | Free wrappers: no; Patagames: partial | Yes |
| Add Watermarks | Not built-in | Yes |
| Headers/Footers | Not built-in | Yes |
| Form Filling | Free wrappers: no; Patagames: yes | Yes |
| Digital Signatures | Free wrappers: no; Patagames: yes | Yes |
| Password Protection | Free wrappers: no; Patagames: yes | Yes |
| Native Dependencies | Required | Bundled / NuGet-managed |
| Cross-Platform | Complex (per-RID native binaries) | Automatic |
| Memory Management | Manual disposal | Simplified |
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, orPdfium.Net.SDK - Delete native
pdfium.dll/.so/.dylibbinaries fromx86/,x64/,runtimes/folders - Remove platform-specific conditional compilation
- Update .csproj to remove native binary references
- Install
IronPdfNuGet package:dotnet add package IronPdf
Code Changes
- Add license key configuration at startup
- Replace
PdfDocument.Load()withPdfDocument.FromFile() - Replace
document.Save()withpdf.SaveAs() - Replace
document.GetPdfText(i)loops withpdf.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

