Posted on by & filed under epub, tools.

Finally there’s a commercial word processor that can export ePub.

Today Apple released an update to iWork 9.0.4 that provides ePub as one of the output formats in the Export menu, alongside PDF and Word. Apple has also provided a support page describing the differences between ePub and PDF, and a very helpful Pages template for use in creating an ePub.

I quickly took a stroll through the template and its output and so far I’m quite impressed.

The template provides a number of different default styles and headers. The headers are critical; this is how Pages determines which items are chapter boundaries that should be given unique NCX entries. Headers with the Chapter Name style mark the boundaries where content is chunked into discrete XHTML files. The Chapter Subtitle style will create a new nested TOC entry but not a new XHTML file. This is sensible and should produce rich TOCs if used appropriately.

I modified the sample template just a bit to test out color and ensure that my changes were propagated into the epub:

Test document in Pages

Then I went to the Export Menu, which now has an ePub option:

Pages ePub export

and prompts you for some additional metadata, a nice touch:

Pages ePub metadata

The ePub file was valid, hooray. I took a look at the OPF file:

<dc:title>ePub Best Practices for Pages 09-49-51</dc:title>
<dc:creator opf:role="aut">Liza Daly</dc:creator>
<dc:contributor opf:role="bkp">Pages v4.0.4</dc:contributor>
<dc:subject>Business &amp; Personal Finance</dc:subject>

Nice use of opf:role, one of the additional types of ePub authorship metadata that we recommend. The NCX file was also sane.

The CSS is a little bloat-y and unreadable but that’s typical of automated output from page-centric tools. It’s no worse than InDesign’s:

	color: #000000;
	font-size: 75.0000%;
	font-style: normal;
	font-variant: normal;
	font-weight: normal;
	letter-spacing: 0.0000em;
	margin-bottom: 1.2821%;

The default style produces some reasonable CSS for superscripts and subscripts, another nice touch:

	font-size: 67%;
	vertical-align: 33%;
	font-size: 67%;
	vertical-align: -10%;

In future improvements I’d like to see the randomly-numbered classnames be transformed to something more human-readable.

Unfortunately I can’t say as many positive things about the XHTML:

<div class="s2">
  This document will show you how to use paragraph styles to create a publication that looks great.. 

If those are paragraph styles, where are the paragraphs? It is not acceptable to use <div> where <p> is semantically accurate. This must be corrected in future updates.

Uploading it to Ibis Reader produced good results, and the CSS “works”:

Pages ePub output in Ibis Reader

I had a few random Pages documents lying around and I got decent ePub output from them too, even without using the styles found in the best-practices template. Those styles should be used on content of any length or complexity, if only to get the critical XHTML automatic chunking.

Overall I’m quite excited that there’s finally a commercial tool for normal humans that produces one-step valid ePub output. If the XHTML output is improved only to use <p> I’ll be able to recommend Pages without reservation.

The outputted ePub file: test-from-pages.epub.

Edited Friday August 27 to reflect some further exploration. Thank you to Baldur Bjarnason for identifying the div issue.


38 Responses to “Test-driving Apple Pages with ePub export”

  1. Orren Merton

    As an FYI, for my fiction writing (I’m a writer/editor) I use a program called Storyist ( that is both a word processor with project management style features for fiction/research. It also exports valid ePub files, but it addresses your concerns about human readable class names and markup.

  2. Walt Shiel

    Too bad it’s only for the Mac and ignores the majority of the computing world.

    For somebody who whines a lot about the rest of the world being one closed or proprietary system or another, Jobs continues to keep his blinders on and insist the only worthwhile solution is something from Apple. That’s OK if you’re only trying to sell computers but dumb when you’re trying to be a serious retailer of eBooks. Oh wait, I think that’s exactly what this has been about since the advent of the iPad and iBooks — selling computers rather than eBooks.

  3. Chad S

    Scriptito provides a web-based (and therefore cross-platform) alternative to products like Storyist, and while not as rich as a desktop-based application (due in part to the web platform, but mostly due to it being a 1.0 product), it does provide you with “access anywhere” and “direct to EPUB” export capabilities.

  4. Ian Betteridge

    Walt: “For somebody who whines a lot about the rest of the world being one closed or proprietary system or another, Jobs continues to keep his blinders on and insist the only worthwhile solution is something from Apple.”

    I don’t understand your point. You want him to produce an ePub export feature for someone else’s product? Or are you complaining because they’re adding support to export to more open formats from their products?

    To take what’s obviously a good thing from any perspective and try and spin it into an anti-Apple rant says more about you than Apple.

  5. Common Sense

    Walt: ePub is cross-platform and there are authoring tools on all major platforms. What are you on about?

  6. Liza Daly

    There’s the whole rest of the internet to argue about Apple, folks. Please keep the discussion civil.

    I appreciate the pointers to other ePub-exporting word processors, thanks!

  7. James Andrews

    Walt, Apple is and always has been a hardware company. They provide software to use on their hardware. I have to agree with Ian. This is a very good thing for those of us who like and use Apple products, and want to produce ePub books, but don’t have the knowledge to edit the ePub manually.

  8. kjkbook

    Re: Storyist-thanks for the link..I vaguely remembered that program having export ePub, but never tried it.

    I think the real issue with Pages having ePub support is that, from what little I can tell, it is iBooks ePub-that is, Apple is positioning Pages as a way to provide content for iBooks, so it will generate iBooks friendly ePubs.

    @liza and @lizcastro have been exploring the idiosyncratic way iBooks handles ePubs-it will be interesting to see how both Pages and iBooks ePub renderer develop going forward.

    And if the iPad version of Pages allows for iBooks editing at some point…wow. (of course, the ePubs will probably still try to open Stanza ;) )

  9. John C. Welch

    Um, I see one ‘major’ complaint about using divs instead of paragraph tags, and as ‘major’ problems go, that’s a small one, especially for a first-release effort.

    Apple positioning iWork to create iBooks content is not some kind of malicious conspiracy, it’s good business sense. iBooks use ePub, Apple *should* have actual Apple tools to create them.

    Would folks prefer that Apple not do anything with regard to easy creation of ePubs unless they could guarantee absolute perfection?

    As far as bagging on Apple because they didn’t create iWork for every platform on the planet, well, that is silly, and shall not be taken seriously.

  10. Michael Pastore

    Two questions:

    1. At the start, can the template be tweaked to fix the XHTML ?

    2. Starting with the final Pages to EPUB output,
    can “Find and Replace” be used to quickly improve the XHTML ?

  11. Baldur Bjarnason

    I’ve been thinking about the same things as Michael Pastore and as far as I can tell the answer to 2. would be a tentative yes.

    I say tentative because I haven’t tried yet, but if the originating document is simple enough structurally it might be just a matter of writing a script that transforms the first div of every chapter into a header and the rest into paragraphs.

    The answer to 1 is a tentative no, I haven’t been able to find any templates for epub export in the Application package or anywhere else. I suspect that it is programmatically generated xhtml rather than a template based thing.

    I’m not condemning Apple for trying as just exporting valid epub files is a step above many of the alternatives. The usefulness of the feature is limited by the unstructured nature of the output file. Which is a pity.

    But it’s also a positive sign. Apple wouldn’t be adding epub export to Pages if it weren’t serious about improving iBooks and I’m sure that when iOS 4 arrives for the iPad with its improved file handling abilities they will add that feature to the iPad version of Pages as well.

  12. Baldur Bjarnason

    Actually scratch that comment about iOS 4, there’s nothing technically preventing them from doing so in iOS 3.2. I suppose they’ll just add it when they get around to it. :-|

  13. Alex

    I can’t figure out how to create page breaks that will appear as such in once I open the EPUB file on my ipad. I tried inserting Section Breaks, Page Brakes, Layout Brakes, working with Stlyes, with no success.

  14. Liza Daly

    I believe the only breaks that are currently output are those between sections as defined by items that have the Chapter Name style applied to them.

  15. Alex

    Thanks for your reply, Liza.
    Are you saying that I need to:
    1) Create a Section Break
    2) Start the new section with a Paragraph whose style is named “Chapter Name?”


  16. Frank Lowney

    This is an excellent start down the road of making ePub accessible to to folks who have something interesting or useful to say but are put off by technical barriers, cost (as with inDesign) and so on. Of course, there’s more to be done. Bringing the iBooks app to the desktop would be a big help in streamlining one’s work flow.

    For academic types like myself who use Apple’s free iTunes U service, it would be great to see support for ePub there too. It is already possible to include an ePub file in an RSS Podcast Feed such that the iTunes application will subscribe to it and then synch the ePub and PDF eBooks to any iOS device running the iBooks app. I expect that to happen any day now. It’s just a logical extension of today’s announcement.

  17. Alex

    Regarding page break: I ran a few tests but the results are not consistent. It seems like in order to activate a page break you need to:
    1) Start a new section
    2) Type a line using the Chapter Number style
    3) Type a line using the Chapter Name style

    This sequence will produce a page break above the Chapter Number 80% of the time.

  18. Chad S

    Replying to Michael Pastore. I think you you’re going in the right direction; as this seems to me more of an “opportunity” than anything else. An EPUB file is much easier to parse than a proprietary format so if anything, this will allow third parties to easily accommodate Pages-originated ePub import and cleanup.

  19. Ric Day

    I have been waiting for Apple to do this ever since I saw that iWorks uses XHTML. Tested it last night and agree with everything Liza says. Apple does not have to do too much more to make this into a very good, basic epub production platform.

    I have had my book editors working with tagged ASCII manuscript files since 1999; an improved iPages might almost persuade me to shift the editorial operation to it. Or maybe not .

    Off to my Windows box to see if I can whip up some scripts in UltraEdit to tweak the current output files.

  20. Greenfrog

    >Finally there’s a commercial word processor that can export ePub

    It’s not the first commercial word processor that can export EPUB.
    Atlantis Word Processor is also a commercial word processor, and it can export to EPUB too (starting version 1.6.4 released on June 2009, ie more than a year ago).
    You can find details here.

  21. Charles

    Greenfrog is right. Atlantis Word Processor has been a leading tool for epub production for over a year. I’m amazed that you failed to spot it Liz.

    Unfortunately, as with Pages, it fails to use style names for the css selectors, I don’t know why these programmers fail to recognise that all automated css will need a bit of manual touch-up to fix its failings (I see Pages uses % for inter-block margins – ewww, fail). But at least it separates paragraph and character-level styling rather than glomming them all together in a single class.

  22. Mark

    I have been using Sigil which is a free app to produce my ePub files. Whilst the interface is not pretty it is cross platform and gives me total control over the output. Oh and the files it produces are lightweight and syntactically correct.

  23. Liza Daly

    I’m aware of Atlantis and I’m glad it was mentioned here. However, it does not have the potential reach of a product by Apple or Microsoft in terms of getting ebook production into the hands of the general public.

  24. Walt Shiel

    I guess I wasn’t clear in my comment that I was segueing into a side issue brought to mind by this new Pages feature.

    My complaint actually centers on things like Apple refusing to support Flash (something that continues to annoy me when using my iPad) and limiting iProducer access to the Mac platform.

    Much of the web uses Flash in one way or another.

    If they really wanted to be a major player in the eBook world, they need to open iProducer up to platforms beyond the Mac. Which led me to my implication that Apple doesn’t really care that much about selling eBooks, just selling more hardware. That’s fine, but they should not make noises about being serious about eBooks.

  25. Willem-Jan van Zeist

    Funny thing, when I opened my exported epub in the Stanze app on my iPhone, I thought it didn’t work. Turnes out the .epub forces black text, which is difficult to see when you’re used to reading white text on a black background… Anyone else encounter this, might be easy to fix?

  26. Richard Latimer

    FWIW, I think:

    Within iBooks page breaks occur at the start of a new file. iBooks does not honor page-break-before or page-break-after attributes in CSS. So, to get a page break in iBooks you need to start a new file:

    Chapter 1.xhtml
    Chapter 2.xhtml
    Full Page Color Illustration for Chapter 3.xhtml
    Chapter 3.xhtml

    Within Pages it may be that your Pages file is split into new files at the beginning of every new section. Open the recently released Apple ePub template for Pages. Look at Insert -> Sections or hold down the disclosure triangle on the Sections icon in the toolbar. There are nine different kinds of pages that may be inserted:

    Title Page

    So, at the start of every new chapter, insert a new Chapter template page. I haven’t verified this, but it seems reasonable. This may work for any Word Processing template that has a choice of page types to insert.

    File splitting probably has nothing to do with the word “Chapter” and the TOC is an entirely separate issue.

    Hope this helps. I will probably experiment with this tomorrow to see if it works.

  27. Frank Lowney

    For my first test file, I used Apple’s sample page by saving it under a different name. The other technique suggested is to import the styles into a new blank template but that produces a slightly different working environment that I hope to explore later. It may be inconsequential but I wanted to be conservative the first time out.

    Using the provided styles plus the “Sections” submenu is the key. I created new chapters by:
    1) Choosing “Chapter” from “Sections” in the toolbar (or Insert > Sections)
    2) Choosing Chapter Number and Chapter Title from the Styles drawer

    Chapters are indicated in the Pages list with a yellow outline that may encompass several pages. I found that helpful in understanding that I actually had created distinctly separate chapters.

    My test ePub content was adapted from a web page on my faculty web site here:

    There are several iPhone-sized videos included. I discovered that these have to be set as “inline” as opposed to “floating” or the export function will complain. Here’s the finished product to “sideload” into iTunes for syncing to iBooks and viewing:

    It’s 51.5 MB, slightly smaller than the parent 60.1 MB Pages file.

  28. Jeff Ferrell

    Has anyone had luck with the Stanza reader recognizing Pages ePub font sizes? From my tests, they don’t seem to translate. Anyone have any idea why not?

  29. Aaron Shepard

    Walt, I can understand your frustration about the requirement for Apple hardware and software, but the entry cost into this world is just $600 for a Mac Mini, which even includes a free copy of Pages. In other words, about the same cost as a single Adobe CS app or a low-end iPad. It doesn’t seem a lot to ask.

    And now consider the handicaps that Mac users have had to deal with in publishing over the years — restricted Internet access, second-rate or overpriced software. Would you like to know how many years I had to forge my browser’s signature just to gain access to Lightning Source? Or how long I’ve had to run Mobipocket software in a Windows emulator? For myself as a Mac user, working on two platforms is simply a requisite of serious publishing. Why should Windows users expect anything different?

  30. Laertes13

    Sorry, I didn’t read the code disclaimer for comments, let me try again.

    I just tried exporting from Pages to epub. When I looked at the XHTML file in Dreamweaver, before the end of each closing div tag there is the symbol [&][#][13][;] . I understand this is a “carriage return” code. Why is it showing up in the XHTML, and should I care?


  31. Laertes13

    Nevermind, sorry for wasting your time. For some reason when copied the original manuscript from Word into Pages, the paragraph returns were carriage returns. I simply used Find and Replace to change them. Now the code looks good. Thanks!

  32. Michael Campbell

    Apple’s iBooks ignores most paragraph tag code, but it respects div code. So I’m not surprised Pages is using div tags for formatting. ePubs created in Pages will likely display better than ePubs created elsewhere.

    Thanks, Liza, for the review!

  33. Chad Creighton

    This was an awesome blog that really helped out. Thanks a lot Liza. But I did have one question that I was curious if anyone else had issues with in Pages.

    When you are exporting to Epub file and you have a book with (55 or more) jpg’s of art in it, has anyone else had any issues with this? It keeps puking up and saying there are errors and only shows half of the illustrations. But if I change those same jpg’s to png’s it works fine, but it changes all the png’s to clickable video links. It’s rather odd. Not sure if there is a workaround that you might know about. Or if you’ve even encountered this before?

  34. Daniel

    How did you open the epub file to look inside at the auto created code? I need to hand tweak this.

    I usually replace .epub with .zip and this will “decompile” the epub and show you the files within. This has always worked with epubs that I’m building by hand.

    With this new auto exported format, if I change the extension to .zip it will output a .cpgz and if I decompress that it will produce another .zip strangely enough. It becomes a never ending loop and I can’t actually look at the guts of the epub in Finder.

  35. Liza Daly

    If you want to do any real work with epub (on a Mac) it’s useful to become familiar with Terminal. If you open Terminal and ‘cd’ to the appropriate directory where the file is you can just type ‘unzip myfile.epub’ without renaming and it will unzip it.

    FWIW, I hadn’t heard of the issue you described, but it’s not specific to Pages/epub:

  36. Daniel

    Thanks for the quick response! Lightening!

    The unix command is much better, it works fine now. The gui archive utility does some strange things sometimes…

  37. Drew

    I’m creating page breaks using HEADING style, which puts whatever heading text I use into the Table of Contents. Wish I could figure how to force a page break without adding another line in TOC…?