Skip to content

mini-software/MiniPdf

Repository files navigation

MiniPdf


A minimal, zero-dependency .NET library for converting office files to PDF.

Features

  • Excel-to-PDF — Convert .xlsx files to PDF
  • Word-to-PDF — Convert .docx files to PDF
  • Zero dependencies — Uses only built-in .NET APIs (no external packages)
  • Valid PDF 1.4 output
  • Chart — Not currently supported well

Getting Started

Install via NuGet

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");

// 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);

Xlsx Benchmark

MiniPdf output is compared against LibreOffice as the reference renderer across 180 classic test cases (including 30 image-embedding cases, 30 chart cases, 30 styling cases, and 30 multilingual/emoji cases).

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

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

Visual Comparison

All test cases comparing MiniPdf output vs LibreOffice reference. Page 1 shown for multi-page results.

MiniPdfLibreOffice (Reference)
classic01 Basic table with headers 🟢 99.9%
classic02 Multiple worksheets 🟢 99.8%
classic03 Empty workbook 🟢 100.0%
classic04 Single cell 🟢 100.0%
classic05 Wide table 🟢 99.8%
classic06 Tall table 🟢 97.8%
classic07 Numbers only 🟢 100.0%
classic08 Mixed text and numbers 🟢 99.9%
classic09 Long text 🔴 60.2%
classic10 Special xml characters 🟢 99.9%
classic11 Sparse rows 🟢 100.0%
classic12 Sparse columns 🟢 99.9%
classic13 Date strings 🟢 99.9%
classic14 Decimal numbers 🟢 99.9%
classic15 Negative numbers 🟢 99.9%
classic16 Percentage strings 🟢 99.4%
classic17 Currency strings 🟢 99.9%
classic18 Large dataset 🟢 95.7%
classic19 Single column list 🟢 99.9%
classic20 All empty cells 🟢 100.0%
classic21 Header only 🟢 99.9%
classic22 Long sheet name 🟢 99.9%
classic23 Unicode text 🟢 91.3%
classic24 Red text 🟢 99.9%
classic25 Multiple colors 🟢 99.8%
classic26 Inline strings 🟢 99.9%
classic27 Single row 🟢 99.9%
classic28 Duplicate values 🟢 99.9%
classic29 Formula results 🟢 99.9%
classic30 Mixed empty and filled sheets 🟢 100.0%
classic31 Bold header row 🟢 99.9%
classic32 Right aligned numbers 🟢 99.9%
classic33 Centered text 🟢 99.9%
classic34 Explicit column widths 🟢 99.9%
classic35 Explicit row heights 🟢 99.5%
classic36 Merged cells 🟢 99.9%
classic37 Freeze panes 🟢 99.6%
classic38 Hyperlink cell 🟢 99.9%
classic39 Financial table 🟢 99.8%
classic40 Scientific notation 🟢 99.9%
classic41 Integer vs float 🟢 99.9%
classic42 Boolean values 🟢 99.6%
classic43 Inventory report 🟢 99.5%
classic44 Employee roster 🟢 98.0%
classic45 Sales by region 🟢 99.9%
classic46 Grade book 🟢 99.6%
classic47 Time series 🟢 99.3%
classic48 Survey results 🟢 99.6%
classic49 Contact list 🟢 98.5%
classic50 Budget vs actuals 🟢 99.6%
classic51 Product catalog 🟢 98.5%
classic52 Pivot summary 🟢 99.6%
classic53 Invoice 🟢 99.5%
classic54 Multi level header 🟢 99.8%
classic55 Error values 🟢 99.8%
classic56 Alternating row colors 🟢 99.6%
classic57 Cjk only 🟢 91.1%
classic58 Mixed numeric formats 🟢 99.5%
classic59 Multi sheet summary 🟢 99.9%
classic60 Large wide table 🟢 97.4%
classic61 Product card with image 🟢 99.9%
classic62 Company logo header 🟢 99.6%
classic63 Two products side by side 🟢 99.8%
classic64 Employee directory with photo 🟢 99.1%
classic65 Inventory with product photos 🟢 99.4%
classic66 Invoice with logo 🟢 99.2%
classic67 Real estate listing 🟢 99.8%
classic68 Restaurant menu 🟢 98.6%
classic69 Image only sheet 🟢 100.0%
classic70 Product catalog with images 🟢 99.2%
classic71 Multi sheet with images 🟢 99.8%
classic72 Bar chart image with data 🟢 99.4%
classic73 Event flyer with banner 🟢 99.5%
classic74 Dashboard with kpi image 🟢 97.9%
classic75 Certificate with seal 🟢 99.5%
classic76 Product image grid 🟢 99.6%
classic77 News article with hero image 🟢 99.6%
classic78 Small icon per row 🟢 99.0%
classic79 Wide panoramic banner 🟢 99.8%
classic80 Portrait tall image 🟢 99.8%
classic81 Step by step with images 🟢 99.7%
classic82 Before after images 🟢 99.3%
classic83 Color swatch palette 🟢 99.2%
classic84 Travel destination cards 🟢 99.6%
classic85 Lab results with image 🟢 99.2%
classic86 Software screenshot features 🟢 98.7%
classic87 Sports results with logos 🟢 99.8%
classic88 Image after data 🟢 99.7%
classic89 Nutrition label with image 🟢 99.4%
classic90 Project status with milestones 🟢 97.7%
classic91 Simple bar chart 🟢 96.4%
classic92 Horizontal bar chart 🟢 96.9%
classic93 Line chart 🟢 92.5%
classic94 Pie chart 🟢 92.1%
classic95 Area chart 🟡 76.4%
classic96 Scatter chart 🟢 94.3%
classic97 Doughnut chart 🟢 91.5%
classic98 Radar chart 🟢 95.1%
classic99 Bubble chart 🟢 92.4%
classic100 Stacked bar chart 🟢 95.0%
classic101 Percent stacked bar 🟢 93.6%
classic102 Line chart with markers 🟢 93.0%
classic103 Pie chart with labels 🟡 88.4%
classic104 Combo bar line chart 🟡 81.6%
classic105 3d bar chart 🟡 85.8%
classic106 3d pie chart 🟢 91.7%
classic107 Multi series line 🟡 80.6%
classic108 Stacked area chart 🟢 94.4%
classic109 Scatter with trendline 🟢 92.3%
classic110 Chart with legend 🟡 84.7%
classic111 Chart with axis labels 🟢 92.1%
classic112 Multiple charts 🟡 85.4%
classic113 Chart sheet 🟡 86.4%
classic114 Chart large dataset 🟢 91.6%
classic115 Chart negative values 🟢 92.1%
classic116 Percent stacked area 🟢 93.8%
classic117 Stock ohlc chart 🟡 80.9%
classic118 Bar chart custom colors 🟢 95.5%
classic119 Dashboard multi charts 🟢 91.0%
classic120 Chart with date axis 🟡 76.1%
classic121 Thin borders 🟢 99.7%
classic122 Thick outer thin inner 🟢 99.6%
classic123 Dashed borders 🟢 99.1%
classic124 Colored borders 🟢 99.7%
classic125 Solid fills 🟢 99.2%
classic126 Dark header 🟢 99.5%
classic127 Font styles 🟢 99.6%
classic128 Font sizes 🟢 99.0%
classic129 Alignment combos 🟢 99.8%
classic130 Wrap and indent 🟢 99.5%
classic131 Number formats 🟢 99.6%
classic132 Striped table 🟢 99.0%
classic133 Gradient rows 🟢 99.6%
classic134 Heatmap 🟢 98.8%
classic135 Bottom border only 🟢 99.8%
classic136 Financial report styled 🟢 99.3%
classic137 Checkerboard 🟢 98.4%
classic138 Color grid 🟢 99.4%
classic139 Pattern fills 🟢 99.2%
classic140 Rotated text 🟢 98.1%
classic141 Mixed edge borders 🟢 99.7%
classic142 Styled invoice 🟢 98.3%
classic143 Colored tabs 🟢 100.0%
classic144 Note style cells 🟢 99.6%
classic145 Status badges 🟢 99.1%
classic146 Double border table 🟢 99.6%
classic147 Multi sheet styled 🟢 99.7%
classic148 Frozen styled grid 🟢 97.3%
classic149 Merged styled sections 🟢 98.7%
classic150 Kitchen sink styles 🟢 97.5%
classic151 Multilingual greetings 🟢 93.5%
classic152 Emoji sampler 🟢 91.1%
classic153 Currency symbols 🟢 98.5%
classic154 Math symbols 🟢 95.7%
classic155 Diacritical marks 🟢 99.8%
classic156 Rtl bidi text 🟡 84.0%
classic157 Cjk extended 🟢 91.3%
classic158 Emoji skin tones 🟢 99.3%
classic159 Zwj emoji 🟢 90.6%
classic160 Punctuation marks 🟢 94.4%
classic161 Box drawing 🟢 95.0%
classic162 Cjk emoji styled 🟡 86.5%
classic163 Cyrillic alphabets 🟢 99.6%
classic164 Indic scripts 🟡 87.4%
classic165 Southeast asian 🟢 96.0%
classic166 Emoji progress 🟢 98.6%
classic167 Musical symbols 🟢 90.0%
classic168 Mixed ltr rtl styled 🟢 94.5%
classic169 Korean invoice 🟡 88.4%
classic170 Emoji dashboard 🟢 96.3%
classic171 Ipa phonetic 🟢 97.6%
classic172 Emoji timeline 🟢 95.3%
classic173 African languages 🟢 90.8%
classic174 Technical symbols 🟢 94.4%
classic175 Multiscript catalog 🟢 92.6%
classic176 Combining characters 🟢 94.5%
classic177 Emoji calendar 🟡 88.4%
classic178 Caucasus ethiopic 🟢 96.9%
classic179 Emoji inventory 🟢 91.0%
classic180 Polyglot paragraph 🟢 93.6%

DOCX Benchmark

MiniPdf DOCX output is compared against LibreOffice as the reference renderer across 30 classic test cases.

Category Count Threshold
🟢 Excellent 30 ≥ 90%
🟡 Acceptable 0 70% – 90%
🔴 Needs Improvement 0 < 70%

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

DOCX Visual Comparison

All DOCX test cases comparing MiniPdf output vs LibreOffice reference. Page 1 shown for multi-page results.

MiniPdfLibreOffice (Reference)
classic01 Single paragraph 🟢 99.7%
classic02 Multiple paragraphs 🟢 98.5%
classic03 Headings 🟢 99.5%
classic04 Bold italic 🟢 99.9%
classic05 Font sizes 🟢 99.3%
classic06 Font colors 🟢 99.9%
classic07 Alignment 🟢 99.1%
classic08 Bullet list 🟢 96.7%
classic09 Numbered list 🟢 99.6%
classic10 Simple table 🟢 99.0%
classic11 Table with shading 🟢 96.9%
classic12 Merged cells table 🟢 99.2%
classic13 Long document 🟢 96.8%
classic14 Mixed content 🟢 98.3%
classic15 Indentation 🟢 98.9%
classic16 Line spacing 🟢 98.6%
classic17 Page break 🟢 99.9%
classic18 Embedded image 🟢 98.1%
classic19 Multiple images 🟢 97.4%
classic20 Table with many rows 🟢 97.9%
classic21 Nested lists 🟢 97.2%
classic22 Horizontal rule 🟢 99.6%
classic23 Mixed formatting runs 🟢 99.8%
classic24 Two column table layout 🟢 98.1%
classic25 Title and subtitle 🟢 99.6%
classic26 Table alignment 🟢 99.2%
classic27 Long paragraph wrapping 🟢 96.8%
classic28 Special characters 🟢 99.4%
classic29 Table with image 🟢 98.7%
classic30 Comprehensive report 🟢 98.6%

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 Word(docx) and Excel (.xlsx).

Topics

Resources

License

Stars

Watchers

Forks

Contributors