This is the project with user-friendly and simple interface that perform converting files with .doc/.docx extention to PDF on local Windows/Linux server
- Each of the algorithms (both for Windows and Linux) uses the built-in functions of programs-viewers (such as Microsoft Word for Windows and LibreOffice Writer for Linux) to convert files with .doc/.docx extension to PDFs with minimum errors of conversion.
- All files after the conversion are returned in archive with PDFs (if there are more than one file) or as a single PDF file otherwise.
- In case if the user will choose file(-s) with ".pdf" extension, then the program will send them back =).
Demo.mp4
- Attempt to convert nothing
- Attempt to convert file(-s) with unsupported extensions
errs.mp4
- Clone the project
- Open project directory in console
- Make the scripts' executables:
chmod +x runserver.sh build.sh first-run.sh
source ./first-run.sh
source ./build.sh
source ./runserver.sh
sudo apt install python3
sudo apt install python3-venv
sudo -S apt -y update && sudo -S apt -y install libreoffice
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py makemigrations main
python3 manage.py migrate
python3 manage.py migrate
One command format:sudo apt install python3 && sudo apt install python3-venv && sudo -S apt -y update && sudo -S apt -y install libreoffice && python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt && python3 manage.py makemigrations && python3 manage.py makemigrations main && python3 manage.py migrate && python3 manage.py runserver
source venv/Scripts/activate
python manage.py makemigrations
python manage.py makemigrations main
python manage.py migrate
python manage.py runserver
- Open configurations editor
- Add new configuration
- Python
- Name it as you want
- Set script path (Path to manage.py)
- Set parameters: "runserver"
- Make sure that here is configured your environment
- Go on the generated link.
- The main page will be opened. There you will see two buttons: "Choose files" and "Convert".
- You can choose files on your machine and after that convert them by clicking the same-called buttons.
- Depending on the amount of chosen files, you will receive a single-converted file (if you chose one file) or an archive of converted files otherwise.
- HTML
- CSS
- JavaScript
- JQuery
- Python
- Django
- Django Rest Framework
- Sphinx
- docx2pdf
DocPdf converter has two different modules that allow efficient conversion on both Linux and Windows-based servers. The system identifies the platform it runs on, and, depending on the result, executes corresponding module.
Please, pay attention to the fact the under correct file(s)
in Body param name
we assume all the files with the correct extension:
- .doc
- .docx
- .xls
- .xlsx
To see example requests on Postman, you should firstly accept the invitation
URL | Request type | Body param name | Param value | Response code | Response content | Example |
---|---|---|---|---|---|---|
http://127.0.0.1:8000/convert | POST | files |
single correct file | 200 | single .pdf file |
Postman |
http://127.0.0.1:8000/convert | POST | files |
multiple correct files | 200 | multiple .pdf file |
Postman |
http://127.0.0.1:8000/convert | POST | files |
null | 400 | { "error": "invalid_files", "error_description": "Files field is empty."} | Postman |
http://127.0.0.1:8000/convert | POST | files |
empty file | 400 | { "error": "empty_file", "error_description": "Empty file in your request."} | Postman |