A PDF-to-HTML reader with Microsoft Edge neural text-to-speech (TTS) and word-level audio synchronization.
Extracts text directly from PDFs with embedded text layers, falling back to OCR for scanned documents.
- Direct Text Extraction: Extracts selectable text layers without OCR overhead across Windows, macOS, and Linux.
- OCR Fallback: Optical character recognition for scanned documents (native
winocron Windows;pytesseracton macOS/Linux). - Edge Neural TTS: Proxies text to Microsoft Edge neural voice endpoints with SQLite caching for audio segments.
- Web Reader UI: Responsive reader with synchronized word-by-word highlighting, playback speed and volume controls, themes, image filters, and keyboard shortcuts.
- Offline Mode: Falls back to the browser Web Speech API when the local backend server is offline.
Install requirements directly:
pip install -r requirements.txtInstall the package to expose the pdf-tts CLI tool on your system path:
pip install .Run run_server.bat to start the local server and open the most recently converted document in the default web browser.
If installed via pip install .:
pdf-tts [file.pdf | file.html] [options]Or run directly with Python:
python -m pdf_to_speech.cli [file.pdf | file.html] [options]Running pdf-tts without arguments:
- Scans the current directory for
.htmlfiles and serves the newest document. - If no
.htmlfile is found, converts the newest.pdfinto an HTML reader and starts the server.
positional arguments:
file Path to the PDF to convert, or HTML to serve.
options:
-h, --help show this help message and exit
--convert, -c Force conversion and text extraction of the PDF.
--serve, -s Start the local TTS web server.
--output OUTPUT, -o OUTPUT
Custom output path for the generated HTML.
--port PORT, -p PORT Port to host the server (default: 8000).
--host HOST Host address to bind the server (default: 127.0.0.1).
--lang LANG, -l LANG Language code for OCR (default: hu for Hungarian).
--force-ocr Force OCR processing even if PDF has a text layer.
- Convert a PDF and run the server (auto-detects text layer):
pdf-tts book.pdf
- Force OCR on a PDF with a text layer:
pdf-tts book.pdf --force-ocr
- Serve an already converted HTML reader on a custom port:
pdf-tts book.html --port 9000
- Convert a document using language-specific OCR:
pdf-tts spanish_book.pdf --lang es