Skip to content

codespearhead/word-to-pdf-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation




Simple Flask API to convert Microsoft Word files (DOC/DOCX) to PDF


QuickStart

Note: You'll need to have the latest version of the Docker Engine and Docker Compose installed on your machine

  1. Clone the repository and cd into it:
git clone https://github.com/codespearhead/doc-to-file-api
cd doc-to-file-api
  1. 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
  1. 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