Conversion to MOBI Format

The conversion from EPUB to MOBI/KF8 format can be accomplished using the Kindlegen program or the Kindle Previewer. Kindle previewer 3 can be downloaded from

https://www.amazon.com/gp/​feature.html?ie=UTF8&docId=1000765261.

The EPUB file can be input to the previewer where it is converted and displayed. The displayed MOBI file is not saved automatically, but can be saved using the Export option in the File menu.

Another option for converting an epub file to a mobi file is to use the Kindlegen program. Kindlegen is a command line program that can be downloaded from

http://www.amazon.com/​kindleformat/kindlegen.

Since Kindlegen is a command line program, the user must enter the full path of the executable kindlegen.exe in order to use it. It is possible to develop an alias that includes all the path information and is set every time a command window is opened. The alias can be used to run Kindlegen in any folder. In this section I am assuming that we are running Kindlegen on a computer using a Windows operating system. We first create a bat file init.bat that we can use to set any command aliases we desire. If kindlegen.exe is stored in the directory c:\kindlegen, then we put the following command in init.bat

doskey kg=c:\kindlegen\kindlegen.exe -c1 -verbose $1

You can also put aliases for the zip commands (used in building EPUB file) in init.bat. If zip.exe is stored in the directory e:\utilities, then we insert the following commands in init.bat

doskey zipnc=e:\utilities\zip.exe $1 -DX0 mimetype

doskey zipc=e:\utilities\zip.exe $1 -rDX9 META-INF OEBPS

If you downloaded the epubcheck validator, you can put an alias for it in init.bat, i.e.,

doskey val=java -jar e:\utilities\​epubcheck\epubcheck-3.0b4.jar $1

where you need to use the correct path for the jar file you downloaded.

Now running init.bat in the command window will replace the complete path to Kindlegen plus the options by the alias kg. Similarly, the zip commands will be replaced by zipnc and zipc,and the epubcheck command will be replaced by val. We next modify the registry so that init.bat will run automatically every time a command window is opened. We run regedit from the start menu to open the registry editor. We then navigate down the tree to the key

HKEY_LOCAL_MACHINE\​SOFTWARE\Microsoft\​Command Processor

We then enter a new string value whose value name is AutoRun and whose value data is c:\MyFolder\init.bat. Of course, you need to substitute the path to init.bat for c:\MyFolder. It is necessary to restart the computer in order for these settings to be incorporated. Now you only need to type kg in the command window in order to run Kindlegen in any folder. To convert an EPUB file BookName.epub to MOBI format we execute the command

kg BookName.epub

The result will be a file called BookName.mobi. This Mobi file can be viewed with the Kindle Previewer at various font size settings in order to see approximately how it will look on a Kindle.

To load the Mobi file on your Kindle connect the Kindle to your PC using the provided USB cable. The Kindle will appear as a drive on your PC. Under this drive there are several directories, one of which is named “documents”. You want to copy the MOBI file you created to this directory on the Kindle. You can then safely disconnect the Kindle as you would any connected device. When Windows says it is safe to disconnect the device, you can remove the cable from both the Kindle and the PC. The book you created will now appear on the home page of your Kindle.

If you are selling your book on Amazon, either the epub file or the mobi file can be used for uploading your document. You should consult the Amazon Kindle Publishing Guidlines for Amazon's requirements.

+++++