Skip to content

Navigation Menu

Sign in
Sign up

Is this ready to render EPUB books? #3

Unanswered
finnvyrn asked this question in Q&A
Discussion options

Is this ready to render EPUB books?

You must be logged in to vote

Replies: 1 comment

Comment options

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:

  1. 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.xhtml and EPUB 2 toc.ncx navMap).
  2. Internal Image & Resource Resolver:
    • Resolves internal relative image paths (<img src="..."> inside the archive) directly to memory buffers via HyperViewer.imageLoader.
  3. 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!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /