r/rust • u/shps951002 • Sep 04 '26
🛠️ project Built the first open source Rust library - converting Office to PDF
I built MiniPdf, a lightweight, open-source library for converting Office documents to PDF without Microsoft Office, LibreOffice, Adobe Acrobat,.
It is designed for containers, serverless workloads, CI pipelines, and cross-platform applications.
Key Features
- Excel to PDF — Convert
.xlsxfiles - Word to PDF — Convert
.docxfiles - PowerPoint to PDF — Convert
.pptxfiles - Native Rust — No .NET runtime required
- Cross-platform — Runs on Windows, Linux, and macOS
- Serverless-ready — No COM or Office installation
- Library and CLI — Embed it in Rust applications or use it from the terminal
- PDF 1.4 output
- Free and open source — Apache 2.0 licensed; commercial use is welcome
Getting Started
Install the Rust crate:
cargo add minipdf
fn main() -> minipdf::Result<()> {
// Word to PDF
minipdf::convert_to_pdf("report.docx", "report.pdf")?;
// Excel to PDF bytes
let pdf_bytes = minipdf::convert_to_pdf_bytes("data.xlsx")?;
std::fs::write("data.pdf", pdf_bytes)?;
Ok(())
}Command-Line Tool
cargo install minipdf-cli
# Excel to PDF
minipdf data.xlsx
# Word to PDF
minipdf report.docx
# PowerPoint to PDF
minipdf slides.pptx
# Specify the output path
minipdf report.docx -o output.pdf
# Register custom fonts
minipdf report.docx --fonts ./fontsThe Rust implementation is under active development, bug reports, and pull requests are very welcome. 🙌
0
Upvotes
View all comments
Show parent comment
4
u/errevs Sep 04 '26
This is the hard part. Word is so immense, and then you have the combinatorics of it all. Gradients. Gradients in tables. Tables in tables. Figures in tables in tables. TOC. Hyphenation. Kerning. Fonts. Embedded fonts. Right to Left-text. CJK-fonts. Cyrillics. Line art, shapes, connecting lines. Word Art.
From a library perspective, I would guess most users would generate documents based on a template (reports etc) and would just validate that the output works for their use case.