Uploading to the Kindle Store
*edit* Added info for page breaks and cover images
After you’ve set up your account at dtp.amazon.com, there are a couple of ways to prepare your ebook so that you can upload it. You can prepare and upload it in html, doc, prc, or one of the other accepted formats. I like to prep books in html and then upload to Amazon. I let them do the conversion to the Kindle’s format. So in this article I’m going to talk about preparing a book in zipped html. If you want even more control, you can produce a file in the Kindle-Friendly .prc format. My buddy Darcknyt has a tutorial for that.
Why HTML?
If you are going to publish your ebook directly to the Amazon Kindle Store, one way you can upload your ebook is in zipped HTML format. I like html because it is easy to work with and I understand it inside an out. Plus, it’s easy to test.
Basic Steps
- export book to .html
- clean up html using notepad++ (or any old text editor with a search and replace)
- test in a browser.
- put html file into a zip file (using windows archiver thingy or 7-zip)
- Upload zipped html to dtp @ amazon.
1. Export
Exporting is easy. I use OpenOffice.org, so when I want an html version of my book, I just use File->Save As
then I select html from the Save as Type list in the file dialog.
Microsoft work handles it in a similar manner.
2. Clean Up
Word processors tend to put in a whole bunch of stuff into the html that doesn’t need to be there, and may very wel affect your formatting when you upload the book. So I open the file in my favorite text editor ( notepad++ ) and erase the crap.
The crap come in two forms: header crap and extra styling crap that is fed into the body of the work.
Header crap is easy to remove, just select it and delete it.
The extra styling crap I take care of using search and replace. In notepad++, you just hit Ctrl+H to open up the dialog.
In my OpenOffice.org exported html, I had just a couple of tags that extra crap thrown in.
<H1 CLASS="western" STYLE="page-break-before: always"> <P CLASS="first-paragraph" STYLE="margin-left: 0.49in; text-indent: 0in"> <P CLASS="first-paragraph"> <P STYLE="font-weight: normal">
I used the find and replace to change them to (respectively)
<H1> <P> <P> <P>
Also, if you have extra lines anywhere that look like:
<BR> <BR> <BR> <BR>
or
<P></p> <P></p> <P></p> <P></p>
make sure you remove them, too.
3. Test
Just close the text editor, then find the html file and double click it, or use file->open in your browser. Just scroll around and make sure things look ok.
4. Zip
You need to put the html in a zip file so that you can upload it to Amazon. Just put the .html file in it’s own directory, rename it to index.html (your windows may automatically handle the .html part), then right click the file and select Send To –> Compressed (zipped) folder.
You can now use the zipped html file.
5. Upload
As you are using the wizard on dtp.amazon.com to create your book, just select your shiny new zipped html file at the appropriate time.
Other Stuff
Table of Contents
If you want to have a table of contents, here’s how you can easily add one in.
Open the html file in notepad++ (or your favorite text editor). After the title & copyright information, you add in an unordered list that looks like this:
<p>Table of Contents</p> <ul> <li><a href="#ch_01">Chapter 1</a></li> <li><a href="#ch_02">Chapter 2</a></li> <li><a href="#whatever">Chapter Whatever</a></li> </ul>
The hash mark “#” is important, but you can pretty much name your chapters anything you want after that.
Now you add anchors to your chapter headings like this:
<h2><a name="ch_01">Chapter 1</a></h2> <p>It was a dark and stormy night...</p> <p>...</p> <h2><a name="ch_02">Chapter 2</a></h2> <p>Her hair smelled of watermelons and rancid corn...</p> <p>etc...</p>
Make sure you test the html file in your browser to make sure you’ve gotten the links right.
Page Breaks
If it’s important to you to have page breaks before each chapter (to make sure every chapter starts on the top of a page) you have two options.
- Add in the special tag <mbp:pagebreak /> before each chapter heading.
- modify the h1> (or h2> or b> or whatever) tags to be like this <h1 style=”page-break-before: always”>
Adding a Cover Image
Ok, here’s how to add an embedded cover image.
- Make a cover .jpg image. For example, call it “cover.jpg”
- Put the cover .jpg in the same directory as your .html file
- Open the html file in your favorite text editor. Right after the <body> tag, add in the following line
<div id=”cover”><center><img src=”cover.jpg”></center></div>
then save the html file.
- Now select both the cover and the html files in your file explorer and right click on one of them, then choose Send To -> compressed (zipped) archive from the menu as before. Both files will be included in the zip.
- Upload your new cover-containing zipped html file to dtp.amazon.com. Amazon will grayscale and resize your cover for you.
Pingback: » New Self-Publishing Tutorial Available Story Hack
I love this process, Bryce. My only question is how you make the HTML recognize a page break between chapters for the Kindle. I can leave the breaks in from my Word HTML file and when the .prc file is created, it (meaning the Kindle Previewer software I use, which is SUPPOSEDLY pretty doggone close to a real Kindle for format/appearance) recognizes the page breaks and moves the next chapter/story to the proper place.
Is this not necessary in HTML when Amazon’s DTP does the conversion from HTML? Do they know to do this automagically?
And I also read on the DTP support forums (which, remember, is only a bunch of users) that the ToC can be created in Word/OO.org and converted over to HTML just like the rest of the document, FYI.
I also believe inclusion of a cover image might be helpful; do you have information on that?
This is a well-written, clear and concise explanation of what goes into prepping a Kindle e-book. Nice work, bud!
About the page breaks. If you want to force the page breaks in each chapter, you can leave in one of the “extra formatting crap” things that I took out. You can change the <H1> (or whichever) tags to say <H1 STYLE=”page-break-before: always”> or you can add in a special tag <mbp:pagebreak /> where you want the page break to occur. I’ll edit the tutorial to include page breaks.
I like the simplicity of an unordered list best, and I’ve been afraid to see how a translated/exported table of contents ends up.
Not sure on the covers. I know there’s a way. I’ll check it out and get back to you. Thanks for the questions/ideas.
*edit: I figured out covers, too*
Pingback: eBook Preparation for Kindle Store | How To Self Publish A Book | Discount Kindle Books
Pingback: Bibliography: Self-Format & Self-Publish Your Novel | Text Isle Patchwork Blog
Awesome. Extremely helpful. Just what I was looking for regarding page breaks and images in ebooks. Thanks so much!