Creating and Formatting EPUB with InDesign

It’s possible to format just about any book in InDesign so that it will export as a perfect EPUB file–I’m just not sure it’s worth the effort in all cases.

I frequently work on books that contain hundreds of photographs and other design elements apart from the main text. Since almost all of the books I work on are going to be printed, my number one priority is to maintain the integrity and accuracy of the typeset pages without introducing extra EPUB formatting that might cause elements to shift on the final printed pages.

All text and images must be linked to flow in a continuous thread for InDesign to create an EPUB file that contains all of the text and images in the proper order. All unlinked text and images are placed at the end of the linked/main text of the EPUB file, in the order the elements appear on the pages.

It can be very difficult and time consuming to format some books as a single, flowing text block. I’ve gone back and forth on whether it’s best to do all of the hard work of linking all of the elements–text, images, captions, boxes, sidebars, etc.–upfront in the InDesign file or to edit and rearrange the elements in the EPUB file at the end of the job.

Sometimes it makes sense and is easier and faster to typeset the pages in InDesign without linking all of the various elements. This means that you will have to use an xhtml editor such as Adobe DreamWeaver or the <oXygen/> XML editor to cut and paste the unlinked elements into their proper positions within the flowing text.

These are the steps I use to create EPUB files from InDesign:

1. Create a new “Book” in InDesign that includes all of the InDesign files in the order they should appear in the eBook, including an InDesign file of the book’s cover. The cover is usually supplied to me as a jpeg or PDF file. I place the cover image jpeg or PDF into an InDesign file and place that file at the top of the list of the InDesign files in the eBook.

2. Choose “Export book to EPUB” from the pulldown menu in the “Book” window. I uncheck the “Include Document Metadata” box in the General window and the “Include Embeddable Fonts” box in the Contents window. I leave all other settings on the InDesign default settings. It usually takes InDesign less time to create an EPUB file than to make a comparable PDF file.

To access the xhtml files from the EPUB file for opening and editing with an xhtml editor such as Adobe DreamWeaver, yo have to “unstuff” the EPUB file using the Stuffit Expander program. The unstuffed EPUB file will contain two folders–“META-INF” and “OEBPS”–and a file named “mimetype.”

The OEBPS folder contains all of the xhtml files for the book, with one xhtml file for each of the InDesign files used to make up the book. I usually create individual files for each chapter of a book, with a single InDesign file for the frontmatter pages, although some publishers prefer to have books in a single InDesign file.

If the entire book is contained in a single InDesign file, there will only be one xhtml file in the OEBPS folder.

I use Adobe DreamWeaver to open/edit the xhtml files. Using the final typeset InDesign pages as a guide, I cut and paste all of the unlinked elements at the end of the xhtml file into their proper positions in the flowing text, and also correct and remove any unneeded formatting that may have come through from the InDesign file, such as extra or forced paragraph breaks.

IMPORTANT NOTE: The EPUB file created directly from InDesign will not pass the validation required by ibookstores. For the files to be validated and usable, the content.opf file, which is in the OEBPS folder, must be modified.

Open the content.opf file with a text editor (not a word processor), such as TextEdit on the Mac, and search for the <dc:date/> line. Change this text to read:

<dc:date>2011-07</dc:date>

and save the file. The date 2011-07 is just an example. you should use the current date, just in the format mmmm-dd.

When all of the elements are in place in the xhtml file use the downloadable program ePub Zip 1.0.2 to combine the folders and files into a new .epub file. Place the two folders (META-INF and OEBPS) and mimetype file into a new folder, and drag and drop the folder onto the ePub Zip application. This will produce a new .epub file that you can open and view with an EPUB browser.

The final step is to validate or check to make sure that the EPUB file passes the ibookstore requirements. There are several downloadable or online programs that evaluate and validate EPUB files. I am currently using the online validation service at www.epubconversion.com.

The <oXygen/> XML editor offers an even faster and easier way to edit EPUB files. It has many useful features, including EPUB validation and the ability to browse and edit EPUB files without having to unzip and restore the EPUB file. The program is available for evaluation and purchase at oxygenxml.com.

The process for creating EPUB files is evolving rapidly. I have no doubt that a future version of InDesign will address many of these issues, and make it much easier to convert printed books into eBooks.

5 thoughts on “Creating and Formatting EPUB with InDesign”

  1. Thank you for this, this was very helpful. (I was going crazy with InDesign and the Sigil editor.) I will try your workflow instead. Epub format has a looooooong way to go, baby!

    1. Thanks–I’m glad you found this helpful. I’ve been working on my EPUB workflow for a long time. I wanted to write it all down as much for my own reference as to help anyone else in need!
      Andrea

  2. Thanks for this! I’ve been looking at epub advice but most of it’s aimed at non-designer folk. Awesome to find some good technical advice for people with some prior knowledge of book design. Liked reading your other posts too, I have always wanted to do more book design but the closest I get these days is magazine layout!

Thank you! Andrea