Join Anne-Marie Concepción for an in-depth discussion in this video Getting inside an EPUB file, part of InDesign CS6 to EPUB, Kindle, and iPad.
- View Offline
So you have done all you can in InDesign, you have exported it to EPUB, made sure it's valid, but there's still something that you need to change, there is something you want to edit. You know you can open it up in ADE and proof it on the iPad or whichever device you're going to be using. And maybe you want to change something here in the Table of Contents in the navigational TOC. Maybe there is a link that you want to add or remove. Maybe you want to change the CSS. There are something that you can do it InDesign and some things that are just really difficult or impossible to do in InDesign that you can only do by editing the HTML, CSS files, or other component files inside the EPUB.
So, the question that we're confronted with is how do we get to the files inside an EPUB? If you recall from an earlier video, I mentioned that an EPUB is a collection of files, kind of like a miniature website. And they're all compressed into a zip file that is masquerading as an EPUB. And if you you're on Windows it's very simple to extract those component files just as you would extract any zip file. You would just select the zip file, right- click and choose Extract All with unzip, or dzip, or 7zip or whichever kind of utility that you have.
You can't do that on the Macintosh, though. You can change the extension from .epub to zip. I'm going to Use zip, and this is what you will be doing on Windows and in that Windows you can just right-click and decompress it. But on the Mac if are accustom to double- clicking this to unzip it, it doesn't quite work. It just goes into this endless loop. Now, there are UNIX command line commands that you can use in Terminal on the Macintosh to unzip an EPUB. Let me trash this and rename this back to EPUB.
Instead, I like to use this utility called EPUB UnZip, and I have included this AppleScript in the Scripts folder of the exercise files. And it's freely available all around the internets so you can just do a search for EPUB UnZip app. It essentially writes all those Command Line codes into an AppleScript. And so to expand an EPUB, you simply drag and drop right on top of the EPUB UnZip, and it makes a folder with the exact same name of the EPUB at the same level.
So, this script can be anywhere on your hard drive, and as soon as you extract an EPUB, using it, it'll put that folder at the same level of the EPUB. And now, we can come in here, and we can edit the HTML files or we can edit the CSS files, and all this other fun things that we're going to be learning about. Now, when you're done editing these files, then the trick is how do you put Humpty Dumpty back together again? On a PC you essentially can simply rezip it. You have everything inside the folder, right- click, compress it into a zip file and then change the .zip to .epub, and that should work.
But on the Mac, you can do that. Instead, you have to use Command Line Tools in Terminal or you can use our friend EPUB Zip. So, when you're done editing it, you'd just take this folder-- now, I'm actually going to rename it, because it's going to say, hey, there's already a History-of-Art.epub, should I overwrite it? So, I'll call it History-of-Art2, drag and drop at right on top of EPUB Zip, and there we have our EPUB, double-click, it opens just fine in Adobe Digital Editions. Now, there are a number of programs that will let you get to the inside of an EPUB without having to crack it open.
For Example, on a Macintosh there is this program called Springy, and I have an icon of it right here. So, I can drag and drop this right on to Springy, and it shows me the contents. Now to have some cracked it open, but it lets me see what's in here, and I could select a file and get a preview of it. In fact, I could right-click on a file, and I could extract a single one, or I could actually edit it while its sitting here. So, for example, I can edit this file in TextWrangler, change something here, like delete the word had, close TextWrangler, save it, and then it says, Are you sure you want to overwrite the existing item? Yes please. And then that's it.
When I close it still History-of-Art.2, but it's got my change saved there. There are a few programs for both the Macintosh and Windows that can do this kind of editing of what are called archive files. But very often, when you are editing an EPUB, you want to make a change throughout all of the files. You want to change all instances of one thing to something else. You want to do a Find and Replace across multiple files or do more heavy-duty editing, you want to make sure if you change the file name of an image that all links to it or automatically updated. So, in those cases you need something more robust than this little peak and fix kind of utility.
And that's when your friends the AppleScripts for unzipping and zipping EPUBs will come into play on the Mac, and as I said, on Windows you really don't have to worry about it.
- Understanding the differences between ebook formats
- Best practices for InDesign file preparation
- Managing the content flow with Layout order and the Articles panel
- Using free InDesign scripts to automate EPUB productions
- Optimizing images, charts, and tables
- Opening and examining EPUB files
- Editing important CSS and HTML tags
- Including drop caps, pull quotes, and text wraps
- Enriching your EPUBs with video and embedded fonts
- Acquiring an ISBN for ebooks
- Converting EPUBs to Kindle format (MOBI and KF8)
- Distributing ebooks with resellers and aggregators