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
- Host: GitHub
- URL: https://github.com/codespearhead/word-to-pdf-api
- Owner: codespearhead
- License: apache-2.0
- Created: 2023-02-25T00:25:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-31T03:30:53.000Z (over 1 year ago)
- Last Synced: 2024-12-03T12:55:06.336Z (6 months ago)
- Topics: doc-to-pdf, docx-to-pdf, pdf-generation, word-to-pdf
- Language: Python
- Homepage:
- Size: 49.8 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```