Whether you want to merge collections of short stories into a DIY anthology, or you want to split a greatest-works volume you recently acquired into the author’s individual novels, you can follow along as we show you how to merge and split ebooks with ease.
Why Do I Want to Do This?
There’s all manner of motivations for wanting to split or combine ebooks in your collection. Perhaps you break up a massive anthology into small pieces, combine collections of poetry into a mega volume, or create one big master copy of every single Robert Heinlein book so you can use the progress tracking meter on your ebook reader to see exactly how far you’ve progressed in working your way through his entire life work.
Regardless of your motivation, today’s tutorial shows you how to merge and split the painless way without all the headache of mucking around in the guts of an ebook where you can easily wreck the markup language and render your book corrupt.
What Do I Need?
For this tutorial you’ll need the following things:
- A copy of free ebook management software Calibre
- The EpubMerge/Split Plugins
- DRM-free ebooks, in ePub format, you wish to merge or split
First, although you don’t need to be intimately familiar with Calibre to follow along with our tutorial, it wouldn’t hurt to familiarize yourself with the application. Check out our introduction to Calibre here. For the purposes of this tutorial, we’re assuming you’ve already installed Calibre and added the books you wish to work with.
Second, this technique relies on the structure of the ePub format. You can easily convert your books from another format into ePub format using Calibre (and then, when finished merging or splitting, convert them from ePub back to the original format). If the files you wish to work with are currently DRM-laden, you’ll need to strip the DRM before you begin manipulating them.
Installing and Configuring the Plugins
The heart of our workflow here, Calibre itself aside, is a pair of plugins contributed to the Calibre plugin database by JimmXinu. In order to use the plugins, we need to first install them. Within Calibre, navigate to the plugin menu by clicking Preferences ->Get plugins to enhance calibre, as seen in the screenshot above.
The User Plugins menu is, by default, sorted by the date the plugin was added to/updated in the database. Click on the Plugin Name column to sort by name and make locating our two plugins easier. Once sorted by name, scroll down until you find EpubMerge and EpubSplit, like so:
Select one and then click the Install button. Click Yes when the security risk dialog box pops up. In the next step, the plugin installer will ask where you want links to the plugin to appear. By default, it will add a button to your main toolbar. Because we tend to work frequently from the context menu, we also added a context menu entry:
As noted at the bottom of the window, you can always go into Preferences -> Customize the toolbar to change these settings later. Once you’ve made your selection and hit OK here, it will remind you that the changes won’t take effect until you restart Calibre.
Click OK instead of Restart as we need to install the second plugin. Repeat the exact same process for the second plugin. Double check that both EpubMerge and EpubSplit are installed. Restart Calibre.
After you’ve restarted Calibre, either right click to access your context menu or navigate to the main menu bar. EpubMerge has a few basic configuration options, whereas EpubSplit is configuration free. When you select Configure Plugin under EpubMerge, you’ll see the following options:
This is the default configuration and, unless you have a pressing reason to do otherwise, we suggest leaving as it is. Preserving the Metadata makes it extremely easy to precisely reverse the merge at a later date if you need to return the documents to their original state.
Merging Your Ebooks
For the purposes of this tutorial, we’re going to create a mega anthology of Jane Austen’s novels and some supplementary material. In order to create your merge, you need to highlight all the ePub documents you wish to collect together and then, either using the context menu or the menu bar, select EpubMerge -> Merge Epubs.
Note: If any of the documents you select are not ePubs or are DRM-protected ePubs, the process will fail immediately and you will be notified via popup window which documents caused the failure.
After selecting the documents and starting the merge, you’ll see the box shown in the screenshot above. By default, the ePubs are ordered as they appeared in Calibre. If you wish to rearrange them (in our case we arranged them by date of publication), you may use the green arrows on the righthand side to move them up, down, or (if you accidentally included an ePub file) remove them with the red X. When they are in the order you want, click OK.
In the next stage, two things happen. First, Calibre creates a metadata entry for the merged document in the Calibre database. A box will pop up warning you that you must review the entry before the actual merged document is created. This entry automatically inherits the metadata of the first document in the merge list:
In the case of our Jane Austen book merge, it inherited most of the metadata from her first book Sense and Sensibility (including the cover, title, author name, and if the book had been tagged in Calibre, the tags too). The comment metadata, usually where you would find a summary/review of the book, is replaced with a block of text generated by EpubMerge that lists the contents of the anthology. You can leave all this data as it is or take a moment to modify it (you can always modify it later by editing the merged document’s metadata in Calibre).
After approving the metadata, the merge is begins:
After the merge is complete, you’ll have a brand new entry in Calibre that contains the new metadata and the new ePub document. Let’s take a look at the ePub document to see how the structure of the pre-merge documents has been preserved:
All the books are gathered together with the individual structures of each book preserved (right down to the volume/chapter division from the original novel). Not only that, but the structure is preserved when we convert to MOBI. Success!
Splitting Your Ebooks
When it comes time to split your ebooks, there is the ultra-super-easy way and the slightly trickier way. If you are splitting a book that you previously merged with EpubMerge (and you had the “Keep Unmerge Metadata” box checked in the plugin options), then it’s a snap to split the mega volume apart.
In the case of our massive Jane Austen anthology, all we had to do to turn the mega volume back into the individual books was to right click on it and select EpubMerge -> UnMerge Epub. Afterwards, the plugin created a new entry for each distinct book, dumped the old metadata back into it, and placed the individual novel as an ePub in the directory. Thanks to the preserved metadata, it’s that easy.
If you’re splitting a document that does not have the metadata preserved by the EpubMerge plugin (either because you have the feature turned off or the document wasn’t created by the plugin in the first place) you’ll need to get your hands a little dirtier. Let’s take a look at our Jane Austen anthology using the EpubSplit plugin. After selecting the anthology and clicking EpubSplit, we’re presented with a fairly messy look at the guts of the ePub:
There is no automatic way to split a document that isn’t tagged with the helpful unmerge data placed by the EpubMerge plugin, so we’ll have to do this by hand. In the case of this already merged anthology, we have two sets of information we can go off to guide our split. First, each separate document that was originally merged into the mega volume has a unique number identifier found in the HREF column (in the case of the first novel, Sense and Sensibility, every file belonging to that novel is tagged with the number 9781411433144).
Alternatively, if we were working with a document that did not have clean demarcation via serial number between the different sections, we could look at the Table of Contents column to see where each portion (as marked via the ePubs table of contents structure) started and stopped. We could further confirm these points in the text by hovering over the list entry to preview a portion of the first page.
Either way, once we establish what we wanted to manually extract from the ePub, we then highlight just those entries and click New Book. You will receive a warning, just like you did with the Merge function, that indicates a new entry has been created in Calibre but will not be populated until you review the metadata:
Also like the merge process, the metadata is pulled from the original document (in this case, the anthology) and applied to the extracted document. In the absence of preserved metadata, you have to enter it manually (or use Calibre’s metadata scraping function) to properly populate the new documents metadata.
Let’s take a peek at our freshly extracted book:
The table of contents has survived the extraction process, as well as the formatting of the novel. Another success!
Have an ebook tip, trick, or technique of your own to share? Have an idea for an ebook-related tutorial? Join in the discussion below.
Jason Fitzpatrick is warranty-voiding DIYer and all around geek. When he's not documenting mods and hacks he's doing his best to make sure a generation of college students graduate knowing they should put their pants on one leg at a time and go on to greatness, just like Bruce Dickinson. You can follow him on Google+ if you'd like.
- Published 07/24/13