Skip to content

About

Basic text-to-speech Python Script

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Python PDF Reader

A simple Python application that reads PDF files aloud using text-to-speech technology.

Features

  • PDF Text Extraction: Extracts text content from all pages in a PDF file
  • Text-to-Speech: Converts extracted text to spoken audio
  • File Dialog: User-friendly file picker to select PDF files
  • Page-by-Page Processing: Reads each page sequentially

Requirements

  • Python 3.x
  • PyPDF2 (for PDF processing)
  • pyttsx3 (for text-to-speech)

Installation

  1. Install the required dependencies:

    pip install PyPDF2 pyttsx3
  2. Ensure you have Tkinter installed (usually comes with Python):

    • Windows/Mac: Included with Python installation
    • Linux: May need to install separately:
      sudo apt-get install python3-tk

Usage

  1. Run the application:

    python main.py
  2. A file dialog will open. Select a PDF file from your system.

  3. The application will:

    • Read each page of the PDF
    • Extract text from each page
    • Convert the text to speech and play it aloud

How It Works

  1. File Selection: Uses tkinter.filedialog.askopenfilename() to allow users to select a PDF file
  2. PDF Processing: PyPDF2 reads the PDF and extracts text from each page
  3. Text-to-Speech: pyttsx3 initializes a speech engine for each page and converts text to audio
  4. Playback: Audio plays sequentially for each page

Notes

  • The application processes one page at a time
  • Speech speed and voice can be customized via pyttsx3 properties
  • Works with most text-based PDF files
  • Performance depends on PDF size and system capabilities

What Did I Learn

  • PDF Processing: Working with PyPDF2 library to parse and extract text from PDF documents
  • Text-to-Speech Integration: Understanding pyttsx3 for converting text to audio output
  • GUI File Dialogs: Using Tkinter's file picker for user-friendly file selection without building complex UI
  • Sequential Processing: Iterating through multiple pages and processing each one independently
  • Cross-Platform Compatibility: Handling platform differences (Windows/Mac/Linux) for dependencies like Tkinter
  • External Libraries: How to integrate third-party Python packages for specialized functionality
  • User Interaction Flow: Creating simple scripts that guide users through workflows

About

Basic text-to-speech Python Script

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages