Simple Flask API to convert Microsoft Word files (DOC/DOCX) to PDF
Note: You'll need to have the latest version of the Docker Engine and Docker Compose installed on your machine
- Clone the repository and cd into it:
git clone https://github.com/codespearhead/doc-to-file-api
cd doc-to-file-api
- Spin up the API
Note: The container will take a while to boot because "libreoffice" is a rather large dependency. Luckily, Flask's built-in web server will auto-reload the Flask app once changes are made to the server.py and saved, since the Flask app's running in debug mode.
docker compose up
- Check if the API is working:
3.1. (UI) Go to http://localhost:5000/doc_to_pdf, select a local DOC or DOCX file, such as the one in ./mre/dummy_doc.docx, then press upload
and see whether a PDF file is either displayed on the browser or downloaded automatically.
3.2. (API) Send a dummy DOC or DOCX file to it via a POST request and see whether a file named "output.pdf" has been created in the project's root directory:
python client.py