EPUB2PDF Print Perfect
A Python tool that converts EPUB eBooks into beautiful, print-ready PDFs with preserved typography, embedded images, auto-generated tables of contents, and clean chapter breaks.
Overview
Most EPUB-to-PDF converters produce PDFs with broken layouts, missing images, ugly line spacing, and inconsistent typography. EPUB2PDF Print Perfect was built to fix that. The tool takes an EPUB file and produces a PDF that actually looks like a book — typeset cleanly, images embedded and correctly sized, a table of contents that reflects the source, and page numbering that makes sense.
Features
- Clean chapter separation with automatic page breaks so chapters don’t run together on one page.
- Image handling that embeds and resizes artwork to fit the page while preserving aspect ratio.
- Auto-generated table of contents from the EPUB structure, hyperlinked to the corresponding sections.
- Professional typography: justified text, readable line height, proper margins, embedded fonts.
- CSS sanitization that strips broken or hostile stylesheets while preserving useful inline styling.
- Robust parsing that handles malformed EPUBs, encoding issues, oversized images, and broken internal links gracefully instead of crashing.
- Page numbering hidden on the first page, visible from the first chapter onward.
Performance
Converts a typical 300-page book in roughly five seconds on a modern laptop, including full image processing and font embedding.
Tech stack
Python 3.10+, using ebooklib for EPUB parsing, BeautifulSoup4 for HTML cleaning, WeasyPrint for PDF rendering, Pillow for image processing, and tqdm for progress reporting.
Why it exists
I wanted to read a few EPUB-only books on paper, and every existing converter produced something unusable. The tool started as a weekend script and stabilized into a proper utility after it turned out a lot of other people had the same problem.