Wednesday, May 1, 2013

Controlling spreads in EPUB3 Fixed Layout

EPUB 3's spread settings should allow you to decide when individual documents are placed next to each other on a 'synthetic' spread in a book. For example, you might want to show two consecutive pages in a spread if the device is held in landscape orientation but individually if it's held in a portrait orientation. According to the spec, that's possible. In real life, on real devices, it's not.

Let's look at the different options, since they're not very self-explanatory.

First, you can find a quick overview on this earlier article about EPUB 3 fixed layout.

EPUB 3 has three important fixed layout rendition properties, layout, spread, and orientation. The first is the one that determines if an EPUB 3 document is fixed layout or not. So, if you want a fixed-layout book, you'll add the following code to the meta section of your opf file.

<meta property="rendition:layout">pre-paginated</meta>

And if you want a flowing book, you'll leave it out to use the default value of reflowable. Can you mix fixed layout and flowing pages in a single book? Theoretically, yes, by adding the property to individual pages in the spine section, but unfortunately not in the real world. At least not yet.

The spread property determines when pages should be placed next to each other in a 'synthetic' spread. The default is for the first page to be shown by itself on the right, and each two pages after that to be shown opposite each other in a spread. With EPUB 3's spread options, you can choose to have pages always be shown independently (none), only when the device is in landscape mode (landscape), only when the device is in portrait mode (portrait), in both orientations (both), or just use the automatic settings of the reading device (auto).

So, for example, here's what it looks like in iBooks if you choose none. Each page is shown in its own spread.

rendition:spread-- none in iBooks

Unfortunately, iBooks doesn't support any of the other options, which would be very welcome. You might have a fixed-layout book that looks great in two-page spreads in landscape orientation, but that is too small in portrait view. By choosing landscape, you could force the spread in landscape, but allow for the individual pages to fill the device in portrait as well. Hopefully some day in the future.

There are additional page-spread properties that you can apply to individual pages (in the spine section) to indicate that a page should always be shown on the left side of a spread or on the right side of a spread. But I have not been able to get them to work in iBooks either.

It does work in Readium, though. Notice how the Introduction page here has been forced to display on the left, which both leaves the previous page by itself (not shown), and pulled the subsequent page next to it:

Forced left hand page

Readium doesn't seem to support any of the other spread options. No matter what I choose, it always initially shows a single page, and then if I change the options in the Settings box, it shows two.

The third property is orientation. This is how you force a book to always be displayed in one orientation or another, regardless of the way the reading device is held. The choices are landscape, portrait, and auto, and the first two options constrain the display to the given orientation.

So, if you choose auto, the book rotates with the reading device. Here's what it looks when held horizontally:

Landscape orientation iBooks

And here's what it looks like if it's rotated to a portrait orientation:

Auto orientation with device held vertically

But if you choose either landscape or portrait, then no matter how the reader holds the device, the book will always be shown in that orientation. Here's a book with the landscape orientation chosen, with the device being held vertically:

landscape forced




6 comments:

  1. Liz, you need to check out the AZARDI samples. It takes the ePub spec fixed layout spec to where it should be. Maybe not important for the trade-book crowd, but very important for education content and other more advanced presentation information. Readium with landscape|landscape only uses half the viewport. It is dysfunctional.

    iBooks doesn't support reflowable and fixed layout mixed, probably the most useful functionality of all, but it directly competes with the Apple iPublish product so guess we wont be seeing that anytime soon.

    By the way. Welcome back from Catalonia!

    ReplyDelete
  2. Hello Liz,

    i did play around with the apple sample fxl epub and found that it will open with the first page as single page to the right in ibooks but with a spread of two pages in readium (which is not intended). Your sample opens in ibooks the same way (single page to the right) but in readium it works as well (single page to the right). Whats the difference between your sample (working as intended in readium) and the apple sample (not working right in readium)?

    Cheers

    Caspar

    ReplyDelete
  3. Hi Liz,

    i found the answer myself (but no solution): Its the dreaded "com.apple.ibooks.display-options.xml" in META-INF... without this file readium will show page1&2 as first spread and with this file readium will show page 1 solo and page2&3 on the first spread...

    The "com.apple.ibooks.display-options.xml" is obsolete now with all the iBooks options in the OPF file, so how to get rid of it and forcing readium to show page1 solo?!? Thank you very much!

    ReplyDelete
    Replies
    1. You're saying that Readium uses info from the com file?

      Delete
  4. Thank you for the clarity of the informations, I had a hard time figuring how to use those from the specs! Now, it's rendering as expected!

    ReplyDelete
  5. Hi, Is it possible to hide the interactive pages at the end of the fixed layout eBook?
    I have an fixed layout eBook which contains some interactive elements (animations, external HTML window).
    while viewing in iPad, those pages are appearing at the end of the book eventhough I Used "linear="no" " in OPF's spine. can any one help on this.

    Note: In reflow epub It works fine..

    Thanks,
    Sabari

    ReplyDelete

More of my books