Word to Calibre to MOBI: Part 3: File Conversion

You went through Part 1 and styled your Word file properly. In Part 2 you learned how to turn it into a functional html file. Now it is time to convert your file.

A caveat before we begin. I use Calibre, but I don’t really use it. It has a pleasant display and it’s a good way to double-check EPUB files I create. I don’t use it to convert my files. What I am about to show you is the result of some serious screwing around with the program. It’s a hack and it may not be the very best one. What it does is work. So, if any of you are more familiar with how Calibre works and you have a better way, feel free to share.

STEP 1: Open your html file in Calibre. It will convert into a “zip” file.

CAL16STEP 2: Convert the ebook into an EPUB file. (Yes, EPUB, not MOBI. You will never again use Calibre to convert MOBI files for commercial purposes. It’s still just fine for personal use.)

CAL17STEP 3: Once your book is converted and you are back at the main page, right click on the book title and a drop down menu will appear. There will be an entry that says “Edit Book.” Click that.

CAL18STEP 4: Holy Moley time again. It’s an EPUB editor.

CAL19STEP 5: In the left hand sidebar, under “Text” delete the file that says “titlepage.xhtml”

STEP 6: Under “Styles” open the file that says “page_styles.css”. It will contain some code that says:

{
margin-bottom: 5pt;
margin-top: 5pt
}

Delete that and Copy/Paste in its place this bit of code:

{margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline;}
body {text-align: justify; line-height: 120%;}

STEP 7: Under “Images” will be your cover image. Open it. Now resize it. (make sure the Keep Aspect Ratio box is checked) Change the width to 800px. (The cover height should increase proportionately.)

STEP 8: Under “Miscellaneous” will be a file called “content.opf.” Open it. Scroll down to the bottom and you will see two entries: <guide> and </guide>. If you built your html file the same way as in this tutorial and deleted your titlepage.xhtml, there will be nothing in the guide.

CAL20Using Copy/Paste, insert this code between the two entries

<reference href=”FILE NAME” type=”toc” title=”Table of Contents” />
<reference href=”FILE NAME” type=”text” title=”Beginning” />

STEP 9: Figure out which of the files under “Text” is your table of contents. Copy the file name and paste it in the reference line so it replaces FILE NAME. (use Ctrl C to copy and Ctrl V to paste)

Do the same thing for whichever file (your title page or Chapter One or your preference for the beginning of your ebook) in the “Beginning” reference line.

Mine looks like this:

CAL21STEP 10: Save and close the EPUB editor.

STEP 11: Open the Kindle Previewer. Click on “Open Book” and select the EPUB file you just modified. If you did this right, you will get this box:

CAL22Now you have a MOBI file that will upload successfully at Amazon–and it will work. No squishy lines, no messed up formatting, and the user’s navigation guides will work.

I’m sure there are plenty of things you can do to modify the file in the EPUB editor. (I didn’t, for instance, even touch on the toc.ncx) This is a pretty rough hack I’ve come up with, and it can probably stand some streamlining. There is plenty of room for fine tuning. What I hope you see is that Word can be used for styling, but its html leaves far too much room for error in ebooks. With a little knowledge of html, you can write in Word, but then you do your styling in the text editor. When you’re comfortable with html, you can make complete ebooks and not have to use Calibre at all. (And you’ll be ready for Paul Salvette’s guide to ebook development, it’s featured in the sidebar.)

Again, you probably have plenty of questions. So send them to me at jayewmanus at gmail dot com and I’ll put together a FAQ post to answer them.

3 thoughts on “Word to Calibre to MOBI: Part 3: File Conversion

  1. Make changes suggested by not able to see the Table of Contents in th NCX in kindle preview. Any suggestions. Thanks for taking the time to teach us.

    • Hi Luis, yes, there is a way to change the Table of Contents display. I haven’t messed around with it, too much–Calibre doesn’t make it very easy. Calibre does NOT want to display the producer’s ToC since it is redundant in their display. So if you use a heading 1 declaration and “Table of Contents” or “Contents”, it’s going to suppress it even if it’s listed in the spine. You’ll need to go into the toc.ncx and insert the table of contents manually. If you do so, don’t forget to change the play order. See if that works for you.

  2. Pingback: Calibre and Kindle, Not a Good Match | J W Manus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s