Along with the iPad last week Apple announced iBooks with support for the ePub format and iBookstore. We don’t know the details of what will be available, what we will be able to do, or how we will interact with it but I was curious about the iPub format and am sure it will see increased activity and interest in the future.
The format spec can be found at International Digital Publish Forum and can be a little daunting at first. ePub is a combination of different formats including Open Packaging Format (OPF), Open Publication Structure (OPS) and the OEBPS Container Format (OCF). Don’t let all that scare you though, it turns out an ePub ‘book’ is a zipped file of XML, XHTML and related assets (CSS, images, etc).
There are lots of free ePubs on the net. Check out Feed Books and find something that interests you. I suggest you download and unzip it. The easiest way to do that is to change the extension from .ePub to .zip or use the unzip command in a terminal window.
The unzipped folder will contain a:
- mimetype file with a single line that says “application/epub+zip”
- META-INF directory with the container.xml file and a link to the OPF file
- and the payload directory, typically OEBPS, with the actual book content.
The OPF file is important because it contains the following sections:
- metadata - info about the book
- manifest - list of the assets in the book and a pointer to the table of contents
- spine - the reading order of the book
To use an ePub in an application one would probably want to unzip the file, parse the META-INF/container.xml file. Look for the rootfile entry with the path to the content OPF file, parse the OPF file and start showing the user which ever pages you want. Its not as complicated as it might seem at first.
Hope this encourages you to explore this format and create exciting new content, tools and applications.
Links:

Post new comment