-
Notifications
You must be signed in to change notification settings - Fork 5
Is this ready to render EPUB books?
All reactions
-
👀 1
Replies: 1 comment
Hi @finnvyrn,
Yes, EPUB rendering is fully supported! 🚀
We provide a dedicated modular package: hyper_render_epub designed specifically to unzip, parse, and render EPUB containers seamlessly with HyperViewer.
✨ Key EPUB Capabilities:
- Container & Manifest Parser (
EpubBook.open):- Parses
META-INF/container.xml, OPF package documents (dc:title,dc:creator, cover image, manifest, spine). - Resolves full Table of Contents (supports both EPUB 3
nav.xhtmland EPUB 2toc.ncxnavMap).
- Parses
- Internal Image & Resource Resolver:
- Resolves internal relative image paths (
<img src="...">inside the archive) directly to memory buffers viaHyperViewer.imageLoader.
- Resolves internal relative image paths (
- E-Reader Layout Modes:
HyperRenderMode.paged: Page-by-page reader UI with gesture navigation and chapter overflow scroll.HyperRenderMode.virtualized: Continuous scrolling for large chapters with zero memory spikes.- CSS Floats & Typography: Full Furigana/Ruby, Kinsoku line-breaking, and float layouts inside chapters.
💻 Quick Example:
import 'package:flutter/services.dart'; import 'package:hyper_render/hyper_render.dart'; import 'package:hyper_render_epub/hyper_render_epub.dart'; Future<void> loadEpub() async { // 1. Open the EPUB archive final bytes = await rootBundle.load('assets/book.epub'); final book = await EpubBook.open(bytes.buffer.asUint8List()); print('Loaded: "${book.title}" by ${book.author}'); final chapter = book.chapters.first; // 2. Render with HyperViewer HyperViewer( html: chapter.htmlContent, mode: HyperRenderMode.paged, // or HyperRenderMode.virtualized imageLoader: book.imageLoader, // resolves archived image assets ); }
Check out the runnable example in packages/hyper_render_epub/example/example.dart for a complete reader implementation.
Let us know if you run into any specific book formatting requirements!
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment