View Single Post
Old 10-08-2013, 03:33 PM   #590
tacitus
Member
tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.tacitus ought to be getting tired of karma fortunes by now.
 
Posts: 11
Karma: 288770
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by DiapDealer View Post
I don't know about calibre, but once you make the changes to your html file and your opf file, you should then convert the opf file with kindlegen/previewer. What you've described is what happens when you try to convert the html file (which knows nothing about the opf file). All files must remain in their relative position to each other in the directory structure when feeding the opf file to kindlegen, too.
Thanks for taking the time to respond to my questions.

This is the process I'm using (I'm testing with the Android Kindle app on a Nexus 10).

First Calibre to convert from DOCX to MOBI:

Code:
ebook-convert "First Contact.docx" "FirstContact.mobi" --mobi-keep-original-images --no-inline-toc --disable-font-rescaling
(I edited out all the metadata stuff).

This works great. It's the only way (so far) I have found that reliably preserves top-margins (for things like pages with Chapter headings). The paragraphs are indented correctly, and there are no gaps between them. The only problem is the lack of an active TOC link in the Kindle Goto menu. Note: it is generating, the old, Mobi version 6 (7?), format.

Next, KindleUnpack. I'm using the latest pyw file downloaded from the link in the first comment on this thread. I don't turn on any of the options, and it extracts (generates) the HTML, OPF, and NCX files, along with the single image I use, all in a mobi7 directory.

Finally, if I don't touch those three files at all, and use "KindleGen FirstContact.opf" and test the resulting mobi file, the top margins that appeared in the Calibre generated mobi file are gone, as are the paragraph indents, and the paragraphs now have what looks like the default HTML spacing between them.

NOTE: Some empty lines I use for padding in the front matter are gone too (at the top of pages only). It looks as though the HEIGHT attribute used to do this vertical spacing at the top of pages is no longer being honored at all.

Quote:
That's mobi markup. There is no css--inline or otherwise. It's basically HTML3. Left margins are done with <blockquote> and indents are done with the "width" parameter of the <p> tag. Top-margin is achieved with the "height" parameter. There are no right margins or bottom margins in mobi.
Yeah, I can see that the Calibre conversion from DOCX to MOBI (HTML) inlines all the styling for everything, which is why I don't understand why unpacking and then repacking causes the loss of some of the styling. I thought I must be missing something obvious, but I don't see it.

Quote:
Also, when using kindlegen, you need to make sure you're viewing the mobi part of the conversion and not the KF8 part (which will also look exactly as you described if you fed the converter mobi-only source code).
I was only generating the mobi part in the Calibre conversion anyway, so that was not an issue.

Quote:
You can also use KindleUnpack to split the mobi-only portion of the resulting file from the KF8 portion.

The bottom-line is (and I know this is probably confusing): mobi-only source (html) is not suitable for building KF8 kindlebooks.
Well, I've tried using the OPF multiple times (with the other files in place) and the formatting changes everytime. I can try the KF8 route, but there is no real reason for my book to use it since there is no special formatting requirement above what Calibre's MOBI conversion provides.

It's as though the Kindle app is no longer recognizing the unpacked/repacked mobi file as the same type of format. Could that be happening? Is KindleGen doing something that's changing some internal setting on the MOBI file?

I'll keep fiddling, but it looks as though my current route is stymied unless I can understand why my formatting vanishes even though I seem to be following the correct process to the letter. I may take a look at the conversion source code to see if I can hack the TOC recognition into that. Alternatively, I could give up on my formatting of the TOC (it's a list of short story titles, so I've centered them on the page) and conform it to what Calibre expects.

Thanks again for your timely reply.

Last edited by tacitus; 10-08-2013 at 03:38 PM.
tacitus is offline   Reply With Quote