EPUB: Server-side pagination
EPUB file format has been widely adopted as a format for digital books. EPUB specification is very comprehensive, it defines:
- EPUB Container, XHTML files in a zip container.
- EPUB Package, a way to relate components of an EPUB to each other. This may include various metadata, index, table of contents and spine information.
- EPUB Canonical Fragment Identifier (CFI), a mechanism for describing a location within an EPUB.
- Media Overlays, which allow to synchronize audio tracks with text content in a book.
and various other technical standards. The latest spec is EPUB 3.1.
There are two omissions however, namely searching and pagination. We will describe searching in a future article and tackle pagination today.
Pagination is used to determine where you are in the book. Pagination is simple for physical books. Each page gets a number assigned, in sequence. For EPUB books the story is more complicated. EPUB, by nature, is an HTML page. The number of screens in a book will ultimately depend on the physical size of the device. Imagine reading Moby Dick on a 12.9” iPad Pro vs the original iPhone. Many reader vendors simply display a screen number. For example iBooks and Kindle determine the total number of screens in a book and display the user’s position within the book that way. However this causes headaches in the classroom. Imagine the teacher asks you to turn to page 322 in Moby Dick. Using Apple’s addressing scheme, page 322 will be different on an iPhone vs an iPad. Not a good user experience.
In ActiveTextbook we’ve decided to go in a different direction. We developed server side functionality that generates pagination metadata that ensures that page numbers are consistent across the devices. This guarantees that page 322 of Moby Dick starts in exactly the same point on an iPad as it does on an iPhone as it does 30” 4K monitor.
EPUB specification defines a page-list nav element that allows publishers to map print page to “logical” pages. In our experience not many publishers take advantage of this functionality. Our server-side process creates standards compliant page-list nav set of elements that allow Readium/ActiveTextbook to determine position within the book regardless of the physical screen size of the device.
This is the first of the two part articles about the server side processing we do to make EPUBs reacher. Next instalment will cover searching.