This article originally appeared in TidBITS on 2015-02-19 at 3:14 p.m.
The permanent URL for this article is: http://tidbits.com/article/15425
Include images: Off

How to Proof EPUBs on the iPad with iBooks

by Michael E. Cohen

According to Ecclesiastes, “Of the making of books there is no end,” a statement with which almost any publisher can agree. For those who spend their endless time developing ebooks in the EPUB format — the format used by most ebooks sold through Apple’s iBooks Store — Apple used to supply a small but useful utility to help speed the process along: Book Proofer.

This little app enabled ebook developers to edit any of an EPUB’s constituent files on the Mac and, at the same time, view that EPUB-in-progress in iBooks on a connected iPad or iPhone: make a change and iBooks displayed the results of that change almost immediately. This was a great boon to publishers… until the app stopped working with the release of iOS 8 and OS X 10.10 Yosemite.

The unexpected demise of Book Proofer caused many book developers (a small but proud community of which I am a member) more than a little consternation. Without Book Proofer one has to go through the arduous process of editing an EPUB’s files, packaging them all up inside an EPUB file, loading that EPUB into iBooks, reviewing the results, and then, if the results aren’t as desired, deleting the book from iBooks, and engaging in another round of editing, packaging, and loading.

As if to add insult to injury, the iBooks app that ships with Yosemite ostensibly offers a way out with its Advanced > Add ePub to Library as Proof command. (You must first enable the Advanced menu in iBooks > Preferences > Advanced.) Frustratingly, though, that command doesn’t seem to work. Choose it, and you see a standard Mac file dialog in which EPUBs show up as unselectable!

[image link] [1]

[image link] [2]

However, it turns out that the command does work, just not with a normal EPUB file. Here’s the trick — in four-part harmony — for making it work.

The first part of the trick has to do with understanding that an EPUB file is actually a Zip archive. The archive contains all the files that make up an EPUB: the HTML files that provide the book’s text and layout, the image files used for its illustrations and cover, the files that store the book’s table of contents and other metadata (such as the title, genre, and publisher), and so on. What the old, now-broken Book Proofer used to do was to allow a book developer to put all of those files into an ordinary Finder folder and use that folder as the “book” to be proofed.

The second part of the trick is the “package” format supported by the Mac. A package is just an ordinary folder that the Finder treats as a single file if its name ends with any of a number of certain special filename extensions. It turns out that all sorts of things on your Mac that look like files are actually packages. For example, a Pages document is actually a package, a folder containing a bunch of files inside. You can see the contents of a package by Control-clicking the package in the Finder and choosing Show Package Contents from the contextual menu: a Finder window opens and you can then access and edit any of the packaged files.

The third part of the trick is Paul Durrant’s simple AppleScript application, ePub Zip/Unzip, which you can download from the bottom of the first post in this MobileRead thread [3]: drop an EPUB on that app and its files are extracted into a new folder; drop that folder back onto the app and it is zipped up into a normal EPUB. (Note that Paul’s AppleScript app is unsigned, so you must Control-click its icon in the Finder, choose Open from the contextual menu, and then give it permission to run.)

The fourth part of the trick, and the part that makes book proofing possible, is this: take a Finder folder that contains all the files that make up an EPUB and append the extension .epub to the folder’s name. The Finder may warn you that doing so may have consequences if you do this by hand, but in this case the consequences are to your advantage: the folder becomes a package that appears as an EPUB in the Finder, and it is this special package that iBooks on the Mac allows you to add as a proof to your Mac’s iBooks library. Happily, you need not rename the folder by hand: the latest version of the ePub Zip/Unzip app can do this for you automatically, appending _pkg.epub to the folder name when it unzips an EPUB.

[image link] [4]

When you open an EPUB package with iBooks’ Add ePub to Library as Proof command, it appears in iBooks on the Mac with a special badge that labels it as a proof. This proof opens just like a regular EPUB does, and you can read it just as you would any other EPUB.

[image link] [5]

However, the proof book’s window features a new button: Devices. Click it and you’re given the opportunity to view the book not only on your Mac but also in any other iOS device you have connected to your Mac via USB.

[image link] [6]

To put it all together:

  1. Find an EPUB that you want to edit.

  2. Drop it on ePub Zip/Unzip to turn it into a folder and append the .epub extension.

  3. In iBooks, choose Advanced > Add ePub to Library as Proof and select your renamed folder.

  4. Open the newly imported proof in iBooks.

  5. Connect your iPad to your Mac via USB, and choose it from the Devices button’s popover.

Once you have run through these steps, you can start making changes and previewing them. Open the EPUB package on your Mac with the Show Package Contents command, and edit to your heart’s content. Whenever you make a change to any of the EPUB’s files, those changes appear within seconds in iBooks on your Mac and on any connected iOS device.

When you finish editing, you can turn the package back into a normal EPUB file by dropping it on ePub Zip/Unzip again. (If you want do want rename the package manually, choose File > Get Info in the Finder and then remove the .epub extension from the package’s name in the Info window — you can’t remove the extension directly in the Finder because all that does is hide the extension instead of removing it.)

After that, you are ready to ship your book… and move on to the next one. After all, of the making of books there is no end.

[Author’s Note: After I wrote the first version of this article, Paul Durrant modified his ePub Zip/Unzip app to append _pkg.epub to the folder name automatically, and to re-zip folders dropped on it that have that extension. I revised the article to reflect how the new version of his app operates. Moreover, if the EPUB package contains the standard OEBPS folder, the app also opens the package for you to that enclosed folder (though if that internal folder is missing or has a different name, you see an error message and have to open the package manually). Thanks, Paul!]

[1]: http://tidbits.com/resources/2015-02/Advanced-prefs.png
[2]: http://tidbits.com/resources/2015-02/add-epub-item.png
[3]: http://www.mobileread.com/forums/showthread.php?t=55681
[4]: http://tidbits.com/resources/2015-02/epub-zip-unzip-3-dialog.png
[5]: http://tidbits.com/resources/2015-02/tcpages-proof.png
[6]: http://tidbits.com/resources/2015-02/devices-menu.png