IRONSOFTWAREHOME
MIGRATION GUIDES

How to Migrate from DinkToPdf to IronPDF in C#

Curtis Chau
Curtis Chau
Updated: August 1, 2026

DinkToPdf wraps wkhtmltopdf, inheriting all its security vulnerabilities and technical limitations. Understanding these issues is critical for evaluating migration urgency.

Critical Security Issues

DinkToPdf inherits unpatched security advisories from wkhtmltopdf:

  1. CVE-2022-35583 (SSRF): A Server-Side Request Forgery advisory against wkhtmltopdf 0.12.6 (CVSS 9.8 in NVD; disputed by the upstream project as an application-side input-sanitization issue rather than a library bug). Either way, it will not be patched.
  2. Archived Project: The wkhtmltopdf/wkhtmltopdf repository was archived on January 2, 2023, and the entire wkhtmltopdf GitHub organization was archived on July 10, 2024.
  3. No Future Security Patches: Any known or future vulnerabilities will not be fixed upstream.

Technical Problems

IssueImpact
Thread SafetyBasicConverter is single-threaded only; SynchronizedConverter serializes calls and can still hit native-side crashes under load
Native BinariesComplex deployment with platform-specific libwkhtmltox binaries
CSS LimitationsOlder QtWebKit fork - no modern Flexbox/Grid layout support
JavaScriptInconsistent execution, timeouts
RenderingOutdated QtWebKit-based engine (wkhtmltopdf 0.12.6, last release June 2020)
MaintenanceDinkToPdf 1.0.8 last released April 18, 2017 on NuGet

Architecture Comparison

AspectDinkToPdfIronPDF
SecurityCVE-2022-35583 (SSRF), unpatched / disputed upstreamNo known critical CVEs
Rendering EngineOlder QtWebKit fork (wkhtmltopdf 0.12.6)Modern Chromium
Thread SafetySynchronizedConverter serializes calls; native-side crashes reported under loadThread-safe by design
Native DependenciesPlatform-specific libwkhtmltox binariesManaged NuGet package
CSS SupportNo modern Flexbox/GridFull CSS3
JavaScriptLimited, inconsistentSupported
MaintenanceDinkToPdf last release April 2017; wkhtmltopdf org archived July 2024Actively maintained

Feature Comparison

FeatureDinkToPdfIronPDF
HTML to PDF✅ (outdated engine)✅ (Chromium)
URL to PDF
Custom margins
Headers/Footers✅ (limited)✅ (full HTML)
CSS3❌ Limited✅ Full
Flexbox/Grid
JavaScript⚠ Limited✅ Full
PDF manipulation
Form filling
Digital signatures
Encryption
Watermarks
Merge/Split

Pre-Migration Preparation

Prerequisites

Ensure your environment meets these requirements:

  • .NET Framework 4.6.2+, .NET Core 3.1+, or .NET 5/6/7/8/9/10
  • Visual Studio 2019+ or VS Code with C# extension
  • NuGet Package Manager access
  • IronPDF license key (free trial available at ironpdf.com)

Audit DinkToPdf Usage

Run these commands in your solution directory to identify all DinkToPdf references:

# Find all DinkToPdf usages in your codebase
grep -r "using DinkToPdf" --include="*.cs" .
grep -r "SynchronizedConverter\|HtmlToPdfDocument\|ObjectSettings" --include="*.cs" .

# Find NuGet package references
grep -r "DinkToPdf" --include="*.csproj" .

# Find wkhtmltopdf binaries
find . -name "libwkhtmltox*"
SHELL

Breaking Changes to Anticipate

ChangeDinkToPdfIronPDFImpact
ConverterSynchronizedConverter(new PdfTools())ChromePdfRendererSimpler instantiation
DocumentHtmlToPdfDocumentDirect method callNo document object
SettingsGlobalSettings + ObjectSettingsRenderingOptionsSingle options object
Return typebyte[]PdfDocumentMore powerful object
Binarylibwkhtmltox.dll/soNone (managed)Remove native files
Thread safetyBasicConverter single-threaded; SynchronizedConverter serializesThread-safe by defaultSimpler code
DISingleton requiredAny lifetimeFlexible

Step-by-Step Migration Process

Step 1: Update NuGet Packages

Remove DinkToPdf and install IronPDF:

# Remove DinkToPdf
dotnet remove package DinkToPdf

# Install IronPDF
dotnet add package IronPdf
SHELL

Step 2: Remove Native Binaries

Delete these platform-specific files from your project:

  • libwkhtmltox.dll (Windows)
  • libwkhtmltox.so (Linux)
  • libwkhtmltox.dylib (macOS)

IronPDF has no native dependencies - everything is managed code.

Step 3: Update Namespace References

Replace DinkToPdf namespaces with IronPDF:

// Remove these
using DinkToPdf;
using DinkToPdf.Contracts;

// Add this
using IronPdf;

Step 4: Configure License

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

Complete API Migration Reference

Core Class Mapping

DinkToPdfIronPDF
SynchronizedConverterChromePdfRenderer
BasicConverterChromePdfRenderer
PdfToolsNot needed
HtmlToPdfDocumentNot needed
GlobalSettingsRenderingOptions
ObjectSettingsRenderingOptions
MarginSettingsIndividual margin properties

GlobalSettings Mapping

DinkToPdf GlobalSettingsIronPDF Equivalent
ColorMode = ColorMode.ColorDefault (always color)
Orientation = Orientation.PortraitPaperOrientation = PdfPaperOrientation.Portrait
Orientation = Orientation.LandscapePaperOrientation = PdfPaperOrientation.Landscape
PaperSize = PaperKind.A4PaperSize = PdfPaperSize.A4
Margins = new MarginSettings()Individual margin properties

MarginSettings Mapping

DinkToPdf MarginsIronPDF Equivalent
Margins.Top = 10MarginTop = 10
Margins.Bottom = 10MarginBottom = 10
Margins.Left = 15MarginLeft = 15
Margins.Right = 15MarginRight = 15

Code Migration Examples

Basic HTML to PDF

The fundamental conversion demonstrates the dramatic simplification from DinkToPdf's verbose configuration to IronPDF's streamlined API.

DinkToPdf Implementation:

// NuGet: Install-Package DinkToPdf
using DinkToPdf;
using DinkToPdf.Contracts;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new SynchronizedConverter(new PdfTools());
        var doc = new HtmlToPdfDocument()
        {
            GlobalSettings = {
                ColorMode = ColorMode.Color,
                Orientation = Orientation.Portrait,
                PaperSize = PaperKind.A4,
            },
            Objects = {
                new ObjectSettings() {
                    HtmlContent = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>",
                    WebSettings = { DefaultEncoding = "utf-8" }
                }
            }
        };
        byte[] pdf = converter.Convert(doc);
        File.WriteAllBytes("output.pdf", pdf);
    }
}

IronPDF Implementation:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1><p>This is a PDF from HTML.</p>");
        pdf.SaveAs("output.pdf");
    }
}

IronPDF reduces a 20-line DinkToPdf configuration to 4 lines. No SynchronizedConverter, no PdfTools, no HtmlToPdfDocument, no ObjectSettings - just render and save. For more options, see the HTML to PDF documentation.

URL to PDF Conversion

DinkToPdf Implementation:

// NuGet: Install-Package DinkToPdf
using DinkToPdf;
using DinkToPdf.Contracts;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new SynchronizedConverter(new PdfTools());
        var doc = new HtmlToPdfDocument()
        {
            GlobalSettings = {
                ColorMode = ColorMode.Color,
                Orientation = Orientation.Portrait,
                PaperSize = PaperKind.A4,
            },
            Objects = {
                new ObjectSettings() {
                    Page = "https://www.example.com",
                }
            }
        };
        byte[] pdf = converter.Convert(doc);
        File.WriteAllBytes("webpage.pdf", pdf);
    }
}

IronPDF Implementation:

// 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("webpage.pdf");
    }
}

IronPDF's RenderUrlAsPdf replaces the nested ObjectSettings.Page configuration with a direct method call. For more options, see the URL to PDF documentation.

Custom Settings with Landscape and Margins

DinkToPdf Implementation:

// NuGet: Install-Package DinkToPdf
using DinkToPdf;
using DinkToPdf.Contracts;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new SynchronizedConverter(new PdfTools());
        var doc = new HtmlToPdfDocument()
        {
            GlobalSettings = {
                ColorMode = ColorMode.Color,
                Orientation = Orientation.Landscape,
                PaperSize = PaperKind.A4,
                Margins = new MarginSettings { Top = 10, Bottom = 10, Left = 15, Right = 15 }
            },
            Objects = {
                new ObjectSettings() {
                    HtmlContent = "<h1>Custom PDF</h1><p>Landscape orientation with custom margins.</p>",
                    WebSettings = { DefaultEncoding = "utf-8" }
                }
            }
        };
        byte[] pdf = converter.Convert(doc);
        File.WriteAllBytes("custom.pdf", pdf);
    }
}

IronPDF Implementation:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
        renderer.RenderingOptions.MarginTop = 10;
        renderer.RenderingOptions.MarginBottom = 10;
        renderer.RenderingOptions.MarginLeft = 15;
        renderer.RenderingOptions.MarginRight = 15;
        
        var pdf = renderer.RenderHtmlAsPdf("<h1>Custom PDF</h1><p>Landscape orientation with custom margins.</p>");
        pdf.SaveAs("custom.pdf");
    }
}

IronPDF's RenderingOptions replaces both GlobalSettings and MarginSettings with a unified, fluent API. For more configuration options, see the rendering options documentation.

Critical Migration Notes

Remove Native Binaries

The most important cleanup step is removing wkhtmltopdf native binaries. IronPDF has no native dependencies:

# Delete native binaries
rm libwkhtmltox.* 2>/dev/null
SHELL

No Singleton Required

DinkToPdf's documented guidance is to register SynchronizedConverter as a singleton. IronPDF's ChromePdfRenderer is thread-safe with any DI lifetime:

// DinkToPdf - typically registered as singleton
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

// IronPDF - any lifetime works
services.AddScoped<ChromePdfRenderer>();
// Or just create inline:
var renderer = new ChromePdfRenderer();

Richer Return Type

DinkToPdf returns byte[]. IronPDF returns PdfDocument with manipulation capabilities:

// DinkToPdf returns byte[]
byte[] pdf = converter.Convert(doc);
File.WriteAllBytes("output.pdf", pdf);
return File(pdf, "application/pdf");

// IronPDF returns PdfDocument
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
return File(pdf.BinaryData, "application/pdf");
C#

Full CSS3 Support

Modern layouts that fail in DinkToPdf work perfectly in IronPDF:

// DinkToPdf - doesn't work (wkhtmltopdf uses 2015 WebKit)
var html = "<div style='display: flex;'>...</div>";  // Broken!

// IronPDF - full support (modern Chromium)
var html = @"
    <div style='display: flex; justify-content: space-between;'>
        <div>Left</div>
        <div>Right</div>
    </div>";
var pdf = renderer.RenderHtmlAsPdf(html);  // Works!
C#

Post-Migration Checklist

After completing the code migration, verify the following:

  • Run all unit tests to verify PDF generation works correctly
  • Test multi-threaded scenarios (the SynchronizedConverter path serializes calls and was prone to native-side crashes under load)
  • Compare PDF output quality (IronPDF's Chromium renders better)
  • Verify CSS rendering (Flexbox/Grid now works)
  • Test JavaScript execution (reliable with IronPDF)
  • Update CI/CD pipelines to remove wkhtmltopdf installation
  • Verify security scan passes (no more CVE-2022-35583 flags)
  • Remove native binary deployment from Docker/deployment scripts

Additional Resources


Migrating from DinkToPdf to IronPDF retires the unpatched wkhtmltopdf attack surface (CVE-2022-35583), the serialized SynchronizedConverter concurrency model, native binary deployment, and the older QtWebKit rendering path. The transition to a modern Chromium engine delivers full CSS3 support, reliable JavaScript execution, and an actively maintained library.

Please note: DinkToPdf and wkhtmltopdf are registered trademarks of their respective owners. This site is not affiliated with, endorsed by, or sponsored by DinkToPdf or wkhtmltopdf. 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