Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 2 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# MiniPdf

A minimal, zero-dependency .NET library for generating PDF documents from text and Excel (.xlsx) files.
A minimal, zero-dependency .NET library for converting Excel (.xlsx) files to PDF.
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README now positions MiniPdf as Excel-to-PDF only, but the NuGet package metadata still describes “generating PDF documents from text and Excel files” and includes text in tags (src/MiniPdf/MiniPdf.csproj). Consider aligning the README wording with the packaged description/tags so users see consistent functionality across NuGet and GitHub.

Copilot uses AI. Check for mistakes.

> **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 `.xlsx` files 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
- **Valid PDF 1.4** output

## Getting Started

Expand All @@ -23,50 +22,8 @@ dotnet add package MiniPdf

- .NET 9.0 or later

### Build

```bash
dotnet build
```

### Run Tests

```bash
dotnet test
```

## Usage

### Simple Text PDF

```csharp
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

```csharp
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

```csharp
using MiniPdf;

Comment on lines 25 to 29
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage section’s code sample (below) calls ExcelToPdfConverter and ExcelToPdfConverter.ConversionOptions, but those types are internal in the library (src/MiniPdf/ExcelToPdfConverter.cs). As published on NuGet, consumers won’t be able to compile the README example. Update the sample to use the public API (MiniPdf.ConvertToPdf(...)), or make the converter/options types public (or expose public overloads that accept options).

Copilot uses AI. Check for mistakes.
Expand All @@ -86,34 +43,6 @@ var doc = ExcelToPdfConverter.Convert("data.xlsx", options);
doc.Save("data.pdf");
```

### Save to Stream or Byte Array

```csharp
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