On my own time · 2026
Scanned Bengali books to EPUB
A command-line tool that turns a scanned Bengali PDF into a clean EPUB or Kindle file, using AI for the OCR at no cost.
The problem
Many Bengali books exist only as scanned PDFs: page images that cannot be searched, resized or read comfortably on an e-reader. Ordinary OCR handles Bengali script poorly.
What I built
- Pages that already contain real text are read directly. Only image-only pages go to OCR.
- Scanned pages are sent to Google Gemini in small batches, with instructions to keep the reading order and skip page numbers and running headers.
- Each page is saved as soon as it arrives. A run that hits the daily free quota continues the next day from the same page.
- Clean-up joins paragraphs split across pages, applies a growing list of word fixes and splits chapters at headings.
- Calibre builds the EPUB and Kindle files with a Bengali font embedded.
How it works
- Read the PDF
- OCR scanned pages with Gemini
- Save each page
- Clean and split into chapters
- Build EPUB and Kindle files
Results
- About 99% accuracy on a test page with the default model.
- Costs nothing to run: it works within Gemini's free tier.
- Works on Windows and Linux, including drag and drop.
Built with
Python, PyMuPDF, Google Gemini API, Calibre.