SelectPdf.Compat.DinkToPdf.Licensed 1.0.0

Prefix Reserved
dotnet add package SelectPdf.Compat.DinkToPdf.Licensed --version 1.0.0
                    
NuGet\Install-Package SelectPdf.Compat.DinkToPdf.Licensed -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SelectPdf.Compat.DinkToPdf.Licensed" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SelectPdf.Compat.DinkToPdf.Licensed" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SelectPdf.Compat.DinkToPdf.Licensed" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SelectPdf.Compat.DinkToPdf.Licensed --version 1.0.0
                    
#r "nuget: SelectPdf.Compat.DinkToPdf.Licensed, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SelectPdf.Compat.DinkToPdf.Licensed@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SelectPdf.Compat.DinkToPdf.Licensed&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SelectPdf.Compat.DinkToPdf.Licensed&version=1.0.0
                    
Install as a Cake Tool

SelectPdf.Compat.DinkToPdf.Licensed

The DinkToPdf API (IConverter, SynchronizedConverter, HtmlToPdfDocument, GlobalSettings, ObjectSettings) on the licensed SelectPdf.Universal library. Chromium does the rendering instead of wkhtmltopdf, with no page limit.

It is the same code as the free SelectPdf.Compat.DinkToPdf package, built on SelectPdf.Universal instead of the Community Edition. Moving from the free package to this one means changing the package reference; the code stays the same.

  • Keeps the DinkToPdf API. The namespace and types are DinkToPdf's, so existing code builds against this package.
  • No native wkhtmltopdf files. You can delete libwkhtmltox.dll, .so and .dylib.
  • Runs on Windows x64/x86, Linux x64/ARM64, macOS on Apple Silicon, and Docker.
  • Renders modern HTML and CSS (flexbox, grid, web fonts, current JavaScript) through Chromium instead of the archived Qt WebKit.
  • Keeps the size of your content. CSS sizes are scaled the way wkhtmltopdf's smart shrinking scaled them, and content wider than the page is shrunk to fit.
  • No page limit, and several objects that include a URL are merged into one PDF.
  • Needs a SelectPdf license. Without a license key, the output carries a demo watermark. See pricing.

This package is not affiliated with DinkToPdf.

 

Migrate

dotnet remove package DinkToPdf
dotnet add package SelectPdf.Compat.DinkToPdf.Licensed

Then add the SelectPdf engine package for the platform the application runs on: SelectPdf.Universal.Native.<rid>, where <rid> is win-x64, win-x86, linux-x64, linux-arm64 or osx-arm64. Reference one engine package per build, because they all install into the same folder. A project developed on Windows and deployed to a Linux container can pick the package by platform:

<PropertyGroup>
  <SelectPdfRid>$(RuntimeIdentifier)</SelectPdfRid>
  <SelectPdfRid Condition="'$(SelectPdfRid)' == '' And
      $([MSBuild]::IsOSPlatform('Windows'))">win-x64</SelectPdfRid>
  <SelectPdfRid Condition="'$(SelectPdfRid)' == ''">linux-x64</SelectPdfRid>
</PropertyGroup>
<ItemGroup>
  <PackageReference Include="SelectPdf.Universal.Native.$(SelectPdfRid)"
                    Version="26.5.0" />
</ItemGroup>

Delete the libwkhtmltox.* files from your project and the CustomAssemblyLoadContext code that loaded them. Your code stays as it is:

using DinkToPdf;
using DinkToPdf.Contracts;

services.AddSingleton(typeof(IConverter),
    new SynchronizedConverter(new PdfTools()));

byte[] pdf = converter.Convert(new HtmlToPdfDocument
{
    GlobalSettings =
    {
        PaperSize = PaperKind.A4,
        Orientation = Orientation.Portrait,
        Margins = new MarginSettings { Top = 10 }
    },
    Objects =
    {
        new ObjectSettings
        {
            HtmlContent = html,
            FooterSettings = { Center = "Page [page] of [toPage]" }
        }
    }
});

 

License key

SelectPdf.Universal.GlobalProperties.LicenseKey = "your license key";

Set the key once at startup, before the first conversion.

 

Docker

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "YourApp.dll"]

The engine package bundles the Chromium libraries, so the image needs no apt-get lines. On Linux, glibc 2.30 or later is required, which the official .NET images have. Linux images often have no fonts installed; the engine has built-in fonts for Latin scripts, and SelectPdf.Universal.Fonts adds every other script.

 

How settings map

DinkToPdf SelectPdf
PaperSize (any PaperKind or PechkinPaperSize) and Orientation Exact page size in points
Margins (mm, cm or in) Margins in points. Defaults to 10 mm on each side, as in wkhtmltopdf
HeaderSettings / FooterSettings: Left/Center/Right, FontName, FontSize, Line, Spacing Text sections placed inside the margin, as wkhtmltopdf placed them
[page], [topage], [frompage], [date], [isodate], [time], [title], [doctitle], [webpage] {page_number}, {total_pages}, or the value itself (case-insensitive, so [toPage] works)
HtmUrl HTML header/footer section
ObjectSettings.Page (URL or local file) / HtmlContent ConvertUrl / ConvertHtmlString
Several Objects (HTML) One PDF, page breaks between objects
WebSettings.EnableIntelligentShrinking, LoadSettings.ZoomFactor The scale of the content, as wkhtmltopdf applied it
ColorMode.Grayscale Grayscale color space
DocumentTitle, Outline/OutlineDepth, ImageQuality, PageOffset, ViewportSize, Out Title, h1..hN bookmarks, JPEG level, first page number, browser viewport, file output (returns an empty array, as before)
WebSettings: PrintMediaType, EnableJavascript, Background, UserStyleSheet CSS media type, JavaScript, backgrounds, custom CSS
LoadSettings: Username/Password, JSDelay, Proxy, CustomHeaders, Cookies, BlockLocalFileAccess HTTP auth, conversion delay (rounded up to whole seconds), proxy, headers, cookies, local file access
Events: PhaseChanged, ProgressChanged, Finished, Error, Warning Raised at the same points

Settings with no equivalent, such as Copies, DPI and MinimumFontSize, are ignored. Each one raises the Warning event so you can see it.

 

What behaves differently

  • Engine. Chromium lays pages out like a current browser. Layouts that worked around WebKit's missing flexbox and grid support now render as written, and text metrics differ slightly. Use CSS break-before, break-after and break-inside: avoid to control page breaks.
  • HTML header/footer URLs. wkhtmltopdf passed ?page=&topage= to the HtmUrl page. That isn't done here, so use text headers for page numbers.
  • Wide content without smart shrinking. With EnableIntelligentShrinking = false, content wider than the page is shrunk to fit instead of being cut at the right edge.
  • Several objects. The first content object's header, footer and web settings apply to the whole document.
  • Several objects with a URL. Each object is converted on its own and the PDFs are appended, so [page] and [topage] count the pages of each object.
  • Concurrency. SynchronizedConverter no longer queues every conversion on one thread. SelectPdf converts in parallel, so a singleton converter serves concurrent requests.
  • Failures. A failed conversion returns an empty array and raises Error, as before. Set SelectPdfCompat.ThrowOnError = true to throw instead.

 

Other SelectPdf options

SelectPdfCompat.Configure receives the SelectPdf.Universal.HtmlToPdf converter after your settings are applied, so you can set any other SelectPdf option:

SelectPdfCompat.Configure = (converter, obj) =>
    converter.Options.ConversionDelay = 2;

 

License

This package is MIT licensed. Its public API reproduces DinkToPdf's (MIT, © 2017 Rok Dvojmoc); see THIRD-PARTY-DinkToPdf-LICENSE.txt. Rendering uses the licensed SelectPdf.Universal library, © Outside Software SRL, which needs its own license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 10/15/2026