Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 12-12-2013, 03:53 PM   #1
mountainsoft
Junior Member
mountainsoft began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
Internal Linking in a MOBI file (Coding Help Needed)

I am a software developer and have added a MOBI export feature to one of my applications. This has worked well so far, but I'm wanting to add an index at the beginning so the document will be easier to navigate.

I am doing all of the coding myself, and am not relying on external tools like Kindlegen, Mobicreator, or Calibre. So I am hoping someone here has low level knowledge of the MOBI file format.

I am attaching a sample file (recipes.mobi) that I have exported from my application. The index shows up, but the links don't do anything when you click them?

I am also attaching the source (recipes.htm) document. This uses simple HTML linking such as
Code:
<a href="#recipe1">Recipe 1</a>
in the index and
Code:
<a id="recipe1" />
at the start of each section.

The links work fine in the HTM source (in a web browser).

If I use KindleGen to encode the Recipes.htm source, the links do work correctly. But if I use Unkindle in Calibre to unpack the MOBI file, the HTM doesn't look much different than my original source. I'm clearly missing something in the MOBI encoding.

Any ideas what I need to do to get the internal links to work?

Thanks,

Anthony Watson
Attached Files
File Type: mobi recipes.mobi (8.6 KB, 28 views)
File Type: zip recipes.zip (2.5 KB, 25 views)
mountainsoft is offline   Reply With Quote
Old 12-12-2013, 06:14 PM   #2
KevinH
Guru
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 953
Karma: 410248
Join Date: Nov 2009
Device: many
Hi,
Kindle mobi is a compiled format. It is not like other formats. It takes significant work and preprocessing to actually properly create a mobi.

KindleUnpack does its best to decompile the format back into something that can be passed back into Kindlegen. If you use KindleUnpack you need to ask for the raw text to be dumped as well (it is a command line option). That raw text will give you an idea of how the compilation step is done in part. Note mobi 7 and mobi 8 versions handle links differently.

KevinH

Quote:
Originally Posted by mountainsoft View Post
I am a software developer and have added a MOBI export feature to one of my applications. This has worked well so far, but I'm wanting to add an index at the beginning so the document will be easier to navigate.

I am doing all of the coding myself, and am not relying on external tools like Kindlegen, Mobicreator, or Calibre. So I am hoping someone here has low level knowledge of the MOBI file format.

I am attaching a sample file (recipes.mobi) that I have exported from my application. The index shows up, but the links don't do anything when you click them?

I am also attaching the source (recipes.htm) document. This uses simple HTML linking such as
Code:
<a href="#recipe1">Recipe 1</a>
in the index and
Code:
<a id="recipe1" />
at the start of each section.

The links work fine in the HTM source (in a web browser).

If I use KindleGen to encode the Recipes.htm source, the links do work correctly. But if I use Unkindle in Calibre to unpack the MOBI file, the HTM doesn't look much different than my original source. I'm clearly missing something in the MOBI encoding.

Any ideas what I need to do to get the internal links to work?

Thanks,

Anthony Watson
KevinH is offline   Reply With Quote
Old 12-12-2013, 07:06 PM   #3
susan_cassidy
Wizard
susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.susan_cassidy ought to be getting tired of karma fortunes by now.
 
Posts: 1,906
Karma: 1704270
Join Date: Jan 2009
Device: Kindle, iPad (not used much for reading)
Why on earth would you reinvent the wheel by trying to write your own program to create mobi files? Just use Kindlegen or Mobipocket Creator, or Calibre. It takes a lot of work to create a .mobi file.
susan_cassidy is offline   Reply With Quote
Old 12-12-2013, 11:56 PM   #4
mountainsoft
Junior Member
mountainsoft began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
Quote:
Why on earth would you reinvent the wheel by trying to write your own program to create mobi files?
My application needs to export to the MOBI format so users can view their documents on Kindle devices (PDF works better for iOS). For a variety of reasons (file size, licensing, personal preference, etc.) I can't rely on third party utilities for this feature.

I already have basic MOBI exporting working fine. External links even work great. It is only the internal links that are not working correctly.

Thanks,

Anthony
mountainsoft is offline   Reply With Quote
Old 12-13-2013, 07:10 AM   #5
KevinH
Guru
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 953
Karma: 410248
Join Date: Nov 2009
Device: many
Hi,
Again, use KindleUnpack raw text option to see how filepos (offsets into the text file) are used in mobi 7 and base 32 encoded numbers are used in Mobi 8.

Hope this helps.

KevinH
KevinH is offline   Reply With Quote
Old 12-17-2013, 11:02 AM   #6
mountainsoft
Junior Member
mountainsoft began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2013
Device: Kindle Fire
Quote:
use KindleUnpack raw text option to see how filepos (offsets into the text file) are used
Thanks, that's what I needed. I have the links working properly now.

Take care,

Anthony
mountainsoft is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion from mobi (to mobi, or epub) breaks internal links bounder Conversion 1 10-09-2012 11:56 AM
Update Mobi header/file metadata without doing a Mobi to Mobi conversion RecQuery Conversion 2 06-30-2012 11:43 AM
PDF with internal hyperlinks to MOBI wlloydw Conversion 3 02-23-2011 04:33 PM
What file system should the internal memory be? rahulm Sony Reader 1 06-14-2010 01:23 PM
Internal Plucker linking rsperberg Reading and Management 0 11-20-2005 08:22 AM


All times are GMT -4. The time now is 07:47 AM.


MobileRead.com is a privately owned, operated and funded community.