DocToolkit

Convert, edit and protect documents in pure managed C#, inside your own app.

latest version
0.59.0
downloads on NuGet
31,577
native files in the build
0

Pick a conversion, copy the code

Choose the format you start from and the format you want. The snippet compiles against the published package.

From
To
using DocToolkit;

string html = "<h1>Invoice 2026-114</h1><p>Due on receipt</p>";
byte[] pdf = await HtmlToPdfConverter.ConvertAsync(html);
File.WriteAllBytes("output.pdf", pdf);

Read more about HTML to PDF

What it converts

What DocToolkit converts. Read each row as the format you start from, and each column as the format you get.
FromCSVDOCXHTMLMarkdownPDF
DOCNoYes: DOC to DOCXNoNoNo
DOCXNoSame formatYes: DOCX to HTMLYes: DOCX to MarkdownYes: DOCX to PDF
HTMLNoYes: HTML to DOCXSame formatNoYes: HTML to PDF
MarkdownNoYes: Markdown to DOCXNoSame formatYes: Markdown to PDF
PPTXNoNoNoNoYes: PPTX to PDF
XLSXYes: XLSX to CSVNoYes: XLSX to HTMLNoYes: XLSX to PDF

Why pure .NET

What each approach needs on your server before it can convert a document.

Needs on the serverDocToolkitHeadless browserOffice install
A browser binaryNoYes, downloaded to the serverNo
Office installed and licensedNoNoYes, on Windows
Native filesNoneThe browser's native librariesOffice's own program files

DocToolkit's build output held 0 native files when measured on 2026-08-09, with the package added to an empty net8.0 console app.

See the full comparison

The facts

  • Runs on Linux, macOS, Windows and arm64, with no network calls.
  • Password-protects DOCX, XLSX, PPTX and PDF.
  • Targets .NET 8 and .NET 10. MIT licensed.

Install

dotnet add package Ank.DocToolkit

Version 0.59.0, 31,577 downloads on NuGet, as of 2026-11-03. Release notes

NuGetDocumentationGitHub

Questions

Does it need Office or a browser?

No. DocToolkit is pure managed code: no browser, headless or otherwise, no Word installation, no LibreOffice and no Office interop. HTML to PDF goes through a Word document the library builds itself.

Does it run on Linux, macOS, arm64 and in Docker?

Yes. The full test suite runs in CI on Linux, Windows, macOS and arm64. In Docker a plain .NET runtime image is enough, such as mcr.microsoft.com/dotnet/runtime:8.0, with nothing to install; use runtime, not runtime-deps.

Which .NET versions does it support?

It targets net8.0 and net10.0, the two LTS releases. A net9.0 app uses the net8.0 build. There is no netstandard2.0 build.

What licence is it under?

MIT. Its 35 dependencies are 33 MIT and 2 Apache-2.0: no revenue thresholds and no per-seat fees.

Does it make network calls?

Not by default: no conversion opens a socket, stylesheets are not fetched and remote images are dropped. 40 air-gap tests check it. Remote images are the one opt-in, per call or through DocToolkitOptions, with a host allow-list and a block on loopback and private addresses.

What can it not do?

It converts the 12 pairs in the grid above, plus a legacy .ppt straight to PDF, and no others. Nothing converts a PDF into another format (it reads PDF text and edits pages), nothing reads CSV, and a legacy .xls is refused with a message to save it as .xlsx. HTML to PDF does not apply flexbox, grid or floats.

How do I install it?

Run dotnet add package Ank.DocToolkit. Everything in it is a static class, so there is nothing to register. For dependency injection in ASP.NET Core, add Ank.DocToolkit.Extensions.DependencyInjection too.