/convert-document

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

Primary LanguagePythonMIT LicenseMIT

convert-document

A docker container environment to bundle the execution of 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 controlled via a local socket (i.e. the UNO protocol).

Usage

This service is intended for use exclusively as a docker container. While it may be possible to run this application stand-alone, this is not recommended. For normal usage, you should pull the latest stable image off DockerHub and run it like this:

docker pull alephdata/convert-document
docker run -p 3000:3000 -ti alephdata/convert-document

Once the service has initialised, files can be sent to the /convert endpoint, and a PDF version will be returned as a download:

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

Development

To build, run:

docker build --rm -t alephdata/convert-document .

To get a development shell:

make shell

Forced restart

make build && docker-compose -f docker-compose.dev.yml stop convert-document && docker-compose -f docker-compose.dev.yml up -d convert-document

License

MIT, see LICENSE.

Troubleshooting

  • LibreOffice keeps crashing on startup with Fatal exception: Signal 11

If AppArmor is running on the host machine, it may be blocking LibreOffice from starting up. Try disabling the AppArmor profiles related to LibreOffice by following these instructions: https://askubuntu.com/a/1214363