Before we can proceed to build our ebook file we need to know exactly what it's made of. Like nearly all ebooks today, Kindle fixed layout files are based closely on ePub, with some additional code for Kindle-specific features, as previously mentioned. Thus, we need to understand how ePub files are built, and just what Amazon has added (or in some cases removed). As we progress I'll point out which is which, and what parts you can alter.
Apple's fixed layout format for iBooks is also based on ePub (with their own proprietary code included), so that much of what you learn here can be used to make those as well (the 7-part tutorial on this blog shows you how). With some minor modifications, the same file can be re-configured to meet ePub and iBooks specs, making it readable on virtually any device. If you have already read my iBooks tutorial then you will recognize much of what is included in a Kindle ebook file, and you may also notice that a few items are missing. I will point out which features are Kindle-specific and cannot be used in other ePub editions of your ebook, and which ones are common to all. In many cases, you can simply leave the Kindle code intact and add the iBooks code in too! Here, however, we are focusing entirely on Kindle fixed layout ebooks, which can only be read by Kindle apps and tablets.
Opening the File
If you haven't downloaded one (or both) of the templates yet, then now would be the time to do so, as I'll be using them to describe the contents of a standard Kindle fixed layout file. We'll begin with the simplest layout pages and progress in stages to the more advanced features.
As I mentioned earlier, an epub file is just a zip archive with its extension changed. Consequently, you can open an epub the same way you open any zip file, by either changing the .epub extension back to .zip and extracting the contents, or by context-clicking on it (right-click or control-click, depending on your system, hereafter referred to simply as a context-click without distinction) and then selecting the options to open it with your zip tool of choice.
Most zip programs will add some options for creating and opening archives to your context menu, or offer you the option to do so. If yours are missing, you will want to (re)install a zip program with these options selected. As mentioned previously, 7-zip allows you to open an .epub as an archive without changing the extension to .zip, which will save you a great many steps along the way.
NOTE: Do not double-click the .epub file to "open" it, as this will open the ebook in your system's default ePub reader (or ask you to choose one), rather than as a collection of files contained within a zipped archive. The .epub file will open as an ebook, by the way, but it will not display correctly, since it is a Kindle file that has not yet been converted to Kindle format. Kindle apps and devices cannot read ePubs, and so this will not be one of your choices for opening the file as an ebook.
Inside the Template
When you look inside the template (or at the contents that have been extracted) what you'll see is two files and a number of folders (three in the simple template and four in the advanced version), which look like this:
nav.xhtml [Advanced Template only]
nav.xhtml [Advanced Template only]
/fonts/ [Advanced Template only]
This is the basic file structure which makes up the basis of any Kindle file, although there are endless variations, with either more or less content, and it's not always organized neatly into folders. Sometimes there are few (or no) folders at all and everything is just lumped together in one big mess (this is what you'll find if you look inside Amazon's own sample files, for example). But I like to keep things tidy for ease of reference, and I recommend that you do, too.
Here there is a separate folder for each type of file, plus two (or three) essential "controller" files that contain the "brains" of the operation, telling the e-reader what to do with the contents of the folders. If you look into each folder you will see that each contains a number of files of the relevant type to the folder's name. We will look at each of these in turn.
One thing you will notice in the /html/ folder is that there is a separate file for each and every page in the template. This is required for all fixed-layout ebooks, regardless of the format, since by its very nature the content of each page must be fixed, just as if you were designing it on paper or in a graphics program. Even if your ebook consists of nothing but full-page size images, each one much be contained in a separate html file with precisely defined dimensions.
In many ways, Kindle files are easier to make than iBooks or other fixed layout ePubs. If you have studied my iBooks tutorial, for example, you will see that there are no mimetype or container.xml files, and no /META-INF/ folder included here, such as are required by other ePubs, including iBooks. While these must be manually created for other fixed layout formats, the Kindle conversion process creates them for you automatically. So there are two pieces already that you don't even need to know!
A Note On File Names: With one exception, the names of the files can be anything you like, such as mybook.opf or illustration1.jpg, The exception is the cover.jpg file, found in the images folder, which is required by Amazon in order to create the thumbnails that appear on Kindle bookshelves. You cannot name your cover image anything but "cover" - not the title of your book, not "my_book_cover" or anything else.
Other than this, you're free to name your files however you like. So you might have, for example, yourbooktitle.ncx or mystyles.css instead of what is in the template. And, of course, there will very likely be a whole boatload of additional files in each folder before you're done, depending on the length of your book. So I highly recommend naming your files either sequentially or with some clearly descriptive titles that will make them readily recognizable.
If you look at the advanced template you'll see that there are several files inside each folder, including nearly a dozen CSS files and over twenty images, as well as three different fonts and an HTML file for each its eighteen pages, the latter of which are all numbered sequentially. The CSS files are each given numbers as well according to the page they are associated with, aside from one general stylesheet that covers the first eight pages.
We will take a look at each of these files in due time. But first we need to dive into the two operational files so that we can understand how a Kindle ebook works and make a few informed decisions as we start our project.
PURCHASE THE COMPLETE EBOOK TUTORIAL NOW!
The definitive guide to the Kindle fixed layout format, this fully revised and expanded tutorial will take you line-by-line through two working templates, including both the content and support files, as well as all layout and functionality features, explaining in painstaking detail what each element is for, and what your options are in every instance. Also included in the ebook is a code to download both templates for free!
Kindle .mobi format