Bookshelf | Reports | Community | KDP Select

Home » Amazon KDP Support » Ask the Community » Formatting

Thread: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 26 - Pages: 2 [ 1 2 | Next ] - Last Post: Jul 10, 2012 7:59 AM Last Post By: man2010
man2010

Posts: 1,897
Registered: 01/01/10
How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 6, 2011 12:41 AM
Click to report abuse...   Click to reply to this thread Reply
You need to know the simplest basics of the HTML language and HTML editing in order to follow this protocol; they are described here:

http://forums.kindledirectpublishing.com/kdpforums/thread.jspa?threadID=12155&tstart=0

Generally speaking, this protocol is best suited for epub (Nook) books, but can also be used for Kindle books. You should only use this protocol for a Kindle book as a method of last resort. If you are a Mac user or don't have Microsoft Word, a better method for you is the HTML-only procedure described at the end of the above web page. Keep in mind that Calibre-generated ebooks occasionally get rejected by the KDP website. If you are a Windows PC user and have Microsoft Word on your computer, then the best approach for Kindle books is to use MobiPocket Creator and KindleGen as described in the following post:

http://forums.kindledirectpublishing.com/kdpforums/thread.jspa?threadID=9978&tstart=0

The protocol that follows is based on a free program called Calibre ( http://calibre-ebook.com/ ) and seems to be the best option for Mac users and for people who do not have Microsoft Word. This procedure will create a good-quality full-screen cover for your Kindle book. In the case of a NookBook, you will have a good-quality native cover (Nook covers are not full-screen by design). The protocol will also create both the regular and logical (NCX) table of contents for your Kindle and Nook books. The table of contents will be placed at the end of the book and will be absent from the free sample of your Kindle book on Amazon.com (this is not a big deal). The “Beginning” function may not work predictably in your Calibre-generated Kindle book (no big deal either).

Before importing the book file into Calibre, please make sure that your file does NOT have the cover and table of contents because they will be created separately by Calibre. Save your manuscript file as a web page (extension .html not .htm) in your word-processing software (WordPerfect, OpenOffice, Microsoft Word, etc). If you have the option "web page, filtered," then select the latter option.

The next step is HTML cleanup and formatting as described in the following post:
http://forums.kindledirectpublishing.com/kdpforums/thread.jspa?threadID=12155&tstart=0

To edit HTML files, Mac users can use a simple program called "TextEdit"; make sure to "Save as plain text". After that, for both the Kindle and Nook book, you will need to prepare the HTML file of your book for creation of the Table of Contents BEFORE importing the file into Calibre. This is a little tricky because you need to know the basics of HTML. Basically, you need to wrap all your headings (titles of chapters, sections, etc.) within your book using the "h1" heading tags (this is done in HTML code manually). It should look like this in the HTML file:

<h1>Chapter One</h1>

(Your text code here)

<h1>Chapter Two</h1>

(Your text code here)

See the examples of code in this well-formatted HTML template, i.e. a beginning of a book (right-click and save as .html file):

http://forums.kindledirectpublishing.com/kdpforums/servlet/JiveServlet/download/13-9978-41539-2755/how%20to%20become%20smarter%20kindleedition4_f3d6c44b.html

If you want to get fancy, you can wrap your lower level headings (e.g. sections within chapters) using tags "h3" in a similar fashion. (See the HTML template in the link above.)

Final preparatory note: you need to create HTML tags for page breaks that Calibre will easily recognize. You can insert this custom tag: <pgbrk /> manually in your HTML code immediately before each place where you plan to have a pagebreak (before each chapter and section within a chapter, title page, copyright page, etc.). IMO, this is the simplest way to create pagebreaks that Calibre will recognize easily. Unfortunately, Calibre cannot be easily programed to recognize the Kindle pagebreak <mbp:pagebreak/>. If you have pagebreaks created by Word, the corresponding HTML tag in your resulting HTML file will be somewhat more complicated, something like this:

<p style="page-break-before: always">

IMO, it will be quite difficult for beginners to program Calibre to recognize all these different tags simultaneously (h1, h3, page-break-before, etc.) and that’s why I recommend inserting this custom tag <pgbrk /> throughout your HTML file manually in Notepad, in order to mark pagebreaks. You can use the automatic “Edit -> Replace” menu of Notepad for this purpose, for example replace all occurrences of <mbp with <pgbrk /><mbp and so on for other tags. You get the idea.

Now the HTML file of your book is ready, and you can download and install Calibre e-book management software ( http://calibre-ebook.com/ ). Select an easy to remember location for your Calibre library, when prompted to do so. Launch the program.

Click “Add books” button, navigate to your HTML file and click “OK.”

Select the book in the central panel of Calibre (single left click) and then press the “Edit metadata” button. Fill out the following fields (ignore the rest): author (format: Smith, Jane), title, published, and publisher (KDP or Pubit). In the center of the dialog window you will see the section “Change cover.” Press the button “Browse” and select your cover image. The image should be JPEG format, 126KB or slightly smaller for a Kindle book, dimensions 600x800 pixels. If your image file is bigger than 126KB, you can reduce JPEG quality settings in your graphics editor when saving the file; many graphics editors have this option. For a NookBook (epub format), the cover should be JPEG format, 259KB or less, with dimensions 600x730 pixels. Click “OK” to close the metadata dialog window.

Select the book in the central panel of Calibre (single left click) and then press the “Convert books” button. At the top of the dialog window, it should say “input format: ZIP” on the left-hand side and you need to select “output format: EPUB” for a NookBook or “output format: MOBI” for a Kindle ebook. Each option will be described separately below.

KINDLE BOOK:
You are creating a .mobi file and in order to build a table of contents you need to set the following options in the conversion dialog window.

Click “Page Setup” on the left-hand panel and select Kindle as the output profile and “Default Input Profile” as the input profile.

Click “Structure detection” on the left-hand panel of the dialog window and DELETE all code in all text fields and uncheck every option. Set “Chapter mark:” to “none.” Now click the magic wand button next to your empty “Insert pagebreaks before” field. Replace the asterisk * in the top field with “pgbrk” (without quotes). Leave the other two fields empty and click “OK.”

Click “Table of Contents” on the left-hand panel of the dialog window and click the magic wand button next to the field “Level 1 TOC.” Replace the asterisk * with “h1” (without quotes) and click “OK.” If you are planning to have a two-level table of contents with h3 tags, then you can program h3 tags in the Level 2 TOC field in a similar fashion.

Do not change any other options in the conversion dialog window and click “OK” to proceed with the conversion. After some rumination, Calibre will create your .mobi file and place it in your book folder in the Calibre Library directory, next to the zip file of your imported HTML file. You will know the job is finished when “Jobs: 1” changes to “Jobs: 0” in the lower left-hand corner of Calibre main window. That’s it. Calibre should create a nice cover, TOC and a matching NCX. Check the formatting of your ebook in Kindle for PC (or Kindle for Mac, available at: http://www.amazon.com/gp/kindle/kcp ), in Kindle Previewer (available at: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621 ), and also e-mail the .mobi file to your Kindle device, if you own one. Rinse and repeat if you need to change something.

See the end of the following post regarding possible problems with the free sample of your Kindle book on Amazon.com:

http://forums.kindledirectpublishing.com/kdpforums/thread.jspa?threadID=9978&tstart=0

NOOK BOOK:
Remember that your cover image should have dimensions that are different from a Kindle cover (600x730 versus 600x800). Change the metadata if necessary; you can also do this in the conversion dialog window.

Select the book in the central area of Calibre and select the zip format immediately to the left (you need to mark it with a big green plus sign).

Click the “Convert books” button and make sure you have these settings at the top of the window: “input format: ZIP” on the left-hand side and “output format: EPUB” on the right.

Click “Page Setup” on the left-hand panel and select Nook as the output profile and “Default Input Profile” as the input profile.

Click “Structure detection” on the left-hand panel of the dialog window and DELETE all code in all text fields and uncheck every option. Set “Chapter mark:” to “none.” Now click the magic wand button next to your empty “Insert pagebreaks before” field. Replace the asterisk * in the top field with “pgbrk” (without quotes). Leave the other two fields empty and click “OK.”

Click “Table of Contents” on the left-hand panel of the dialog window and click the magic wand button next to the field “Level 1 TOC.” Replace the asterisk * with “h1” (without quotes) and click “OK.” If you are planning to have a two-level table of contents with h3 tags, then you can program h3 tags in the Level 2 TOC field in a similar fashion.

Do not change any other options in the conversion dialog window and click “OK” to proceed with the conversion. After some rumination, Calibre will create your .epub file and place it in your book folder in the Calibre Library directory, next to the zip file of your imported HTML file. You will know the job is finished when “Jobs: 1” changes to “Jobs: 0” in the lower left-hand corner of Calibre main window. That’s it. Calibre should create a nice cover, TOC and a matching NCX. Check the formatting of your ebook in the Calibre eReader or other epub software, including Nook for PC. Edit the original HTML file and reimport it if you want to change something.

Do not worry about epubcheck compliance; it is very likely that your Calibre-generated file will be accepted by the Pubit system without any problems. In the unlikely event that you experience problems, you can use my HTML template (the link above) to rebuild your ebook, and this should result in a problem-free (but epubcheck-uncompliant) EPUB file.

In its formatting guidelines, B&N recommends checking your epub file for compliance with epubcheck, but this does not mean that epubcheck is required by B&N. One of my book files has over 600 epubcheck problems, but it was published successfully by Pubit and works fine on Nook and Kobo eReaders and in Nook reading applications. You will save yourself a lot of unnecessary headache if you you do not submit your ebook to retailers that require epubcheck. These retailers hold a miniscule share of the ebook market and, with most of them, you cannot update your book file easily and free of charge, the same way you can on KDP and Pubit. Those two occupy over 90% of the eReader and ebook market; if you have your ebook on Nook and Kindle, you need not expand any further.
starbuckjones

Posts: 659
Registered: 06/07/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 13, 2011 1:17 PM   in response to: man2010 in response to: man2010
Click to report abuse...   Click to reply to this thread Reply
Helpful information. I wrote a guide based on my experiences trying to create the correct files and format for a nook book and kindle. It can be found here. I did not try to create a table of contents.

http://www.TheEternalGateway.com
booknookbiz

Posts: 2,041
Registered: 03/04/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 14, 2011 1:51 AM   in response to: man2010 in response to: man2010
Click to report abuse...   Click to reply to this thread Reply
Man2010:

Your statement, "Do not worry about ePubCheck compliance, it is not required for B&N ebooks. Calibre designers know enough about ebooks and the EPUB format to ignore epubcheck. I recommend this post regarding EPUB files created by Calibre"

Is incorrect. B&N's own FAQ and formatting standards state:

"Also, make sure that it passes ePub Check 1.0.5. To test your ePub file in ePub Check, go to http://code.google.com/p/epubcheck/. "

I think Calibre is wonderful--but I don't know anyone who has EVER gotten an epubcheck-passed epub out of it without significant editing in XHTML. People should not expect PubIt-acceptable titles from a Calibre conversion. Am I saying it absolutely, positively, will NOT work? No...but it most likely will not.

HTH,
Hitch
I produce ebooks
http://www.booknook.biz/
Please check out SHAKEN: STORIES FOR JAPAN http://amzn.to/lsKlS2 - 100% of the royalties go directly to Japanese Tsunami, Earthquake and Radiation victims.
man2010

Posts: 1,897
Registered: 01/01/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 14, 2011 2:54 AM   in response to: booknookbiz in response to: booknookbiz
Click to report abuse...   Click to reply to this thread Reply
Bkhitch,

you have more experience than I am, but I have to respectfully disagree. One of my books consists of an extremely complex epub file: about a thousand each of internal and external links and about 200 split HTML files. The file was created by Calibre and tested by guys at Borders-BookBrewer on Kobo and Nook readers. They found no problems with the ebook and it works fine in Nook for PC (my testing). At the same time, epubcheck generates over 600 arcane errors.

The Calibre team tests epub files on the Nook ereader, if memory serves, I saw it in one of their change logs. Calibre-generated epub files work fine and this tells me that epubcheck is largely irrelevant. Kovid Goyal (the creator of Calibre) thinks that publishers who require epubcheck compliance are without a clue.

It is true that B&N recommends epubcheck compliance, but it does not require it. I have published and reuploaded new versions of the above-mentioned epub file over 30 times now, and there are no problems in the Pubit system and the Pubit preview. The file has over 600 epubcheck problems.

If you are curious how this book works with Nook apps and devices, I can send you a B&N gift card, just give me your e-mail address.

Having said that, it is possible that my complex epub file has problems with other epub-compatible devices and applications. IMO, the cost of epubcheck compliance would be greater than a possible benefit. If you have your ebook on Nook and Kindle you have over 80% of the market covered.
booknookbiz

Posts: 2,041
Registered: 03/04/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 14, 2011 7:38 PM   in response to: man2010 in response to: man2010
Click to report abuse...   Click to reply to this thread Reply
man2010:

I'm not arguing about whether or not epubcheck is requisite, or whether or not one can sideload an epub that is rife with errors to Nook, NookColor, iBooks or any other epub-reader; and i'm personally very fond of Kovid, and always impressed with his work.

HOWEVER, that being said, clueless or not, B&N's standard [u]right now[/u] states that passing epubcheck IS required for epubs. You stated that it wasn't. I can tell you from experience that outside of "enhanced" epubs (iow, with audio/video) no epub that does not pass epubcheck will make it past Apple's filters, either. If B&N change their requirements, great; but I get a LOT of non-compliant epubs in here that are Calibre-generated that can't get past B&N's upload and get kicked back for not passing epubcheck.

I'm not getting into some argument about the relevance, irrelevance, or necessity of epubcheck. B&N doesn't recommend it; it states it's required. I can guaran-damn-tee you that Apple requires it. Hell, even SMASHWORDS generates epubcheck-passing epub files. Kobo requires it, as does Diesel.

Nor do I disagree that having books on Nook and Kindle covers (significantly more than) 80% of the market.

I'm simply stating that B&N isn't "recommending" epubcheck; they are requiring it, at least on files that I'm getting from DIY'ers that have had epubs that are NOT passing. Does this mean that EVERY Calibre epub won't upload? No, but it does mean that B&N won't help a DIY'er with a non-compliant epub that doesn't upload "auto-magically." My point was that telling people that epubcheck isn't required, so they can ignore it, is misleading.

HTH
Hitch
I produce ebooks
www.booknook.biz
man2010

Posts: 1,897
Registered: 01/01/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 14, 2011 10:12 PM   in response to: booknookbiz in response to: booknookbiz
Click to report abuse...   Click to reply to this thread Reply
changed the wording in the first post.
badken

Posts: 828
Registered: 04/10/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 14, 2011 10:24 PM   in response to: booknookbiz in response to: booknookbiz
Click to report abuse...   Click to reply to this thread Reply
Hm. Well, this could be embarassing, because I've been using Calibre to make epubs for people. I haven't got any complaints, but maybe they're just cursing my name silently.

What kinds of problems does Calibre introduce? What tools would you recommend for a trouble-free PubIt submission?

url=mailto:ken@ebookfab.comK. P. Badertscher[/url] – Ebookfab.comEbook blogFacebook@ebookfab
Transforming manuscripts into beautiful ebooks.
booknookbiz

Posts: 2,041
Registered: 03/04/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 15, 2011 2:29 AM   in response to: badken in response to: badken
Click to report abuse...   Click to reply to this thread Reply
Hm. Well, this could be embarassing, because I've
been using Calibre to make epubs for people. I
haven't got any complaints, but maybe they're just
cursing my name silently.

What kinds of problems does Calibre introduce? What
tools would you recommend for a trouble-free PubIt
submission?

url=mailto:ken@ebookfab.comK. P. Badertscher[/url]
Ebookfab.com
Ebook blog
[url=http://www.facebook.com/pages/Ebookfabcom/1699121
86402173]Facebook[/url] –
@ebookfab
Transforming manuscripts into beautiful ebooks.


Badken:

Honestly, I don't know how to say this diplomatically, but--if you don't already know the answer to this, how can you be charging people to MAKE ebooks for them?

I used to make epubs by hand. Now I use Sigil, (an xhtml epub editor) which saves a fair amount of time. I certainly would not use Calibre, not because it's [i]not[/i] a worthwhile program, but because even Kovid Goyal would tell you that it is NOT a production tool, it's a bloody library program that handily converts books [u]for their OWNERS[/u]. if you're saying that you don't know that Calibre introduces problems that prevent it from passing epubcheck, that tells me that you haven't used epubcheck on your epubs--what have you been using? When someone comes back to you with an epub that failed epubcheck--that couldn't be uploaded to, say, Apple, what is your game plan to FIX that epub, if you don't know how you made it?

You should take one of your Calibre-genned epubs, and run it through epubcheck, and work through ALL of the resulting errors, until you get an error-free epub. It's an experience you won't soon forget. I'm not saying this to be a jerk--I'm saying it because it is a genuine learning experience. I'd recommend you use Sigil or a really good html editor like NoteTab Pro to work through the errors and fixes. That's my best recommendation.

HTH,
Hitch
I produce ebooks
www.booknook.biz
badken

Posts: 828
Registered: 04/10/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 15, 2011 1:20 PM   in response to: booknookbiz in response to: booknookbiz
Click to report abuse...   Click to reply to this thread Reply
Well, I'm of the "jump off that bridge when we get to it" school of problem solving. Since I hadn't run into any problems with Calibre yet, I wasn't expecting any. Now I know better. I have used Sigil, and of course I can make epubs manually, but that's a pain in the butt. Sigil is much nicer, and now that I know it's more conformant, I'll be using it. Calibre was just a whole lot easier, so I was taking the path of least resistance.

I don't think it's fair to be saying that I have no right to charge anyone to produce ebooks. I have helped a lot of people. I'm not trying to dupe anyone, I'm doing the best that I know how. I'm completely open with post-production support, and I make sure everyone knows they can contact me at any time in the future if they have a problem with a book I've produced. Since nobody ever came to me with a problem, I wasn't aware there was a problem until I saw this thread.

If I'm guilty of anything, it's trusting that a piece of software that says it will create an epub will do it correctly.

url=mailto:ken@ebookfab.comK. P. Badertscher[/url] – Ebookfab.comEbook blogFacebook@ebookfab
Transforming manuscripts into beautiful ebooks.
notjohn

Posts: 15,241
Registered: 01/06/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Jun 26, 2011 2:44 AM   in response to: badken in response to: badken
Click to report abuse...   Click to reply to this thread Reply
[i]of course I can make epubs manually[/i]

Wow. That's impressive. (You too, Hitch.)

My own experience with Calibre wasn't happy, but then my experience with Sigil wasn't that great either. I would get literally hundreds of faults from epubcheck. I corrected the ones I could understand and find, uploaded the (somewhat) mended epub file to Pubit, published it, bought a copy, and was quite happy with the result.

Hitch says that Kindle plus Nook = more than 80 percent of the market. If that's true, I have to guess that Kindle less Nook = 75 percent of the market. (I do appreciate that some people sell more copies on B&N than on Amazon, but that's certainly not my experience.) So I've decided to put no more effort into epubs.

I also sell a few books on the Sony and Apple platforms, uploaded through Lulu or Smashwords. They didn't pass epubcheck either! (Last fall, Apple stopped accepting books from Lulu. Perhaps I was the cause of that?)
sanforddr

Posts: 2
Registered: 05/27/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Aug 19, 2011 10:49 AM   in response to: badken in response to: badken
Click to report abuse...   Click to reply to this thread Reply
No problem for me at all when converting my book using Calibre. The Pubit was accepted overnight, and the file looks great on the device.
I'm very happy with Calibre, for Kindle, nook, sony, and ipad conversion.
Back in April I worked out the html for forcing your chapter titles into a table of contents. It works very well, also allowing you to feed in the Acknowledgements, Dedication, etc...

D R Sanford, author of FREEFALL
booknookbiz

Posts: 2,041
Registered: 03/04/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Sep 30, 2011 2:19 AM   in response to: sanforddr in response to: sanforddr
Click to report abuse...   Click to reply to this thread Reply
No problem for me at all when converting my book
using Calibre. The Pubit was accepted overnight, and
the file looks great on the device.
I'm very happy with Calibre, for Kindle, nook, sony,
and ipad conversion.
Back in April I worked out the html for forcing your
chapter titles into a table of contents. It works
very well, also allowing you to feed in the
Acknowledgements, Dedication, etc...

D R Sanford, author of FREEFALL


Hi:

Don't think I can find your title on the iBookstore? When was it ingested? I see it on Nook, uploaded in August, but not on the iBookstore yet?

Hitch
I produce ebooks
http://www.booknook.biz/
Follow me on Twitter: http://twitter.com/BooknookBiz
notjohn

Posts: 15,241
Registered: 01/06/10
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Nov 4, 2011 2:24 AM   in response to: sanforddr in response to: sanforddr
Click to report abuse...   Click to reply to this thread Reply
**Back in April I worked out the html for forcing your chapter titles into a table of contents. It works very well, also allowing you to feed in the Acknowledgements, Dedication, etc...**

Tell us more! Are you speaking of a hotlinked table of contents or a NCX file?
punchygonzales

Posts: 2,853
Registered: 11/26/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Dec 18, 2011 6:29 PM   in response to: man2010 in response to: man2010
Click to report abuse...   Click to reply to this thread Reply
“Before importing the book file into Calibre, please make sure that your file does NOT have the cover and table of contents because they will be created separately by Calibre.”

Actually, Calibre will only generate an external TOC (the one your e-reader uses in the “go to Toc” function) but certainly not an internal one (at the beginning of a book), and most readers with any savvy will want to have both. And if you place a cover at the front of the book, you can always check the box in Calibre that says “Remove first image”.

One of these days I’m going to post my own way of producing mobi and epub files starting with basic HTML and then going through Calibre’s conversion settings. I don’t use many of the extra functions in Calibre. I think it’s best to do as much as possible in HTML instead. If you do it right, you can create a perfect mobi file and then bring that back into Calibre and output a perfect (or nearly so) epub file from the mobi. Having the HTML right to begin with is the most important thing. And don’t use external style sheets. Use internal style codes in the HEAD instead. Stuff like that makes the conversion go much smoother.
punchygonzales

Posts: 2,853
Registered: 11/26/11
Re: How to use Calibre to create a Kindle book (with TOC, NCX and native cover)
Posted: Dec 18, 2011 6:30 PM   in response to: man2010 in response to: man2010
Click to report abuse...   Click to reply to this thread Reply
“Kovid Goyal (the creator of Calibre) thinks that publishers who require epubcheck compliance are without a clue.”

I think Goyal is without a clue considering what a trite and poorly written piece of software he has. Even the Help file is a mess. I use it because there’s nothing else available that’s any better, not because I think it’s a good program—it’s not. I can think of a dozen changes that would make it considerably easier to use by improving functionality, but Goyal is simply too lazy to put in the kind of work it would take to make this a first class piece of software. I would certainly start by giving it a “book view” mode like Sigil, and a drop-down menu for adding chapter headings to the TOC along with several other common sense features its currently lacking.
Legend
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums