Skip to content

[Beta status] A minimal, zero-dependency .NET library for generating PDF documents from text and Excel (.xlsx) files.

License

Notifications You must be signed in to change notification settings

mini-software/MiniPdf

Repository files navigation

MiniPdf


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

Features

  • Excel-to-PDF — Convert .xlsx files to paginated PDF with automatic column layout
  • Embedded images — JPEG and PNG images embedded in Excel sheets are rendered in the PDF output
  • Zero dependencies — Uses only built-in .NET APIs (no external packages)
  • Valid PDF 1.4 output
  • Word-to-PDF — In development
  • Chart — Not currently supported

Getting Started

Install via NuGet

dotnet add package MiniPdf

Requirements

  • .NET 9.0 or later

Usage

using MiniSoftware;

// File to file
MiniPdf.ConvertToPdf("data.xlsx", "data.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);

Benchmark

MiniPdf output is compared against LibreOffice as the reference renderer across 90 classic test cases (including 30 image-embedding cases).

Category Count Threshold
🟢 Excellent 82 ≥ 90%
🟡 Acceptable 7 70% – 90%
🔴 Needs Improvement 1 < 70%

Average overall score: 96.4% (text similarity 40% + visual similarity 40% + page count 20%)

Visual Comparison

All 90 test cases comparing MiniPdf output (left) vs LibreOffice reference (right). Page 1 shown for multi-page results.

Test CaseMiniPdfLibreOffice (Reference)Score
classic01
Basic table with headers
🟢 99.8%
classic02
Multiple worksheets
🟢 99.5%
classic03
Empty workbook
🟢 100.0%
classic04
Single cell
🟢 100.0%
classic05
Wide table
🟢 99.7%
classic06
Tall table
🟢 95.1%
classic07
Numbers only
🟢 99.9%
classic08
Mixed text and numbers
🟢 99.9%
classic09
Long text
MiniPdf: 1 page
Reference: 12 pages
🔴 21.9%
classic10
Special XML characters
🟢 99.8%
classic11
Sparse rows
🟢 100.0%
classic12
Sparse columns
🟢 99.9%
classic13
Date strings
🟢 98.8%
classic14
Decimal numbers
🟢 99.8%
classic15
Negative numbers
🟢 99.8%
classic16
Percentage strings
🟢 99.6%
classic17
Currency strings
🟢 99.0%
classic18
Large dataset
🟢 91.5%
classic19
Single column list
🟢 99.7%
classic20
All empty cells
🟢 100.0%
classic21
Header only
🟢 99.9%
classic22
Long sheet name
🟢 99.9%
classic23
Unicode text
🟡 87.1%
classic24
Red text
🟢 99.8%
classic25
Multiple colors
🟢 99.5%
classic26
Inline strings
🟢 99.9%
classic27
Single row
🟢 99.9%
classic28
Duplicate values
🟢 99.8%
classic29
Formula results
🟢 99.8%
classic30
Mixed empty and filled sheets
🟢 99.9%
classic31
Bold header row
🟢 99.7%
classic32
Right-aligned numbers
🟢 99.9%
classic33
Centered text
🟢 99.9%
classic34
Explicit column widths
🟢 99.8%
classic35
Explicit row heights
🟢 96.8%
classic36
Merged cells
🟢 97.8%
classic37
Freeze panes
🟢 99.1%
classic38
Hyperlink cell
🟢 99.2%
classic39
Financial table
🟢 99.6%
classic40
Scientific notation
🟢 94.6%
classic41
Integer vs float
🟢 97.6%
classic42
Boolean values
🟢 92.6%
classic43
Inventory report
🟢 99.2%
classic44
Employee roster
🟡 87.3%
classic45
Sales by region (4 sheets)
🟢 99.9%
classic46
Grade book
🟢 99.5%
classic47
Time series
🟢 98.6%
classic48
Survey results
🟢 98.8%
classic49
Contact list
🟡 86.4%
classic50
Budget vs actuals (3 sheets)
🟢 99.1%
classic51
Product catalog
🟡 81.9%
classic52
Pivot summary
🟢 99.3%
classic53
Invoice layout
🟢 96.0%
classic54
Multi-level header
🟢 99.5%
classic55
Error values (#N/A, #DIV/0!)
🟢 99.7%
classic56
Alternating row colors
� 75.4%
classic57
CJK-only sheet
🟡 85.2%
classic58
Mixed numeric formats
🟢 94.8%
classic59
Multi-sheet summary (4 sheets)
🟢 99.8%
classic60
Large wide table (20×50)
🟢 94.9%
classic61
Product card with image
🟢 99.3%
classic62
Company logo header
🟢 98.8%
classic63
Two products side by side
🟢 99.2%
classic64
Employee directory with photo
🟢 98.1%
classic65
Inventory with product photos
🟢 98.2%
classic66
Invoice with logo
🟢 96.2%
classic67
Real estate listing
🟢 98.5%
classic68
Restaurant menu with photos
🟢 92.3%
classic69
Image-only sheet
🟢 99.1%
classic70
Product catalog with images
🟢 96.3%
classic71
Multi-sheet with images (3 sheets)
🟢 99.2%
classic72
Bar chart image with data
🟢 97.7%
classic73
Event flyer with banner
🟢 93.9%
classic74
Dashboard with KPI image
🟢 97.2%
classic75
Certificate with seal
🟢 99.2%
classic76
Product image grid (2×2)
🟢 98.5%
classic77
News article with hero image
🟢 97.3%
classic78
Small icon per row
🟢 95.9%
classic79
Wide panoramic banner
🟢 97.7%
classic80
Portrait tall image
🟢 98.9%
classic81
Step-by-step with images
🟢 98.7%
classic82
Before/after images
🟢 97.4%
classic83
Color swatch palette
🟢 97.4%
classic84
Travel destination cards
🟢 97.8%
classic85
Lab results with image
🟢 97.2%
classic86
Software screenshot features
🟢 97.1%
classic87
Sports results with logos
🟢 99.5%
classic88
Image after data
🟢 98.9%
classic89
Nutrition label with image
🟢 96.5%
classic90
Project status with milestones
🟡 87.2%

License

This project is licensed under the Apache License 2.0.

About

[Beta status] A minimal, zero-dependency .NET library for generating PDF documents from text and Excel (.xlsx) files.

Topics

Resources

License

Stars

Watchers

Forks

Contributors