View Single Post
Old 10-14-2007, 02:08 PM   #1
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
Posts: 6,977
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
MobiPocket TOC using mobigen

MobiPocket's command line tool, mobigen.exe, is for Windows only, but danx found it to be usable via Wine on Linux (and presumably OSX). It is a free download from the Mobipocket Developer Center. This tool takes either a single .html file or an OEB .opf file and creates a .mobi file. The thread Images in MobiPocket, notes that .jpg images and the new -jpeg option to mobigen will produce the best possible images for larger screens. However, we don't have an easy way to create a Table of Contents (TOC) that MobiPocket will recognize - so most .mobi (.prc) files posted here have an in-lined TOC near the start. This allows navigation, but isn't recognized by MobiPocket Reader as a TOC (e.g. it isn't attached to the TOC icon on the iLiad) and so isn't optimal.

MobiPocket's Creator software can automatically build a TOC from HTML files, but that is a hit or miss process and in any case it isn't an option with mobigen. However, you can create your own separate TOC.html file. As described on the MobiPocket Forum:
Quote:
to do that, you should create the anchors in the main content file (main.html for instance).
Then you create a separate TOC file (TOC.html for instance) and you create links to the main file in it. For instance your TOC.html will contain a link that points to main.html#chapter_1 if chapter_1 is the name of the anchor you created for chapter 1.
Then you simply put both TOC.html and main.html in your publication in the Creator.
That works for Creator (if you explicitly make TOC.html the TOC), but not for mobigen. However, Creator works by producing a .opf file and then essentially running mobigen over it to produce the final .mobi file. So to create a .mobi version of a single-file .html e-book with a separate TOC and a cover image using only mobigen do the following:
  1. Create a stand-alone TOC.html
  2. Include a link to TOC.html just after the title in MAIN.html
  3. Create a MAIN.opf that references MAIN.html and TOC.html in the manifest and spine, and TOC.html in the guide as a "toc".
  4. Create a COVER.jpg (or .gif)
  5. Include the COVER as an image at the start of MAIN.html
  6. Reference COVER.jpg in MAIN.opf as an EmbeddedCover
  7. Optionally add other fields to MAIN.opf, such as Title,Creator,Subject as in the example
  8. Create MAIN.mobi via: mobigen.exe MAIN.opf -c1 -s0 -jpeg
If the source is a single .html file, then it should be easy to produce an .opf file - and even multi-file .html should not be too hard. I attach an example based on MobiPocket's "Alice In Wonderland" test e-book (which uses a lot of MobiPocket HTML extensions). This gives a clickable TOC icon on the iLiad.
Attached Thumbnails
Click image for larger version

Name:	Alice_1st.gif
Views:	1308
Size:	118.4 KB
ID:	6311   Click image for larger version

Name:	Alice_TOC.gif
Views:	1253
Size:	128.1 KB
ID:	6312  
Attached Files
File Type: zip Alice_In_Wonderland.zip (433.9 KB, 1114 views)
wallcraft is offline   Reply With Quote