May 13, 2010

How to make an ePub e-book?

I wanted to create an e-book version of Homo Competens that could be sold via Apple's iBookstore and read on an iPad. I'm not an iPad owner (I live on the wrong side of the planet for that), but I did try out one on my recent trip in California. iPad or Kindle or other device, the really unique thing about Apple versus others is not so much its simple design or uber-coolness, but its ability to make people actually pay. Maybe, just maybe, that will work for ebooks too now.

So, how to convert a book into an ebook for the iPad? Two things: 1-  It needs to be an ePub format (*.epub), and 2- as a self publishing author you need to submit it via an authorized channel.  The last item is the easiest one: there are two authorized channels that I know of: lulu.com or smashwords.com. The paper version of the book is already available on lulu.com, and so in the end I decided to also use them. Just an hour ago I purchased the lulu service to submit the ebook to the iBookStore (free for the time being.)

Back to the e-book creation. That was not a walk in the park. Epub is an open standard for e-books that is more widely used than ever now and on its way to become the preferred format for e-books. It is in fact a zip file that contains your books contents in html files and some specific files to indicate the table of content and other information about your book. If you change the file name from .epub to .zip you can actually unzip it and see the contents. If you know a little about html syntax, the files will look familiar. It is actually xhtml that is used, that is a bit more picky on what you can do in your html code (no name tags, no width tags etc unless in the style guide class, etc). Before Apple accepts your epub file, it must pass the epub validation tool epubcheck version 1.0.5. That is a free tool (I believe made by Adobe). You can also find an online version of that tool on threepress.org.

But why do it the hard way writing up your html files when there are conversion tools? I first tried the program calibre to convert my .doc Word file to an epub file. Calibre is a free e-book management and reader tool. It can also convert between ebook file formats. So I used it to convert PDF into epub. But that didn't look good. Epub is a very good format for novels that just contain text. But my book with all its illustrations, page layout and tables is something else to make look decent. In ebooks, you need to let go of the page concept. Every device will make up its own page count and division in pages, and it will even change if you turn the device from portrait to landscape mode. As an author, you just provide a big flow of text basically, and all formatted correctly.

Next try was with smashwords.com. They run a service similar to Lulu or Createspace, but only for ebooks. They allow you to upload a Word document that needs to adhere to very specific syntax rules. From that base file, they generate all kind of ebook formats, amongst them an epub file. And they do it all for free and let you sell it as well (they do need a commission on every sale of course.) The best thing about this try was to go through their syntax guidelines to adapt the Word file of my book. I stripped a lot of unneeded images out, simplified it, made sure all paragraphs were correctly defined, etc. Going through their style guide goes a long way. But unfortunately, the ebook generated by smashwords did not really look good either, and it give tons and tons of errors with the epubcheck tool.

So finally I created the book with the free and open source epub editor Sigil. The tool is relatively simple, but allows all you need: you can set the metadata such as descripton, title, author, etc, and you can define the table of contents by identifying the headers. It has a book view for editing, but you can also edit the xhtml source code. I first exported the .doc file to stripped html (in Word), then opened it up in Sigil (takes some time to load), then reworked it for a proper table of contents, and went into the html code to fix all errors reported by epubcheck. After hours, I jumped up in the air as no more errors were reported. Here is the list of things I had to do in the html code view of Sigil:
  • Get rid of the 'lang' elements that ended up in my html code because my programs are in Dutch, not English
  • Make sure all images have an 'alt' description defines, otherwise you will get a missing attribute error
  • No width attributes for images or tables. (You can have most formatting specifications in the style sheet and style sheet classes, but not directly on the paragraphs anymore.)
  • No 'name' tags.
The list of errors would have been a lot longer if I hadn't first updated my Word source file according to the SmashWord guidelines, so that helped a lot. After validation by epubcheck, I used Calibre again to view the file, and it looked good, with a proper table of contents. Mission accomplished. Now fingers crossed for the inclusion in the iBookStore.

18 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. This comment has been removed by a blog administrator.

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. This comment has been removed by a blog administrator.

    ReplyDelete
  16. This comment has been removed by a blog administrator.

    ReplyDelete
  17. This comment has been removed by a blog administrator.

    ReplyDelete
  18. This comment has been removed by a blog administrator.

    ReplyDelete