Simple GUI
A Tkinter desktop window with drag-and-drop (tkinterdnd2), file picker, page count, and a live progress bar.
// Personal Project · Case Study
A little desktop app I built after buying a friend a Kindle as a gift. The Albanian books they wanted to read only existed as PDFs, a lot of them scanned, and every converter I tried turned the text into a mess. So I wrote one that doesn't.
I bought a friend a Kindle as a gift, but the Albanian books they wanted weren't sold in any format it could read. They only existed as PDFs, and a lot of them were scanned images rather than real text.
I went through a dozen online PDF to EPUB converters and they all fell over the same way.
Scanned files came out as unreadable image blobs, and the handful that tried OCR
butchered Albanian's special letters. Every ë and
ç came out as garbage, which made the whole book pointless. So I decided to
write my own.
The trick is realising that not all PDFs are the same. One that was written digitally already has selectable text inside it, while a scanned book is really just photos of pages. The converter figures out which one it's looking at and handles it accordingly.
sqi+eng).def _is_scanned(doc) -> bool: for i in range(min(5, len(doc))): if doc[i].get_text().strip(): return False return True
That's the whole detection step: if none of the first five pages has any text to pull out, the PDF is a scan and goes through OCR.
Generic OCR has no idea about Albanian, so it keeps misreading the accented letters. Fixing it came down to two things: pointing Tesseract at the Albanian language pack, and then cleaning up the few mistakes that still slipped through.
Tesseract on its own
Një ditë vendosi ta shkruante vetë fundin e tregimit. Mori njé fletore të re, ndezi llambën dhe filloi: «Cdo gjë që ka réndési, fillon me një faqe të bardhe.»
After the clean-up, in the EPUB
Një ditë vendosi ta shkruante vetë fundin e tregimit. Mori një fletore të re, ndezi llambën dhe filloi: «Çdo gjë që ka rëndësi, fillon me një faqe të bardhë.»
misread fixed
A Tkinter desktop window with drag-and-drop (tkinterdnd2), file picker, page count, and a live progress bar.
Conversion runs on a background thread so the window never freezes, reporting per-page progress back to the UI.
PyMuPDF for parsing & rendering, Tesseract for OCR, ebooklib for spec-compliant EPUB output with a TOC.
Packaged into a standalone Windows .exe with PyInstaller, so there's no Python install needed to run it.
It ended up doing the one thing nothing else could, and it's genuinely in use: