Blog Pile

The “e” in ePub Does Not Stand for Easy


cc licensed flickr photo shared by michael.heiss

Given the rising tide/trend of electronic books, for a number of months I’ve been pondering how to make our NMC publications available in an ebook format. With the push of an iThing it looked like ePub was the format to aim for. It is after all, a standard (or is it a guideline).

My experience suggests it is a muddy place, much depends on the devices that access the content (oi the browser wars of the 1990s), but this is a stream of what I’ve figured out so far. I will pre-amble that I have almost no expertise in this- its just what I figured out by head-banging attempts to produce an ePub.

I’ll foreshadow the hint that I am excited about the just released Anthologize tool for generating electronic texts but it’s too early to tell on that one.

First, I tried a number of the various tools that offered to convert a PDF to an ePub -e.g. ePubBud. I can say that you get “something” you can view at the end, but its really not optimal on format, layout- you don’t get much in the options to customize, so its a crapshot whether it does a decent job.

That is because under the hood- what an ePub file really is is not a file at all, but a container of files, many of them XML, and all the “content” portions of your ePub are structured HTML, or XHTML. So anything that attempts to “convert” your PDF must make guesses as to what are headers, where are breaks, etc, and who knows what it does with things like lists and links.

I learned the most from the excellent tutorial “How to Create an ePub By Hand” which clearly illustrates many of the moving parts in an ePub, and provides a template to start with. Harrison Ainsworth’s Epub Format Guide is another great reference (and is also available as an ePub).

So what you end up doing is a lot of hand coding of XML and XHTML files, package it up with a few other key files in a zip, and than just change the file extension from “.zip” to “.epub” If you are leaping ahead like I did and think you can take that DRM sprinkled ePub, swap its file extension to .zip, and pry open to peek at the structure– good luck. You get a *.cpgz file which when you uncompress– gives you another version of the original zip, endless circle (well not exactly true, I just found the unix command line “ditto -xk source.zip ” which seemed to pop it open, but thats just a detail- have not tried it yet with a dl-ed epub).

While embarking down this manual path, I also asked our publication designer, who does use inDesign to generate our documents, to experiment with its ability to export ePub. I’ve not hear much, but he was unable to even get a simple test file going, and as is, this would require recasting of his templates and styles to get something ePub-able.

I also got connected (thanks Phil Long) with someone who does this as a business – and found out on that end, they doe a ton of work doing it the manual way to get a template that works, and then get to the point of more automation in generating the content.

I thought this would be pretty easy to do for our NMC Horizon Reports since I already re-publish them in WordPress format (see http://wp.nmc.org/) so I already have the content in HTML. It took a little bit of tidying to get clean XHTML- changing extensions to .xhtml, closing some tags properly, adjusting local links, changing the HTML headers to:

The tricky part was packaging the files up. The instructions indicate that the special mimetype file should not be compressed, and must be the “first added to the zip”. I had no luck getting this to work on a Mac, and even on a PC using WinZip, with everything as stated, I could not get the file to validate using the ThreePress validator— it kept saying the first file in the zip was not 8 characters long (meaning it was not finding “mimetype” first.

Crap. I was in a corner.

I looked at other apps- Calibre is very handt for converting between eBook formats, and allows some modifications of the various settings (setting a cover image, editing the metadata) but what I really sought was something that was more of a full fledged ePub editor.

And than I found maybe not the Holy Grail, but for me, what turned out to be pretty Grail-ish – eCub by Julian Smart. It is cross platform and free!

eCub is a cross-platform tool for creating EPUB and MobiPocket books. EPUB is become a popular e-book standard and is open and free for all to implement. EPUB files can be read by MobiPocket, Adobe Digital Editions, FBReader, Stanza, the Sony Reader, and many other readers and applications. MobiPocket books can be read on desktop platforms, mobile platforms and the Amazon Kindle e-book reader.

eCub offers a convenient way to import text and XHTML files and create all the necessary components of an EPUB file. It makes it easy to view and edit files, and check the generated EPUB, using external tools. It can also generate audio files from your book content using eSpeak and other text-to-speech software.

A wizard allows you to create a new project in seconds, with options for generating a table of contents, a cover page, and a title page. You can create a simple cover design image using templates and a simple design tool. Then you can compile, check and try out the EPUB at the click of a button.

With eCub, I simply made a new project, and was able to import my directory of xhtml files. The file tool allows me to change the order, and even to edit them if needed:

There are a number of settings panels that pretty much take care of the grunt work of generating the content.opf and other XML files the ePub needs, plus it adds the meta data.

It has templates you can use to generate a cover, but I just went for the simple of the same cover image from our publications.

I went a few rounds of edits (mostly tweaking the XHTML for some formatting errors) with the ThreePress ePub validator to get all but one error cleared there (it seems to be saying the format for my publication date is invalid, but I cannot see any issue there).

So here is 2010-Horizon-Report.epub (236k) a test version of an ePub equivalent of the 2010 NMC Horizon Report (web version) This is a draft version, yadda yadda, small type legal mumbo jumbo, batteries not included, your mileage will vary…

But the test was in seeing how it worked. The desktop version of Stanza was sad, as it seemed to ignore all formatting, and produced a river of text.

I have to say the iBooks app in the iPad looks and acts the best so far. I like how my own publication sits in the shelf

The downside is of course, the jump rope of having to get stuff there via iTunes sync. Also, mysteriosuly enough, with ePub files sent my mail or even when accessed in DropBox, iBooks is never offered as a helper app for opening ePub files.

But in iBooks, this version works in a lovely manner- it displays using the simple styles I made for headers, the hyperlinks to internal and external URLs all work, the table of contents and other bits work great.

Stanza too displayed the content reasonably (though it ignored my own style sheet), but did all of the lists, bold, italics as it should:

However, the hyperlinks in the generated Table of Contents as well as internal ones went nowhere. In some searching (I cannot locate the exact location now, but thought it was here)… I found out to get Stanza hyperlinks to work, you actually have to press and hold the link at least 2 seconds. I think that is “the fix is in progress” statement here.

So I have an ePub proof done, and tested it small scale. I don’t have access to other readers, and assume I might have to run it through Calibre to generate versions that will work with other eReaders (which has my scratching my head over the concept of “standard”). With eCub and my content already in formatted HTML I should eb able to convert a number of our other documents more easily.

In the end, creating an ePub is far from easy. I would think there is a ton of room for someone to create a better kind of application to generate ePub files and more than the quick and slap conversions, but a full fledged editor.

And most ideally, I am hopeful the just off the code press Anthologize will be a viable option, which might be the best since our content already exists in WordPress. It does require a little bit of server sized tweaking (re-compiling PHP to include the ZIP extension).

This is really an early stage for ePub– there are some interesting possibilities of JavaScript ePub readers perhaps making it possible to embed/integrate ePub with other web content. Then there is the headier stuff, since ePub can allow for scripts and object tags, for Interactivity in ePub. Definitely the folks at ThreePress are doing a lot with this leading edge — see http://blog.threepress.org/.

And that’s all I know for now!

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

  1. Second post I’ve seen on ePub today (wonder how much this is the iPad effect?)

    On my site I use the free feedbooks.com service to turn my feed automatically turn my feed into ePub, Mobipocket/Kindle, PDF (here is the ePub link if you want to try http://www.feedbooks.com/newspaper/7414.epub).

    The idea for this came from a post by Joss Winn on Creating a PDF or eBook from an RSS feed http://joss.blogs.lincoln.ac.uk/2010/01/04/creating-a-pdf-or-ebook-from-an-rss-feed/

    The post generated a number of comments, in particular, James Kwak at baselinescenario mentioned he was creating ebook friendly archive of his site. I wonder if you could do something similar for the Horizons Report using the WP version? Your limitation I suppose is you have to have to rely on the feedbooks template. Although through a bit of rss manipulation you can tweak the content as explained here http://www.rsc-ne-scotland.org.uk/mashe/2010/01/feedbooks-pipe/

    [I’ve also developed a wp plugin (Make PDF Newspaper) which incorporates the FiveFilters.org PDF Newspaper code to let you generate a newsletter format pdf of posts.]

    Yes I’m a format junkie but I figure if get the data is already there may as well make it available in as many ways as possible ;-)

    Martin

    1. I can say I have been trying this off and on for a few weeks or months ;-)

      Thanks for the clever approaches; especially the pipes jumping. I doubt feedbooks will work since to get things in correct display order in CommentPress/Digressit, our content will come out in a feed in reverse order.

      It should not be this hard ;-)

    1. Have not tried- I suspect similar issues will rear its head- it’s not a matter of needing an app that can do the conversion; its one that preserve the headings, lists, and links in the source docs.

      Actually eCub can also generate its output in mobipocket form; I did not try it yet, but will…

      thanks Coop! I did remember your experiments with the plethora of platforms.

  2. I just wanted to thank you for the bit about holding the hyperlinks for 2 seconds or so. I have been ready to pull my hair out with Stanza.

Leave a Reply

Your email address will not be published. Required fields are marked *