푸터 콘텐츠로 바로가기
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

Issue Impact IronPDF Solution
Windows-only Cannot deploy to Linux, Docker, Azure Functions Full cross-platform support
Outdated rendering engine Modern CSS fails, layouts break Up-to-date Chromium
5-page free version limit Aggressive watermarking after 5 pages Generous trial
No .NET 10 support Future-proofing problems Full .NET 10 support
Cloud deployment blocked Can't use AWS Lambda, Azure Functions Cloud-native

SelectPdf vs IronPDF Comparison

Feature SelectPdf IronPDF
Platform Support Windows Only Full cross-platform, 10+ distros
Modern Web Standards Support Limited (Outdated Blink) Full CSS3, modern Chromium
Maximum Free Version Page Limit 5 pages Flexible, no hard limit
Pricing Starts at $499 Transparent and flexible pricing
.NET 10 Support None Supported
Deployment in Cloud Environments Not Supported Fully supported
CSS Grid Limited Supported
Flexbox Limited Supported
CSS Variables Not supported Supported
Docker NOT SUPPORTED Official images
Azure Functions NOT SUPPORTED Supported
AWS Lambda NOT SUPPORTED Supported

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

SelectPdf IronPDF Notes
HtmlToPdf ChromePdfRenderer Core 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 needed IronPDF handles cleanup
converter.Options.PdfPageSize renderer.RenderingOptions.PaperSize Paper size
converter.Options.PdfPageOrientation renderer.RenderingOptions.PaperOrientation Orientation
converter.Options.MarginTop renderer.RenderingOptions.MarginTop Top margin
converter.Options.MarginBottom renderer.RenderingOptions.MarginBottom Bottom margin
converter.Options.MarginLeft renderer.RenderingOptions.MarginLeft Left margin
converter.Options.MarginRight renderer.RenderingOptions.MarginRight Right margin
PdfPageSize.A4 PdfPaperSize.A4 A4 size enum
PdfPageOrientation.Portrait PdfPaperOrientation.Portrait Portrait enum
PdfPageOrientation.Landscape PdfPaperOrientation.Landscape Landscape 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

| Platform | SelectPdf | IronPDF | | ---------- | :---: | :---: || 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 Feature SelectPdf IronPDF
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)

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.