Converts documents to PDF using libreoffice running in a Docker container without the need to install libreoffice and its dependencies on your host system.
Uses the UNIX way of reading from stdin
and outputting to stdout
, so no volume mounting is needed.
You need to have docker installed on your system. For instructions on how to install, see here:
Image is not yet published to Dockerhub yet, you have to build it locally:
$ docker build -t doctopdf .
Using the --rm
flag ensures that the container is removed after use and does not clutter your docker with unused containers.
$ docker run --rm -i doctopdf < Document.docx > Document.pdf
Alternatively, you could use the cat
command to pipe the input file into the container:
$ cat Document.docx | docker run --rm -i doctopdf > Document.pdf
The image comes with the default debian fonts as well as the non-default Microsoft fonts like Arial
or Times New Roman
by installing the ttf-mscorefonts-installer
package.
Additional TrueType fonts can be placed into the fonts folder. They are copied into the image on build and can then be used in the PDF creation process.
Thanks go to Vlad Hulobiev as the idea is heavily based on his work.