This project allows you to translate PDF files into other languages using the WebAI to API service. The script extracts the text from each page of a PDF and sends it to your WebAI to API server for translation. The final result is saved in a Word (.docx) file with two columns: the original text and the translated text.
This project is especially useful for students, researchers, translators, and anyone who needs to quickly and efficiently translate PDF documents.
Open the config.ini
file and adjust the settings if needed.
Note: The default settings are pre-configured. If you are running WebAI to API with the same configuration, you do not need to change anything.
Before running the project, make sure the following are installed:
- Python 3.10 or higher (version 3.13 is currently used)
- Poetry (for dependency management)
curl -sSL https://install.python-poetry.org | python3 -
-
Visit the following address:
-
Run the installer script using Python. For example, in PowerShell, enter:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
- After installation, you may need to add the following path to your
PATH
environment variable:
%USERPROFILE%\AppData\Roaming\Python\Scripts
To confirm the installation, run
poetry --version
in your terminal.
Once the prerequisites are installed, navigate to the project directory and run:
poetry install
To run the main script, use the following command:
poetry run python main.py
This project is released under the MIT License. Feel free to modify and use it.
2025