Creating a Free Kindle-Compatible eBook: Part 3

June 20, 2012
Author Article Technology

The most important file for the eBook is the content file. Actually, this could be more than one file, if you prefer. Some people like to have a separate file for each chapter. Personally, I think it is easier to make the whole content into one file. A number of files might, however, be easier, if you wish to have separate end notes at the end of each chapter, although this can also be done by splitting your final file into sections.

The content file should be prepared as a .doc Word document. It is possible to prepare such a file in Microsoft Word, or to use OpenOffice.org Write. In either case, the formatting of the document is important. The document must be well-formed. The chapter headings should be defined using Heading 1 style, with subheadings styled with Heading 2. The main text should be Normal or Body style. If you are not used to defining headings in such a way, or using styles, then please consult a tutorial on how to do this.

You now have two options. Mobi Creator is able to work on .doc files, though it will make an eBook that has quite a bloated file size. However, this first option is the easier of the two. The native file format for Microsoft Word, after 2003, is .docx, and the native file format for Write is .odt. In either case, you should save the file into the old .doc Word format. Both word processors can do this. The resulting .doc file can be imported into Mobi Creator, and the next tutorial will show you how to do this.

Your second option is to create HTML files. This is much cleaner and more efficient, but more time consuming, and requiring some knowledge of HTML code.

Using either word processor, save the file as an html file, using “Save as HTML” or “Save as Web Page”. Use the filtered HTML option if available.

The resultant file contains a lot of proprietary non-standard HTML code. We need to remove this. It is a painstaking process, but necessary. You could do it yourself in an HTML editor, but it is usually easier to get rid of most of it, using a Word HTML cleaner.

If you visit www.wordhtmlcleaner.co.uk, you will find a page where your bloated HTML file can be uploaded. After finding it with the browse button, click on the Process button. When the processing has finished, you will see a page filled with all your text. There is a tab for “cleaned HTML”. Click on that tab, and use the link to copy all of the cleaned HTML. This should be pasted into a new file in an HTML editor.

I usually use the CoffeeCup HTML Editor for this purpose. Make a new file in CoffeeCup, then delete all the HTML code that it has created. Paste the cleaned Word HTML into it.

You will then have to do some extra code cleaning. Look at the code below, which shows the html declaration and the document head.

<html>
<head>
<link rel=Preview href=”TheHolyWarForKindle_files/preview.wmf”>
<link rel=dataStoreItem
href=”TheHolyWarForKindle_files/item0001.xml”
target=”TheHolyWarForKindle_files/props0002.xml”>
<link rel=themeData href=”TheHolyWarForKindle_files/themedata.thmx”>
<link rel=colorSchemeMapping
href=”TheHolyWarForKindle_files/colorschememapping.xml”>
</head>

There are a number of things wrong with the code. All attributes should be in double quotes. For example, you will need to change

<link rel=Preview href=”TheHolyWarForKindle_files/preview.wmf”>

To

<link rel=”Preview” href=”TheHolyWarForKindle_files/preview.wmf”>

Do this to other statements within the <head></head> tags.

The code has produced an incorrect break tag. Therefore, <br/> must be changed to <br /> throughout the document; i.e. there needs to be a space between the r and the /. This is best done by a File > Replace call.

Some extra CSS style must be added to the head section. It is probably easiest to add this immediately before the closing </head> tag, as shown.

<style type=”text/css”>
<!–
body {
color: #000000;
font-family: calibri, arial, helvetica, sans-serif;
}
hr {
page-break-after:always;
width:0;
}
img {
display: block;
margin: 5px auto;
text-align:center;
}
–>
</style>

</head>

The body code is not strictly necessary. It just defines the font as Calibri (or use something else, if preferred). The img style ill enable images to be centered and blocked. The hr style is very interesting. It will allow the <hr /> tag to be used throughout the file as a Page Break.

Obviously, the next job is to put in page breaks! Work through your code, and place the <hr /> tag wherever you need a page break. The width:0 property makes this horizontal line invisible. I normally place these <hr /> tags at the end of chapters, and do not bother with other places.

When you have tidied this HTML code in this way, save your HTML file. Use a different file name from the earlier Word HTML document, just in case you need to do the code-tidying again. Make sure you save the file with a .html extension, not just .htm.

If you are using multiple HTML files, then you will need to put the CSS style into the header of every HTML file. This differs from producing a website, where a single call to a separate .css file would work for all the files.

The only other file that you absolutely need is an image for the cover. I make this using an image editor, such as GIMP. The best properties for your cover file are 5in x 8in (480px x 768px) and a resolution of 96dpi. A higher dpi is not needed, as this cover is not being printed. A print standard cover would need to be at least 300dpi.

gimpshot

Although it is not needed at this stage, you might want to make a spine of about 0.5 x 8in. This can be used with your cover later to produce a 3D book image that you can use on your website.

Your cover file, and spine file, are usually best saved as .png files, though .jpg could also be used, especially if your cover incorporates a photo.

In the next section, we will put these files and other information into the Mobi Creator and make your eBook.

Leave a Reply

Your email address will not be published. Required fields are marked *

*