ePUB to mobi - problems with ToC
#1  odzio 04-15-2011, 02:25 PM

I'm currently trying to make mobi file from Indesign Book and here's the thing:
1) I've created Table of Contents in Indesign (manually, using hyperlinks) and then exported to ePUB.
2) it looks fine in Adobe Digital Editions and in Calibre.
3) I added the publication date in Sigil and successfully validated at Then I added the cover in Sigil.
4) I opened the file in Kindle Previewer - the compilation process went fine.
BUT: the trouble is that Kindle Previewer does not see the ToC I've made.

I've converted the file from ePUB to mobi in Calibre and then opened it up in Kindle Previewer - and it's OK (I mean the ToC is available).

Do you have any suggestions why this happens? Or did you come across similar problem?

I also tried to convert directly from Indesign using Kindle plugin but it failed and the following error messages appeared:
"Could not find file 1302889739002.epub"
"Java Script Error
Error Number: 45
Error String: Object is invalid"


#2  ATDrake 04-15-2011, 03:52 PM
If you mean that it doesn't show up when you click the TOC access button in KPreviewer, but is otherwise visible in the actual book, then that's because in order for a Mobi file to be able to redirect the reader to the HTML TOC via the menus, you have to put a line in the OPF telling the conversion software about it.

Details are in the Amazon Kindle Publishing Guidelines pdf on pg 12 of version 1.9.

Basically, you just add a <reference type="toc" title="Table of Contents" href="#yourtoclinkhere.html" /> line to the <guide> section.

Hope this helps, and welcome to MobileRead!

#3  odzio 04-16-2011, 12:23 PM
Thanks ATDrake, I did precisely that and it works

#4  jackson25 04-25-2011, 12:28 PM
Quote ATDrake
Basically, you just add a <reference type="toc" title="Table of Contents" href="#yourtoclinkhere.html" /> line to the <guide> section.

Hope this helps, and welcome to MobileRead!
I'm glad I found this post! However, I'm not sure where I need to add the information you offer in your suggestion. Could you expand further?

I see my TOC in the KindlePreview but in the NCX View the links don't work.

#5  ATDrake 04-25-2011, 02:41 PM
The HTML TOC which you see when reading through your e-book (and that's accessible by clicking the TOC button in the menu), and the NCX TOC which provides the little chapter markers at the bottom of the location bar on the Kindle are two different things.

Mobi-creation tools know to add them to the finished Mobi from information in the .opf file, which is like an inventory of all the files that go into making your e-book (cover image, text, etc.), which you can create to accompany your HTML text. Wikipedia's ePub article has a nice short section with example .opf and .ncx files, in case you need help making them.

The Amazon Kindle Publishing Guidelines PDF linked above has a bit more on some Kindle-specific things you need tweak for a proper Mobi book when starting from an unzipped ePub source, since KindleGen expects them to be named/arranged differently.

Basically, the code that tells KindleGen (or Mobipocket Creator, or the Mobi2Mobi tools, etc.) where your HTML TOC is located is the <reference> tag above, which goes in a <guide> section near the bottom of your .opf.

For the NCX TOC, it's referenced in the <spine toc=""> tag, and you have to have an <item> entry in your <manifest> in the .opf which links to your NCX and gives it the exact same id="" name as the toc="" in the <spine> tag has.

If you've got everything filled out properly, then both types of TOC should be accessible via the menu/5-way controller and show up properly in the finished Mobi.

Hope this helps, and welcome to MobileRead!

#6  Chammou 12-01-2011, 08:08 AM
Hi ATDrake
Your information is very helpful, but I am not sure what software should be used to edit the .mobi files to ensure the TOC is included. I created an epub with sigil and then converted to .mobi with kindlegen, but the TOC does not show up in my kindle. What software do i use to edit the .mobi file?

#7  DiapDealer 12-01-2011, 09:24 AM
What software do i use to edit the .mobi file?
You can't directly edit a mobi file. You have to have the source (epub, (x)html , whatever) properly formatted before you build the mobi from that source. A mobi is a binary file, so once it's built... all editing (except for metadata) stops. "Editing" a mobi file involves re-building it... either by maintaining the original source somewhere, or by unpacking the mobi - editing - and then rebuilding.

For the TOC to show up in your Kindle, you need to do two things with your Sigil-built ePub (before converting it to mobi with kindlegen):

1) you need to create an inline (html) representation of your TOC in Sigil—this is what you will SEE on your Kindle when you click "Go To->table of contents." Be sure to right click on the file (in Sigil) that represents your TOC and mark it (Semantics) as "Table of Contents." Note: this is a manual process. Nothing in Sigil will automatically generate a TOC that will just "appear" on the Kindle when you convert the epub to mobi. You have to make the HTML Table of Contents yourself.

2) you need create an ncx TOC (external) in Sigil. You can auto-generate the toc.ncx from the Headers (h1, h2, h3) in your book. This will produce the navigation "dots" on the progress bar on the Kindle.

Item 1 may be enough, but unless kindlegen KNOWS where your TOC is in your epub, it can't know where to jump to when clicking "Go to->table of contents."

I've described how you can do this with only the gui tools in Sigil. But with the newest version of Sigil, you can manually do the same things ATDrake described above by directly editing the opf file and the toc.ncx file. Brushing up on the nitty-gritty of hand-building opf files and ncx files will go a long way toward understanding how you can then do it more easily with gui programs.

#8  ATDrake 12-01-2011, 09:29 AM
Quote Chammou
I created an epub with sigil and then converted to .mobi with kindlegen, but the TOC does not show up in my kindle. What software do i use to edit the .mobi file?
You don't edit the .mobi file directly. When creating your epub, edit the .opf file to include the necessary <reference> info, and then convert to .mobi.

I think you should be able to do this in Sigil, but if not you can always go to the folder where your unzipped ePub working files are kept and modify the .opf file manually in any plain text editor.

Also check to make sure that KindleGen isn't giving you any error messages about your .opf or .ncx being somehow invalid or being unable to find the file you want to use as your TOC. Sometimes it's really picky about what goes into the .opf, NCX, and even the filename (don't put the TOC into a set of folders with # anywhere in their names, because KindleGen will refuse to see it).

Hope this helps, and welcome to MobileRead!

#9  Chammou 12-03-2011, 11:06 AM
Dear DiapDealer and ATDrake.

Thank you very much for the comprehensive replies. .mobi gives a real headache. I am surprised there is not an easy way to edit .mobi. I'll give these suggestions a try.

I also have a problem with footnotes. They are not 'clickable.' I've tried converting from epub made with siegel to .mobi using kindlegen. I've also imported filtered html and word in mobipocket creator. In all cases I have lots of problems, and the footnotes with numbers appear but nothing is 'clickable' in mobireader or kindle. What do you think i'm doing wrong that the footnotes don't work?

#10  DiapDealer 12-03-2011, 11:33 AM
I have no clue about your footnotes. I just create all my footnote links manually (html) in Sigil or Notepad++. I don't use Word, so I have no idea what it does to clickable foot- end-notes when saved as filtered html. I'm a "from-scratch" kind of guy.

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register