IRONSOFTWAREHOME
MIGRATION GUIDES

Migrating from Haukcode.DinkToPdf to IronPDF

Curtis Chau
Curtis Chau
Updated: May 18, 2026

Haukcode.DinkToPdf is a community fork of the once-popular DinkToPdf library, which wraps the wkhtmltopdf binary to convert HTML to PDF for .NET applications. The fork was later renamed to Haukcode.WkHtmlToPdfDotNet, with the latest release 1.5.95 published October 22, 2024 under LGPL-3.0-or-later. While the fork has kept the package alive on NuGet after the original DinkToPdf (1.0.8, April 18, 2017) was abandoned, it still binds to the same archived wkhtmltopdf binary as its parent. The wkhtmltopdf/wkhtmltopdf repository was archived on January 2, 2023, and the entire wkhtmltopdf GitHub organization was archived on July 10, 2024, so upstream issues will not be patched.

This guide offers a migration path from Haukcode.DinkToPdf / Haukcode.WkHtmlToPdfDotNet to IronPDF, including step-by-step instructions, code comparisons, and practical examples for .NET developers looking to move off the archived wkhtmltopdf binary.

Security Advisory: CVE-2022-35583

Haukcode.DinkToPdf inherits a security advisory raised against its upstream wkhtmltopdf binary:

CVE-2022-35583 - SSRF advisory against wkhtmltopdf 0.12.6

A Server-Side Request Forgery advisory has been published against wkhtmltopdf 0.12.6 (CVSS 9.8 in NVD; disputed by the upstream wkhtmltopdf project, which views it as an application-side input-sanitization issue rather than a library bug). Either way, it will not be patched - upstream is archived. Typical exposure patterns flagged in public discussion include:

  • Attack Vector: Untrusted HTML content can cause the renderer to fetch internal resources during conversion
  • AWS Metadata: Requests to http://169.254.169.254 may return instance metadata if the renderer runs on EC2
  • Internal Network Access: Internal services may be reachable from the rendering host
  • Local File Inclusion: Local files may be readable via the file:// protocol

No upstream patch is expected - the wkhtmltopdf repository was archived January 2, 2023, with the last release (0.12.6) in June 2020.

IronPDF vs Haukcode.DinkToPdf: Feature Comparison

Understanding the architectural differences helps technical decision-makers evaluate the migration investment:

AspectHaukcode.DinkToPdfIronPDF
Underlying Enginewkhtmltopdf (QtWebKit fork, circa 2015)Modern Chromium
Security StatusCVE-2022-35583 advisory (unpatched / disputed upstream)No known critical CVEs
Project StatusCommunity fork; upstream wkhtmltopdf archivedActively maintained
HTML5/CSS3No modern Flexbox/GridFull CSS3
JavaScriptLimited, inconsistentFull support
Native Binarieslibwkhtmltox.dll/.so/.dylib per platformManaged NuGet package
Thread SafetySynchronizedConverter serializes callsThread-safe by design
SupportCommunityProfessional support
UpdatesFork last release 1.5.95 (Oct 22, 2024); upstream wkhtmltopdf 0.12.6 (Jun 2020)Regular releases
LicenseLGPL-3.0-or-later (fork) / MIT (original DinkToPdf)Commercial with free trial

Quick Start: Haukcode.DinkToPdf to IronPDF Migration

The migration can begin immediately with these foundational steps.

Step 1: Remove DinkToPdf and Native Binaries

Remove Haukcode.DinkToPdf NuGet packages:

# Remove NuGet packages
dotnet remove package DinkToPdf
dotnet remove package Haukcode.DinkToPdf
dotnet remove package Haukcode.WkHtmlToPdf-DotNet
SHELL

Delete native binaries from your project:

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

Step 2: Install IronPDF

# Install IronPDF
dotnet add package IronPdf
SHELL

Step 3: Update Namespaces

Replace DinkToPdf namespaces with IronPDF:

// Before (Haukcode.DinkToPdf)
using DinkToPdf;
using DinkToPdf.Contracts;

// After (IronPDF)
using IronPdf;
using IronPdf.Rendering;  // For RenderingOptions

Step 4: Initialize License

Add license initialization at application startup:

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

Code Migration Examples

Basic HTML to PDF Conversion

The most fundamental operation reveals the complexity difference between these .NET PDF libraries.

Haukcode.DinkToPdf Approach:

// 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 = "<html><body><h1>Hello World</h1></body></html>",
                }
            }
        };
        
        byte[] pdf = converter.Convert(doc);
        File.WriteAllBytes("output.pdf", pdf);
    }
}

IronPDF Approach:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        
        var pdf = renderer.RenderHtmlAsPdf("<html><body><h1>Hello World</h1></body></html>");
        
        pdf.SaveAs("output.pdf");
    }
}

Haukcode.DinkToPdf requires creating a SynchronizedConverter with PdfTools, constructing an HtmlToPdfDocument with nested GlobalSettings and Objects, adding an ObjectSettings with HtmlContent, calling converter.Convert() to get raw bytes, and manually writing to a file with File.WriteAllBytes().

IronPDF simplifies this to three lines: create a ChromePdfRenderer, call RenderHtmlAsPdf(), and use the built-in SaveAs() method.

For advanced HTML-to-PDF scenarios, see the HTML to PDF conversion guide.

Converting URLs to PDF

URL-to-PDF conversion shows similar pattern differences.

Haukcode.DinkToPdf Approach:

// 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 Approach:

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

Haukcode.DinkToPdf uses the same document construction pattern with ObjectSettings.Page for URLs. IronPDF provides a dedicated RenderUrlAsPdf() method that clearly expresses intent.

Explore the URL to PDF documentation for authentication and custom header options.

Custom Page Settings

Configuring orientation, paper size, and margins requires different approaches.

Haukcode.DinkToPdf Approach:

// 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.Letter,
                Margins = new MarginSettings() { Top = 10, Bottom = 10, Left = 10, Right = 10 }
            },
            Objects = {
                new ObjectSettings() {
                    HtmlContent = "<html><body><h1>Landscape Document</h1><p>Custom page settings</p></body></html>",
                }
            }
        };
        
        byte[] pdf = converter.Convert(doc);
        File.WriteAllBytes("landscape.pdf", pdf);
    }
}

IronPDF Approach:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        
        renderer.RenderingOptions.PaperSize = PdfPaperSize.Letter;
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
        renderer.RenderingOptions.MarginTop = 10;
        renderer.RenderingOptions.MarginBottom = 10;
        renderer.RenderingOptions.MarginLeft = 10;
        renderer.RenderingOptions.MarginRight = 10;
        
        var pdf = renderer.RenderHtmlAsPdf("<html><body><h1>Landscape Document</h1><p>Custom page settings</p></body></html>");
        
        pdf.SaveAs("landscape.pdf");
    }
}

Haukcode.DinkToPdf nests settings inside GlobalSettings with a separate MarginSettings object. IronPDF provides direct RenderingOptions properties with clear names like PaperSize, PaperOrientation, and individual margin properties.

Haukcode.DinkToPdf API to IronPDF Mapping Reference

This mapping accelerates migration by showing direct API equivalents:

Converter Class Mapping

Haukcode.DinkToPdfIronPDF
SynchronizedConverterChromePdfRenderer
BasicConverterChromePdfRenderer
PdfToolsN/A
IConverterN/A

Document Configuration Mapping

Haukcode.DinkToPdfIronPDF
HtmlToPdfDocumentMethod call
GlobalSettingsRenderingOptions
ObjectSettingsRenderingOptions
converter.Convert(doc)renderer.RenderHtmlAsPdf(html)

GlobalSettings Property Mapping

GlobalSettings PropertyIronPDF Property
ColorModeRenderingOptions.GrayScale
OrientationRenderingOptions.PaperOrientation
PaperSizeRenderingOptions.PaperSize
Margins.TopRenderingOptions.MarginTop
Margins.BottomRenderingOptions.MarginBottom
Margins.LeftRenderingOptions.MarginLeft
Margins.RightRenderingOptions.MarginRight

ObjectSettings Property Mapping

ObjectSettings PropertyIronPDF Equivalent
HtmlContentFirst parameter to RenderHtmlAsPdf()
Page (URL)renderer.RenderUrlAsPdf(url)
HeaderSettings.Right = "[page]"{page} inside HtmlHeader.HtmlFragment

Placeholder Syntax Migration

Haukcode.DinkToPdfIronPDF
[page]{page}
[toPage]{total-pages}
[date]{date}

Common Migration Issues and Solutions

Issue 1: Singleton Requirement

Haukcode.DinkToPdf: Requires SynchronizedConverter as a singleton due to thread safety issues with the native wkhtmltopdf binary.

Solution: IronPDF's ChromePdfRenderer is thread-safe by design - no singleton required:

// Before (DinkToPdf) - MUST be singleton
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

// After (IronPDF) - Can be singleton or transient (both work)
services.AddSingleton<IPdfService, IronPdfService>();
// Or services.AddTransient<IPdfService, IronPdfService>() - both are safe!

Issue 2: Native Binary Dependencies

Haukcode.DinkToPdf: Requires platform-specific native libraries (libwkhtmltox.dll/so/dylib).

Solution: IronPDF is self-contained with no native binary dependencies. Delete these files after migration:

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

Issue 3: Return Type Differences

Haukcode.DinkToPdf: converter.Convert() returns byte[] directly.

Solution: IronPDF returns a PdfDocument object with multiple output options:

var pdf = renderer.RenderHtmlAsPdf(html);
byte[] bytes = pdf.BinaryData;  // Get bytes
pdf.SaveAs("output.pdf");       // Or save directly

Issue 4: Header/Footer Placeholder Syntax

Haukcode.DinkToPdf: Uses square bracket syntax like [page] and [toPage].

Solution: Update to IronPDF's curly brace placeholders:

// Before (DinkToPdf)
HeaderSettings = { Right = "Page [page] of [toPage]" }

// After (IronPDF)
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
    HtmlFragment = "<span style='float:right'>Page {page} of {total-pages}</span>"
};

Haukcode.DinkToPdf Migration Checklist

Pre-Migration Tasks

Audit your codebase to identify all DinkToPdf usage:

# Find DinkToPdf namespace usage
grep -r "using DinkToPdf\|using Haukcode" --include="*.cs" .

# Find converter usage
grep -r "SynchronizedConverter\|BasicConverter\|HtmlToPdfDocument" --include="*.cs" .

# Find native library loading
grep -r "wkhtmltopdf\|libwkhtmltox" --include="*.cs" --include="*.csproj" .

# Find GlobalSettings/ObjectSettings usage
grep -r "GlobalSettings\|ObjectSettings\|MarginSettings" --include="*.cs" .
SHELL

Document current GlobalSettings and ObjectSettings configurations. Identify any native library loading code that can be removed.

Code Update Tasks

  1. Remove DinkToPdf NuGet packages
  2. Install IronPDF NuGet package
  3. Update namespace imports from DinkToPdf to IronPdf
  4. Replace SynchronizedConverter with ChromePdfRenderer
  5. Convert HtmlToPdfDocument patterns to direct method calls
  6. Convert GlobalSettings to RenderingOptions
  7. Convert ObjectSettings to RenderingOptions
  8. Update placeholder syntax ([page]{page}, [toPage]{total-pages})
  9. Add IronPDF license initialization at startup

Infrastructure Cleanup Tasks

  1. Delete native binaries (libwkhtmltox.*)
  2. Remove native library loading code
  3. Remove CustomAssemblyLoadContext if present
  4. Update Dependency Injection (singleton no longer required)
  5. Remove platform detection code for native binaries

Post-Migration Testing

After migration, verify these aspects:

  • Test HTML to PDF conversion
  • Test URL to PDF conversion
  • Verify page settings (size, orientation, margins)
  • Verify headers and footers with placeholders
  • Test with actual HTML templates
  • Performance test under load

Key Benefits of Migrating to IronPDF

Moving from Haukcode.DinkToPdf to IronPDF provides several critical advantages:

Security: Eliminates CVE-2022-35583 (SSRF) and other wkhtmltopdf vulnerabilities that will never be patched.

Modern Rendering Engine: Uses actively-updated Chromium instead of the abandoned Qt WebKit from 2015. Full HTML5, CSS3, and JavaScript support.

No Native Binaries: Self-contained library with no platform-specific DLLs to manage. Simplifies deployment across Windows, Linux, and macOS.

Thread Safety: No singleton requirement - use ChromePdfRenderer freely in any pattern including per-request instantiation.

Simpler API: Direct method calls (RenderHtmlAsPdf(), RenderUrlAsPdf()) instead of complex document object construction.

Active Development: IronPDF's regular release cadence keeps it compatible with current .NET versions, including .NET Framework 4.6.2+, .NET Core 3.1+, and .NET 5/6/7/8/9/10.

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