jdkcn / unoservice

A docker container for LibreOffice and unoconv, used to generate PDF files from office-type documents.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LibreOffice PDF generator service

A docker container environment to bundle the execution of unoconv, a command-line utility that uses LibreOffice to convert documents of various types (such as Word, OpenDocument, etc.) to PDF.

An instance of LibreOffice will be run in the background, and used by multiple requestors to perform the necessary conversions.

To build, run:

docker build --rm -t unoconv .

To start the container, run:

docker run -it -m 512m \
  --name unoservice -p 3000:3000 \
  --tmpfs /tmp unoconv

You can use your custom fonts dir for add extra fonts, run:

docker run -m 512m -i -t -d -p 3000:3000  \
  --restart=always --name unoservice \
  --tmpfs /tmp \
  -v /data/unoservice/fonts:/usr/share/fonts/truetype/custom unoconv

Now, files can be sent to the service:

curl -o mydoc.pdf -F format=pdf -F 'file=@mydoc.docx' http://localhost:3000/convert

About

A docker container for LibreOffice and unoconv, used to generate PDF files from office-type documents.

License:MIT License


Languages

Language:Python 96.0%Language:Makefile 4.0%