libreoffice-rs

Crates.iolibreoffice-rs
lib.rslibreoffice-rs
version0.3.3
sourcesrc
created_at2022-05-19 05:45:40.298991
updated_at2023-04-14 02:57:32.52627
descriptionRust binding for LibreOfficeKit
homepage
repositoryhttps://github.com/undeflife/libreoffice-rs
max_upload_size
id589518
size60,062
Sean Pan (undeflife)

documentation

README

libreofficeKit-rs

Rust bindings to LibreOfficeKit

Installation

[dependencies]
libreoffice-rs = 0.3

you need install LibreOffice ( >= 6.0 is recommended ), Debian 11 for example:

$ sudo apt-get install libreoffice libreofficekit-dev clang
# set env variable `LO_INCLUDE_PATH` to the LibreOffice headers.
$ export LO_INCLUDE_PATH=/usr/include/LibreOfficeKit

due to this issue , here use a libwrapper.a to carry static funtion lok_init which defined in LibreOfficeKitInit.h.

Example

use libreoffice_rs::{Office, LibreOfficeKitOptionalFeatures, urls};

fn main() -> Result<(), Box<dyn std::error::Error>> {
  // your libreoffice installation path
  let mut office = Office::new("/usr/lib/libreoffice/program")?;
  let doc_url = urls::local_into_abs("./test_data/test.odt")?;
  let mut doc = office.document_load(doc_url)?;
  doc.save_as("/tmp/test.pdf", "pdf", None);
  Ok(())
}

License

This project is licensed under the [Apache License 2.0][license]

Commit count: 47

cargo fmt