This is a web application that converts PDF files into audio files, creating a personalized audiobook experience. Users can upload a PDF, choose a text-to-speech (TTS) engine (offline or online), and generate an audio version of the document. This application supports both offline (using pyttsx3) and online (using Google TTS - gTTS) TTS engines with multiple language options.
- PDF Upload: Upload a PDF document to convert into an audio file.
- TTS Engine Choice: Choose between offline (pyttsx3) and online (Google TTS - gTTS) TTS engines.
- Voice and Language Selection: Customize the narration by choosing different voices or language codes.
- Responsive UI: Designed with Bootstrap for a modern and user-friendly interface.
- Python (for backend processing of PDF and TTS conversion)
- Flask (for handling requests and routing)
- pyttsx3 (offline TTS engine)
- gTTS (Google TTS for online voice generation)
- Bootstrap (for front-end styling)
-
Clone the Repository
git clone https://github.com/yourusername/pdf-to-audiobook.git cd pdf-to-audiobook -
Install Dependencies Install the required Python packages using
pip:pip install -r requirements.txt
-
Run the Application Start the Flask server:
python app.py
-
Access the Application Open your browser and go to:
http://127.0.0.1:5001
- Upload a PDF: Click on the file input to select and upload a PDF document.
- Choose TTS Engine: Select either
pyttsx3(offline) orgTTS(online) from the dropdown menu. - Set Voice/Language Options:
- If you selected
pyttsx3, choose a voice from the dropdown. - If you selected
gTTS, use the search-enabled dropdown to select a language.
- If you selected
- Generate Audiobook: Click the "Generate Audiobook" button to create your audio file.
If using Google TTS (gTTS), you can choose from a variety of language codes:
- en - English
- tr - Turkish
- fr - French
- de - German
- es - Spanish
Note: For more supported languages, see the gTTS documentation.
pdf-to-audiobook/
├── app.py # Main application file
├── templates/
│ └── index.html # Front-end HTML (Bootstrap-based)
├── static/
│ └── style.css # Custom styles (if any)
└── README.md # Project documentation
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Commit your changes:
git commit -m "Add your message" - Push to the branch:
git push origin feature-branch
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Bootstrap for responsive UI components.
- pyttsx3 for offline TTS support.
- gTTS for Google TTS support.
Thank you for using the PDF to Audiobook Converter!
This README file provides all necessary details for setting up, running, and contributing to the project. Make sure to replace placeholder links and paths (e.g., GitHub repository link, your username) with actual information.