office2pdf
Pure-Rust library and CLI for converting DOCX, XLSX, and PPTX files to PDF.
No LibreOffice, no Chromium, no Docker — just a single binary powered by Typst.
Features
- DOCX — paragraphs, inline formatting (bold/italic/underline/color), tables, images, lists, headers/footers, page setup
- PPTX — slides, text boxes, shapes, images, slide masters, speaker notes
- XLSX — sheets, cell formatting, merged cells, column widths, row heights
- PDF/A-2b — archival-compliant output via
--pdf-a - Zero external dependencies — runs as a standalone executable
Installation
Library
[]
= "0.1"
CLI
Quick Start
As a library
// Simple one-liner
let result = convert.unwrap;
write.unwrap;
// With options
use ;
let options = ConvertOptions ;
let result = convert_with_options.unwrap;
write.unwrap;
// In-memory conversion
use Format;
let docx_bytes = read.unwrap;
let result = convert_bytes.unwrap;
write.unwrap;
CLI
# Single file
# Explicit output path
# Batch conversion
# With options
CLI Options
| Flag | Description |
|---|---|
-o, --output <PATH> |
Output file path (single input only) |
--outdir <DIR> |
Output directory for batch conversion |
--paper <SIZE> |
Paper size: a4, letter, legal |
--landscape |
Force landscape orientation |
--pdf-a |
Produce PDF/A-2b compliant output |
--sheets <NAMES> |
XLSX sheet filter (comma-separated) |
--slides <RANGE> |
PPTX slide range (e.g. 1-5 or 3) |
--font-path <DIR> |
Additional font directory (repeatable) |
Supported Formats
| Format | Status | Key Features |
|---|---|---|
| DOCX | Supported | Text, tables, images, lists, headers/footers, page setup |
| PPTX | Supported | Slides, text boxes, shapes, images, masters |
| XLSX | Supported | Sheets, formatting, merged cells, column/row sizing |
License
Licensed under Apache License, Version 2.0.