Jedisaber.com

Original Content: Home | Books | eBooks | Other | LinksFan Content: Andromeda | Avatars | Anime | Dark Angel | Matrix | Pern | Stargate | Star Trek | Star Wars

ePub.epub eBooks Tutorial Part 3:
Creating the Container and Adding Your Files

 

Other information on ePub:

Reviews of software programs that read ePub files

Where to get books in ePub format

Introduction: What is ePub? | Part 1: Formatting your Source Content | Part 2: Prepare the XML Files | Part 3: Creating the Container and Adding Your Files


Step 3: Put it in the Container

Now we make the .epub container that all these files go in.

  1. Create an empty .zip file with whatever name you like (See notes below for detailed instructions on how to do this.)
  2. Copy the mimetype file into the zip file (don't use compression on this file)
  3. Copy the rest of the files and folders mentioned above into the zip file *
  4. Re-name the .zip extension to .epub

* The specification recommends that the books files go in an "OEBPS" folder inside the zip file. If you put them in another spot, be sure that container.xml in the META-INF folder points to the correct location of the *.opf file. Note also that some readers won't open the book if the content files are not in the OEBPS folder.

The zip file layout should look something like this:

- mimetype
META-INF
   - container.xml
OEBPS
   images
	- sample.jpg
   - content.opf
   - toc.ncx
   - stylesheet.css
   - content.xhtml

You should now be able to open your eBook in Adobe Digital Editions, or any other reader that supports the .epub format.

One thing to note is that the ePub specification calls the mimetype file to be the first file in the container. If you are using a GUI zip program, this is done by making a blank zip file, then copying just the mimetype file into the zip file, then the rest of the files.
If you are using a command line zip utility, then you can either add the mimetype file first, or if your zip program of choice supports adding multiple files/folders at a time, make sure the mimetype file is the first one in the list.

If you want to cheat, download the file below. It's a zip file that has empty chapter pages, and the content and toc files pre filled out, so all you have to do is copy and paste your content into the empty files, and modify the OPF and NCX files.
Blank Sample file

Creating the Container in Windows XP

Below are detailed steps to get your content into a zip file and turn it into an ePub book. (I only have instructions for XP because that's the version of Windows I have. Other versions should be similar.)

  1. Open My Computer or Windows Explorer and navigate to where your book content is.
  2. Right-click on a blank spot, and go to: New>>Compressed (zipped) folder
  3. Type in a new name for the zip file that has been created (leave the .zip on the end. If you don't see the ".zip" at the end of the file name, read the note below.)
  4. Drag the mimetype file onto the zip folder.
  5. Drag the rest of the content onto the zip folder.
  6. Right-click the zip folder, click "Re-name"
  7. Change ".zip" to ".epub"
  8. Click "Yes" when it asks if you're sure if you want to re-name the file.

Note:

Sometimes Windows doesn't show the extensions for files. I think it's trying to be "helpful". Here's how to get it to show them to you:

  1. Open My Computer
  2. Click Tools>>Folder Options
  3. Click the "View" tab.
  4. Remove the check mark next to "Hide extensions for known file types."
  5. Click the "OK" button.
  6. Windows should now show the ".zip" after the name of the zip file, along with the extensions for all the other file types.

 

Creating the Container in OS X

The way the built-in zip support in OS X works makes the process a tad different than on Windows or Linux.

  1. Prepare your content like normal
  2. Right-click the folder the files are in (ensure they are in their own file first) and click "Compress Folder"
  3. Change the "zip" extension to "epub"

The problem with this method is that the mimetype file isn't necessarily added to the zip folder first.
A user at the mobileread forums has created a script file that will do the zipping for you, in the right order. You can get it here: http://www.mobileread.com/forums/showthread.php?t=55681

Note:

I have heard reports of OS X copying metadata files into the container. It's not supposed to do that, but if it does you can do through and delete any folder or file with a period in front of the name.

 

Checking Your ePub file

So you've made a sample ePub book, and it won't open, or it opens with an error, or looks funky. What now?

epubcheck is a program that will scan your ePub file and display any errors it finds in the book.
You can download it here

You can also go to threepress's website to have it scanned online.

If you use Sigil to make your ePubs, it has validation built-in.

For a program to automate of lot of this for you, and that makes creating and editing ePub books a lot easier, and dare I say, fun, check out Sigil. A tutorial on how it works is also on this site, here.


Was this guide useful to you?

You can also follow my blog for updates on books I write, and also some ePub content: http://aarondemott.blogspot.com

Please consider donating a small amount to help pay the server costs. You don't have to, but if you would like to, I'd be very thankful!

Download this Guide

Download this guide as an ePub file (Note: You might have to right-click the link, and select either "Save Link as..." or "Save Target As..."

Comments? Questions?

If you have any comments, notice any bugs, or have any questions on any of the steps here, please e-mail me at: yoda47 (at) jedisaber (dot) com