Use one folder to unpack, repack and validate your epub files
This is a handy way to quickly validate epub files on your Mac, (Mac only, I’m afraid) and preview them in iBooks.
Validating an epub file is a real pain, as it’s such a particular and unforgiving format. Browsers can be pretty forgiving about misplaced closing tags or poor HTML nesting, but .epub readers aren’t, often shutting down at the point where an error occurs.
Solving validation errors is a whole book in itself, never mind a blog post, but here’s a simple workflow and set of tools that you can have in one folder to make the process (relatively) painless.
You’ll need the following apps and scripts to make this work, but all are free.
- Dropbox (for storage and easily transferring files)
You can sign up here if you don’t have an account, or use my affiliate link
- Terminal (for running epubcheck)
Don’t panic if you’ve never used this before, it’s less complicated than it looks.
- epubcheck (for validating .epub files)
This is a Java tool for validation. It uses Terminal, but it’s really simple once it’s set up. Download the latest version.
- Epub Unzip (for unpacking .epub files)
Available from this forum thread, as is the script below.
- Epub Zip (for repacking .epub files)
Both scripts available from this forum thread. Scripts created by Dan Rodney
- Make a folder in Dropbox called “epubcheck” (or anything really)
- Download epubcheck, epubunzip and epubzip and copy the contents into this folder. It should look like this:
- Drag your .epub file into the folder (assume it’s called mybook.epub)
- Open Terminal and go to the epubcheck folder on Dropbox. (Tip: Just type “cd” and drag the folder into the terminal window to save time) – see animation below…
java -jar epubcheck-3.0.1.jar mybook.epub, and take note of all the errors.
- Drag mybook.epub onto ePub UnZip 1.0 – this will unpack your epub into its component files, allowing you to fix your errors.
- Fix as many errors as you can!
- Drag the mybook folder onto ePub Zip 1.0.3 – this will convert it pack into an epub, and save over the old file.
- Repeat until you are error free.
- On your iPad, open mybook.epub in Dropbox, and choose the option to open in iBooks. This will let you preview it on an actual device.
Step 5 (fixing the errors) is obviously the toughest part of all this, but hopefully these steps will make it fairly painless to get to the root of the errors rather than trying to find them in the first place.
We’re working on making it really simple to create your own publications and have them look great everywhere, so if there’s any way we can help, please let us know!