Skip to footer content
MIGRATION GUIDES

How to Migrate from SelectPdf to IronPDF in C#

Migrating from SelectPdf to IronPDF transforms your PDF generation workflow from a Windows-only solution with an outdated rendering engine to a modern, cross-platform library with full CSS3 and JavaScript support. This guide provides a complete, step-by-step migration path that enables deployment to Linux, Docker, Azure Functions, and other cloud platforms that SelectPdf cannot support.

Why Migrate from SelectPdf to IronPDF

Understanding SelectPdf

SelectPdf is a commercial library designed to convert HTML content into PDFs using C#. The library is tailored towards developers who require seamless integration of PDF generation functionality within their applications. The strength of SelectPdf lies in its simple API, making it an appealing option for those new to PDF generation.

However, potential users must be aware of its critical limitations. Despite advertising cross-platform capability, SelectPdf only functions on Windows environments. This presents a substantial barrier when considering cloud-based deployment solutions, such as Azure Functions or containers like Docker. Furthermore, its free version is significantly limited, allowing only up to five pages before applying aggressive watermarking. SelectPdf leverages an outdated Blink fork and WebKit-based architecture, which causes compatibility issues with modern web technologies like CSS Grid and advanced flexbox.

Critical Limitations of SelectPdf

IssueImpactIronPDF Solution
Windows-onlyCannot deploy to Linux, Docker, Azure FunctionsFull cross-platform support
Outdated rendering engineModern CSS fails, layouts breakUp-to-date Chromium
5-page free version limitAggressive watermarking after 5 pagesGenerous trial
No .NET 10 supportFuture-proofing problemsFull .NET 10 support
Cloud deployment blockedCan't use AWS Lambda, Azure FunctionsCloud-native

SelectPdf vs IronPDF Comparison

FeatureSelectPdfIronPDF
Platform SupportWindows OnlyFull cross-platform, 10+ distros
Modern Web Standards SupportLimited (Outdated Blink)Full CSS3, modern Chromium
Maximum Free Version Page Limit5 pagesFlexible, no hard limit
PricingStarts at $499Transparent and flexible pricing
.NET 10 SupportNoneFull support
Deployment in Cloud EnvironmentsNot SupportedFully supported
CSS GridLimitedFull support
FlexboxLimitedFull support
CSS VariablesNot supportedFull support
DockerNOT SUPPORTEDOfficial images
Azure FunctionsNOT SUPPORTEDFull support
AWS LambdaNOT SUPPORTEDFull support

For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, SelectPdf explicitly does not support .NET 10, creating future-proofing problems. IronPDF provides full support for all modern .NET versions.


Before You Start

Prerequisites

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

NuGet Package Changes

# Remove SelectPdf
dotnet remove package Select.HtmlToPdf

# Install IronPDF
dotnet add package IronPdf
# Remove SelectPdf
dotnet remove package Select.HtmlToPdf

# Install IronPDF
dotnet add package IronPdf
SHELL

License Configuration

// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
$vbLabelText   $csharpLabel

Complete API Reference

Namespace Changes

// Before: SelectPdf
using SelectPdf;

// After: IronPDF
using IronPdf;
using IronPdf.Engines.Chrome;
// Before: SelectPdf
using SelectPdf;

// After: IronPDF
using IronPdf;
using IronPdf.Engines.Chrome;
$vbLabelText   $csharpLabel

Core API Mappings

SelectPdfIronPDFNotes
HtmlToPdfChromePdfRendererCore converter class
converter.ConvertHtmlString(html)renderer.RenderHtmlAsPdf(html)HTML string conversion
converter.ConvertUrl(url)renderer.RenderUrlAsPdf(url)URL conversion
doc.Save(path)pdf.SaveAs(path)Save to file
doc.Close()Not neededIronPDF handles cleanup
converter.Options.PdfPageSizerenderer.RenderingOptions.PaperSizePaper size
converter.Options.PdfPageOrientationrenderer.RenderingOptions.PaperOrientationOrientation
converter.Options.MarginToprenderer.RenderingOptions.MarginTopTop margin
converter.Options.MarginBottomrenderer.RenderingOptions.MarginBottomBottom margin
converter.Options.MarginLeftrenderer.RenderingOptions.MarginLeftLeft margin
converter.Options.MarginRightrenderer.RenderingOptions.MarginRightRight margin
PdfPageSize.A4PdfPaperSize.A4A4 size enum
PdfPageOrientation.PortraitPdfPaperOrientation.PortraitPortrait enum
PdfPageOrientation.LandscapePdfPaperOrientation.LandscapeLandscape enum
{page_number}{page}Page number placeholder
{total_pages}{total-pages}Total pages placeholder

Code Migration Examples

Example 1: HTML String to PDF Conversion

Before (SelectPdf):

// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";

        HtmlToPdf converter = new HtmlToPdf();
        PdfDocument doc = converter.ConvertHtmlString(htmlContent);
        doc.Save("document.pdf");
        doc.Close();

        Console.WriteLine("PDF generated from HTML string");
    }
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        string htmlContent = "<html><body><h1>Hello World</h1><p>This is a PDF document.</p></body></html>";

        HtmlToPdf converter = new HtmlToPdf();
        PdfDocument doc = converter.ConvertHtmlString(htmlContent);
        doc.Save("document.pdf");
        doc.Close();

        Console.WriteLine("PDF generated from HTML string");
    }
}
$vbLabelText   $csharpLabel

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");

        Console.WriteLine("PDF generated from HTML string");
    }
}
// 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");

        Console.WriteLine("PDF generated from HTML string");
    }
}
$vbLabelText   $csharpLabel

This example demonstrates the core API differences. SelectPdf uses HtmlToPdf as the converter class, calling ConvertHtmlString() to create a PdfDocument, then Save() and Close() to persist and clean up.

IronPDF uses ChromePdfRenderer with RenderHtmlAsPdf(), returning a PdfDocument that's saved with SaveAs(). The Close() call is eliminated—IronPDF handles resource management automatically. See the HTML to PDF documentation for comprehensive examples.

Example 2: URL to PDF Conversion

Before (SelectPdf):

// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        HtmlToPdf converter = new HtmlToPdf();
        PdfDocument doc = converter.ConvertUrl("https://www.example.com");
        doc.Save("output.pdf");
        doc.Close();

        Console.WriteLine("PDF created successfully");
    }
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        HtmlToPdf converter = new HtmlToPdf();
        PdfDocument doc = converter.ConvertUrl("https://www.example.com");
        doc.Save("output.pdf");
        doc.Close();

        Console.WriteLine("PDF created successfully");
    }
}
$vbLabelText   $csharpLabel

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");

        Console.WriteLine("PDF created successfully");
    }
}
// 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");

        Console.WriteLine("PDF created successfully");
    }
}
$vbLabelText   $csharpLabel

SelectPdf's ConvertUrl() method maps directly to IronPDF's RenderUrlAsPdf(). The critical difference is in the rendering engine: SelectPdf uses an outdated Blink/WebKit fork that struggles with modern CSS, while IronPDF uses the latest stable Chromium for full CSS3 and JavaScript support. Learn more in our tutorials.

Example 3: Custom Page Settings and Margins

Before (SelectPdf):

// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        HtmlToPdf converter = new HtmlToPdf();

        converter.Options.PdfPageSize = PdfPageSize.A4;
        converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
        converter.Options.MarginTop = 20;
        converter.Options.MarginBottom = 20;
        converter.Options.MarginLeft = 20;
        converter.Options.MarginRight = 20;

        string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
        PdfDocument doc = converter.ConvertHtmlString(html);
        doc.Save("custom-settings.pdf");
        doc.Close();

        Console.WriteLine("PDF with custom settings created");
    }
}
// NuGet: Install-Package Select.HtmlToPdf
using SelectPdf;
using System;

class Program
{
    static void Main()
    {
        HtmlToPdf converter = new HtmlToPdf();

        converter.Options.PdfPageSize = PdfPageSize.A4;
        converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
        converter.Options.MarginTop = 20;
        converter.Options.MarginBottom = 20;
        converter.Options.MarginLeft = 20;
        converter.Options.MarginRight = 20;

        string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
        PdfDocument doc = converter.ConvertHtmlString(html);
        doc.Save("custom-settings.pdf");
        doc.Close();

        Console.WriteLine("PDF with custom settings created");
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Engines.Chrome;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();

        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait;
        renderer.RenderingOptions.MarginTop = 20;
        renderer.RenderingOptions.MarginBottom = 20;
        renderer.RenderingOptions.MarginLeft = 20;
        renderer.RenderingOptions.MarginRight = 20;

        string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("custom-settings.pdf");

        Console.WriteLine("PDF with custom settings created");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Engines.Chrome;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();

        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Portrait;
        renderer.RenderingOptions.MarginTop = 20;
        renderer.RenderingOptions.MarginBottom = 20;
        renderer.RenderingOptions.MarginLeft = 20;
        renderer.RenderingOptions.MarginRight = 20;

        string html = "<html><body><h1>Custom Page Settings</h1></body></html>";
        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("custom-settings.pdf");

        Console.WriteLine("PDF with custom settings created");
    }
}
$vbLabelText   $csharpLabel

The page settings pattern is nearly identical, with straightforward property name changes:

  • converter.Options.PdfPageSizerenderer.RenderingOptions.PaperSize
  • converter.Options.PdfPageOrientationrenderer.RenderingOptions.PaperOrientation
  • PdfPageSize.A4PdfPaperSize.A4
  • PdfPageOrientation.PortraitPdfPaperOrientation.Portrait

Margin properties maintain the same names and units.


The Windows-Only Problem

SelectPdf's Platform Limitation

Despite any marketing claims, SelectPdf explicitly does not support:

  • Linux (any distribution)
  • macOS
  • Docker containers
  • Azure Functions
  • AWS Lambda
  • Google Cloud Functions
  • Any ARM-based systems

This is a fundamental architectural limitation—SelectPdf depends on Windows-specific libraries and cannot be ported.

Platform Support Comparison

PlatformSelectPdfIronPDF
Windows Server 2019+
Windows 10/11
Ubuntu 20.04+
Debian 10+
CentOS 7+
Alpine Linux
Amazon Linux 2
macOS 10.15+
Azure App Service (Linux)
Azure Functions
AWS Lambda
Docker (Linux)
Kubernetes

The Outdated Rendering Engine

CSS Feature Support Comparison

SelectPdf uses an outdated Blink/WebKit fork that hasn't kept pace with modern web standards:

CSS FeatureSelectPdfIronPDF
CSS Grid⚠️ Partial/broken✅ Full
Flexbox (basic)
Flexbox (gap property)
CSS Variables
CSS calc()⚠️ Limited
@media print⚠️ Limited
@font-face⚠️ Limited
Web Fonts⚠️ Limited
SVG⚠️ Basic✅ Full
CSS Transforms⚠️ Limited
CSS Animations

New Capabilities After Migration

After migrating to IronPDF, you gain capabilities that SelectPdf cannot provide:

Cross-Platform Deployment

// ✅ IronPDF - Works everywhere
using IronPdf;

// Azure App Service (Linux) - WORKS
// Docker container - WORKS
// AWS Lambda - WORKS
// GitHub Actions on ubuntu-latest - WORKS
// macOS development - WORKS

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello</h1>");
pdf.SaveAs("output.pdf");
// ✅ IronPDF - Works everywhere
using IronPdf;

// Azure App Service (Linux) - WORKS
// Docker container - WORKS
// AWS Lambda - WORKS
// GitHub Actions on ubuntu-latest - WORKS
// macOS development - WORKS

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello</h1>");
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

Modern CSS Support

// ✅ IronPDF - Uses latest stable Chromium
var renderer = new ChromePdfRenderer();

var html = @"
<style>
    :root { --primary: #007bff; --gap: 20px; }
    .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
</style>
<div class='grid'>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 1</div>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 2</div>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 3</div>
</div>";

var pdf = renderer.RenderHtmlAsPdf(html);
// All modern CSS features render correctly!
// ✅ IronPDF - Uses latest stable Chromium
var renderer = new ChromePdfRenderer();

var html = @"
<style>
    :root { --primary: #007bff; --gap: 20px; }
    .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
</style>
<div class='grid'>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 1</div>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 2</div>
    <div style='background: var(--primary); color: white; padding: 1rem;'>Item 3</div>
</div>";

var pdf = renderer.RenderHtmlAsPdf(html);
// All modern CSS features render correctly!
$vbLabelText   $csharpLabel

No Close() Required

IronPDF handles resource management automatically:

// Option 1: Let garbage collection handle it
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
// No Close() needed

// Option 2: Explicit disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
    pdf.SaveAs("output.pdf");
}
// Option 1: Let garbage collection handle it
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
// No Close() needed

// Option 2: Explicit disposal
using (var pdf = renderer.RenderHtmlAsPdf(html))
{
    pdf.SaveAs("output.pdf");
}
$vbLabelText   $csharpLabel

Migration Checklist

Pre-Migration

  • Audit all SelectPdf usages in codebase
  • Document current converter options for mapping
  • Identify header/footer implementations
  • Check page number placeholder syntax ({page_number}{page})
  • Note base URL handling patterns
  • Verify target deployment platforms
  • Obtain IronPDF license key from ironpdf.com

Code Updates

  • Remove Select.HtmlToPdf NuGet package
  • Install IronPdf NuGet package
  • Update namespace imports (using SelectPdf;using IronPdf;)
  • Replace HtmlToPdf with ChromePdfRenderer
  • Replace ConvertHtmlString() with RenderHtmlAsPdf()
  • Replace ConvertUrl() with RenderUrlAsPdf()
  • Update option property names (Options.PdfPageSizeRenderingOptions.PaperSize)
  • Convert PdfPageSize to PdfPaperSize
  • Convert PdfPageOrientation to PdfPaperOrientation
  • Replace doc.Save() with pdf.SaveAs()
  • Remove all doc.Close() calls
  • Fix page number placeholders ({page_number}{page}, {total_pages}{total-pages})
  • Add license initialization at application startup

Post-Migration

  • Run all unit tests
  • Verify CSS rendering (especially Grid/Flexbox)
  • Test JavaScript execution
  • Verify header/footer page numbers
  • Test on target platforms (Linux, Docker, etc.)
  • Performance test
  • Compare PDF output quality
  • Update CI/CD pipelines
  • Test cloud deployments (if applicable)

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