Blank Book — The Fixed-Layout ePUB Template

Screenshot of the Blank Book cover image.


If you don’t care much for my story, download Blank Book here.

I have recently been digging up all the dirt I can on eBooks for children’s picture-books for a research project I shall be assisting on from next month. We intend to make a few books to encourage independent reading with iPads in special education, so I was quite happy to find that iBooks in fact supports some very useful features for our needs.

However, it has not been an easy ride learning all I’ve learned. Nobody seems to be helping anybody build a complete publication, or nobody actually cares about making a complete publication, I’m not certain. The information out there just seems to be thin on the ground.

Okay, sure, there are books you can buy but they are covering old ground for those familiar with XHTML, or those who don’t need to learn how to create a flowing ePUB, and you have to buy them. I was elated at my discovery that I already knew how to lay the pages out with HTML and CSS, though. The problem was that I hadn’t a clue what an OPF or an NCX was and the internet was not readily divulging that information.

Fixed Layout

The breakthrough for me was in reading How to Create Fixed-Layout iBooks from a gent named R. Scot Johns whose articles just spelled out the contents of an ePUB very quickly and neatly for me to get my head around.

I urge anybody wanting any kind of understanding to go through the tutorial. It does come in seven parts, lacks through-links, and the example file he includes actually contains some errors, but hey, he did a great job that nobody else was doing so I’m going to list the links to each part here:

How to Create Fixed-Layout iBooks: Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part 7. Phew, load ’em up in tabs.

Read Aloud

With that sorted, I now had to learn the Read Aloud feature separately. Of course, I found almost nothing out there on the subject. It’s mentioned in a WWDC 2011 video, briefly, as if everybody already knows what a SMIL file is, and how it works. Not helpful.

It is also not helpful that many books in the iBookstore are encrypted, and when they’re not encrypted the code is too sloppy to learn anything from. It took a while but I eventually found this terribly formatted post displaying an entire SMIL file. With a little bit of copy and paste I began to decipher it — I’m not sure if it’s stolen from somewhere or what but it was useful nonetheless.

That understood, recording audio came next. While GarageBand makes that simple, Audacity is the only application for labelling tracks easily, and my is it easy. Label the track, and then export the labels. That easy.

Sadly, after that it becomes quite the neck-ache. Copying and pasting the time stamps from the label track to the clipBegin and clipEnd attributes of  <par> elements in separate SMIL files is a joyless experience and I would give much to have this process automated.

A lot of the fun in ePUB-making seems to be renaming files, or changing the numbers on the end of long lists of consecutively numbered filenames, or having to make small changes across multiple files, and going through the process of deleting the last version from iTunes so that you can check those little changes you made, and realise they weren’t quite right.

Rewarding at the end, though. So at this point, I was quite pleased with myself for having produced a talking ePUB, until I realised that there is a standard for it. More fun making changes in multiple documents, then.

ePUB 3

This stage in the process reminded me of my web design beginnings. It was 2007, I was using Dreamweaver and it was outputting table layouts. While trying to fix the problems it was causing, I eventually realised that I actually needed to learn Web Standards and completely rebuild the site. You could say I was late to the table. But nobody would, because that would be a revolting pun.

I found that indeed the ePUB 3 standard tackles fixed-layout and media overlays, and that they have some examples of books to demonstrate the standard. I haven’t looked into which other readers support it yet, but it does seem recent. At least I can say I was there near the beginning.

So I go about a lot of work to make sure I’m doing everything properly, like throwing away the NCX file (as if I even wanted to learn what one was in the first place), using HTML5 elements (thankfully, I feel modern again), and adding up all the milliseconds of my audio for the media:duration property (fantastic…).

But even this wasn’t an easy task, like looking for needles in haystacks, few parts of the many examples actually went towards building a complete package. It was at first difficult to find the differences from the previous standard, and then pick out and piece together the essential code in a neatly structured document. Is nobody concerned with beautiful code in publishing?

However, I managed to get my ePUB up to standard and to validate with no problems, so I hope that’s enough of that malarkey. I’ve even added and declared an iTunes PLIST file in the manifest because it makes iTunes play well, keeps the validator happy, and everybody else I’ve read only seems to moan about it. It’s not part of the spec, but iTunes is going to add one if you don’t. These guys could have just declared it. Seriously. Sometimes. But anyway, on with the exciting part of this post.

It’s Yours

I’ve made a template to make the next few weeks of my life less painful and I’d like to also make it available to you, and to the world. It will be the first real thing I’ve ever contributed to the coding community so I’m rather excited to see what happens with it. As far as I have researched, there is no blank fixed-layout Read Aloud ePUB out there yet, so I only hope it travels far and wide and evolves with contribution and people pointing out any mistakes or misunderstandings I’ve made.

Unfortunately I will probably never be able to write a tutorial for it, neither will I document it, so perhaps it will only be ideal for those familiar with XHTML and such enough to make sense of what’s going on. Having said that, I do believe experimentation gets you far, and got me where I am.

The files are reasonably commented and most of the publishing stage with a file like this should be replacing the images and audio I’ve provided. Any additions you need to make are generally going to be duplications of what exists already. So no excuses. Go and play with it.

I’ve added a Creative Commons BY-SA License, to say in short that I don’t mind if the next big publisher founds their business on publishing books they learned to make from my template, but if the template code is improved or forked I’d like everybody to be able to make use of that (and I’d like to see it).

So you can grab your Fixed-Layout Read Aloud ePUB 3.0 Standard ePUB Blank Book here.

(Please note that I hold no liability for any problems that may arise from your use of the document and its contents and I provide them as is, free of malicious and/or harmful software but with the advice you should scan it yourself. Or in English, I’m sharing this file with only good intent out of the kindness of my heart, so don’t be so rude as to try and sue me if you screw stuff up with it, not that I’m sure you could.)

Work It

To get into this document you’re going to need to unzip it, which is easily done with Stuffit or WinZip (probably) but since you’re also going to need to zip it up again once you’ve finished with it I highly recommend these files if you’re using a Mac (use the latest versions). Simply drag an ePUB over the UnZipper to see the enclosing folder, and drag that folder over the Zipper to create an ePUB. Thanks, to those who made those.

The validator among these files is not able to help with ePUB 3 so don’t bother with it, go instead to the IDPF ePUB Validator to catch your errors.

And that’s it, I think. I can’t wait to see what happens, if anything does.

TL;DR: I made Blank Book because I wish I’d found a book like it four weeks ago. That is all.

The Download, Once More