An open API service indexing awesome lists of open source software.

https://github.com/codespearhead/word-to-pdf-api

Simple Flask API to convert Microsoft Word files (DOC/DOCX) to PDF
https://github.com/codespearhead/word-to-pdf-api

doc-to-pdf docx-to-pdf pdf-generation word-to-pdf

Last synced: 6 months ago
JSON representation

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

Awesome Lists containing this project

README

        

Doc to PDF API










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](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) 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
```

2. 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
```

3. Check if the API is working:

3.1. (UI) Go to [http://localhost:5000/doc_to_pdf](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
```