Crates.io | office-convert-server |
lib.rs | office-convert-server |
version | 0.0.2 |
source | src |
created_at | 2024-08-23 08:39:20.716637 |
updated_at | 2024-09-20 08:22:59.366923 |
description | HTTP server for converting office file formats to PDFs |
homepage | |
repository | https://github.com/jacobtread/office-convert-server |
max_upload_size | |
id | 1348887 |
size | 70,902 |
Simple server for converting office file formats into PDF files built on top of LibreOffice
Requires LibreOffice and LibreOfficeKit
Debian:
sudo apt-get install libreoffice libreofficekit-dev clang
[!NOTE] On Debian bullseye you may not have the latest version of the libreofficekit-dev package which will likely cause the build to fail due to missing functions. I recommend building using Fedora or using Debian Bookworm with the "Bookworm Backports" package repo, which you can add using the following command:
echo "deb http://deb.debian.org/debian bookworm-backports main" | sudo tee /etc/apt/sources.list.d/bookworm-backports.list > /dev/null
The install libreofficekit-dev through that package repo:
sudo apt-get -t bookworm-backports install -y libreofficekit-dev
Fedora:
sudo dnf install libreoffice libreoffice-sdk libreofficekit-devel clang
Ensure you set the following environment variable:
export LO_INCLUDE_PATH=/usr/include/LibreOfficeKit
The server requires the following environment variables.
.env files will be loaded from the same and parent directories of the server
SERVER_ADDRESS=0.0.0.0:3000
LIBREOFFICE_SDK_PATH=/usr/lib64/libreoffice/program
Update LIBREOFFICE_SDK_PATH
your specific LibreofficeSDK path. This is NOT your Libreoffice path
You can build the binary within docker using the following steps:
Build the docker image from the Dockerfile
docker build -t office_convert .
Create a temporary container for the converter
docker create --name temp_container office_convert
Then copy the binary from the container to your host:
docker cp temp_container:/app/office-convert-server ./office-convert-server
Once you have the binary on your host, you can remove the temporary container:
docker rm temp_container