MiniPdf 0.38.4
dotnet add package MiniPdf --version 0.38.4
NuGet\Install-Package MiniPdf -Version 0.38.4
<PackageReference Include="MiniPdf" Version="0.38.4" />
<PackageVersion Include="MiniPdf" Version="0.38.4" />
<PackageReference Include="MiniPdf" />
paket add MiniPdf --version 0.38.4
#r "nuget: MiniPdf, 0.38.4"
#:package MiniPdf@0.38.4
#addin nuget:?package=MiniPdf&version=0.38.4
#tool nuget:?package=MiniPdf&version=0.38.4
English | 简体中文 | 繁体中文 | 日本語 | 한국어 | Italiano | Français
A minimal, lightweight .NET library for converting office files to PDF.
Online Demo: https://mini-software.github.io/MiniPdf/
Features
- Excel to PDF conversion (
.xlsx) - Word to PDF conversion (
.docx) - PowerPoint to PDF conversion (
.pptx) - LLM-friendly Markdown, JSON, and semantic model extraction from
.xlsx,.docx, and.pptx - PDF merge with top-level bookmarks
- 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
- 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!
Install
dotnet add package MiniPdf
Usage
using MiniSoftware;
// Excel to PDF
MiniPdf.ConvertToPdf("data.xlsx", "output.pdf");
// Word to PDF
MiniPdf.ConvertToPdf("report.docx", "output.pdf");
// PowerPoint to PDF
MiniPdf.ConvertToPdf("slides.pptx", "output.pdf");
// File to byte array
byte[] pdfBytes = MiniPdf.ConvertToPdf("data.xlsx");
// Render selected Excel sheets by name or 1-based index (null renders all sheets)
MiniPdf.ConvertToPdf("data.xlsx", "selected.pdf", sheets: new[] { "Summary", "Details" });
MiniPdf.ConvertToPdf("data.xlsx", "selected.pdf", sheetIndexes: new[] { 1, 3 });
// Stream to byte array
using var stream = File.OpenRead("data.xlsx");
byte[] pdfBytesFromStream = MiniPdf.ConvertToPdf(stream);
// Merge PDFs and add bookmarks
MiniPdf.MergePdf(new[] { "cover.pdf", "body.pdf" }, "merged.pdf", new PdfMergeOptions
{
BookmarkTitles = new[] { "Cover", "Body" },
Bookmarks = new[] { new PdfBookmark("Body page 2", 2) },
});
LLM-Friendly Content Extraction
MiniPdfDocumentContent content = MiniPdf.ExtractContent("report.docx");
string markdown = MiniPdf.ConvertToMarkdown("report.docx");
string json = MiniPdf.ConvertToJson("report.docx");
MiniPdf.ConvertToJson("data.xlsx", "data.json", new MiniPdfContentOptions
{
Sheets = new[] { "Summary" },
MaxRows = 200,
MaxColumns = 20,
});
The deterministic JSON schema starts at version 1. Extraction preserves source order, headings, paragraphs, lists, tables, worksheet cell addresses, hyperlinks, DOCX footnotes, and image/chart metadata. It does not perform OCR or export image sidecar files. Comments, tracked changes, threaded comments, and PowerPoint speaker notes are not yet extracted.
PDF Merge Usage
Merge Files
using MiniSoftware;
MiniPdf.MergePdf(
new[] { "cover.pdf", "chapter-1.pdf", "chapter-2.pdf" },
"book.pdf");
Input order is preserved, so pages from cover.pdf appear first, followed by chapter-1.pdf, then chapter-2.pdf.
Add One Bookmark Per Source PDF
Use BookmarkTitles when each input PDF should become a top-level bookmark. The number of titles must match the number of input PDFs.
MiniPdf.MergePdf(
new[] { "cover.pdf", "chapter-1.pdf", "chapter-2.pdf" },
"book-with-bookmarks.pdf",
new PdfMergeOptions
{
BookmarkTitles = new[] { "Cover", "Chapter 1", "Chapter 2" },
});
Add Bookmarks To Specific Pages
Use PdfBookmark for explicit page targets. PageIndex is zero-based and refers to the final merged PDF.
MiniPdf.MergePdf(
new[] { "cover.pdf", "chapter-1.pdf", "chapter-2.pdf" },
"book-with-custom-bookmarks.pdf",
new PdfMergeOptions
{
Bookmarks = new[]
{
new PdfBookmark("Start", 0),
new PdfBookmark("Chapter 2 - page 3", 8),
},
});
Return A Byte Array
byte[] mergedPdf = MiniPdf.MergePdf(
new[] { "cover.pdf", "chapter-1.pdf" },
new PdfMergeOptions
{
BookmarkTitles = new[] { "Cover", "Chapter 1" },
});
Supported inputs are unencrypted PDFs that use classic xref tables. Encrypted PDFs and xref-stream-only PDFs throw NotSupportedException.
Benchmark
MiniPdf output is compared against LibreOffice as the reference renderer across 373 test cases.
Detailed reports:
Links
- Source code: https://github.com/shps951023/MiniPdf
- License: Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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. |
-
.NETFramework 4.6.2
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- System.Drawing.Common (>= 8.0.0)
- System.Memory (>= 4.5.5)
-
net6.0
- System.Drawing.Common (>= 8.0.0)
-
net8.0
- System.Drawing.Common (>= 8.0.0)
-
net9.0
- System.Drawing.Common (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MiniPdf:
| Package | Downloads |
|---|---|
|
Pek.MiniPdf
基于DH框架的Pdf处理库。基于https://github.com/mini-software/MiniPdf |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.38.4 | 818 | 8/14/2026 |
| 0.37.2 | 14,135 | 7/15/2026 |
| 0.36.2 | 4,913 | 7/8/2026 |
| 0.36.1 | 117 | 7/8/2026 |
| 0.35.2 | 1,328 | 7/6/2026 |
| 0.35.1 | 2,515 | 7/2/2026 |
| 0.34.1 | 1,514 | 6/27/2026 |
| 0.34.0 | 125 | 6/27/2026 |
| 0.33.0 | 132 | 6/27/2026 |
| 0.32.0 | 643 | 6/23/2026 |
| 0.31.0 | 11,092 | 6/5/2026 |
| 0.30.0 | 916 | 6/4/2026 |
| 0.29.0 | 22,189 | 4/30/2026 |
| 0.28.0 | 162 | 4/29/2026 |
| 0.27.0 | 132 | 4/28/2026 |
| 0.26.0 | 11,478 | 4/3/2026 |
| 0.25.0 | 588 | 4/2/2026 |
| 0.24.0 | 2,384 | 3/29/2026 |
| 0.23.0 | 623 | 3/27/2026 |
| 0.22.0 | 127 | 3/26/2026 |