librex_imgs v1.0.2 LibrexImgs

Provides functions to convert office documents, spreadsheets, presentations, and images to other formats.

LibreOffice must be installed. It’s recommended that you add the soffice binary your PATH. Otherwise you have to specify the absolute path to the soffice binary as the last parameter.

Examples

iex(1)> LibrexImgs.convert(“test/fixtures/docx.docx”, “/Users/ricn/docx.pdf”)

{:ok, "/Users/ricn/docx.pdf"}

iex(2)> LibrexImgs.convert(“non_existent_file”, “/Users/ricn/docx.pdf”)

{:error, :enoent}

iex(3)> LibrexImgs.convert!(“test/fixtures/docx.docx”, “/Users/ricn/docx.pdf”)

“/Users/ricn/docx.pdf”

iex(4)> LibrexImgs.convert!(“non_existent_file”, “/Users/ricn/docx.pdf”)

** (File.Error) could not read non_existent_file: no such file or directory (librex) lib/librex.ex:13: LibrexImgs.convert!/3

iex(5)> LibrexImgs.convert(“test/fixtures/docx.docx”, “/Users/ricn/docx.pdf”, “/path_to/soffice”)

{:ok, "/Users/ricn/docx.pdf"}

Link to this section Summary

Functions

Converts in_file to out_file Returns :ok if successful, {:error, reason} otherwise

The same as convert/3, but raises an exception if it fails

Returns supported document formats

Returns supported image formats

Returns supported presentation formats

Returns supported spreadsheet formats

Link to this section Functions

Link to this function convert(in_file, out_file, soffice_cmd \\ "soffice")

Converts in_file to out_file Returns :ok if successful, {:error, reason} otherwise.

Link to this function convert!(in_file, out_file, soffice_cmd \\ "soffice")

The same as convert/3, but raises an exception if it fails.

Link to this function supported_document_formats()

Returns supported document formats

Link to this function supported_image_formats()

Returns supported image formats

Link to this function supported_presentation_formats()

Returns supported presentation formats

Link to this function supported_spreadsheet_formats()

Returns supported spreadsheet formats