Order it now! Amazon prioritizes orders on a first come, first served basis.


View Full Version : Kindle 2 .mobi limitations


wz2b
03-09-2009, 11:41 PM
What are the limitations to the Kindle 2's ability to use files generated by mobigen?

I created a small sample project consisting of the files:
1.html
2.html
toc.ncx
test.opf

Using mobigen V6.2 build 41 for linux I produced a nice .mobi file that works fine on my Kindle2 but no TOC. mobigen didn't generate any warnings other than my lack of a cover page.

I might have something wrong with my source, but I don't think so -- and before I proceed any further I was hoping someone could confirm that it should work.

--Chris

toc.ncx:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx version="2005-1" xml:lang="en" xmlns="http://www.daisy.org/z3986/2005/ncx/">
<head>
<meta name="dtb:uid" content="autofrog.com"/>
<meta name="dtb:depth" content="1"/>
<meta name="dtb:totalPageCount" content="0"/>
<meta name="dtb:maxPageNumber" content="0"/>
</head>

<docTitle>
<text>Chris P Daily Report</text>
</docTitle>

<navMap>
<navPoint id="lvl1_1" playOrder="2">
<navLabel>
<text>This is the TOC entry for Chapter 1</text>
</navLabel>
<content src="1.html" />
</navPoint>
</navMap>
</ncx>


test.opf:

<?xml version="1.0"?>
<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId">

<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:opf="http://www.idpf.org/2007/opf">
<dc:title>Chris's Example</dc:title>
<dc:creator opf:role="aut">Chris</dc:creator>
<dc:language>en</dc:language>
</metadata>

<manifest>
<item id="ncx" href="toc.ncx"/>
<item id="page1" href="1.html"/>
<item id="page2" href="2.html"/>
</manifest>

<spine toc="ncx">
<itemref idref="page1"/>
<itemref idref="page2"/>
</spine>

</package>

JSWolf
03-09-2009, 11:45 PM
Did you test this eBook using Mobipocket Reader? I know it means going into Windows, but that's the only way to know what's what.

tompe
03-09-2009, 11:51 PM
You can also use mobi2html to check that the generated code contains the correct tags for the TOC.

wz2b
03-10-2009, 12:01 AM
Hmm you're right, it doesn't seem to work correctly on mobipocket reader for windows, either. Well, that changes the nature of my question, doesn't it :-)

wz2b
03-10-2009, 12:28 AM
You can also use mobi2html to check that the generated code contains the correct tags for the TOC.

Not much help with mobiperl ... mobi2html unpacked to a single html file. Now that file did indeed contain my table of contents, at the very beginning ... so that tells me the information is in the file.

I also tried the reverse: use html2mobi to generate a brand new .mobi and see how it showed up on the kindle. This generated different results: a kindle document that had the table of contents embedded into it at the very beginning -- but not truly a TOC. You know for sure because the TOC menu selection is grayed out.

I guess that embedding the TOC as html at the beginning of the document is okay -- but not great. I'd really like it to work correctly.

tompe
03-10-2009, 12:28 AM
I think you can just add the TOC code in the header of the html file according to the documentation on the MobiPocket web site. I also seem to remember that there was a lot of discussions about how to generate a TOC a year ago here so you can probably find something if you search (or check the wiki).

llasram
03-10-2009, 12:40 AM
The Kindle 2 appears to have support for a fairly new feature of Mobipocket format which allows for at least a single level of real metadata TOC via additional Palm DB records in the Mobipocket file. I noted that mobigen would produce these records if provided OPF with an NCX TOC, but I as nothing seemed to use them in any useful way (Mobipocket Desktop just uses them to show what "chapter" you're currently in) I didn't look into them much further.

Anyway, what is it that isn't working? Is the file not displaying at all, or is the TOC just not displaying as expected?

wz2b
03-10-2009, 12:57 AM
I noted that mobigen would produce these records if provided OPF with an NCX TOC, but I as nothing seemed to use them in any useful way (Mobipocket Desktop just uses them to show what "chapter" you're currently in) I didn't look into them much further.

Ahh okay. That sort of confirms what I'm seeing ... these records seem to be in the .mobi file, but the kindle2 just ignores them.

Anyway, what is it that isn't working? Is the file not displaying at all, or is the TOC just not displaying as expected?

Yeah. As you noted, those records don't seem to be displayed or used in any way on the Kindle2. On the other hand, creating a file called toc.html then adding a "guide" section to the .opf file seemed to help:


<guide>
<reference type="toc" title="Table Of Contents" href="toc.html"/>
</guide>


Of course I had to also add said document to the manifest.

So perhaps that's the answer?

wallcraft
03-10-2009, 01:27 AM
What are the limitations to the Kindle 2's ability to use files generated by mobigen?

I created a small sample project consisting of the files:
1.html
2.html
toc.ncx
test.opf

Using mobigen V6.2 build 41 for linux I produced a nice .mobi file that works fine on my Kindle2 but no TOC. mobigen didn't generate any warnings other than my lack of a cover page.

I might have something wrong with my source, but I don't think so -- and before I proceed any further I was hoping someone could confirm that it should work. What you generated is essentially an ePub, which mobigen then converted to a MOBI. The problem is that mobigen ignores the toc.ncx in an ePub and so you got the expected behavior. Calibre will use the toc.ncx when generating a MOBI, although I'm not sure if its any2mobi (or oeb2mobi) commands will work from your .opf file or if you will actually need to build an .epub.

If mobipocket ever upgrades its ePub import support to include toc.ncx then most likely what you did will work. If you want to continue to use mobigen then you need either a toc.html (contents.html) identified as the TOC in the guide items or a "tour" in the .opf: <tours>
<tour id="chaptertour" title="Chapter Tour">
<site title="Down The Rabbit-Hole" href="CarAlic.html#_RWTOC-1" />
<site title="The Pool of Tears" href="CarAlic.html#_RWTOC-2" />
<site title="A Caucus-Race and a Long Tale" href="CarAlic.html#_RWTOC-3" />
<site title="The Rabbit Sends in a Little Bill" href="CarAlic.html#_RWTOC-4" />
<site title="Advice from a Caterpillar" href="CarAlic.html#_RWTOC-5" />
<site title="Pig and Pepper" href="CarAlic.html#_RWTOC-6" />
<site title="A Mad Tea-Party" href="CarAlic.html#_RWTOC-9" />
<site title="The Queen&amp;rsquo;s Croquet-Ground" href="CarAlic.html#_RWTOC-10" />
<site title="The Mock Turtle&amp;rsquo;s Story" href="CarAlic.html#_RWTOC-11" />
<site title="The Lobster Quadrille" href="CarAlic.html#_RWTOC-12" />
<site title="Who Stole The Tarts?" href="CarAlic.html#_RWTOC-13" />
<site title="Alice&amp;rsquo;s Evidence" href="CarAlic.html#_RWTOC-14" />
</tour>
</tours>
<guide>
<reference type="copyright-page" title="Copyright link" href="copyright.html" />
<reference type="other.ms-thumbimage" title="PocketPC thumbnail image" href="PCthumb.jpg" />
<reference type="toc" title="Table of Contents" href="Contents.htm" />
<reference type="other.ms-coverimage-standard" title="Standard cover image" href="alice.jpg" />
<reference type="title-page" title="About this title link" href="~cov0001.htm" />
<reference type="other.ms-titleimage-standard" title="Standard title image" href="Ebookspine.jpg" />
<reference type="other.ms-thumbimage-standard" title="Standard thumbnail image" href="thumb.jpg" />
<reference type="other.ms-coverimage" title="PocketPC cover image" href="PCcover.jpg" />
</guide> The examples I have seen (mostly from exploded LIT ebooks) include both a tour and a contents.html, so I'm not sure if tour is sufficient on its own (a contents.html or a reference to an internal TOC in the guide items is sufficient on its own).

wz2b
03-10-2009, 01:52 AM
wallcraft: thanks so much for the explanation. Just for completeness, I'll try making a <tour> and see how Kindle2 treats it.