Home | Links | Updates | Andromeda | Avatars | Anime | Dark Angel | eBooks | Matrix | Other | Pern | Stargate | Star Trek | Star Wars
Because it's a completely open and free standard.
The .epub is a standard for eBooks created by the International Digital Publishing Forum.
It consists of basic XHTML for the book content, XML for descriptions, and a re-named zip file to hold it all in.
Anyone can make these eBooks, and since they're essentially just XHTML, anyone can read them.
Currently, the only reader that I've been able to get to open them is Adobe Digital Editions. Several other readers claim to be able to read the format, or plan to have support for it very soon,
but for now Adobe's reader is the only one that I, personally, have gotten to work fully. I hope to be able
to update this page with several more readers that support this format very soon.
(Update: 9/10/2007 - See above for notes on FBReader and Mobipocket.)
Yes, I'm aware that Adobe InDesign and several other soon to be released programs can automate the process,
but I don't have the $600 or so to spend on them, and the format is completely open, so we can do this ourselves
with free tools.
One other note: I figured out the information in this guide by a combination of reverse engineering
the Sherlock Holmes book from Adobe's site, reading through the specs at the IDPF web site, and trial
and error until I got a working eBook to load properly in Digital Editions. (I figure it's OK to do
that since Holmes is in the public domain now...)
Some books in the IDPF .epub format are avaliable here.
Tools Needed:
- A text editor. Anything that can edit text files, HTML, and XML. Example: Notepad
- A .zip program. Anything that can create .zip files. Example: Windows XP's built-in .zip support
The Process can be broken down into two parts:
1. Prepare the content
2. Put in in the container.
First, let's go check out the official specs. Yes, it's very boring and hard to follow,
but aren't they all?
These will come in handy later on though. After getting the basic structure of the file setup,
the official specs are handy to reference for tags that aren't used very often, or if you can't
remember what exactly goes in a certain tag.
Don't let them scare you though, we really only have to fiddle with two XML files, the rest is
either straight XHTML, or files that you can copy from the sample file that we'll be looking at later.
IDPF Specs:
(Allowed Mark-up reference for included XHTML files)
Structure
Container
Before we start preparing our own eBook, lets look inside a sample file.
Great. Now what is all this stuff?
A .epub file contains, at a bare minimum, the following files/folders:
Lets look at each of these in more detail.
Feel free to extract these files and use them as a template...
One thing to note before we get started: At least in Digital Editions, the filenames are
case sensitive.
This means that if you have a file named "Chapter1.htm" and you refer to it as
"chapter1.htm" in the .OPF file or .NCX file, the book will not display properly.
mimetype
This file is just a plain ASCII text file that contains the line:
"application/epub+zip"
This file isn't needed to get the eBook to open in Adobe Digital Editions,
but it's listed in the specs, so it should be there.
Idealy, the operating system can look at this file to figure out what a .epub
file is instead of using the file extention.
This file should be the first file in the zip file, and should not be compressed.
META-INF Folder
This contains the container.xml file, which points to the location of the
Content.opf file.
This folder is the same for every e-book, so you should be able to recycle the whole
folder from the sample file without making changes.
OEBPS Folder
images Folder
If you have any images for your eBook, they go in here.
Content.opf
This file gives a list of all files in the .epub container, defines the order of files,
and stores meta data (author, genre, publisher, etc.) information.
Note that this file can be named anything you want to call it, as long as the container.xml
file mentioned above points to the correct filename.
Lots of stuff in this file. I'll go through each required tag here. Check the specs to see more information about optional meta data tags.
dc:title - Title of the book
dc:language - Identifies the language used in the book content. The content has to comply
with RFC 3066.
List of lanuague codes.
(I'd just copy the language tag from the sample...)
dc:identifier - This is the book's unique ID. This has to be a unique identifier for ever different e-book.
The spec doesn't give any sort of recommendation for what to use, but an ISBN number would be a good bet.
I used the name of my web site and the date and time.
One thing to note, because of how the file interacts with toc.ncx, just modify what's after the "
uuid:" on this line.
Next comes the manifest. This is just a listing of the files in the .epub
container, and their file type.
Each item is also assigned an item ID that's used in the spine section of content.opf.
This list does not have to be in any perticular order.
The spine lists the reading order of the contents. The spine doesn't have to list every file in the manifest, just the reading order. For example, if the manifest lists images, they do not have to be listed in the spine.
toc.ncx
This is the table of contents. This file controls what shows up
in the left Table of Contents pane in Digital Editions
Things you need to change:
- Make sure the uid matches what you have in content.opf
- doctitle: The text inside the text tag is what will show up as the books title in the reader software
- The navpoint tag.
Each nav point is a chapter listing, the text is the chapter name, and the src is the file it links to.
If you copy a navpoint tag set to add chapters, make sure to update the id and playorder values.
Special notes about this file: Perhaps I did something else wrong, but it seems that your title page has
to be named "title_page.html" for it to show up properly as the title page in Digital Editions...
page-template.xpgt
This file isn't part of the IDPF spec, but Adobe Digital Editions uses it for formating
and setting column settings and whatnot. You don't need this file at all, but your book
will look nicer in Digital Editions if you include it. Other readers should just ignore it.
Note: You can use a .css style sheet file to layout styles for your book as well. Just make sure to list it in the manifest section of Content.opf
Now we make the .epub container that all these files go in.
* The specification recommends that the books files go in an "OEBPS" folder inside the zip file. If so, be sure that container.xml in the META-INF folder points to the correct location of the *.opf file.
You should now be able to open your eBook in Adobe Digital Editions, or any other reader that supports the .epub format.