This is a simple command line tool for patching opf files present in EPUBs so that they get all the extra features when converting to MOBI.
- Optionally remove the cover declaration. As of right now, Amazon recommends that you upload the cover separately and it'll combine the two when processing your MOBI file. When keeping the cover in, I had problems getting the Cover link to work in Kindle for Android, though that might be another bug. Making this optional however, lets you produce MOBI files for distribution outside of Amazon, with the cover intact
- Optionally add a link for the start of the book so that when readers first open, it starts in the right area
- Optionally add a link for the dedication section
- Optionally add a link for the acknowledgements section
- Optionally add a link for the back-of-the-book section
How do I get set up?
All interaction is done via the command line, making it a perfect fit for a step in your build chain.
Once downloaded, there are two ways to use the OPFPatcher:
Use a pre-built exe
bin folder, you'll find exes for your target platform. Currently Windows x86 and x64, as well as a Mac version. Linux will arrive in time.
Simply target the exe in question in your batch file/command prompt and you're good to go (see uses below)
Work from source
You'll need Node installed, obvs. You can directly target the source (after using
npm install to install dependencies) using a call:
node index.js [arguments]
but you can also install it so it can be accessed globally. Open a command prompt inside the folder where you've downloaded the source and type:
npm install -g
This will let you call it from anywhere using the
--help to get a list of all the commands and what they do. A full example would be:
opfpatch -i PATH_TO_OPF.opf --book book.xhtml --book-title "Book" --ded ded.xhtml --ded-title "Dedications" --ack ack.xhtml --ack-title "Acknowledgements" --bob bob.xhtml --bob-title "About the author" --cover-html my-super-cover.xhtml --keep-cover
If you’re using a pre-built exe, then replace the