Developing an E-book Reader Mobile Application
Building a reader that just opens EPUB is a week's work. Building one people enjoy using is different. Smooth scrolling through long chapters, correct CSS rendering from EPUB3, syncing reading position across devices, night mode without artifacts—each requires separate solutions.
Formats and Rendering
Main formats: EPUB 2/3, PDF, FB2, sometimes MOBI/AZW3.
EPUB
EPUB is a ZIP archive with HTML/CSS/XML inside. Rendering without intermediate layer won't work natively.
Readium is the de facto standard for mobile readers, open source. Readium Swift Toolkit (iOS) and Readium Kotlin Toolkit (Android) support EPUB 2/3, PDF, audiobooks, LCP DRM. Used by Litres Library, Storytel, and many others.
Readium renders EPUB via built-in WKWebView / WebView with JavaScript engine injection. Gives full CSS support, including custom fonts and complex typography.
// iOS — open book via Readium
let publication = try await streamer.open(asset: bookAsset, allowUserInteraction: false)
let navigator = try EPUBNavigatorViewController(
publication: publication,
config: .init(
editingActions: EditingAction.defaultActions,
fontOverrides: userSettings.fontOverrides
)
)
iOS: PDFKit (native, fast, supports annotations). Android: PdfRenderer (built-in, basic) or PdfiumAndroid for complex docs with vector graphics.
FB2
Custom XML parser + render via TextView (Android) / AttributedString (iOS). Or convert to EPUB on server/device via fb2c or Calibre-like logic.
Reading Preferences
Font, size, line spacing, margins, theme (light/dark/sepia)—stored locally in UserDefaults / SharedPreferences, applied via CSS injection in Readium:
val preferences = EPUBPreferences(
fontFamily = FontFamily.GEORGIA,
fontSize = Percentage(1.2),
lineHeight = Double(1.5),
theme = Theme.SEPIA
)
navigator.submitPreferences(preferences)
Important: app theme and reader theme are separate. User reads in dark mode but switches system to light—reader shouldn't auto-change theme. Reader settings are independent.
Progress and Bookmarks
Current reading position: Locator in Readium terms. Object with href (chapter path), progression (0.0–1.0 within chapter), text fragment for precise position recovery after book update.
Bookmarks, annotations, highlights: save to Room / Core Data as Annotation(bookId, locator, text, color, note).
Cross-Device Sync
If sync needed—position and annotations go to server on each change. WorkManager / BGTaskScheduler sends accumulated changes when connected. Conflicts by timestamp: later position wins.
Readium supports OPDS Annotations—if server supports, sync nearly free.
Book Library and Downloads
Books stored in Files (iOS) / filesDir (Android)—not cacheDir, OS will delete on space shortage. iOS 16+ can use FileManager with ubiquityContainerIdentifier for iCloud file sync.
Download via URLSession.downloadTask (iOS) / DownloadManager (Android) with resume (resumeData). Show progress in library.
Full-text search inside EPUB—index all chapter text in FTS4/FTS5 Room table.
Common Issues
- Custom fonts from EPUB3 (
@font-face) don't load if CSS path is../Fonts/—need path normalization -
WKWebViewon iOS truncates long pages ifisScrollEnabled = false—need proper pagination config - PDF with embedded CJK fonts on
PdfRendererAndroid—rendering artifacts, need Pdfium
Work Scope
- EPUB 2/3 via Readium Toolkit
- PDF rendering with native tools
- Font, theme, spacing settings
- Bookmarks and highlights with notes
- Cross-device progress sync (if needed)
- Library with offline download and content search
Timeline
Basic reader EPUB/PDF with settings and bookmarks: 3–5 weeks. Full app with sync, text search, annotations, multi-format support: 8–10 weeks. Pricing after determining format support and sync requirements.







