HTML in. Word and PDF out. Nothing else installed.
You have a Linux container, a Word template and a PDF due on Friday. The usual answers are a headless Chrome, LibreOffice, or a licence with a revenue threshold.
DocToolkit is one NuGet package instead. It is pure managed code. It restores, builds and runs the same on your laptop and in the container.
| Convert | HTML and Markdown to DOCX and PDF; DOCX to HTML, Markdown and PDF; XLSX to CSV, HTML and PDF; PPTX to PDF; legacy Word 97-2003 .doc to DOCX; legacy PowerPoint 97-2003 .ppt to PDF (at a measured rate) |
| Edit | create and edit DOCX, XLSX and PPTX; fill templates, including one row per record; insert images; read text back out |
| page count, merge, split, extract, rotate, reorder, insert; read text; read and stamp document information | |
| Protect | password-protect and unprotect PDF, DOCX, XLSX and PPTX |
| From ↓ / To → | CSV | DOC | DOCX | HTML | Markdown | PPTX | XLSX | |
|---|---|---|---|---|---|---|---|---|
| CSV | — | · | · | · | · | · | · | · |
| DOC | · | — | ✅ | · | · | · | · | · |
| DOCX | · | · | — | ✅ | ✅ | ✅ | · | · |
| HTML | · | · | ✅ | — | · | ✅ | · | · |
| Markdown | · | · | ✅ | · | — | ✅ | · | · |
| · | · | · | · | · | — | · | · | |
| PPTX | · | · | · | · | · | ✅ | — | · |
| XLSX | ✅ | · | · | ✅ | · | ✅ | · | — |
A ✅ is a converter that ships; · is a pair with no converter, not a promise about one. Read a row as "from this format, into these".
dotnet add package Ank.DocToolkit// HTML in, a Word document and a PDF out. No browser, no LibreOffice, nothing to install.
byte[] docx = await HtmlToDocxConverter.ConvertAsync("<h1>Invoice 2026-114</h1>");
byte[] pdf = await HtmlToPdfConverter.ConvertAsync("<h1>Invoice 2026-114</h1>");
// Read a document back, edit one you were given, and lock it when you are done.
string text = DocxEditor.ExtractText(docx);
byte[] locked = PdfEditor.Protect(pdf, new PdfProtection { UserPassword = "s3cret" });That is the whole setup: no browser download, no apt-get, no config file. It targets net8.0 and
net10.0.
Every bar takes a minute to reproduce. The licence column and the method sit beside the chart in Measured against the alternatives.
Reproduce a bar
dotnet new console && dotnet add package <name> && dotnet build -c Release
find bin -path '*runtimes*' \( -name '*.so' -o -name '*.dylib' \) | wc -l
du -sm bin/Release/net8.0/runtimes| Every push | |
| Trimmable / native AOT | both packages run-tested in CI, not just published. ClosedXML emits IL2090. → Trimming and native AOT |
| Provenance and SBOM | every .nupkg and CycloneDX SBOM is attested to the workflow, commit and runner. → Verifying a release |
| Offline, enforced | 40 guard tests assert zero socket connections against 16 ways markup can name a host. → Nothing reaches the network unless you ask |
| Real files | 88–98% success across 500+ real .gov documents, monthly. → Measured on documents nobody here wrote |
| Free for commercial use | 38 dependencies: 35 MIT, 2 Apache-2.0, and OfficeIMO.Core (MIT AND Apache-2.0 AND BSD-3-Clause) |
Remote images are the one network opt-in, and it stays bounded:
byte[] docx = await HtmlToDocxConverter.ConvertAsync(html, allowRemoteImageDownload: true);
// Bounded instead of wide open: timeout, byte cap, host allow-list and a block on
// loopback/private/link-local addresses, all on by default. Not a complete SSRF defence — see
// the Reference page.
byte[] bounded = await HtmlToDocxConverter.ConvertAsync(html, new RemoteImageOptions());Every push is built and tested on Linux, arm64, Windows and macOS. Every release is published to
nuget.org from CI. A monthly run converts 500+ real .gov documents, and 88–98% succeed.
It stays below 1.0.0 on purpose, so a minor version may change the API. Each change is listed in the CHANGELOG.
The ones people meet first. The full list, each one measured, is in Known limitations.
- HTML → PDF goes through Word. Flexbox, grid, floats and absolute positioning do not survive. Text, headings, tables, lists, inline styles and images do.
- No external stylesheets. A
<link rel="stylesheet">is never fetched. Inline<style>andstyle=work. - One page setup per document. A header or footer is one line, with an optional distinct first page.
- Some PDF losses are silent. Conditional formatting and some shape effects are dropped. A table nested inside a table cell loses its content.
- Fonts come from the machine. A container with no fonts falls back to Helvetica. Install fonts,
or pass
PdfFontOptions. - Pivot table results are never computed. Excel fills them in when it opens the file.
DocToolkit fits when the container must stay small and the licence must be clear. Something else fits better when:
- You need a browser's CSS layout. A headless Chrome renders flexbox and grid. This library does not.
- You need every legacy format, or a right-to-left spreadsheet. LibreOffice or Office converts more faithfully, at the cost of an install.
- You lay out a PDF in code. QuestPDF is built for that. Read its licence, and expect 83 MB of native files.
- You only edit XLSX. EPPlus carries almost no native files. Read its licence first.
Does it need Chrome or LibreOffice? No. Every PDF is rendered from a real Word document, in managed code.
Can I use it at work? Yes. It is MIT licensed, and every dependency is MIT, Apache-2.0 or BSD.
Which .NET versions?
net8.0 and net10.0, the two LTS releases. A net9.0 app uses the net8.0 build.
- Guides: one walkthrough per format.
- Reference: every capability, overload and caveat.
- API reference, generated from the source.
- Samples: one runnable project per capability, built against the published packages.
- Dependency injection:
services.AddDocToolkit(). - CHANGELOG · Roadmap · Security · PUBLIC.md
- CONTRIBUTING.md: the build, the commit rules and the four constraints.
MIT. See LICENSE. Maintained by WillowAnk Solution; product page wanksolution.com/doctoolkit.
If this replaced a headless browser in your build, a star helps others find it.

