Sunday, May 16, 2010

How to use Kindlegen to create ebooks for your Kindle

Apparently, this has been a pretty popular article so I decided to provide a quick overview if you just want the fast, dirty steps for using kindlegen. If you would like some more detail then read the further explanation below.

2. Unzip the files to the folder where you keep your ebooks (it's really much easier that way)
3. Open your command line and point to the folder containing your ebooks and kindlegen.
4. Enter the command 'kindlegen.exe ebook.html' where ebook.html is the name of the ebook you want to convert. note: in order for kindlegen to make the conversion the file must be in html format.
5. Move the newly created .mobi file to your kindle's ebook directory
6. Enjoy a favorite book or new adventure that you've converted yourself :)


For some reason (not so difficult to imagine) there appears to be no simple explanation of how to use Kindlegen on the internet. This amazed me since I would think lots of people would want to convert and add their own ebooks to the Kindle. Kinlegen can be used to do just that. The catch is, it is only available in the command line. This may be intimidating for some but I guarantee it's not that difficult once you understand how it works. Here's what to do.

1. Get the latest version of kindlegen from Amazon's website (available here at the time of writing this article: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621 )

2. Unzip the files to a chosen location

3. At this point your options open up considerably. You can create a very basic book or a very complex book depending on how dirty you want to get with HTML and XML coding. Among the unzipped files you'll find a folder called 'Sample' that contains a complex book (the Kindle User's Guide) with all of the supporting files that would be needed to create it, you can review how this is all set up if you like. For now, I'm going to just go over the basic book option in order to keep this short. If you would like more in depth info on how to create a complex book (linking images and table of contents, etc.) go ahead and comment or email me directly.

4. Okay, in order to create a simple ebook for the kindle you'll need an HTML file of your ebook. If you go to Project Gutenberg (gutenberg.org) you can download a TON of out of copyright books in HTML format. You can also use PDFs or txt files you've purchased but you'll need to convert them to html (you can use PDFtoHTML and txt2html respectively to do so). Okay, once you have the HTML file, do yourself a favour and put it into the same folder as Kindlegen.

5. Now, open up your command line. In Windows, go to Start > Run and enter cmd then press enter. In Linux, you should be able to find the terminal under Accessories or some other main menu option. Once open, navigate to the location of Kindlegen.
e.g. C:\Documents and Settings\myname\My Documents\ebooks\Kindlegen\

If you are not familiar with a command line then you are probably in Windows and can get there by entering
c:
cd..
cd Documents and Settings\myname\My Documents\ebooks\Kindlegen

6 Once your command line is pointing to the folder where you have kindlegen and the HTML file (we'll call it ebook.html in our example but you would put in the name of the HTML file you are converting) all you have to do is type

kindlegen.exe ebook.html

For some reason in Linux I had to enter the exact file path so it would be something like this:

/media/disk/Documents/ebooks/kindlegen/kindlegen /media/disk/Documents/ebooks/kindlegen/ebook.html

7. You'll notice that a new file is created in the directory called ebook.mobi. Connect your Kindle to your PC and drop the file into the same folder as your other ebooks.

8. Eject your Kindle, disconnect it and then start the Kindle. If you've done everything correctly you should see the ebook now available in your home screen.

Congrats, you can now take any HTML file you have available to you and create your own ebook for reading on the Kindle. Cheers!


Oh, as a final note - Again, you could get much more in depth in the process and use an OPF and NCX file but you should only need that if you are getting serious about publishing. You can open Kindlegen's help by simply typing kindlegen.exe or kindlegen without any filename following it. This will bring up all of the kindlegen options. Happy reading!