Tag Archives: iPod

Building and publishing an eBook on your iPad

When you start researching online how to publish an eBook, the focus is strongly on commercial release to the general public.

However, particularly in the corporate world, you may not want to make your book publically available. So how do you get all the benefits of an eBook on the iPad (and/or the excuse to buy an iPad for business use) but without releasing your internal documents to the world? After some research, trial and error, the process is really quite simple.

To have your very own library on your very own iPad just three steps are required:

  1. create a valid eBook
  2. drag that book into iTunes, and
  3. synchronise your iPad with your updated iTunes library.

Your personal eBook will then be available on your iPad, right there alongside, and indistinguishable in quality, your John Grisham collection. Or your Alice in Wonderland collection if still stuck in a region – like here in Australia – with no functioning iBooks store.

Step 1. Create a valid eBook

While this may appear daunting it’s really straightforward once you realise a few simple truths.

  • iBooks supports eBooks produced in the standard ePub format (read more on Wikipedia)
  • an ePub book is simple a zipped folder with a different extension (changes .zip to .epub)
  • within your eBook your content must be included as XHTML files, one file per chapter
  • accompanying your content are a variety of XML files that define the structure and order of your content

Sample ePub contents - just XHTML and XML files
And that’s it. You don’t need anything more complicated than a text editor and a folder zipping tool. It’s so simple I strongly recommend you (at least the first time) build one manually. It’ll give you a much better understanding of how it all comes together, and what options you have in defining and manipulating your content.

There are several tutorials online to help guide you through the process to build an eBook.  I recommend you follow this one from jedisaber. Download the sample file provided and follow the steps.

If your experience is the same as mine, most of the issues you’ll face when generating your first book will be in producing valid XHTML content. As such it’s recommended you build and validate this first. Issues I had included:

  • incorrect nesting of tags
  • not closing tags (particularly the img and br items)
  • missing attributes (particularly alt on all my images)

However use a decent XHTML validator (if not using Safari – which tests automagically – go for the master and use the one from W3C) and you’ll get through them.

Outside the XHTML the only other issue was in ensuring all the content files were encoded correctly:

Set encoding in BBEdit (OSX)
On the Mac I was using BBEdit. It gives you an option in the Edit Window to set the encoding: pick UTF-8. Note I also picked Windows CRLF because I was using a PC to package the book, more on that later.

Set encoding in Notepad (Win7)
On the PC I was using Notepad to edit. It allows you to set the encoding when saving. Again, choose UTF-8.

 
Once all your content is complete and valid, you can then compile your book in the folder you’ll then zip and rename to become the finished ePub. Follow the instructions (and sample) from jedisaber:

  1. ignore mimetype and META-INF (content does not need to change from one book to the next)
  2. load your valid content into OPS folder, documents and images (use subdirectory for your images if you set the URLs in your content to match)
  3. edit content.opf (XML file) to list all your content (and only your content – remove references to sample files not used). Make sure the URLs are correct, particularly if using subdirectories in OPS to organise your content
  4. edit toc.ncx (XML file) to list your content in the order to be navigated and with the section/chapter titles as you want them to be shown
  5. ZIP the folder
  6. Rename the folder from a .ZIP extension to a .ePUB extension

Be careful generating the ZIP version on a Mac using the built in compression tool. Not only does this incorporate all the hidden OSX files (DS_Store, etc) it also seems to put an extra folder layer in. I was only able to generate the correctly formatted ZIP file using Winzip on a PC.  This also allowed me to set the compression for the mimetype file to 0% as requested.

Note I managed to resolve the “extra folder” issue in OSX. Trick is not to choose your eBook folder to compress. Instead select the contents of that folder (should be three things: mimetype and META-INF and OEBPS folders) and compress them. You’ll get an Archive.Zip file you can then rename. This doesn’t resolve the potential issue with hidden files but I’ve not had any issues with ePUBs built this way since.

I then suggest you validate the eBook prior to the move into iTunes. Use the online threepress tool – it’s free. It may identify a few items you’ll need to return to your source to resolve. Just make the edits, rebuild/rename the ZIP and try again.

With that tool the only error I was not able to get rid of concerned the length of the first filename. I’m guessing this is because the requirement is for mimetype to be the first file in the ZIP file but I could not find any way to enforce this. However even with this error I did not get any issues with the subsequent steps so if you get this error, ignore it like I did.

If the book validates, then also consider testing it in a reader outside of iTunes. I used the bookworm from O’Reilly. Alternatively try Adobe Digital Editions, a free download so you can test your books without a web connection.

Step 2. Drag into iTunes

Simply open iTunes, select your Books folder, and drag your .epub file into the window. If all works well you should see your book listed, with its cover appearing in all its glory.

Note you cannot open/view/test the book from here. That only happens when you get it onto the iPad.

Step 3. Synchronise and launch on your iPad

When you sync your iPad just ensure its set to include all new eBooks. Your file will then get copied across and be ready for use. Congratulations!

Next steps

Using XHTML it’s straightforward to include text and images in your content. So feel free to improve on your content’s richness. Also consider adding a stylesheet (include in your content.opf file, as well as referenced in your XHTML) to further enhance the presentation.

You can easily add a nicer title/cover page so your book looks better on the shelf. Either build in XHTML or just create as a nice image and include.

From this foundation, the next step for me is to see if possible to include some richer media in the book. For example a video or audio snippet. We’ll see how that goes….

Resources

Note: All the online tools listed here require you to upload your content to their servers. Be mindful of how secure you want/need your content to remain before using any of these tools.

Getting the iPhone simulator to recognise sqlite database changes done in Terminal

I’ve been tearing my hair out for an afternoon working with a simple DB application for the iPhone/iPad. Essentially it connects to a sqlite3 database as the source file. But each time I edited that database content in Terminal, nothing was changing in the application when run.

Finally a solution. Need to reset the simulator itself to remove the local copy taken/needed when running a DB application.

Option you need is Reset Contents and Settings… under the iPhone Simulator menu.

Once reset when the application is run it pulls the updated database across as its copy. Phew!

iPonder

My iPod (and other items?) automatically adjusts for an initial “The” when sorting artist names. Rather than grouping all such bands under “T” it ignores “The” and puts in the appropriate place in the list. Eg “The White Stripes” appear with “Wolf Parade” not “TISM”.

Point to ponder is what happens to the songs by the olde British band The The? Where to go to look for them?