MiniPdf 0.1.0
dotnet add package MiniPdf --version 0.1.0
NuGet\Install-Package MiniPdf -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MiniPdf" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MiniPdf" Version="0.1.0" />
<PackageReference Include="MiniPdf" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MiniPdf --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MiniPdf, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MiniPdf@0.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MiniPdf&version=0.1.0
#tool nuget:?package=MiniPdf&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MiniPdf
A minimal, zero-dependency .NET library for generating PDF documents from text and Excel (.xlsx) files.
Security: All PRs are automatically reviewed by Copilot AI and Azure AI security scan for vulnerabilities.
Features
- Text-to-PDF — Create PDF documents with positioned or auto-wrapped text
- Excel-to-PDF — Convert
.xlsxfiles to paginated PDF with automatic column layout - Zero dependencies — Uses only built-in .NET APIs (no external packages)
- Valid PDF 1.4 output with Helvetica font
Getting Started
Install via NuGet
dotnet add package MiniPdf
Requirements
- .NET 9.0 or later
Build
dotnet build
Run Tests
dotnet test
Usage
Simple Text PDF
using MiniPdf;
var doc = new PdfDocument();
var page = doc.AddPage(); // US Letter size by default
page.AddText("Hello, World!", x: 50, y: 700, fontSize: 24);
page.AddText("This is MiniPdf.", x: 50, y: 670, fontSize: 12);
doc.Save("output.pdf");
Auto-Wrapped Text
var doc = new PdfDocument();
var page = doc.AddPage();
var longText = "This is a long paragraph that will automatically wrap "
+ "within the specified width boundary on the page.";
page.AddTextWrapped(longText, x: 50, y: 700, maxWidth: 500, fontSize: 12);
doc.Save("wrapped.pdf");
Excel to PDF
using MiniPdf;
// One-liner: file to file
ExcelToPdfConverter.ConvertToFile("data.xlsx", "data.pdf");
// With options
var options = new ExcelToPdfConverter.ConversionOptions
{
FontSize = 10,
PageWidth = 595, // A4
PageHeight = 842, // A4
IncludeSheetName = true,
};
var doc = ExcelToPdfConverter.Convert("data.xlsx", options);
doc.Save("data.pdf");
Save to Stream or Byte Array
var doc = new PdfDocument();
doc.AddPage().AddText("Hello", 50, 700);
// To stream
using var stream = new MemoryStream();
doc.Save(stream);
// To byte array
byte[] bytes = doc.ToArray();
Project Structure
MiniPdf.sln
├── src/MiniPdf/ # Library
│ ├── PdfDocument.cs # Document model
│ ├── PdfPage.cs # Page with text placement
│ ├── PdfTextBlock.cs # Text block data
│ ├── PdfWriter.cs # PDF 1.4 binary writer
│ ├── ExcelReader.cs # .xlsx parser (ZIP + XML)
│ └── ExcelToPdfConverter.cs# Excel-to-PDF public API
└── tests/MiniPdf.Tests/ # xUnit tests
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.