Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 1.21 KB

readme.md

File metadata and controls

33 lines (21 loc) · 1.21 KB

LibreOffice Headless with API in Docker

Docker Pulls

A docker image that will run LibreOffice in headless mode, exposing its Universal Network Objects (UNO) API on port 8100.

I use this together with 2 brilliant Java libraries (jodconverter and jodreports) that consume the API to convert documents and generate reports based on ODT templates.

For convenience I also include the Universal Office Converter (unoconv) tool in the image.

Usage

Run

docker run -d --name libreoffice -p 8100:8100 hdejager/libreoffice-api

Try out unoconv (convert a HTML file to PDF):

docker cp test.html libreoffice:/tmp/test.html
docker exec -ti libreoffice \
unoconv \
  --connection 'socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;StarOffice.ComponentContext' \
  -f pdf /tmp/test.html
docker cp libreoffice:/tmp/test.pdf .