How to Migrate from PDFView4NET to IronPDF in C#
Migrating from PDFView4NET to IronPDF transforms your PDF workflow from a UI-focused viewing component to a comprehensive PDF generation and manipulation library. This guide provides a complete, step-by-step migration path that enables server-side processing, web application support, and full PDF lifecycle management capabilities that PDFView4NET cannot provide.
Why Migrate from PDFView4NET to IronPDF
Understanding PDFView4NET
PDFView4NET is a popular choice for developers focusing primarily on PDF viewing features in C#. PDFView4NET provides robust PDF viewing controls tailored for Windows Forms (WinForms) and Windows Presentation Foundation (WPF) applications. The library's emphasis on providing a seamless PDF viewing experience makes it a go-to option for desktop application development.
Despite its strengths, PDFView4NET has limitations that may prompt developers to explore more comprehensive libraries like IronPDF, which offers an all-in-one PDF solution encompassing creation, viewing, and manipulation capabilities without being constrained to specific UI components.
The View-Only Limitation
PDFView4NET is primarily a UI viewing component for WinForms and WPF applications. It focuses on displaying PDFs rather than creating or manipulating them. Key reasons to migrate:
View-Only Limitations: PDFView4NET is designed for viewing, not PDF creation.
UI Framework Dependency: Requires WinForms or WPF context. The requirement for WinForms or WPF environments can restrict usage in other contexts, such as console applications or web services, which are unsupported by PDFView4NET.
No HTML to PDF: Cannot convert HTML or URLs to PDF. The library strictly focuses on viewing, with no built-in capabilities for creating or manipulating PDF files.
Limited Manipulation: Basic editing compared to IronPDF's full feature set.
No Server-Side Support: Cannot run in web services or Azure Functions.
- Legacy Technology: Less active development and modern feature updates.
PDFView4NET vs IronPDF Comparison
| Feature | PDFView4NET | IronPDF |
|---|---|---|
| Primary Focus | PDF Viewing | Complete PDF Solution (Create, View, Edit) |
| UI Frameworks Required | WinForms, WPF | None |
| PDF Creation | No | Yes |
| PDF Manipulation | Limited (Annotations) | Yes |
| Server-Side | Not Supported | Full Support |
| Web Applications | No | Yes |
| Console Apps | Limited | Full Support |
| Azure/Docker | No | Yes |
| HTML to PDF | No | Yes |
| Cross-Platform Context | No | Yes |
| Ease of Integration | Medium | High |
IronPDF sets itself apart with its versatility and comprehensive feature set, making it particularly appealing for developers needing a holistic approach to PDF handling in C#. The library supports PDF creation, viewing, editing, and more, addressing use cases that extend far beyond the viewing capabilities of PDFView4NET.
For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF provides context independence—it can be used across different contexts, including web applications, services, and console applications. This flexibility is crucial for projects requiring cross-platform support and diverse deployment scenarios.
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 PDFView4NET -->
<PackageReference Include="O2S.Components.PDFView4NET" Version="*" Remove />
<!-- Add IronPDF -->
<PackageReference Include="IronPdf" Version="2024.*" /><!-- Remove PDFView4NET -->
<PackageReference Include="O2S.Components.PDFView4NET" Version="*" Remove />
<!-- Add IronPDF -->
<PackageReference Include="IronPdf" Version="2024.*" />Or via CLI:
dotnet remove package O2S.Components.PDFView4NET
dotnet add package IronPdfdotnet remove package O2S.Components.PDFView4NET
dotnet add package IronPdfLicense Configuration
// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";Complete API Reference
Namespace Changes
// Before: PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using O2S.Components.PDFView4NET.Printing;
// After: IronPDF
using IronPdf;// Before: PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using O2S.Components.PDFView4NET.Printing;
// After: IronPDF
using IronPdf;Core API Mappings
| PDFView4NET | IronPDF | Notes |
|---|---|---|
PDFFile.Open(path) | PdfDocument.FromFile(path) | Load PDF |
PDFFile.Open(stream) | PdfDocument.FromStream(stream) | Load from stream |
pdfFile.GetPage(index) | pdf.Pages[index] | Access page |
pdfFile.PageCount | pdf.PageCount | Page count |
PDFPrintDocument | pdf.Print() | Print PDF |
pdfFile.Close() | pdf.Dispose() | Cleanup |
HtmlToPdfConverter | ChromePdfRenderer | HTML to PDF |
| N/A | PdfDocument.Merge() | Merge PDFs |
| N/A | pdf.ApplyWatermark() | Add watermark |
| N/A | pdf.SecuritySettings | Password protection |
Code Migration Examples
Example 1: URL to PDF Conversion
Before (PDFView4NET):
// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdfConverter converter = new HtmlToPdfConverter();
converter.NavigateUri = new Uri("https://example.com");
converter.ConvertHtmlToPdf();
converter.SavePdf("output.pdf");
}
}// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using System;
class Program
{
static void Main()
{
HtmlToPdfConverter converter = new HtmlToPdfConverter();
converter.NavigateUri = new Uri("https://example.com");
converter.ConvertHtmlToPdf();
converter.SavePdf("output.pdf");
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("output.pdf");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("output.pdf");
}
}PDFView4NET uses HtmlToPdfConverter with NavigateUri property set to a Uri object, followed by calling ConvertHtmlToPdf() and then SavePdf(). IronPDF simplifies this to a single ChromePdfRenderer with RenderUrlAsPdf() that accepts a string URL directly, returning a PdfDocument that you save with SaveAs(). IronPDF's approach offers cleaner syntax and better integration with modern .NET applications. See the HTML to PDF documentation for comprehensive examples.
Example 2: HTML String to PDF Conversion
Before (PDFView4NET):
// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
HtmlToPdfConverter converter = new HtmlToPdfConverter();
converter.HtmlContent = htmlContent;
converter.ConvertHtmlToPdf();
converter.SavePdf("document.pdf");
}
}// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using O2S.Components.PDFView4NET.HtmlToPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
HtmlToPdfConverter converter = new HtmlToPdfConverter();
converter.HtmlContent = htmlContent;
converter.ConvertHtmlToPdf();
converter.SavePdf("document.pdf");
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("document.pdf");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("document.pdf");
}
}PDFView4NET uses the HtmlContent property to set the HTML string, then requires calling ConvertHtmlToPdf() followed by SavePdf(). IronPDF provides a more fluent API where RenderHtmlAsPdf() accepts the HTML string directly and returns a PdfDocument. The method names are more intuitive: RenderHtmlAsPdf vs ConvertHtmlToPdf. Learn more in our tutorials.
Example 3: Text Extraction from PDF
Before (PDFView4NET):
// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using System;
using System.IO;
class Program
{
static void Main()
{
using (FileStream fs = File.OpenRead("document.pdf"))
{
PDFDocument document = new PDFDocument(fs);
string text = "";
for (int i = 0; i < document.Pages.Count; i++)
{
text += document.Pages[i].ExtractText();
}
Console.WriteLine(text);
}
}
}// NuGet: Install-Package O2S.Components.PDFView4NET
using O2S.Components.PDFView4NET;
using System;
using System.IO;
class Program
{
static void Main()
{
using (FileStream fs = File.OpenRead("document.pdf"))
{
PDFDocument document = new PDFDocument(fs);
string text = "";
for (int i = 0; i < document.Pages.Count; i++)
{
text += document.Pages[i].ExtractText();
}
Console.WriteLine(text);
}
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}This example highlights a significant API difference. PDFView4NET requires manually creating a FileStream, instantiating PDFDocument with the stream, then looping through document.Pages.Count and concatenating Pages[i].ExtractText() for each page.
IronPDF simplifies this dramatically: PdfDocument.FromFile() loads the PDF directly from a path, and ExtractAllText() extracts text from all pages in a single method call. No manual stream management, no loops, no string concatenation—just two lines of code.
Critical Migration Notes
Converter Class Change
PDFView4NET uses HtmlToPdfConverter; IronPDF uses ChromePdfRenderer:
// PDFView4NET
HtmlToPdfConverter converter = new HtmlToPdfConverter();
// IronPDF
var renderer = new ChromePdfRenderer();// PDFView4NET
HtmlToPdfConverter converter = new HtmlToPdfConverter();
// IronPDF
var renderer = new ChromePdfRenderer();Property-Based vs Method-Based API
PDFView4NET sets properties before conversion:
// PDFView4NET: Set properties, then convert
converter.HtmlContent = htmlContent;
converter.NavigateUri = new Uri(url);
converter.ConvertHtmlToPdf();
converter.SavePdf("output.pdf");
// IronPDF: Method parameters with fluent API
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("output.pdf");// PDFView4NET: Set properties, then convert
converter.HtmlContent = htmlContent;
converter.NavigateUri = new Uri(url);
converter.ConvertHtmlToPdf();
converter.SavePdf("output.pdf");
// IronPDF: Method parameters with fluent API
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("output.pdf");Document Loading Change
// PDFView4NET: Requires FileStream
using (FileStream fs = File.OpenRead("document.pdf"))
{
PDFDocument document = new PDFDocument(fs);
}
// IronPDF: Direct file path
var pdf = PdfDocument.FromFile("document.pdf");// PDFView4NET: Requires FileStream
using (FileStream fs = File.OpenRead("document.pdf"))
{
PDFDocument document = new PDFDocument(fs);
}
// IronPDF: Direct file path
var pdf = PdfDocument.FromFile("document.pdf");Page Access Change
// PDFView4NET: document.Pages.Count and Pages[i]
for (int i = 0; i < document.Pages.Count; i++)
{
document.Pages[i].ExtractText();
}
// IronPDF: pdf.PageCount and Pages[i] or ExtractAllText()
string text = pdf.ExtractAllText();
// Or per-page: pdf.ExtractTextFromPage(0);// PDFView4NET: document.Pages.Count and Pages[i]
for (int i = 0; i < document.Pages.Count; i++)
{
document.Pages[i].ExtractText();
}
// IronPDF: pdf.PageCount and Pages[i] or ExtractAllText()
string text = pdf.ExtractAllText();
// Or per-page: pdf.ExtractTextFromPage(0);Save Method Change
// PDFView4NET: SavePdf()
converter.SavePdf("output.pdf");
// IronPDF: SaveAs()
pdf.SaveAs("output.pdf");// PDFView4NET: SavePdf()
converter.SavePdf("output.pdf");
// IronPDF: SaveAs()
pdf.SaveAs("output.pdf");New Capabilities After Migration
After migrating to IronPDF, you gain capabilities that PDFView4NET cannot provide:
PDF Merging
var pdf1 = PdfDocument.FromFile("chapter1.pdf");
var pdf2 = PdfDocument.FromFile("chapter2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("complete_book.pdf");var pdf1 = PdfDocument.FromFile("chapter1.pdf");
var pdf2 = PdfDocument.FromFile("chapter2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("complete_book.pdf");Watermarks with HTML
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark(@"
<div style='
font-size: 72pt;
color: rgba(255, 0, 0, 0.2);
transform: rotate(-45deg);
'>
CONFIDENTIAL
</div>");
pdf.SaveAs("watermarked.pdf");var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark(@"
<div style='
font-size: 72pt;
color: rgba(255, 0, 0, 0.2);
transform: rotate(-45deg);
'>
CONFIDENTIAL
</div>");
pdf.SaveAs("watermarked.pdf");Password Protection
var pdf = PdfDocument.FromFile("document.pdf");
pdf.SecuritySettings.OwnerPassword = "owner123";
pdf.SecuritySettings.UserPassword = "user456";
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SaveAs("protected.pdf");var pdf = PdfDocument.FromFile("document.pdf");
pdf.SecuritySettings.OwnerPassword = "owner123";
pdf.SecuritySettings.UserPassword = "user456";
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SaveAs("protected.pdf");Form Filling
var pdf = PdfDocument.FromFile("form.pdf");
pdf.Form.GetFieldByName("FirstName").Value = "John";
pdf.Form.GetFieldByName("LastName").Value = "Doe";
pdf.SaveAs("filled_form.pdf");var pdf = PdfDocument.FromFile("form.pdf");
pdf.Form.GetFieldByName("FirstName").Value = "John";
pdf.Form.GetFieldByName("LastName").Value = "Doe";
pdf.SaveAs("filled_form.pdf");Server-Side Processing
PDFView4NET cannot run in server environments. IronPDF excels here:
// ASP.NET Core
[HttpGet]
public IActionResult GeneratePdf()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(GetReportHtml());
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}// ASP.NET Core
[HttpGet]
public IActionResult GeneratePdf()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(GetReportHtml());
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}Feature Comparison Summary
| Feature | PDFView4NET | IronPDF |
|---|---|---|
| View PDFs | Yes (UI) | No (use viewer) |
| Load PDFs | Yes | Yes |
| Save PDFs | Limited | Yes |
| HTML to PDF | No | Yes |
| URL to PDF | No | Yes |
| Merge PDFs | No | Yes |
| Split PDFs | Limited | Yes |
| Watermarks | No | Yes |
| Headers/Footers | No | Yes |
| Password Protection | No | Yes |
| Digital Signatures | No | Yes |
| Text Extraction | Limited | Yes |
| Fill Forms | Limited | Yes |
| WinForms | Yes | Yes |
| WPF | Yes | Yes |
| Console | Limited | Yes |
| ASP.NET | No | Yes |
| Azure | No | Yes |
| Docker | No | Yes |
Migration Checklist
Pre-Migration
- Identify viewing requirements (determine if IronPDF's capabilities can replace UI-based PDF viewing)
- Document printing workflows
- List PDF manipulation needs
- Plan viewer replacement if needed (IronPDF focuses on generation/manipulation)
- Obtain IronPDF license key from ironpdf.com
Package Changes
- Remove
O2S.Components.PDFView4NETNuGet package - Install
IronPdfNuGet package:dotnet add package IronPdf
Code Changes
- Update namespace imports (
using O2S.Components.PDFView4NET;→using IronPdf;) - Replace
HtmlToPdfConverterwithChromePdfRenderer - Replace
converter.HtmlContent+ConvertHtmlToPdf()withrenderer.RenderHtmlAsPdf(html) - Replace
converter.NavigateUri+ConvertHtmlToPdf()withrenderer.RenderUrlAsPdf(url) - Replace
converter.SavePdf()withpdf.SaveAs() - Replace
PDFDocument(stream)withPdfDocument.FromFile(path) - Replace manual page loop extraction with
pdf.ExtractAllText() - Add license initialization at application startup
Post-Migration
- Test PDF loading and saving
- Verify text extraction functionality
- Test HTML to PDF conversion
- Verify server deployment works (new capability)
- Test cross-platform if needed (new capability)
- Remove UI-specific PDF code if server-only






