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.
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);What it converts
| From | CSV | DOCX | HTML | Markdown | |
|---|---|---|---|---|---|
| DOC | No | Yes: DOC to DOCX | No | No | No |
| DOCX | No | Same format | Yes: DOCX to HTML | Yes: DOCX to Markdown | Yes: DOCX to PDF |
| HTML | No | Yes: HTML to DOCX | Same format | No | Yes: HTML to PDF |
| Markdown | No | Yes: Markdown to DOCX | No | Same format | Yes: Markdown to PDF |
| PPTX | No | No | No | No | Yes: PPTX to PDF |
| XLSX | Yes: XLSX to CSV | No | Yes: XLSX to HTML | No | Yes: XLSX to PDF |
Why pure .NET
What each approach needs on your server before it can convert a document.
| Needs on the server | DocToolkit | Headless browser | Office install |
|---|---|---|---|
| A browser binary | No | Yes, downloaded to the server | No |
| Office installed and licensed | No | No | Yes, on Windows |
| Native files | None | The browser's native libraries | Office'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.
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.DocToolkitVersion 0.59.0, 31,577 downloads on NuGet, as of 2026-11-03. Release notes
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.