A minimal, lightweight .NET library for converting office files to PDF.
👉 Online Demo — Try it in your browser, no install required.
⚠️ Due to limited fonts available in the browser, the rendering results may not be optimal. For the best experience, please test locally on your machine.
- Excel-to-PDF — Convert
.xlsxfiles to PDF - Word-to-PDF — Convert
.docxfiles to PDF - Minimal dependencies — Lightweight; relies almost entirely on built-in .NET APIs
- Serverless-ready — No COM, no Office installation, no Adobe Acrobat — runs anywhere .NET runs
- Native AOT — Pre-compiled standalone binaries for Windows / Linux / macOS; no .NET runtime required
- Valid PDF 1.4 output
- 100% open-source & free — Apache 2.0 licensed, commercial use welcome; just keep the attribution. PRs & contributions are even better!
- Chart — Not currently supported well
Note: MiniPdf currently only handles basic conversions. Complex or highly customized Office documents may not convert perfectly. If you encounter compatibility issues, please open an Issue or submit a Pull Request — contributions are very welcome!
dotnet add package MiniPdfusing MiniSoftware;
// Excel to PDF
MiniPdf.ConvertToPdf("data.xlsx", "output.pdf");
// Word to PDF
MiniPdf.ConvertToPdf("report.docx", "output.pdf");
// File to byte array
byte[] pdfBytes = MiniPdf.ConvertToPdf("data.xlsx");
// Stream to byte array
using var stream = File.OpenRead("data.xlsx");
byte[] pdfBytes = MiniPdf.ConvertToPdf(stream);If your environment has limited system fonts (for example, containers or Blazor WASM), register fonts before conversion.
using MiniSoftware;
// Register one or more fonts at app startup.
MiniPdf.RegisterFont("NotoSansSC", File.ReadAllBytes("Fonts/NotoSansSC-Regular.ttf"));
MiniPdf.RegisterFont("NotoColorEmoji", File.ReadAllBytes("Fonts/NotoColorEmoji.ttf"));
MiniPdf.ConvertToPdf("report.docx", "report.pdf");Notes:
- Supported input bytes are TrueType
.ttfand TrueType Collection.ttc. - Register fonts once during startup to avoid duplicate registrations.
- Registered fonts are prioritized before system fonts.
MiniPdf also provides a command-line tool — MiniPdf.Cli — for quick conversion without writing code.
dotnet tool install --global MiniPdf.Cli# Convert Excel to PDF (output: data.pdf)
minipdf data.xlsx
# Convert Word to PDF
minipdf report.docx
# Specify output path
minipdf report.docx -o /path/to/output.pdf
# Register custom fonts (for containers / headless environments)
minipdf report.docx --fonts ./Fonts| Command | Description |
|---|---|
minipdf <file> |
Convert .xlsx / .docx to PDF |
minipdf convert <file> -o <out> |
Convert with explicit output path |
minipdf --version |
Show version |
minipdf --help |
Show help |
MiniPdf.Cli supports Native AOT (Ahead-of-Time) compilation — C# code is compiled directly into native machine code at build time, just like C/C++, producing a standalone executable. No .NET runtime or JIT compiler is needed at run time.
Advantages:
- Zero dependencies — no .NET SDK or runtime needed on the target machine
- Instant startup — native machine code, no JIT warm-up
- Small footprint — single-file binary, easy to distribute and deploy
- CI/CD friendly — download and run in any pipeline without installing .NET
Download: grab the binary for your platform from the GitHub Releases page.
| Platform | File |
|---|---|
| Windows x64 | minipdf-win-x64.zip |
| Windows ARM64 | minipdf-win-arm64.zip |
| Linux x64 | minipdf-linux-x64.tar.gz |
| Linux ARM64 | minipdf-linux-arm64.tar.gz |
| macOS x64 | minipdf-osx-x64.tar.gz |
| macOS ARM64 (Apple Silicon) | minipdf-osx-arm64.tar.gz |
Usage (example on Linux / macOS):
# Download & extract
tar -xzf minipdf-linux-x64.tar.gz
# Convert
./minipdf report.docx -o report.pdfUsage (example on Windows):
# Extract the zip, then run
.\minipdf.exe report.docx -o report.pdfMiniPdf output is compared against LibreOffice as the reference renderer across 373 test cases.
| Report | Cases | 🟢 Excellent (≥90%) | 🟡 Acceptable (70%–90%) | 🔴 Needs Improvement (<70%) | Average Score |
|---|---|---|---|---|---|
| XLSX to PDF | 191 | 175 | 16 | 0 | 96.9% |
| DOCX to PDF | 180 | 178 | 2 | 0 | 97.6% |
| Issue XLSX Files | 2 | 1 | 1 | 0 | 83.8% |
| Total | 373 | 354 | 19 | 0 | 97.2% |
Scoring: text similarity 40% + visual similarity 40% + page count 20%
- XLSX Benchmark Report — XLSX conversion test cases
- DOCX Benchmark Report — DOCX conversion test cases
- Issue Files Xlsx Report — Real-world issue file test cases
- Issue Files Docx Report — Real-world issue file test cases
All test cases comparing MiniPdf output vs LibreOffice reference. Page 1 shown for multi-page results.
This project is licensed under the Apache License 2.0.

























































































































































































































































































































































































