Skip to content
Wei Lin edited this page Mar 2, 2026 · 5 revisions

MiniPdf Wiki

A minimal, zero-dependency .NET library for converting Excel (.xlsx) files to PDF.


Pages

Page Description
Benchmark Self-evolution benchmark pipeline (60 test cases, 96.2% avg score)
PDF Coding Standards Coding conventions and standards for the MiniPdf library
AI CI Reviewer Setup Copilot code review and Azure AI security scan
NuGet Package NuGet publishing workflow and configuration

Project Overview

MiniPdf converts Excel .xlsx files to paginated PDF without any external dependencies — only built-in .NET APIs.

Key Features

  • Excel-to-PDF — Automatic column layout, multi-page, text wrapping, font colors
  • Zero dependencies — No external NuGet packages; uses System.IO.Compression + System.Xml
  • Valid PDF 1.4 output compatible with all PDF readers
  • Streaming API — Works with files, paths, or Stream inputs

Repository Structure

MiniPdf.sln
├── src/MiniPdf/                     # Library (zero-dependency)
│   ├── MiniPdf.cs                   # Public API entry point
│   ├── ExcelToPdfConverter.cs       # Core converter (column grouping, wrapping)
│   ├── ExcelReader.cs               # .xlsx parser (sparse rows, shared strings)
│   ├── PdfDocument.cs               # PDF document model
│   ├── PdfPage.cs                   # Page with text placement
│   ├── PdfWriter.cs                 # Low-level PDF 1.4 binary writer
│   ├── PdfTextBlock.cs              # Text block data
│   └── PdfColor.cs                  # RGB color support
└── tests/
    ├── MiniPdf.Tests/               # xUnit unit tests (93 tests)
    │   ├── ClassicExcelToPdfTests.cs    # 60 classic scenario tests
    │   └── ExcelToPdfConverterTests.cs  # Converter unit tests
    ├── MiniPdf.Benchmark/           # Self-evolution benchmark pipeline
    │   ├── run_benchmark.py         # Total pipeline controller
    │   ├── compare_pdfs.py          # MiniPdf vs LibreOffice comparison engine
    │   ├── generate_reference_pdfs.py  # LibreOffice reference PDF generator
    │   └── reports/                 # HTML / JSON / Markdown reports
    └── MiniPdf.Scripts/             # Excel generators and converters
        ├── generate_classic_xlsx.py # 60 classic .xlsx test file generator
        └── convert_xlsx_to_pdf.cs   # dotnet-script converter runner

Quick Start

dotnet add package MiniPdf
using MiniSoftware;

// File → File
MiniPdf.ConvertToPdf("report.xlsx", "report.pdf");

// File → byte[]
byte[] pdf = MiniPdf.ConvertToPdf("report.xlsx");

// Stream → byte[]
using var stream = File.OpenRead("report.xlsx");
byte[] pdf = MiniPdf.ConvertToPdf(stream);

Benchmark Summary (as of 2026-03-02)

Metric Value
Test cases 60
Average score 96.2%
🟢 Excellent (≥ 90%) 54
🟡 Acceptable (70–90%) 5
🔴 Needs improvement (< 70%) 1 (classic09 long-text multi-page)
C# unit tests passing 93 / 93

See Benchmark for the full pipeline and score table.

CI / Security

Every PR to main runs:

  1. dotnet build + dotnet test (93 tests)
  2. Copilot Code Review — automatic PR review comments
  3. Azure AI Security Scan — GPT-4.1 scans .cs diff, fails CI on security issues

See AI CI Reviewer Setup for details.

Clone this wiki locally