Expand description
Pure-Rust conversion of Office documents (DOCX, PPTX, XLSX) to PDF.
§Quick start (native only)
let result = office2pdf::convert("report.docx").unwrap();
std::fs::write("report.pdf", &result.pdf).unwrap();§With options (native only)
use office2pdf::config::{ConvertOptions, PaperSize, SlideRange};
let options = ConvertOptions {
paper_size: Some(PaperSize::A4),
slide_range: Some(SlideRange::new(1, 5)),
..Default::default()
};
let result = office2pdf::convert_with_options("slides.pptx", &options).unwrap();
std::fs::write("slides.pdf", &result.pdf).unwrap();§In-memory conversion (works on all targets including WASM)
use office2pdf::config::{ConvertOptions, Format};
let docx_bytes = std::fs::read("report.docx").unwrap();
let result = office2pdf::convert_bytes(&docx_bytes, Format::Docx, &ConvertOptions::default()).unwrap();
std::fs::write("report.pdf", &result.pdf).unwrap();Modules§
Functions§
- convert
- Convert a file at the given path to PDF bytes with warnings.
- convert_
bytes - Convert raw bytes of a known format to PDF bytes with warnings.
- convert_
with_ options - Convert a file at the given path to PDF bytes with options.
- render_
document - Render an IR Document to PDF bytes.