View Full Version : Mobipocket output


Pages : [1] 2

llasram
01-18-2009, 10:34 PM
Early adopters,

Kovid has just released calibre version 0.4.129, which integrates at beta quality my support for generating Mobipocket format books. This feature is currently accessible from your favorite command-line shell via the expected ‘oeb2mobi’ and ‘any2mobi’ with the usual options (plus a few new ones).

Benefits and/or failings over other Mobipocket-generation tools:


Full markup conversion. Normalizes all input into Mobipocket-specific, pure-formatting markup for as faithful rendering in Mobipocket readers as possible.
Standards-compliant input over proprietary extensions. No support for Mobipocket-custom tags in input, but will generate Mobipocket-specific output for corresponding OPS and OPF features such as page breaks and non-linear content (e.g., footnotes).
SVG rasterization. Here for the first time, but soon to appear in other format converters near you, full rasterization of SVG vector graphics. Tell all your friends – SVG is now safe and fun for the whole family of e-book readers!
In-content TOC generation. Ensures that generated books have a TOC, whether they want one or not. Uses standard metadata TOC (OPF 2.0 NCX etc.) if an in-content TOC is not provided by the source.


Try it out now, and post your bug reports to the calibre trac (http://calibre.kovidgoyal.net/)!

mtravellerh
01-19-2009, 03:04 AM
Tried it out. Works really fine so far.

Will the mobi creation be integrated in the GUI (once the beta phase is over?) Oh a little btw: I generate german books, too and I might like to rename the TOC to Inhalt or Inhaltsangabe and french books (Matières or Table de Matières) Any way to do that with the command line tool?

Now the "Inhaltsangabe" is converted to "Table of Contents". That is not very elegant. Still superior to mobigen, though.

Thanks for the work. This will be getting better than Creator.

llasram
01-19-2009, 08:03 AM
Will the mobi creation be integrated in the GUI (once the beta phase is over?)

I believe that is Kovid's plan, yep.

Oh a little btw: I generate german books, too and I might like to rename the TOC to Inhalt or Inhaltsangabe and french books (Matières or Table de Matières) Any way to do that with the command line tool?

Wow, such a typical American mistake. There is not at this time, but I'll correct that this evening.

Thanks for the work. This will be getting better than Creator.

Glad you find it useful. :)

Format C:
01-19-2009, 12:18 PM
Early adopters,

Kovid has just released calibre version 0.4.129, which integrates at beta quality my support for generating Mobipocket format books. This feature is currently accessible from your favorite command-line shell via the expected ‘oeb2mobi’ and ‘any2mobi’ with the usual options (plus a few new ones).

Benefits and/or failings over other Mobipocket-generation tools:


Full markup conversion. Normalizes all input into Mobipocket-specific, pure-formatting markup for as faithful rendering in Mobipocket readers as possible.
Standards-compliant input over proprietary extensions. No support for Mobipocket-custom tags in input, but will generate Mobipocket-specific output for corresponding OPS and OPF features such as page breaks and non-linear content (e.g., footnotes).
SVG rasterization. Here for the first time, but soon to appear in other format converters near you, full rasterization of SVG vector graphics. Tell all your friends – SVG is now safe and fun for the whole family of e-book readers!
In-content TOC generation. Ensures that generated books have a TOC, whether they want one or not. Uses standard metadata TOC (OPF 2.0 NCX etc.) if an in-content TOC is not provided by the source.


Try it out now, and post your bug reports to the calibre trac (http://calibre.kovidgoyal.net/)!

:thanks:

:clap::clap::clap:

Can't wait to try it!!!!!!!!!

wallcraft
01-19-2009, 01:36 PM
There are not a huge number of ePubs from commercial sources without DRM, but those that do exist provide a relatively wide range of ePub styles for testing. I looked at some of them from a chapter heading viewpoint in Ebook page design (http://www.mobileread.com/forums/showpost.php?p=255119&postcount=4). So I tried using any2mobi (default settings) on these examples. About half failed, and I'll post bug reports on calibre trac. One surprise was that all three FeedBooks ePubs I tried failed to work. FeedBooks has its own MOBI option, but we should still be able to convert their ePub to MOBI.

The attached screenshots are from the original ePub (Adobe Digital Editions) and the any2mobi MOBI (Windows MobiPocket Reader).

Appleton's Alice's Adventures is from Adobe's free library. It works well except for color in the chapter header and quotation marks and other special characters which are not displayed correctly (wrong encoding?). MobiPocket isn't capable of wrapping text round an image, so that lack isn't any2mobi's fault.

One of the two Penguin samples I tried failed, the other worked very well except for indenting the start of paragraphs. Penguin's have embedded fonts, which are not being transfered. So far as I can tell, the ebook is just using the reader selected font (Times New Roman).

Rosetta's Red Alert is also in Adobe's free library. Its chapter header isn't transfering well, but the rest looks good except for the indenting of the 1st paragraph.

The threepress Huck Finn again has paragraph indent issues.

llasram
01-19-2009, 02:16 PM
Appleton's Alice's Adventures is from Adobe's free library. It works well except for color in the chapter header and quotation marks and other special characters which are not displayed correctly (wrong encoding?).

Doh!, color! I forgot to add that to my written oeb2mobi todo list and apparently thus forgot to add color support to oeb2mobi. Watch for it in a later release...

I actually had tested converting that edition of Alice, but only with oeb2mobi. It's possible I introduced a regression, or that the error is in the any2* plumbing... I'll take a look this evening.

One of the two Penguin samples I tried failed, the other worked very well except for indenting the start of paragraphs.

The extra spacing is added by the any2* option '--remove-paragraph-spacing'. Which, um, presently seems to be on by default with no way to turn it off. Kovid, am I missing something?

Penguin's have embedded fonts, which are not being transfered. So far as I can tell, the ebook is just using the reader selected font (Times New Roman).

Mobipocket doesn't support font-embedding, so not much to be done there.

Rosetta's Red Alert is also in Adobe's free library. Its chapter header isn't transfering well, but the rest looks good except for the indenting of the 1st paragraph.

No idea why that's happening... I'll have to grab a copy and see what's up.

kovidgoyal
01-19-2009, 02:25 PM
The extra spacing is added by the any2* option '--remove-paragraph-spacing'. Which, um, presently seems to be on by default with no way to turn it off. Kovid, am I missing something?



Typo, fixed. Now off by default. You can turn it off with
opts.remove_paragraph_spacing = False

wallcraft
01-19-2009, 03:02 PM
Mobipocket doesn't support font-embedding, so not much to be done there. It does in principle support specifying the font, which would presumably work if the font is available on the device. However, MobiPocket strongly recommends against specifying the font so perhaps this is an area best left alone.

mtravellerh
01-19-2009, 03:14 PM
It does in principle support specifying the font, which would presumably work if the font is available on the device. However, MobiPocket strongly recommends against specifying the font so perhaps this is an area best left alone.

Absolutely, as the Mobi readers are spread over a wide range of OS's, the result tends to be quite desastrous if a font is not present in the system (I once saw a book in glorious Courier!)

llasram
01-20-2009, 01:37 AM
Rosetta's Red Alert is also in Adobe's free library. Its chapter header isn't transfering well, but the rest looks good except for the indenting of the 1st paragraph.

Huh. I just fired up ADE on a Windows VM and grabbed Red Alert, but the version I was able to download is DRMed. So the mystery of the missing headers must live on...

wallcraft
01-20-2009, 01:57 AM
Huh. I just fired up ADE on a Windows VM and grabbed Red Alert, but the version I was able to download is DRMed. So the mystery of the missing headers must live on... Perhaps you got the PDF version. The ePub is here (http://adedemo.com/Title-XHTML.asp?InventoryID={0267D86F-EDAC-4B2F-8763-FE088111B5AB}). All Adobe's sample ePubs are here (http://adedemo.com/XHTML.asp).

llasram
01-20-2009, 08:38 AM
Perhaps you got the PDF version. The ePub is here (http://adedemo.com/Title-XHTML.asp?InventoryID={0267D86F-EDAC-4B2F-8763-FE088111B5AB}). All Adobe's sample ePubs are here (http://adedemo.com/XHTML.asp).

Nope, that's the URI I downloaded from, and what it netted me is a DRMed EPUB. It oddly enough did have a ".pdf" extension, but examining the file itself showed it to be a ZIP archive with the proper EPUB trappings plus a META-INF/encryption.xml covering all the files, all of which are in fact Adept DRM encrypted.

kovidgoyal
01-24-2009, 02:17 PM
Version 0.4.130 has integrated MOBI output into the GUI. It should be working for all file types except comics.

DDHarriman
01-24-2009, 03:16 PM
Yes it does, and it's great already!

Problems:

1 - image of the eBook cover, shows in the Cybook, does not show in Mobipocket Reader for the Desktop and for the PokectPC;

2 - it would be great if existed and option to compress the mobi file - mobipocket creator has 3 levels and if the 3th (high compression) takes a lot of time and it’s good just for compressing dictionaries, the 2th (standard compression) is acceptable and cuts the size of the eBook in half at least.

I understand that using any2mobi in command line one can do the compression I ask in (2), so I think is a question of time.

Let me say, it’s now outstanding stable and creates great files.

Thank you for the hard work put into this,

tompe
01-24-2009, 03:47 PM
1 - image of the eBook cover, shows in the Cybook, does not show in Mobipocket Reader for the Desktop and for the PokectPC;


When I had this problem with MobiPerl it was because I had not set the correct pointers in the MobiHeader.

zelda_pinwheel
01-24-2009, 03:55 PM
hello ! thank you for this, it's brilliant, and i know a lot of people are going to be really happy to use calibre with their cybooks.

just a little (well, not that little actually) problem i've just noticed. to test, i ran my recipe for Libération (http://www.liberation.fr/) asking for mobi output. all seems to be going well, it makes me a mobi file, and the beginning looks fine : the short texts all display correctly. BUT, on SOME articles (not all though), if you follow the link for the full article, none of the special characters are displayed correctly !

i am attaching a sample file of the same recipe in epub (no worries there) and mobi.

in the first section, "La une", we have the excerpt
Obama met fin à une clause anti-avortement [sam., 24 janv. 13:44] Le nouveau président de Etats-Unis multiplie mesures et annonces sur tous les sujets sensibles, en totale rupture avec son prédécesseur George Bush.
note all the accents are properly displayed. if you follow that link, you get this result :

EPUB VERSION (all characters correctly displayed)
Obama met fin à une clause anti-avortement

Barack Obama a autorisé à nouveau vendredi le financement d'organisations pratiquant ou facilitant l'avortement à l'étranger, étendant aux grandes questions de société la remise en cause des politiques de son prédécesseur George W. Bush.
Signe du caractère sensible d'une telle décision, prise trois jours seulement après son investiture, M. Obama a signé le décret hors présence de la presse, à la différence d'autres décrets au grand retentissement signés la veille et ordonnant la fermeture du camp de Guantanamo.

MOBI VERSION (all accented characters missing, and some spaces missing too)
Obama met fin à une clause anti-avortement
BarackObamaa autoris nouveau vendredi le financement d'organisations pratiquant ou facilitant l'avortement l'tranger, tendant aux grandes questions de socit la remise en cause des politiques de son prdcesseur George W. Bush.

Signe du caractre sensible d'une telle dcision, prise trois jours seulement aprs son investiture, M.Obamaa sign le dcret hors prsence de la presse, la diffrence d'autres dcrets au grand retentissement signs la veille et ordonnant la fermeture du camp de Guantanamo.

the really odd thing, is that in some articles the text is correctly displayed. :blink:

acidzebra
01-24-2009, 05:01 PM
Ha ha ha Calibre is going to dominate the ebook world in that cross-platform open kind of awesome way. Great work, guys.

sianon
01-24-2009, 05:21 PM
Calibre is having difficulties converting some Lit files to Mobi, easy work around to convert to epub, then convert from epub to mobi and final output looks very good.

kovidgoyal
01-24-2009, 05:23 PM
Calibre is having difficulties converting some Lit files to Mobi, easy work around to convert to epub, then convert from epub to mobi and final output looks very good.

Please open tickets and attach the LIT files as this should not be happening.

kovidgoyal
01-24-2009, 05:23 PM
Ha ha ha Calibre is going to dominate the ebook world in that cross-platform open kind of awesome way. Great work, guys.

That's the plan ;)

kovidgoyal
01-24-2009, 05:24 PM
@zelda

Can you open a ticket and also attach your recipe if it's not a builtin one.

zelda_pinwheel
01-24-2009, 05:26 PM
@zelda

Can you open a ticket and also attach your recipe if it's not a builtin one.

it is the built-in one, but i'll open a ticket anyway if you want.

kovidgoyal
01-24-2009, 05:31 PM
it is the built-in one, but i'll open a ticket anyway if you want.

Thanks, helps to keep track of things :)

brewt
01-24-2009, 05:45 PM
Brewt's Contribution to the Plan for World Domination

Attached is a zip file that has in it everything:

Source html's,
mobicreator output,
calibre outout of epub & mobi file


The epub output of calibre = not too bad.

Calibre mobi output:
The html links in the file I had for the toc don't work.
The left-justified text of the body copy is all centered
Despite unckecked "do not add detected chapters to table of contents" the chapters were added, but not differentiation of toc levels.
The "Title" style was split
Sub-tocs partially centered.
cross-reference link (Comment) lost.

ticket 1687 opened.

-bjc

zelda_pinwheel
01-24-2009, 05:57 PM
ticket 1688 opened.

llasram
01-24-2009, 11:36 PM
When I had this problem with MobiPerl it was because I had not set the correct pointers in the MobiHeader.

Do you remember any details? All my test output shows cover in Desktop fine, but hey...

zelda_pinwheel
01-25-2009, 08:03 AM
ticket 1688 opened.
wow, ticket 1688 was resolved while i was sleeping ! it's like magic. :) cheers llasram !

tompe
01-25-2009, 09:14 AM
Do you remember any details? All my test output shows cover in Desktop fine, but hey...

In my case I had not set the offsets at all. I did not know they existed before somebody pointed out that it did not work in the Desktop reader.

bkilian
01-26-2009, 08:28 PM
I noticed that any2mobi doesn't support all the functions of any2lrf, like, for instance --baen, and force-page-break-before. Is this by design? The baen html is horrid, and probably needs fixing irrespective of the output format :)

kovidgoyal
01-26-2009, 08:36 PM
I noticed that any2mobi doesn't support all the functions of any2lrf, like, for instance --baen, and force-page-break-before. Is this by design? The baen html is horrid, and probably needs fixing irrespective of the output format :)

Baen HTML is autodetected. You can use --chapter to force page breaks

bkilian
01-26-2009, 09:07 PM
I'm getting an error on a lot of my files:

Generating in-line TOC...
Applying case-transforming CSS...
Traceback (most recent call last):
File "from_any.py", line 70, in <module>
File "from_any.py", line 66, in main
File "from_any.py", line 56, in any2mobi
File "calibre\ebooks\mobi\writer.pyo", line 574, in oeb2mobi
File "calibre\ebooks\oeb\transforms\manglecase.pyo", line 36, in transform
File "calibre\ebooks\oeb\transforms\manglecase.pyo", line 46, in mangle_spine
File "calibre\ebooks\oeb\stylizer.pyo", line 163, in __init__
File "calibre\ebooks\oeb\stylizer.pyo", line 280, in _apply_style_attr
File "cssutils\css\cssstyledeclaration.pyo", line 128, in __init__
File "cssutils\css\cssstyledeclaration.pyo", line 168, in __setattr__
File "cssutils\css\cssstyledeclaration.pyo", line 325, in _setCssText
File "cssutils\util.pyo", line 371, in _parse
File "cssutils\css\cssstyledeclaration.pyo", line 316, in unexpected
File "cssutils\errorhandler.pyo", line 89, in __handle
xml.dom.SyntaxErr: CSSStyleDeclaration: Unexpected token, ignoring upto u'; marg
in: 0pt;'. [1:1: ;]

If you're interested, I'll create a bug and add a file that does it.

bkilian
01-26-2009, 09:18 PM
Baen HTML is autodetected. You can use --chapter to force page breaksAah, see, a page break may not be the same as a chapter. For instance, I might want page breaks before certain images, even if they could fit ion the same page, or I might want it at section headers and not chapter headers.

No real hassle though.

bkilian
01-26-2009, 09:24 PM
I'm getting an error on a lot of my files:

Generating in-line TOC...
Applying case-transforming CSS...
Traceback (most recent call last):
File "from_any.py", line 70, in <module>
File "from_any.py", line 66, in main
File "from_any.py", line 56, in any2mobi
File "calibre\ebooks\mobi\writer.pyo", line 574, in oeb2mobi
File "calibre\ebooks\oeb\transforms\manglecase.pyo", line 36, in transform
File "calibre\ebooks\oeb\transforms\manglecase.pyo", line 46, in mangle_spine
File "calibre\ebooks\oeb\stylizer.pyo", line 163, in __init__
File "calibre\ebooks\oeb\stylizer.pyo", line 280, in _apply_style_attr
File "cssutils\css\cssstyledeclaration.pyo", line 128, in __init__
File "cssutils\css\cssstyledeclaration.pyo", line 168, in __setattr__
File "cssutils\css\cssstyledeclaration.pyo", line 325, in _setCssText
File "cssutils\util.pyo", line 371, in _parse
File "cssutils\css\cssstyledeclaration.pyo", line 316, in unexpected
File "cssutils\errorhandler.pyo", line 89, in __handle
xml.dom.SyntaxErr: CSSStyleDeclaration: Unexpected token, ignoring upto u'; marg
in: 0pt;'. [1:1: ;]

If you're interested, I'll create a bug and add a file that does it.

I found it, I think, it appears to be from a file called "calibre_title_page.html" which appears to be generated by Calibre? It doesn't seem to like the lack of space in the "padding:0pt;" bit. That's the only instance of "margin: 0pt" in the file I was looking at.

C:\Users\bkilian\AppData\Local\Temp\calibre_0.4.13 0_hzidig_any2mobi\oeb\content>
more calibre_title_page.html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Cover</title>
<style type="text/css" title="override_css">
@page {padding: 0pt; margin:0pt}
body { text-align: center; padding:0pt; margin: 0pt; }
div { margin: 0pt; padding: 0pt; }
</style>
</head>
<body>
<div>
<img src="resources/_cover_.jpg" alt="cover" style="height: 100%" />
</div>
</body>
</html>

kovidgoyal
01-26-2009, 09:33 PM
Update to the newly released 0.4.131 and if it is still there open a ticket

sianon
01-27-2009, 02:30 AM
I installed the update today and seems to be working well. The books I experienced error messages with the other day seem to be converting well now. Keep up the excellent work David and team. he only thing I need now to make Calibre absolutely perfect would be to be able to convert my old LRF files to MOBI.

Karen

Gaurnim
01-27-2009, 04:40 AM
This is great news !
I have to find the time to play with this news release, then !

mtravellerh
01-27-2009, 07:57 AM
I do have a problem with my pagebreaks when conwerting from html or epub to Mobi. I am using <div style="page-break-before:always;"></div> as my standard pagebreak command.

The converter doesn't seem to recognize this tag? Any idea why? The reason I am using this is because I want to be able to do pagebreaks wherever I want.

Edit: Actually, that was a viewer problem. Pagebreaks worked in Cybook and PC mobi reader

kovidgoyal
01-27-2009, 11:24 AM
I do have a problem with my pagebreaks when conwerting from html or epub to Mobi. I am using <div style="page-break-before:always;"></div> as my standard pagebreak command.

The converter doesn't seem to recognize this tag? Any idea why? The reason I am using this is because I want to be able to do pagebreaks wherever I want.

Edit: Actually, that was a viewer problem. Pagebreaks worked in Cybook and PC mobi reader

Yeah at the moment the viewer doesn't handle page breaks in MOBI

Amalthia
01-27-2009, 12:41 PM
I had a question about the profiles in the mobiconverter?

What's the difference between the source Browser/kindle/cybook/prs-505? I wasn't sure what profile to select? and it looks like you have to pick twice?

Basically, i'd like my mobi file to come out looking like my LRF files do using the same HTML source.

I tried this with epub and I never quite got it working. :(

Also, for the mobi the indents seem rather indented I tried <p style="text-indent: 0pt"> </p> and p { text-indent: 3pt}

but neither seemed to work and the p { text-indent: 0pt} caused an extra space between paragraphs as well. or at least I assume that's what caused it.

I'd appreciate any and all help,
Thanks

Pulp
01-27-2009, 01:10 PM
<p width="X"> (pixels), <p width="X%">,<p width="Xem"> or <p width="Xpt">
works for adjusting the intent of mobi-paragraphs.
Also have a look here (http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=justification.htm).

llasram
01-27-2009, 01:14 PM
What's the difference between the source Browser/kindle/cybook/prs-505? I wasn't sure what profile to select? and it looks like you have to pick twice?

The defaults should be fine for general use. Right now it only affects the interpretation of the CSS absolute font sizes and the pixel size of rasterized SVG images.

Basically, i'd like my mobi file to come out looking like my LRF files do using the same HTML source.

Try having a CSS rule which sets both the 'text-indent' and 'margin' for your paragraph tags:


p {
text-indent: 1em;
margin: 0;
}

If that doesn't work for you, try the --remove-paragraph-spacing option.

Amalthia
01-27-2009, 01:15 PM
<p width="X"> (pixels), <p width="X%">,<p width="Xem"> or <p width="Xpt">
works for adjusting the intent of mobi-paragraphs.
Also have a look here (http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=justification.htm).

Thanks for the link and code.

I just need to add this to the css override box, correct?

And for the space added between paragraphs I select remove space between paragraphs? I used it once and it worked but when I created another copy it didn't work. I wasn't sure if that had to do with the profile or not though?

llasram
01-27-2009, 01:16 PM
<p width="X"> (pixels), <p width="X%">,<p width="Xem"> or <p width="Xpt">
works for adjusting the intent of mobi-paragraphs.
Also have a look here (http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=justification.htm).

No. Calibre doesn't use the Mobipocket-specific markup and tags. For writing content to convert with calibre use the W3C XHTML and CSS specs.

Amalthia
01-27-2009, 02:46 PM
No. Calibre doesn't use the Mobipocket-specific markup and tags. For writing content to convert with calibre use the W3C XHTML and CSS specs.


I thought I did originally? But it didn't seem to work?

llasram
01-27-2009, 02:56 PM
I thought I did originally? But it didn't seem to work?

Did you see post #41 (http://www.mobileread.com/forums/showpost.php?p=337035&postcount=41) in this thread?

Amalthia
01-27-2009, 05:56 PM
Did you see post #41 (http://www.mobileread.com/forums/showpost.php?p=337035&postcount=41) in this thread?

I completely missed your earlier post. :( sorry about that.

And thanks for being so patient.

Amalthia
01-29-2009, 01:13 AM
Okay I tested this code.

p {
text-indent: 1em;
margin: 0;
}

and I tried

p {
text-indent: 1em;
}

and neither did anything to address the wide indent for every paragraph.

kovidgoyal
01-29-2009, 01:27 AM
Disable the remove paragraph spacing option

Amalthia
01-29-2009, 05:13 PM
Disable the remove paragraph spacing option

but if I do that won't there be a space between the paragraphs?

kovidgoyal
01-29-2009, 05:25 PM
yeah but you can add the following to override css to get rid of the spaces
(this is what that option does anyway)

p { margin: 0pt; border:0pt;}

Amalthia
01-29-2009, 08:39 PM
yeah but you can add the following to override css to get rid of the spaces
(this is what that option does anyway)

p { margin: 0pt; border:0pt;}


I'll try this later tonight. And thanks for helping.

Amalthia
01-31-2009, 03:24 AM
yeah but you can add the following to override css to get rid of the spaces
(this is what that option does anyway)

p { margin: 0pt; border:0pt;}



It appears I didn't need to use your code after all. Once I un-selected the remove paragraph space it all worked.

Again, thank you for your help. I still don't get why it worked like that...but I'm glad it's working regardless. :)

Edit: Um it looks like I spoke too soon. I tried the same thing on another file and I'm back to having spaces between paragraphs. :(

brewt
02-01-2009, 01:52 PM
Brewt's Contribution to the Plan for World Domination

blah blah blah
ticket 1687 opened.

-bjc

on Latest build 0.4.132:

test files - same as before - my toc with 2 html files.

the links from my toc now work (yay!).

However, with "Do Not Add Generated Table of Contents" checked, this Table of Contents is added anyway:

Table of Contents
1st book
2nd book
Chapter 1
Chapter 2
Sub Chapter
Chapter 3
Epilogue
[MSOffice1]
[MSOffice1]


With "Do Not Add Generated Table of Contents" UNchecked, this toc is added:

Table of Contents
1st book
2nd book
Chapter 1
Chapter 2
Sub Chapter
Chapter 3
Part 1
Part 2


My toc:

Test
1st book 3765 bytes
2nd book 4096 bytes

The sub toc from the 1st book:

1st book (<title>)
Blah blah blah blurb
Chapter 1 (<h1>)
Chapter 2 (<h1>)
Sub Chapter (<h2>)
Chapter 3 (<h1>)
Epilogue (<h1>)

The
sub toc from the second book:

2nd book (<title>)
Blah blah blah blurb
Prologue (<h1>)
Part 1 (<h2>)
Chapter 1 (<h3>)
Chapter 2 (<h3>)
Part 2 (<h2>)
Chapter 3 (<h3>)
Epilogue (<h1>)

On generating tocs: if "Don't Add" is checked, should the Table of contents be the root html file imported?
And if it isn't, the 1st html seems to have 2 layers, but the 2nd html file seems to only have the 2nd layer (not the 1st or 3rd).

Thoughts?

Case 1687 reopened.

-bjc

Oh, uh, all thru the gui.

llasram
02-01-2009, 02:12 PM
However, with "Do Not Add Generated Table of Contents" checked, this Table of Contents is added anyway:

"Do Not Add Generated TOC" should probably cause the output Mobipocket book not to have a generated TOC, but beyond that (comparing the generated TOCs) what do you expect to happen? For any document with more than a very simple, obvious, and flat layout there just isn't a good way to reliably completely automate generation of a TOC. If you want an accurate / multi-level TOC you need to provide it with either the calibre XPath TOC detection options or a manually written NCX file.

brewt
02-02-2009, 11:37 AM
For my purposes (because, as we all know, it IS all about me), The way to add a multi-file book is to drag the root document (toc) into the gui - would there be a way to label that document as a toc and have it be w....well know wait a minute, I haven't tried something yet.

Suppose I have a directory full of html files (chapters, books, whatever), but haven't built a toc, and want calibre to create a book and the toc. Whic file do I point the gui to? Does calibre create the zip based on the contents of the entire directory, or is there something that it is parsing to say "this file, not that one"?

If I have built a TOC, and drag it it, and do not check "Do Not Add Generated TOC", then Calibre shouldn't build one anyway. It would make sense to me to have some way to mark the file as the toc - that's how it works in Mobi Creator.

Am I thinkin' wrong (again)?

-bjc

brewt
02-02-2009, 12:21 PM
uh oh. Thought some more.

In order to muddy the waters even further:

1) If one were to build a single ebook out of a single-file source, and doing it all the really hard way (hand-coding xhtml in notepad), the notion of having the ebook generation software create the table of contents for you is a handy thing - notepad don't do that.

If suggestions are ok, may I suggest that your built-in parsing routines simply indent the differing layers of headline calls:
<h1>
<H2>
<h3>
<h1>
<h2>

This "should" make your built-in routines for creating a toc build something more reader-friendly, than
<h1>
<h1>
<h2>
<h1>
<h2>
and "shouldn't" be too far out of whack from the outline of the book.

Because I haven't done it this way, if I have multiple documents I intend to be combined into the book - what order do they appear in? The sort order they are in my source directory? Then each subdocument would have the same routine leveled against it, and again, the outline of the book "should" be presented in the toc.

I'm assuming you've seen this part of MobiCreator, where i can specify certain page-types (attached photo). This grants me a layer of control in mobi that I would want in Calibre - so I can use one app to create both outputs pretty much the same way.

Personally, outside of the toc (in mobi) I haven't had much need for those other book-document-types, but "real" pro might....


-bjc

kovidgoyal
02-02-2009, 02:30 PM
calibre follows all links in HTML files to create the ZIP from an HTML file. It does this recursively upto 5 (IIRC) levels of recursion.

The order that is used to combine the files into a single source is the "depth first" order of appearance of links. You can always customize this by creating an OPF file that specifies the desired order.

As for the TOC, you can use the --level*-toc options to create a TOC from multiple files. If you dont want to specify these options, the TOC can also be created from links in the files. In either case the algorithm for finding TOC elements is applied to each HTML file successively.

And for complete control you can create an NCX file that specifies the TOC and have calibre use that.

And on a general note, I should point out that calibre is designed for file *conversion*, not *creation*. The idea is that you use your favorite software to create the ebook and then calibre to convert it to various formats.

Abelturd
02-03-2009, 07:42 AM
Sorry if this has been discussed before and I overlooked it but I tried to grab a webpage article with Bookit Ff extension and Bookit saved it only in lrf format. Then I tried to convert it to mobi prc but failed with Calibre giving me this error message: Cannot convert...as this book has no supported formats.
So my question is: doesn't Calibre support conversion from lrf to mobi yet or what might be the problem?

llasram
02-03-2009, 08:17 AM
So my question is: doesn't Calibre support conversion from lrf to mobi yet or what might be the problem?

No, calibre does not support LRF as a source format. If you want to use BookIt with formats other than LRF, you'll need to get the BookIt author to add support for that.

Gudy
02-06-2009, 04:10 PM
Okay I tested this code.

p {
text-indent: 1em;
margin: 0;
}

and I tried

p {
text-indent: 1em;
}

and neither did anything to address the wide indent for every paragraph.

Unless I'm missing something major, the whole mechanism seems to be completely b0rked in 0.4.133.

I used "p { text-indent: 1em; margin: 0; }" in the CSS Override box with the "Remove spacing between paragraphs" option disabled, and didn't get any paragraph indent whatsoever. Running mobi2html on the resulting .mobi file showed all paragraphs as <p align="justify" height="1em" width="0pt"> which is... unexpected but matches the results, at least. :blink:

As a general usability complaint, I find it rather unacceptable that I need to resort to handcoding CSS in order to set something as basic as a paragraph indent in EPUB and MOBI files, especially since there is a far simpler way available for LRF files. In the same vein, having to use XPath expressions to detect chapter headings pretty much ensures that I will never use that feature in calibre but will instead hand-massage the html file before import.

llasram
02-06-2009, 04:41 PM
Unless I'm missing something major, the whole mechanism seems to be completely b0rked in 0.4.133.

It appears to work just fine to me. I'm going to guess that the source you're converting from contains CSS with a more specific rule which is trumping your override rule's single-element 'p' selector. Try something like "html body p { text-indent: 1em; margin: 0; }". If that doesn't work either, open a bug on the calibre trac and attach a file which is failing to convert as expected.

As a general usability complaint, I find it rather unacceptable that I need to resort to handcoding CSS in order to set something as basic as a paragraph indent in EPUB and MOBI files, especially since there is a far simpler way available for LRF files.

Hmm. I may agree with you, especially given situations like what I believe is your current issue. Paragraph marking is probably one of the formatting areas users most frequently wish to control, and might deserve a direct interface which can use use some sort of heuristics to detect normal paragraphs and style them accordingly.

In the same vein, having to use XPath expressions to detect chapter headings pretty much ensures that I will never use that feature in calibre but will instead hand-massage the html file before import.

What sort of interface would you prefer to see?

-Marshall

kovidgoyal
02-06-2009, 04:42 PM
As a general usability complaint, I find it rather unacceptable that I need to resort to handcoding CSS in order to set something as basic as a paragraph indent in EPUB and MOBI files, especially since there is a far simpler way available for LRF files. In the same vein, having to use XPath expressions to detect chapter headings pretty much ensures that I will never use that feature in calibre but will instead hand-massage the html file before import.

Paragrpah indents will eventually be settable with a simple control. As for XPath, I think it is easier to use than the various LRF settings, if you spend 5 minutes reading the XPath tutorial in the calibre User Manual

Amalthia
02-06-2009, 06:33 PM
Paragrpah indents will eventually be settable with a simple control. As for XPath, I think it is easier to use than the various LRF settings, if you spend 5 minutes reading the XPath tutorial in the calibre User Manual

I think for people unfamilar with css or Xpath it's not as easy to figure out what you need to do to set settings. I think the LRF conversion is more intutive for people that are starting out with little or no knowledge of programming or html coding.

I'm still not quite sure what to do with xpath but I have used command line to try some stuff out?

And I've also run into troubles using css to make paragraph indents. The code should work but it doesn't always? I found that I have to convert the file. Turn off the program, re-open and convert the file again and on the second pass the indents stick. It's worked like that two times...and maybe with the newer version the css you gave me will do the trick on first try.

But considering Epub and Mobi are still in beta I expect a few bumps in the road and am willing to try and figure out what's happening.

However, I don't think I'm your average user.

edit: forgot to mention...having said everything I said I'm still rather excited about the ablity to set paragraph indents like I do for the LRF settings.

kovidgoyal
02-06-2009, 06:49 PM
At some point I will get around to coding an XPath expression builder, but for the time being, you have to enter them by hand.

Gudy
02-07-2009, 06:09 AM
And I've also run into troubles using css to make paragraph indents. The code should work but it doesn't always? I found that I have to convert the file. Turn off the program, re-open and convert the file again and on the second pass the indents stick. It's worked like that two times...and maybe with the newer version the css you gave me will do the trick on first try.

Some more experimenting revealed that this is precisely the problem, yes. Changes in the CSS Override input box only take effect after completely restarting Calibre. This is true, at least for Mobipocket, in both 0.4.133 and 0.4.134

Paragrpah indents will eventually be settable with a simple control. As for XPath, I think it is easier to use than the various LRF settings, if you spend 5 minutes reading the XPath tutorial in the calibre User Manual

I'm definitely looking forward to the simple settings. :-)

As for XPath vs. the LRF settings, with the latter it took me 30 seconds of thinking about what I'm supposed to enter into those fields and exactly one failed attempt until I had the chapters detected and page breaks inserted exactly where I wanted them. I have no doubt that XPath is far more powerful and versatile a tool, but I doubt I would have gotten up to speed with XPath within two minutes...

mtravellerh
02-07-2009, 07:54 AM
Some more experimenting revealed that this is precisely the problem, yes. Changes in the CSS Override input box only take effect after completely restarting Calibre. This is true, at least for Mobipocket, in both 0.4.133 and 0.4.134



I'm definitely looking forward to the simple settings. :-)

As for XPath vs. the LRF settings, with the latter it took me 30 seconds of thinking about what I'm supposed to enter into those fields and exactly one failed attempt until I had the chapters detected and page breaks inserted exactly where I wanted them. I have no doubt that XPath is far more powerful and versatile a tool, but I doubt I would have gotten up to speed with XPath within two minutes...

Ah, to be quite plain about it, Kovid's XPath default expression is REALLY a catch-all put there to well catch nearly all chapters. If you have a specific file, one simple expression including a tag per hierarchic level is generally enough.

It might be a good habit for anyone involved in bookmaking in some way to just mark TOC files (parts, sections, chapters) in a uniform hierarchical way with tags or at least with uniform class labels and not use those tags or labels for other tasks.

Gudy
02-07-2009, 08:12 AM
It might be a good habit for anyone involved in bookmaking in some way to just mark TOC files (parts, sections, chapters) in a uniform hierarchical way with tags or at least with uniform class labels and not use those tags or labels for other tasks.

Probably, yes. The thing is, I don't often make books myself. I've converted about two dozen books to FB2 for my own use using Bookdesigner, and this was my first attempt to go beyond that single format. So I'm still working out an optimal work flow. I've gone Word .doc -> Bookdesigner -> .html -> Cleanup with VIM -> Calibre with this one, but that's probably not optimal at all, especially since the BD html output leaves a lot to be desired as a basis for further work on a book.

Amalthia
02-07-2009, 05:17 PM
I have a question about <br > tags. For some reason when I convert to mobi there is an extra space added after using them. So they kind of act like paragraph breaks. Is there anyway to make the break tag work like a regular break tag? I don't use break tags often but they are a big part of my TOC and with LRF my TOC is single spaced. I'd like to replicate that result with my mobi files.

giddion
02-08-2009, 06:24 PM
Is it possible now that Calibre has MOBI output to save the updated meta data?

I don't want to do the full convert because I don't want to reformat the ebook, I'm happy with the format, I just want to put a better cover in the file and add series information to the meta.
Mobi2Mobi_gui will let me update some of the meta but it doesn't give series and it doesn't have the great lookup function Calibre has to find the correct cover graphic and meta data.

llasram
02-08-2009, 11:29 PM
I have a question about <br > tags. For some reason when I convert to mobi there is an extra space added after using them. So they kind of act like paragraph breaks. Is there anyway to make the break tag work like a regular break tag? I don't use break tags often but they are a big part of my TOC and with LRF my TOC is single spaced. I'd like to replicate that result with my mobi files.

It sounds like what's probably going on is that you have <br/> tags directly in the <body/>. In XHTML and HTML <br/> tags aren't actually allowed there, so the way they get interpreted varies with the renderer. MSReader and (most? all?) the Mobipocket viewers will renderer a <br/> in the <body/> following a block as a blank line, but AdobeDE will only render the blank line if there are two <br/> tags.

Anyway, try wrapping your table of contents or whatever in a <div> </div> tags so that your <br/> tags aren't directly in the <body/>.

llasram
02-08-2009, 11:32 PM
Is it possible now that Calibre has MOBI output to save the updated meta data?

Er, yes? It should be automatic. If you import a Mobipocket version, update the metadata, then "save to disk" as Mobipocket, it should just write out a copy of the Mobipocket version w/ the updated metadata.

kovidgoyal
02-08-2009, 11:43 PM
Er, yes? It should be automatic. If you import a Mobipocket version, update the metadata, then "save to disk" as Mobipocket, it should just write out a copy of the Mobipocket version w/ the updated metadata.

It will in the next release. There were a couple of bugs in the mobipocket metadata setting code that needed to be fixed first.

giddion
02-09-2009, 07:00 AM
It will in the next release. There were a couple of bugs in the mobipocket metadata setting code that needed to be fixed first.

Ok thank you very much, I was about to reply that I have tried the save as mobi and the cover graphic isn't being saved. Have to admit though I didn't double check whether the rest of the meta updated, was going to go back and check that before my reply - can still check which elements updated and which didn't if it would be helpful.

Amalthia
02-09-2009, 02:01 PM
It sounds like what's probably going on is that you have <br/> tags directly in the <body/>. In XHTML and HTML <br/> tags aren't actually allowed there, so the way they get interpreted varies with the renderer. MSReader and (most? all?) the Mobipocket viewers will renderer a <br/> in the <body/> following a block as a blank line, but AdobeDE will only render the blank line if there are two <br/> tags.

Anyway, try wrapping your table of contents or whatever in a <div> </div> tags so that your <br/> tags aren't directly in the <body/>.

yeah I tried that but it only worked for one table of contents and I have about 5 or 6 stories mixed into one file and they have summary, title, author notes and etc...it doesn't look so great when it's paragraph indented but when I tried to use css to remove the paragraph indents for just those sections it didn't work.

Basically, yes I'm using <br > tags within the body of the html but what I still don't get is why when I convert to LRF the <br > tags work like they do on web browsers but when I convert to MOBI it adds an extra line.

llasram
02-09-2009, 02:27 PM
Basically, yes I'm using <br > tags within the body of the html but what I still don't get is why when I convert to LRF the <br > tags work like they do on web browsers but when I convert to MOBI it adds an extra line.

The any2* tools are mostly for e-book conversion, and in MSReader and Mobipocket a <br/> tag there will create a new blank line. If calibre didn't convert such <br/>s then people converting books from those formats would find that they were missing blank lines in e.g. their EPUB versions.

More abstractly, the problem is that you should never be using the <br/> tag in hand-written HTML. You should use semantic markup around anything you want to be rendered as a block-level box and use CSS to set appropriate display and margins.

For example:

<div class="lines">
<div class="line">This is on a line!</div>
<div class="line">This is on another line!</div>
</div>

Then have CSS like:

.lines { margin: 0; }
.line { margin: 0; }


The CSS2.1 spec has lots of examples.

Amalthia
02-09-2009, 10:38 PM
The any2* tools are mostly for e-book conversion, and in MSReader and Mobipocket a <br/> tag there will create a new blank line. If calibre didn't convert such <br/>s then people converting books from those formats would find that they were missing blank lines in e.g. their EPUB versions.

More abstractly, the problem is that you should never be using the <br/> tag in hand-written HTML. You should use semantic markup around anything you want to be rendered as a block-level box and use CSS to set appropriate display and margins.


When I learned html coding in college <br> tags were part of the learning experience. Last time I checked <br> is valid html coding.

Is there another equivalent to <br> that does not require stylesheet coding? Because in my book the people who were coding mobipocket and MS Reader screwed things up. <br> stands for a line break not paragraph. :(

grrrr

Not angry at you in fact I appreciate your advice it's just frustrating because all my files use <br> to designate line breaks and it's worked for LRF and I did not want to create two separate html files one for LRF the other for Mobi.

Basically, you kind of gave me an answer I didn't want to hear. :(

llasram
02-09-2009, 10:57 PM
Is there another equivalent to <br> that does not require stylesheet coding? Because in my book the people who were coding mobipocket and MS Reader screwed things up. <br> stands for a line break not paragraph. :(

This special interpretation applies only to <br/> tags which are direct children of the <body/> element, so just wrap everything in a <div/> and you should be fine.

The problem with <br/> is that it's a purely formatting element. HTML isn't really a formatting language, especially XHTML 1.x. Instead the markup language supplies semantic constructs -- tags for headers, paragraphs, quotations, etc -- and allows any formatting for those elements the designer wants using CSS. The <br/> tag doesn't really fit this paradigm, and is best avoided (IMHO, as yes -- it isn't yet deprecated).

Amalthia
02-09-2009, 11:29 PM
This special interpretation applies only to <br/> tags which are direct children of the <body/> element, so just wrap everything in a <div/> and you should be fine.

The problem with <br/> is that it's a purely formatting element. HTML isn't really a formatting language, especially XHTML 1.x. Instead the markup language supplies semantic constructs -- tags for headers, paragraphs, quotations, etc -- and allows any formatting for those elements the designer wants using CSS. The <br/> tag doesn't really fit this paradigm, and is best avoided (IMHO, as yes -- it isn't yet deprecated).

what would happen if i just applied <div> text here</div> to a line of text? would the create a line break or a paragraph break? or do I need to add extra coding? And how would the html to LRF conversion go using those tags instead? Basically, I've concluded that while I may not go back and re-do the coding for my previous conversions I could try moving ahead with a new code that would work for LRF, Epub, and Mobi.

Thanks for your help.

llasram
02-10-2009, 07:59 AM
what would happen if i just applied <div> text here</div> to a line of text? would the create a line break or a paragraph break?

The tags are just places to hang CSS off of. The <div/> tag creates a block-level element with no extra margins or indent by default, so with no extra CSS it will just make whatever is within the element have line breaks before the start tag and after the end tag.

But what I was suggesting was literally just put the entire document in a single <div/>. Try right after your <body> tag adding a <div> tag and right before your </body> tag adding a </div> tag. That will make sure that none of your <br/> tags are direct children of the <body/> element.

Amalthia
02-10-2009, 03:46 PM
The tags are just places to hang CSS off of. The <div/> tag creates a block-level element with no extra margins or indent by default, so with no extra CSS it will just make whatever is within the element have line breaks before the start tag and after the end tag.

But what I was suggesting was literally just put the entire document in a single <div/>. Try right after your <body> tag adding a <div> tag and right before your </body> tag adding a </div> tag. That will make sure that none of your <br/> tags are direct children of the <body/> element.

actually, that's kind of brilliant and if it works then it'll make my life so much easier for converting documents. :) Will try it tonight.

Um, not to beat a dead horse but just to be sure. Will this affect converting to LRF? Or should my previous <p> and <br> work like they have been so far?

Mostly, I just want paragraph indents for <p> and no space between paragraphs. And <br> to just add a line break. I'm kind of shooting to have a uniform standard for mobi, lrf, and epub.

Again thanks for your help! Obviously, I still have much to learn about html and css.

tompe
02-10-2009, 04:16 PM
When I learned html coding in college <br> tags were part of the learning experience. Last time I checked <br> is valid html coding.

<br> and <br/> is not the same thing. <br> only is not valid in XHTML.

Amalthia
02-10-2009, 05:38 PM
<br> and <br/> is not the same thing. <br> only is not valid in XHTML.

so if I switched out all my <br> with <br/> then my line breaks would work properly when converting to mobi?

kovidgoyal
02-10-2009, 05:46 PM
so if I switched out all my <br> with <br/> then my line breaks would work properly when converting to mobi?

As far as calibre is concerned there is no difference between <br> and <br/>

You should try embedding everything in a <div> like llasram suggested. It shouldn't make any difference to the LRF conversion and it will allow you to use <br> as you want for epub and mobi conversion

Amalthia
02-10-2009, 06:07 PM
As far as calibre is concerned there is no difference between <br> and <br/>

You should try embedding everything in a <div> like llasram suggested. It shouldn't make any difference to the LRF conversion and it will allow you to use <br> as you want for epub and mobi conversion

Okay, that's what I needed to know.

Thanks for your patience. :)

Bob Butler
02-11-2009, 08:16 PM
I have an HTML file (extracted from an ereader pdb if it matters) that I converted with any2mobi 0.4.136.

Symbols such as the copyright symbol, colons and hyphens don't convert properly, they show as a boxed '?' symbol.

My Kindle recently upgraded to the 1.2 firmware, I don't think I had this problem before with 1.08.

When I use html2mobi instead of any2mobi, the conversion works properly. I'm wondering if there is possible a charset or language setting in the metadata that needs to be set properly for the new Kindle firmware?

Bob

llasram
02-11-2009, 09:01 PM
@Bob: Sounds like a possible encoding detection bug in calibre. Can you check the any2mobi output in Mobipocket Desktop? And if it's messed up there too, could you go ahead and open a ticket on the calibre trac and attach a copy of the input file?

Bob Butler
02-11-2009, 09:36 PM
go ahead and open a ticket

Done. I was able to include just a few lines that demonstrate the issue.

I'm not sure the HTML attachment was correct (it didn't display correctly when I clicked through) so I zipped it and attached the zip too.

mtravellerh
02-12-2009, 06:52 PM
Just a small question:

I have tried to create mobi files per Calibre lately and the results turn out quite all right. The only thing that really bugs me is the size of those mobi files. They are nearly twice the size of the epub files every time. This is definitely not normal as the same files created by the Mobipocket creator are only slightly bigger than the epub files.

Is that a known problem or is there some mistake in my procedure (import xhtml and a cover, create lrf, epub, mobi files from the zip)? This happens regularly, so it is not a one time thing.

I tried creating mobi files from epub with the same result.

kovidgoyal
02-12-2009, 07:11 PM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress

nrapallo
02-12-2009, 07:50 PM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress

:chinscratch: Is that standard compression? or high (huffdic) compression?

llasram
02-12-2009, 07:57 PM
:chinscratch: Is that standard compression? or high (huffdic) compression?

"Standard" PalmDOC compression. Calibre doesn't support compressing with huffdic compression (yet anyway, although the gains seem modest vs. the generation time).

nrapallo
02-12-2009, 08:02 PM
"Standard" PalmDOC compression. Calibre doesn't support compressing with huffdic compression (yet anyway, although the gains seem modest vs. the generation time).

That's reassuring! I was hoping the answer would be "standard".

No need for high compression, except for dictionaries! ;)

Thanks for the heads-up.

wallcraft
02-12-2009, 09:07 PM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress The manual says that this takes a long time to run, but I have not noticed any particular slowdown when compressing. Is it slower than zip for ePub?

kovidgoyal
02-13-2009, 01:01 AM
Yeah its implemented in pure python. Eventually either llasram or I will get around to implementing it in C at which point it will be enabled by default.

mtravellerh
02-13-2009, 07:11 AM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress

Thanks

Lilly
02-15-2009, 03:14 PM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress

This might be a dumb question but I'm technically challenge but willing to learn new things, so I've always used the GUI but I want to run this command line. What path should I be pointing to in the command prompt to run this command line?

wallcraft
02-15-2009, 06:19 PM
What path should I be pointing to in the command prompt to run this command line? The Calibre command line programs are automatically in your path, so you can run them from any directory. See Visual Kindle Guide (http://wiki.mobileread.com/wiki/Visual_Kindle_Guide) for more details on using the command line. However, you don't need to download python and you don't need to worry about path issues (so its even easier than outlined in the guide).

Lilly
02-16-2009, 12:35 AM
The Calibre command line programs are automatically in your path, so you can run them from any directory. See Visual Kindle Guide (http://wiki.mobileread.com/wiki/Visual_Kindle_Guide) for more details on using the command line. However, you don't need to download python and you don't need to worry about path issues (so its even easier than outlined in the guide).

Thank you!

mdibella
02-20-2009, 12:10 PM
Oh, this is just wonderful! Thanks so very much! I'm expecting my Kindle 2 this week and I'm in the process of organizing my ebook library, which at the moment is spread out between two readers (Sony and Kindle) and two memory cards (one per reader).

This tool is turning what could be a really tedious job into...um...a less tedious job?

In the 'Some people are never satisfied' category, given the Kindle's lack of folders, it would be nice if I could highlight a series of books in the Calibre library window and generate a text document containing the list of currently selected books, in order, including their 'series' info. Basically I'd want to be able to highlight some books, then copy that list into my clipboard for later pasting into a text document.

Then I could add that text document back into to the calibre library, edit metadata to add the author (E.G. Anthony, Piers), change the title to the overall series name (E.G. Xanth) and then move that document to the Kindle as an E-Book. Voila, I can open it on the Kindle and see the reading order for all 30 books in the series.

kovidgoyal
02-20-2009, 12:40 PM
While you cant do exactly that, you can get a list of all books in your library by running the following simple command ina terminal



calibredb list > books.txt



The file bookstxt will have a list of your books.

mdibella
02-20-2009, 12:45 PM
While you cant do exactly that, you can get a list of all books in your library by running the following simple command ina terminal



calibredb list > books.txt



The file bookstxt will have a list of your books.

hmmm I see that, it works well but it does not list the series info. Could that be added? I just want a way not to have to type in a zillion titles just so I can have a list of series reading orders...

kovidgoyal
02-20-2009, 12:48 PM
calibredb list --help

mdibella
02-20-2009, 12:49 PM
OH WOOT! That's perfect!!!!

Thanks so very much!!!

mdibella
02-20-2009, 01:25 PM
I have some books in my Calibre library that exist only in LRF format. They are not DRM books, just LRF.

Trying to convert them to MOBI results in the message 'this book has no supported formats'.

I would have thought it would convert the book to html and then to MOBI, a 2 step process. Is this not the case?

JSWolf
02-20-2009, 01:29 PM
I have some books in my Calibre library that exist only in LRF format. They are not DRM books, just LRF.

Trying to convert them to MOBI results in the message 'this book has no supported formats'.

I would have thought it would convert the book to html and then to MOBI, a 2 step process. Is this not the case?

See LRFTools at http://www.mobileread.com/forums/showthread.php?t=28707

starrigger
02-20-2009, 04:27 PM
Question about mobipocket file output. I discovered that the reason I couldn't use mobi files produced by Calibre on my PDA is that they're .mobi files instead of .prc. When I renamed them to .prc, they worked. So I put in a ticket asking if .prc could be an output option in Calibre. Kovid answered that .prc is a deprecated extension in Mobipocket, and that Calibre wouldn't support it.

This was the first I'd heard that, so I'm just asking for more information. As far as I can tell, I have the most recent version of Mobi Creator (4.2), and it produces .prc files. Soooo....how is it that .prc is deprecated in mobipocket?

My Mobi Reader (desktop) can read either .prc or .mobi. But my older (Win CE) Pocket PC, which also has the most recent version it can support, can only read .prc.

I take it that there's more to it than just choosing a different file extension, which is why Kovid doesn't want to add .prc output as an option. But if a .mobi file renamed to .prc works as a .prc, wouldn't adding the extension option be a pretty easy thing?

I don't know, mind you, I'm just wondering out loud.

kovidgoyal
02-20-2009, 04:45 PM
It's like this:

A MOBI file is a perfectly valid PRC file, but a PRC file need not in general be a valid MOBI file. So by labelling mobi output as .mobi calibre is indicating that the file it has produced is a valid MOBI ebook. It's unfortunate that there isn't a new enough version of MOBI reader for your win ce device, but I'd rather not change the behavior of calibre to accomodate something that is rapidly becoming obsolete.

nrapallo
02-20-2009, 04:47 PM
But if a .mobi file renamed to .prc works as a .prc, wouldn't adding the extension option be a pretty easy thing?

I don't know, mind you, I'm just wondering out loud.

Yep, I think, renaming is your friend, in this case... ;)

I think, going forward, the .mobi file extension tipifies that the file is truly an ebook, whereas, historically, in PalmOS, .prc had a somewhat confusing beginning as a ebook file format (it shares it's file extension with Palm Resource programs/files).

So, since newer software will accomodate the .mobi file extension, going forward, it's a non-issue. For older software, it's a rename away. Just my take.

giddion
02-20-2009, 04:57 PM
The version of Mobipocket I downloaded and installed for my win mobile device handles the .mobi files just fine but when I select import from the menu it doesn't find them because the import has *.prc or all files - and you don't want to select all files cause that tries to list every file on the device.

However, if I use the file browser application and I browse to the folder where I put the Mobi file and double click it the mobi pocket reader loads the file fine and adds it to the library.

starrigger
02-20-2009, 05:44 PM
Fair enough. But it leaves me wondering at the fact that there's this new, improved standard, which Calibre (and presumably others) produce to--but Mobi Creator does not. Wouldn't Mobi Creator be the pace car, so to speak, on changes like this?

Indeed, I guess "rename" is my friend. :chinscratch:

Fortunately, most of my conversions go in the opposite direction.

taspool
02-20-2009, 06:13 PM
I have changed from using Mobipocket software to Calibre for my recently acquired Cybook. I love Calibre, the look and feel is professional and the degree of user control over functions is fantastic.

A couple of issues have arisen for me, which may well be my own inexperience, but I couldn't see answers on this thread;

1. When importing or replacing the cover image, this works fine as far as reading the book (the cover image comes up full screen if I've imported an 800x600 image) but no matter what size jpg I start with, the thumbnail picture in the Cybook library does not take up the full thumbnail space in the books listing, instead the cover image is a tiny picture in the centre with a large white margin around it. Other books, such as purchased prc files, have "full size" thumbnails. What can I do to get "full size" thumbnails from Calibre?

2. I'm one of those who'd like the maximum amount of the cybook screen filled with text to minimise page turning. Is there any way of formatting the conversion or send-to-device process so that the header is not shown and instead used by text, or so that side margin white space can be reduced? Simply turning off "show header" in the cybook just leaves blank space at the top.

Thanks for any help. And just in case bribery works, please be advised that I always donate to freeware if I keep using it after a month :)

In any case, great program, congratulations to the developers.

Greg

llasram
02-20-2009, 06:43 PM
A couple of issues have arisen for me, which may well be my own inexperience, but I couldn't see answers on this thread;

Both of the issues you've mentioned sound pretty weird to me, and I'm not sure they're something I can fix without a Cybook, but I'm willing to try. Calibre make the thumbnail by re-sizing to what mobigen produced, and which size looks fine in Mobipocket Desktop. For header and side margin, calibre isn't actually setting anything at all.

Go ahead and open a separate ticket for each issue on the calibre trac, and attach a book which (a) shows the behavior you want but (b) when run through calibre (extracted then re-converted to Mobi) shows the behavior you don't want. If you don't want to attach the book directly, you can e-mail it to me at <llasram@gmail.com>.

taspool
02-20-2009, 07:56 PM
Both of the issues you've mentioned sound pretty weird to me, and I'm not sure they're something I can fix without a Cybook, but I'm willing to try. Calibre make the thumbnail by re-sizing to what mobigen produced, and which size looks fine in Mobipocket Desktop. For header and side margin, calibre isn't actually setting anything at all.

Go ahead and open a separate ticket for each issue on the calibre trac, and attach a book which (a) shows the behavior you want but (b) when run through calibre (extracted then re-converted to Mobi) shows the behavior you don't want. If you don't want to attach the book directly, you can e-mail it to me at <llasram@gmail.com>.

Thanks for the reply. I suspect my problem with thumbnails has more to do with my lack of knowledge rather than a bug in the program, so I'm reluctant to post it as a ticket until I rule out user error. But I'm happy to send book examples of my problem and would appreciate any help you can offer. Although as you say without a cybook you might not be able to see the problem. For the book examples what should I send you - the book files from the cybook itself, or from the calibre folders?

taspool
02-21-2009, 08:28 AM
A fix has been found by Jellby to the Cybook thumbnail problem I posted at 111 above. He kindly responded to my crosspost in the cybook subforum.

Simply deleting the t2b files from the Cybook allowed the thumbnails to be regenerated at the correct sizes.

As to why it happened in the first place, might well be the cybook rather than the calibre, but in any case an easy and complete fix!

JSWolf
02-21-2009, 08:39 AM
As for the margins on the Gen3, the margins are fixed in the software on the Gen3. There's nothing you can do about it other then complain to Bookeen about it.

Why not try generating your next Mobipocket eBook using the command line tool any2mobi and see what happens.

mtravellerh
02-21-2009, 06:53 PM
As for the margins on the Gen3, the margins are fixed in the software on the Gen3. There's nothing you can do about it other then complain to Bookeen about it.

Why not try generating your next Mobipocket eBook using the command line tool any2mobi and see what happens.

Exactly. any2mobi on the command line works way better than the GUI version, not least because there are more switches available. (compression, for instance)

starrigger
02-26-2009, 01:29 AM
The GUI doesn't have an option to enable compression for mobi output. You have to use the commandline any2mobi with the option --compress

Will that option be coming anytime soon? I'd consider that a fairly high priority for my own use of conversion to mobi.

starrigger
02-26-2009, 01:34 AM
In my tests with the mobi conversion, I noticed that it seemed to be forcing line justification. Is there any way to turn that off? (I really dislike having justification forced on me in a small reader, especially since, in the Mobi Reader software, I can turn it on or off at will--but only if it's off in the file build.)

kovidgoyal
02-26-2009, 01:39 AM
Will that option be coming anytime soon? I'd consider that a fairly high priority for my own use of conversion to mobi.

The whole conversion system is undergoing a re-organization right now. Once that's done, this will be added. So in a couple of months.

starrigger
02-26-2009, 01:57 AM
The whole conversion system is undergoing a re-organization right now. Once that's done, this will be added. So in a couple of months.

Excellent! (Well, I'm sorry I won't have it next week :), but really. I'm amazed how fast this tool is coming along, and how well it works.)

llasram
02-26-2009, 01:09 PM
In my tests with the mobi conversion, I noticed that it seemed to be forcing line justification. Is there any way to turn that off? (I really dislike having justification forced on me in a small reader, especially since, in the Mobi Reader software, I can turn it on or off at will--but only if it's off in the file build.)

Right now Mobipocket conversion uses whatever the source specifies. So if the source specifies justified, then the output specifies justified. Setting (or allowing setting) the alignment for main body paragraphs to the default "unspecified" is probably a good idea. Open a feature ticket so that this doesn't get lost?

kovidgoyal
02-26-2009, 01:28 PM
Actually the EPUB conversion layer currently forces justification, option to turn it off will be in the next release.

starrigger
02-26-2009, 03:05 PM
Actually the EPUB conversion layer currently forces justification, option to turn it off will be in the next release.

Glad to hear it.

But I'm confused about something. Why is it that my epub files appear justified in the Calibre viewer, and produce justified mobi output -- but appear unjustified on my Sony 700?

nrapallo
02-26-2009, 03:07 PM
Glad to hear it.

But I'm confused about something. Why is it that my epub files appear justified in the Calibre viewer, and produce justified mobi output -- but appear unjustified on my Sony 700?

ADE is the culprit; it currently has no support for text justification. It's on Adobe's "To Do" list... :smack:

starrigger
02-26-2009, 03:59 PM
ADE is the culprit; it currently has no support for text justification. It's on Adobe's "To Do" list... :smack:

Ah--so that's ADE running on my Sony? (I'm just as happy to have it unjustified, but would prefer control one way or the other.)

This may be a related question:

In some test conversions to EPUB, I'm finding that the in-text ToC always displays centered on my Reader, even if it was left-justified in the source html. Any idea why this should be?

kovidgoyal
02-26-2009, 04:25 PM
In some test conversions to EPUB, I'm finding that the in-text ToC always displays centered on my Reader, even if it was left-justified in the source html. Any idea why this should be?

you;ll have to provide an example file

mtravellerh
02-26-2009, 04:33 PM
Ah--so that's ADE running on my Sony? (I'm just as happy to have it unjustified, but would prefer control one way or the other.)

BTW, it's a Sony problem now 'cause Adobe supports justification now in it's PC ADE edition, so Sony just has to update it's firmware.

starrigger
02-26-2009, 06:38 PM
you;ll have to provide an example file

Never mind, my mistake. The ToC was indented, and when put on the smaller screen, pushed over so far it looked centered. I need to get rid of the indentation.

Valloric
02-26-2009, 07:18 PM
ADE is the culprit; it currently has no support for text justification. It's on Adobe's "To Do" list... :smack:

BTW, it's a Sony problem now 'cause Adobe supports justification now in it's PC ADE edition, so Sony just has to update it's firmware.

I just want to chime in on this: it's not Adobe's fault. There a lot of problems with mobile DE that are Adobe's fault, but this isn't one of them.

Sony needs to update the firmware.

Palquito
03-08-2009, 02:43 PM
Can someone tell me how to indent at the start of every paragraph? I am converting (mostly lits to mobis) and many of my source files do not indent at the beginning of each paragraph, which drives me crazy. I've searched but only found the general margins, not paragraph indents. Thanks.

mtravellerh
03-08-2009, 02:54 PM
Can someone tell me how to indent at the start of every paragraph? I am converting (mostly lits to mobis) and many of my source files do not indent at the beginning of each paragraph, which drives me crazy. I've searched but only found the general margins, not paragraph indents. Thanks.

Do a little css like this p {text-indent: 2%} and put this under the Look & Feel tab overwrite CSS. That will indent your paragraphs. Caution: Every paragraph not tagged otherwise will be thus indented.

Palquito
03-08-2009, 03:06 PM
Do a little css like this p {text-indent: 2%} and put this under the Look & Feel tab overwrite CSS. That will indent your paragraphs. Caution: Every paragraph not tagged otherwise will be thus indented.

Thanks for the help. It looks great.

Amalthia
03-09-2009, 02:43 PM
Right now Mobipocket conversion uses whatever the source specifies. So if the source specifies justified, then the output specifies justified. Setting (or allowing setting) the alignment for main body paragraphs to the default "unspecified" is probably a good idea. Open a feature ticket so that this doesn't get lost?

How do you specify justification in the source file?

I'm creating mobipocket files and without a device that can read the format I'm kind of at a loss as to figuring out how it actually looks on a device and it wasn't until i started experimenting more with Epub that I realized what a big difference justification has on the way the ebook turns out.

pdurrant
03-09-2009, 03:19 PM
For Mobipocket you should not specify the text alignment of normal paragraphs. The Mobipocket program allows the reader to specify whether they want the text to be justified or not. If you force the issue with explicit alignment styles you'll irritate the readers who like it the other way.

Paul

How do you specify justification in the source file?

I'm creating mobipocket files and without a device that can read the format I'm kind of at a loss as to figuring out how it actually looks on a device and it wasn't until i started experimenting more with Epub that I realized what a big difference justification has on the way the ebook turns out.

slayda
03-09-2009, 03:19 PM
I just used Calibre to convert from RTF to Mobipocket for my Kindle 1. I worked but the resulting PRC's font was too small to read and could not be resized. I went back and used Mobipocket Creator and the font is fine. Anyone know why or what happened?

kovidgoyal
03-09-2009, 03:22 PM
I just used Calibre to convert from RTF to Mobipocket for my Kindle 1. I worked but the resulting PRC's font was too small to read and could not be resized. I went back and used Mobipocket Creator and the font is fine. Anyone know why or what happened?

Interesting, open a bug report and attach the RTF file

JMikeD
03-10-2009, 03:04 AM
This may be only a problem with the Kindle itself, but I keep getting author sort problems when importing and exporting .prc and .mobi files between the Kindle and Calibre.

The problem I have is that Calibre assumes the author name in the .prc or .mobi metadata is in the form Firstname Lastname, when in fact the correct format (as defined by MobiCreator, and used in this fashion by the Kindle) is Lastname, Firstname. This causes no end of problem for importing books (won't sort correctly in Calibre). If the data is corrected in Calibre to sort correctly there, it won't sort correctly when exported to a device.

Mike

itimpi
03-10-2009, 06:00 AM
If the data is corrected in Calibre to sort correctly there, it won't sort correctly when exported to a device.

Calibre does not sort on the author name field, but on the Author sort field.

The Calibre default algorithm for Author sort is to make it lastname, firstname based on the Author name field being in the order firstname lastname.

Sydney's Mom
03-10-2009, 06:53 PM
I'm converting from a PDF, and I have lots of hyphens. Is there something I am doing wrong? Thanks, Debra

Sydney's Mom
03-10-2009, 07:04 PM
I'm converting from a PDF, and I have lots of hyphens. Is there something I am doing wrong? Thanks, Debra

kovidgoyal
03-10-2009, 08:19 PM
The PDF probably has so called soft-hyphens that are being converted to hard hyphens during the conversion. Open a ticket and attach the PDF

JMikeD
03-10-2009, 09:57 PM
Calibre does not sort on the author name field, but on the Author sort field.

The Calibre default algorithm for Author sort is to make it lastname, firstname based on the Author name field being in the order firstname lastname.

I think I didn’t explain my problem well enough.

I have a .mobi/.prc format book on my Kindle. The Kindle shows the author name as "Isaac Asimov." The Kindle will sort correctly by the author's last name. The information in the ebook metadata is "Asimov, Isaac" as seen in a hex editor.

I import this into Calibre. The Calibre author name field says "Asimov, Isaac" and the author sort field says "Isaac, Asimov,". Clearly, this is not desirable.

If I then send the file back to the Kindle, It of course will be fine and sort correctly. If I export to a .mobi file, it will also be fine on the target device.

But the info in the author fields of Calibre is incorrect, and won’t do an author sort properly. It will sort using Isaac instead of Asimov.

kovidgoyal
03-10-2009, 10:06 PM
calibre has no way on knowing if the author name from a MOBI book is first, last or last, first

It assumes it is first, last and therefore swaps for the sort field. You can always correct this manually using the metadata edit dialog

JMikeD
03-11-2009, 09:13 PM
calibre has no way on knowing if the author name from a MOBI book is first, last or last, first

It assumes it is first, last and therefore swaps for the sort field. You can always correct this manually using the metadata edit dialog

The standard seems to be last, first. I've seen very few that are first last, and so I consider those to not be the standard.

Sure, I can correct this manually in Caliber, but then when I send the book to the reader, it will not sort correctly there.

tompe
03-11-2009, 09:26 PM
calibre has no way on knowing if the author name from a MOBI book is first, last or last, first

Well, you should be able to do a good guess. If the form is "A, B" then it is "Last, First" and if the for is "A B" then it is "First Last".

starrigger
03-12-2009, 12:03 AM
This seems to be an area in which there is no standard in ebooks, though "last name, first name" has long been the standard in regular books and libraries.

From a programming point of view, would it be difficult to allow the user a choice of which they want as a default display of author name? That would let people standardize their own collections, anyway.

What if the metadata edit window had three fields (at least): First name, last name, and optional title (such as Editor). Then the user could click on a choice of preferred display order.

JMikeD
03-12-2009, 12:17 AM
This seems to be an area in which there is no standard in ebooks, though "last name, first name" has long been the standard in regular books and libraries.

From a programming point of view, would it be difficult to allow the user a choice of which they want as a default display of author name? That would let people standardize their own collections, anyway.

What if the metadata edit window had three fields (at least): First name, last name, and optional title (such as Editor). Then the user could click on a choice of preferred display order.

In the case of the Kindle, the standard is that the data in the author metadata field is Last, First. As long as the program can recognize that it is connected to a Kindle, then it seems reasonable that Calibre should process the data that way.

Standard in this case is defined by the way books are formatted when purchased from Amazon and other sources and display correctly on the Kindle. Clearly the intent is for the data to be in this form because that is the only way it can be sorted properly on the Kindle. I have no information on the way other devices may use this information, or if they use it at all.

BTW, Jeffrey, I've read a number of your books over the years and enjoyed them all.

starrigger
03-12-2009, 12:26 AM
BTW, Jeffrey, I've read a number of your books over the years and enjoyed them all.

Thanks. :)

bwaldron
03-13-2009, 02:01 AM
The standard seems to be last, first. I've seen very few that are first last, and so I consider those to not be the standard.

Sure, I can correct this manually in Caliber, but then when I send the book to the reader, it will not sort correctly there.

Yes, it will. The Kindle properly picks up First Last or Last, First and displays and sorts appropriately.

JMikeD
03-13-2009, 11:46 AM
Yes, it will. The Kindle properly picks up First Last or Last, First and displays and sorts appropriately.

I disagree. I've had half a dozen books I purchased for the Kindle that don't sort properly, indexing by the first name instead of the last, and it's always been due to improperly entered author metadata. Some of which I've managed to correct.There have been a number of threads on other forums complaining about this.

bwaldron
03-13-2009, 06:10 PM
I disagree. I've had half a dozen books I purchased for the Kindle that don't sort properly, indexing by the first name instead of the last, and it's always been due to improperly entered author metadata. Some of which I've managed to correct.There have been a number of threads on other forums complaining about this.

That's strange, then. My library on the Kindle has a mix of (first last) and (last, first) in the author tags and the Kindle sorts them correctly in the library listing and presents them as (first last) in the header while reading. Guess I'm just lucky.

etherspin
03-14-2009, 09:08 PM
I used a .cbz comic file as input ( a 350mb, black and white, approx 400 page manga!!) ticked cropping to get rid of the white space border thats thick and on every edge and i outputted to .mobi, the file loaded quickly on cybook, took 54mb but still looked identical to the pdf, i.e. the white space wouldnt crop away.. its so close to easily legible i can taste it !!

tlrowley
03-15-2009, 12:00 PM
Is there any way to edit a specific EXTH entry? Since K2 has added personal documents, I'd like to add cdetype=PDOC so that docs I transfer from Calibre end up identified as "Personal Documents".

Thanks

tompe
03-15-2009, 12:20 PM
Is there any way to edit a specific EXTH entry? Since K2 has added personal documents, I'd like to add cdetype=PDOC so that docs I transfer from Calibre end up identified as "Personal Documents".

Thanks

You can do it with mobi2mobi (part of MobiPerl).

llasram
03-16-2009, 09:06 AM
@tlrowley What are the other implications of that? A quick search hasn't turned up any info on what the 'cdetype' entry is used for.

kovidgoyal
03-16-2009, 12:20 PM
@tlrowley What are the other implications of that? A quick search hasn't turned up any info on what the 'cdetype' entry is used for.

As far as I can tell its just used for categorization on the Kindle. The Topaz books have it too in their metadata

Dennis1187
03-18-2009, 11:23 AM
Small question. I have many mobipocket files without correct megadata and covers. When I bring them into Calibre I can correct the megadata but when I add covers and save to disc the covers will not show up in the mobipocket reader. Am I doing something wrong? Thanks for any help --great product by the way!

AnemicOak
03-18-2009, 12:27 PM
Small question. I have many mobipocket files without correct megadata and covers. When I bring them into Calibre I can correct the megadata but when I add covers and save to disc the covers will not show up in the mobipocket reader. Am I doing something wrong? Thanks for any help --great product by the way!

I could be wrong, but I think you have to run a conversion for the cover to get replaced.

starrigger
03-18-2009, 12:58 PM
If I understand this right--and I was just asking a similar question in another thread, so I hope Kovid will correct me if I get it wrong--when you save the files to disk from Calibre, it puts all your new metadata into a .opd file that it stores along with the mobi file. If you then Add that file back into Calibre (don't drag and drop, but use the Add File command), the data gets read and incorporated into the book file at that time--to the extent that the file format supports it.

I don't fully understand the reason for requiring the extra step. I wonder if this might be a place to suggest an enhancement, so that Saving a book file to disk would incorporate those changes, where possible, into the book file in one step.

Dennis1187
03-18-2009, 07:08 PM
If I understand this right--and I was just asking a similar question in another thread, so I hope Kovid will correct me if I get it wrong--when you save the files to disk from Calibre, it puts all your new metadata into a .opd file that it stores along with the mobi file. If you then Add that file back into Calibre (don't drag and drop, but use the Add File command), the data gets read and incorporated into the book file at that time--to the extent that the file format supports it.

I don't fully understand the reason for requiring the extra step. I wonder if this might be a place to suggest an enhancement, so that Saving a book file to disk would incorporate those changes, where possible, into the book file in one step.

Thanks starrigger I'll try that.

Dennis1187
03-18-2009, 07:29 PM
The following was a file that I discovered in the Calibre folder where the mobi book with the added cover resides:

Traceback (most recent call last):
File "calibre\gui2\update.pyo", line 15, in run
File "urllib.pyo", line 87, in urlopen
File "urllib.pyo", line 203, in open
File "urllib.pyo", line 338, in open_http
File "httplib.pyo", line 868, in endheaders
File "httplib.pyo", line 740, in _send_output
File "httplib.pyo", line 699, in send
File "httplib.pyo", line 683, in connect
File "socket.pyo", line 498, in create_connection
IOError: [Errno socket error] [Errno 11001] getaddrinfo failed
Traceback (most recent call last):
File "C:\Program Files\calibre\library.zip\calibre\ebooks\mobi\read er.py", line 555, in get_metadata
File "PIL\Image.pyo", line 1916, in open
IOError: cannot identify image file
Traceback (most recent call last):
File "C:\Program Files\calibre\library.zip\calibre\ebooks\mobi\read er.py", line 555, in get_metadata
File "PIL\Image.pyo", line 1916, in open
IOError: cannot identify image file
Traceback (most recent call last):
File "C:\Program Files\calibre\library.zip\calibre\ebooks\mobi\read er.py", line 555, in get_metadata
File "PIL\Image.pyo", line 1916, in open
IOError: cannot identify image file

kovidgoyal
03-18-2009, 07:41 PM
Just convert the file, the new cover will be included in the conversion

Dennis1187
03-18-2009, 08:28 PM
Duh, am I dumb. I never thought to convert mobi to mobi. Thanks for the simple solution!

starrigger
03-19-2009, 01:16 AM
Duh, am I dumb. I never thought to convert mobi to mobi. Thanks for the simple solution!

Dumb? It wouldn't have occurred to me, either. :rolleyes:

Does that mean that a shorter way to incorporate changes in cover or metadata into the book file is to just run a conversion, even if it's to the same format? (As opposed to Saving, then reimporting.)

kovidgoyal
03-19-2009, 01:34 AM
Yeah you could just convert, in which case calibre will use the metadata in your library to populate the metadata fields of the converted book.

starrigger
03-19-2009, 01:46 AM
Well, that certainly seems simpler than the other way. I'll have to give it a try.

starrigger
03-20-2009, 03:05 AM
Here's a suggestion for an enhancement. Is there any reason why you couldn't add as a Save to Disk option either:

"Save existing file with updated metadata and cover"

or

"Include updated metadata and cover in new book file"

The present method of requiring either a Save followed by a reimport into the library, or Converting to the same format, is sort of unintuitive and cumbersome.

Just a thought.

kovidgoyal
03-20-2009, 03:29 AM
I'm not clear as to why you want the files in the calibre library to have updated metadata? When you want to send them to a device or save them to disk, the metadata is updated automatically, so why do you car about the state of the metadata in the in library copies?

starrigger
03-20-2009, 03:55 AM
I'm not clear as to why you want the files in the calibre library to have updated metadata? When you want to send them to a device or save them to disk, the metadata is updated automatically, so why do you car about the state of the metadata in the in library copies?

Well, the most obvious reason would be if you're tweaking ebook files that you want to give other people to read. Another is, for backup purposes, or copying book files to another computer.

As for saving files to disk, didn't you just explain to me in another thread that when you Save the files, the metadata is included in the .opd file that accompanies the book file, but is not actually incorporated into the book file itself until you Add it back into the library? (That's what I understood you to say; maybe I got it wrong.) This process results in multiple copies of the book file, all slightly different, and it can quickly become hard to keep track of which is which.

So, if I'm trying to correct something in a book file that I'm going to send to my friend Jane, or put up for download, or add to the MR library, I start to feel like I'm chasing my tail until I know I have a book that'll be right in someone else's device.

kovidgoyal
03-20-2009, 04:57 AM
So this is (I hope) the definitive explanation for how metadata works:

1) When you make changes to metadata in calibre, it is stored in the database, but the book files are not updated.

2) When you use either the save to disk or the send to device functions the metadata *is* updated, but only in the copies (i.e. in the newly saved files). The files in calibre's library are still not affected.

3) Because different ebook formats support different amounts and kinds of metadata, the only complete set of metadata in te "saved to disk" files is in the OPF file. I cannot overemphasize just how dicey this process is. For example different generations of PRC files support different amounts of metadata. The same is true for LRF files. This craziness was what prompted me to make the decision to store metadata in a database in the first place. Even EPUB doesn't support the full set of metadata in the calibre database.

4) Instead of re-importing the saved books with the metadata into calibre, you should use the edit metadata dialog to just re-import the specific format.

5) When you do a conversion, it will use the latest metadata from the database, so your newly converted file should have as up to date metadata as possible. In many cases, this will result in a file that has superior metadata to one for the "Save to disk" process. This is because calibre generates the most modern version of each file format, with the greatest support for metadata. But it is important to understand that even a converted file will not have all the metadata available in the calibre database.

starrigger
03-20-2009, 01:36 PM
That is such a clear explanation even I finally understand it. :rolleyes:

That's worth putting in its own thread with a sticky.

bkilian
03-23-2009, 04:13 PM
Even EPUB doesn't support the full set of metadata in the calibre database.Huh. Since ePub's metadata is based on the OPF XML format, it's extensible, and therefore should be able to support all the metadata Calibre can throw at it. Sure, other apps wouldn't be able to read it unless they implement your extensions, but that's not really the point.

mros
03-28-2009, 04:08 AM
I tried to convert a txt file to mobi.
The converted file removed most paragraphs. It seems that it detects a paragraph only when a double CR is found.
I looked into the txt file with an editor and I found that each paragraph correcltly ends with "0D 0A" bytes (LF CR).
Sometimes there's a double sequence (LF CR LF CR). Only this one is detected.

Mobipocket Creator, the tool provided by Mobipocket, has a "suppress single carriage returns" option.
It's useful with some txt files, having a CR at the end of every line and a double CR at the end of every paragraph. (Maybe as a result of a hard page scanning).

It seems that Calibre always suppress single CR.
I tried to convert to other formats, but I always get the same results.
Is it possible to tell it not to suppress single CR ?

BTW, Thanks for your great job !

kovidgoyal
03-28-2009, 04:11 AM
calibre assumes all txt files are written using markdown syntax, if you have an ordinary txt file, you're better off using something else to convert it to html first.

mros
03-28-2009, 01:13 PM
Thank you for your reply.
I tried to convert txt to html
I just read the txt format, calibre calls the default viewer, notepad++ for me.
Notepad++ can save to html or rtf
Then I added the new format from the metadata window.

Anyway, it would be nice to avoid all this. The txt source is very common and it would be nice to be able to use it directly.

------------

I didn't find a way to specify the language of the e-book.
How can I set the metadata for it ?

It's useful when you have books in different languages and it's used by mobipocket dictionaries.

kovidgoyal
03-28-2009, 01:33 PM
txt is not an actual format, it has no structural information. Different txt files follow different conventions, which is why it is impossible to reliably automatically convert TXT

Forster
03-29-2009, 01:32 PM
I'm having the same problems with my txt files when I convert to mobi with caliber. If I don't convert to mobi and just leave it as text I can copy the file to my kindle and read it just fine, but......the title/author entry on my kindle is not the way I like it. If I convert the txt file to mobi the metadata is updated and looks good on my kindle home page but......I lose all my paragraphs making it virtually unreadable.

So, if I'm understanding correctly, to get the best of both worlds I can convert my txt to html using another program, import the new html file into caliber and then use caliber to convert the html to mobi? I will then hopefully have both my paragraphs formated correctly and have the metadata updated the way I want?

kovidgoyal
03-29-2009, 02:13 PM
yes .

nrapallo
03-29-2009, 10:16 PM
get the best of both worlds I can convert my txt to html using another program, import the new html file into caliber and then use caliber to convert the html to mobi?

In the past, I have used this utility, Text2Html (http://www.cybermatrix.com/text2html.html), to convert many .txt to .html with good results. Just experiment with different Preference settings until you like the results, then convert every .txt in a directory to .html. My Preferences were:
http://www.mobileread.com/forums/picture.php?albumid=131&pictureid=1223

Then use the Calibre GUI or any2mobi command line utility on the resulting .html(s).

Forster
03-29-2009, 10:38 PM
Thanks for the the info guys!

Converting the txt to html and then having caliber convert the html to mobi worked perfectly. Not only do I get my kindle title page with nice clean titles/authors, the text in the book is formated much better than when I was just reading the txt files.

jimad
03-31-2009, 02:23 PM
Are the parameters to the --encoding option on any2mobi documented anywhere? -- I haven't found it yet.

I am having a fair amount of problems with the autoguess encoding feature of any2mobi, which I would like to be able to override.

wallcraft
03-31-2009, 02:34 PM
Are the parameters to the --encoding option on any2mobi documented anywhere? -- I haven't found it yet. The documentation for any2lrf has a bit more information: --encoding

Specify the character encoding of the source file. If the output LRF file contains strange characters, try changing this option. A common encoding for files from windows computers is cp-1252. Another common choice is utf-8. The default is to try and guess the encoding.

BarnOwl
05-02-2009, 09:43 AM
I have a 9 mb PDF file with paragraph spacing in the original file. If I convert it to Mobi the paragraph spacing is gone.
This also happens if I convert the pdf (with Acrobat) to rtf/doc whatever and then convert it in Calibre. Somehow Calibre removes the spacing.

Surely I am missing something, a parser with settings in a conversion option menu would be great.

tlc
05-05-2009, 12:06 AM
calibre assumes all txt files are written using markdown syntax

Is there (or could you create) a list of specific syntax details like this somewhere? The Calibre FAQ says it supports TXT and HTML, when it supports subsets of these. I understand why, but it would be very useful to know the subsets.

For example, some time ago when a pdf-to-mobi conversion didn't do well, I looked into the pdf-to-html conversion and saw a bunch of absolute positioning
<div style="position:absolute;top:523;left:91">
and no paragraph elements. I would guess that the html-to-mobi (or html-to-*) needs paragraph elements to generate paragraphs.

Specifically, what html elements are useful to the html-to-* converters? Ideally, should the absolute positioning I saw be "fixed" in pdf-to-html or html-to-*?

Thanks,
tlc

kovidgoyal
05-05-2009, 12:13 AM
As a general rule, for best results you should generate semantic markup. Use <p> for paragraphs, <h1-6> for headings class="chapter" for chapters and so on.

Lee Crocker
05-08-2009, 07:57 AM
Is there a way to manually get an "mbp:pagebreak" tag into the result file from HTML? Putting the Mobipocket-specific code in the source doesn't work, as you specify (input is treated as standard)--but there's no standard equivalent in HTML. This is a real deal-breaker for me--I have to be able to specify my own pagebreaks. Perhaps you could interpret some "magical" CSS like a "pagebefore" class? Or maybe a flag to pass through Mobi tags unmolested?

pdurrant
05-08-2009, 08:48 AM
No need to invent a pseudo-CSS property for this, there's already a real one:

page-break-before: always

Is there a way to manually get an "mbp:pagebreak" tag into the result file from HTML? Putting the Mobipocket-specific code in the source doesn't work, as you specify (input is treated as standard)--but there's no standard equivalent in HTML. This is a real deal-breaker for me--I have to be able to specify my own pagebreaks. Perhaps you could interpret some "magical" CSS like a "pagebefore" class? Or maybe a flag to pass through Mobi tags unmolested?

Lee Crocker
05-08-2009, 09:34 AM
(About CSS page-break-before:always)

Yes, but that would require Calibre to parse and interpret all of the CSS associated with the input HTML, a much more difficult task than just using a tag class.

I can get the pagebreaks I need by using the --chapter-mark tag, and then using my own .ncx file for the TOC (which I have to do anyway). Now if I can figure out how to attach a second ncx file for a list of illustrations...

kovidgoyal
05-08-2009, 12:54 PM
(About CSS page-break-before:always)

Yes, but that would require Calibre to parse and interpret all of the CSS associated with the input HTML, a much more difficult task than just using a tag class.

I can get the pagebreaks I need by using the --chapter-mark tag, and then using my own .ncx file for the TOC (which I have to do anyway). Now if I can figure out how to attach a second ncx file for a list of illustrations...

calibre does parse all CSS. And using page-break-before:always will work. Int he 0.6 release of aclibre you will also be able to specify an XPath expression to insert page breaks.

Lee Crocker
05-08-2009, 08:00 PM
Cool. What about multiple NCXs?

kovidgoyal
05-08-2009, 08:09 PM
What's the point of multiple NCXs? Just create one NCX with multiple sections

kindleformatting
06-16-2009, 03:26 PM
Kovid, et al.,

With the release of the Kindle DX, the problems with Creator's default image re-sizing/scaling has become more apparent.

http://kindleformatting.com/blog/2009/06/kindle-dx-image-test.php

I would love to have the ability to create a Mobi file from my Mobipocket-specific source using a third-party app. Any2mobi converts to an ePub first and removes my Mobi-specific HTML, and also ignores the NCX file. That happens even if I run any2mobi on an OPF created in Creator.

Thoughts on a solution?

- Joshua

kovidgoyal
06-17-2009, 12:22 AM
calibre does not ignore NCX files, if they are pointed to in the OPF. As for mobi specific formatting, what formatting exactly do you have in mind that you can't acheive with normal HTML?

kindleformatting
06-17-2009, 05:27 AM
Kovid, thanks for the reply back. I was unable to make the NCX file catch when I was testing any2mobi. I tried running it on the opf I had made in Creator and on the HTML file. I am trying to get the location bar on the K2 to have waypoints the same way it does in a PRC made with Creator

As I outline in my Kindle Formatting book, there is a lot of HTML formatting that is not valid in Mobi/Kindle, and some specific Kindle formatting that is not necessarily valid HTML. An example of this problem is the lack of support for outlines made from list tags. Mobi does not support the list-style-type CSS or the related HTML attribute, so there is no way to make an outline like that. I use a selection of special markup to make outlines look good. So, I could make an ePub first, but, as with Mobigen, the formatting does not necessarily translate to Mobi perfectly. I really want the best of both worlds: Mobipocket Creator's ability to take my HTML and make a Mobi directly, and any3mobi's ability to gracefully handle large image files.

The best way for you to see the types of formatting peculiarities I am talking about is for you to read my book. I'd be happy to send you a copy if you like. Just tell me if you want it in print, PDF, ePub, or Mobi (print, PDF, and ePub are best).

I appreciate your assistance.

- Joshua

tompe
06-17-2009, 06:20 AM
As I outline in my Kindle Formatting book, there is a lot of HTML formatting that is not valid in Mobi/Kindle, and some specific Kindle formatting that is not necessarily valid HTML. An example of this problem is the lack of support for outlines made from list tags. Mobi does not support the list-style-type CSS or the related HTML attribute, so there is no way to make an outline like that. I use a selection of special markup to make outlines look good. So, I could make an ePub first, but, as with Mobigen, the formatting does not necessarily translate to Mobi perfectly. I really want the best of both worlds: Mobipocket Creator's ability to take my HTML and make a Mobi directly, and any3mobi's ability to gracefully handle large image files.


html2mobi or opf2mobi in MobiPerl will probably handle this. They do not change MobiPocket specific markup and they allow the images not to be rescaled or resized.

kovidgoyal
06-17-2009, 09:33 AM
calibre 0.5 does not have support for MOBI indexing (that's what is responsible for the waypoints and joystick based navigation on the Kindle). calibre 0.6 however does, thanks to some nifty reverse engineering by Gregory Riker.

As for support for special mobipocket markup, it should be possible to add support for it to calibre, however, it's not really a priority for me, since most calibre users will never use it. Still if someone wants to take it on, I am always happy to accept patches. :)

sirbruce
06-17-2009, 10:04 AM
calibre 0.5 does not have support for MOBI indexing (that's what is responsible for the waypoints and joystick based navigation on the Kindle). calibre 0.6 however does, thanks to some nifty reverse engineering by Gregory Riker.

But it's still not turned on in 0.6b6, right?

kovidgoyal
06-17-2009, 10:09 AM
But it's still not turned on in 0.6b6, right?

It is (it's what causing most of the bugs you reported :-) Try downloading news using b6 and you will see it in action

sirbruce
06-17-2009, 07:27 PM
It is (it's what causing most of the bugs you reported :-) Try downloading news using b6 and you will see it in action

Oh cool, I hadn't tested it yet. It works!

Sunlite
06-27-2009, 12:36 PM
I have tried to convert html to mobi with the any2mobi tool using a intermediated opf-file. On most parts the conversion works very well. But in one of my sources there is a text part that has a line through it. That is converted to normal text.

The original uses the <strike> tag, but I did tried <span style="text-decoration: line-through">, too. Both are lost when using any2mobi and both are retained by mobigen.

<p>strike through:<br />
<strike>This is a sentence with a strike through.</strike><br />
<span style="text-decoration: line-through">This is a sentence with a strike through.</span><br />
</p>

I extracted the raw html from the two mobi versions with mobi2html from the mobiperl tools. In the any2mobi version the text adornment is just gone. In the mobigen version both lines now use the <strike> tag.

html any2mobi:

<p align="justify" height="1em" width="0pt">strike through:<br />
This is a sentence with a strike through.<br />
This is a sentence with a strike through.<br />


html mobigen:

<p>strike through:<br />
<strike>This is a sentence with a strike through.</strike><br />
<span><strike>This is a sentence with a strike through.</strike></span><br />


Attached are my test html file (cleverly named test.html) and the two mobi versions.

Am I doing something wrong? Is there a way to conserve strike through text with any2mobi?

tompe
06-27-2009, 12:58 PM
calibre 0.5 does not have support for MOBI indexing (that's what is responsible for the waypoints and joystick based navigation on the Kindle). calibre 0.6 however does, thanks to some nifty reverse engineering by Gregory Riker.

Is this format information documented anywhere? In the Wiki?

kovidgoyal
06-27-2009, 09:26 PM
@Sunlite: Open a ticket for strike through support, IIRC, calibre's MOBI output doesn't implement it

@tompe: In the source code, but, GRiker who did the reverse engineering plans to release some documentation of it of soon

llasram
06-30-2009, 11:05 AM
As I outline in my Kindle Formatting book, there is a lot of HTML formatting that is not valid in Mobi/Kindle, and some specific Kindle formatting that is not necessarily valid HTML. An example of this problem is the lack of support for outlines made from list tags.

Can you point to an example of this Mobipocket/Kindle-optimized markup? I haven't been active in calibre lately, but my underlying principle when I initially wrote the Mobipocket generation code was to accept standards-compliant markup and CSS as input and produce Mobipocket-optimized markup as output. So for me the ideal solution would be to figure out what XHTML+CSS most closely represents the output you want, and figure out how to produce the Mobipocket-optimized markup from that input.

chorpler
07-04-2009, 11:43 AM
Is this something that will allow ebook-convert's Mobipocket output to create navigation entries? The ones you use by adding <reference> tags under the <guide> section of the .opf file? Most of my custom Mobipocket books include things like Table of Contents, Copyright Page, Dedication, Notes, etc. When I create the book with mobigen, these entries show up in the Contents menu (in the desktop Reader app) or in the Navigation menu (in the Windows Mobile app). But when I create them with ebook-convert, which is of course the only way to get larger images to store properly in the books, only the Table of Contents shows up. I've tried searching to see if I'm missing something, but I haven't been able to find out.

kindleformatting
07-05-2009, 06:23 PM
Can you point to an example of this Mobipocket/Kindle-optimized markup? I haven't been active in calibre lately, but my underlying principle when I initially wrote the Mobipocket generation code was to accept standards-compliant markup and CSS as input and produce Mobipocket-optimized markup as output. So for me the ideal solution would be to figure out what XHTML+CSS most closely represents the output you want, and figure out how to produce the Mobipocket-optimized markup from that input.

The outlines issue I mentioned is a pretty common problem. While you can make a nested list in HTML and give list-style-type properties to the lists, those outline-type lists do not translate into Mobipocket. I have had to create a hack to make nested lists work properly in Mobi, and they look especially good on the Kindle.

Another issue is that calibre does not support the <mbp:pagebreak/> tag. I know it is not valid HTML, but it is valid for Mobi files so it would be nice to see calibre use it.

calibre also requires that any attached NCX file be added to the end of the document, even when there is a TOC in the HTML, and that NCX-generated TOC takes the focus of the TOC guide element.

I have also noticed some differences in how calibre interprets and displays some basic formatting, like line heights and heading font sizes.

I have attached a sample book with these issues all shown. Source files are included, as well as a mobi file created by calibre and a prc created by Mobipocket Creator.

- Joshua

llasram
07-06-2009, 11:12 AM
The outlines issue I mentioned is a pretty common problem. While you can make a nested list in HTML and give list-style-type properties to the lists, those outline-type lists do not translate into Mobipocket. I have had to create a hack to make nested lists work properly in Mobi, and they look especially good on the Kindle.

I'll give the samples you attached a look this evening. It would certainly be possible to translate 'display: list-item' elements into something other than Mobipocket HTML <li/> elements if it yields better results across most Mobipocket renderers.

Another issue is that calibre does not support the <mbp:pagebreak/> tag. I know it is not valid HTML, but it is valid for Mobi files so it would be nice to see calibre use it.

I'm not too keen on adding support for Mobipocket-specific markup when there is an exactly comparable standards-compliant mechanism available. In this case, CSS 'page-break-before' and 'page-break-after' will let you do exactly the same thing. That said, the OPS specification provides a mechanism for allowing markup to contain XML from foreign namespaces that not all processing applications understand. Adding support for that to calibre could potentially allow it to understand Mobipocket-specific markup it could ignore when generating any other output types.

calibre also requires that any attached NCX file be added to the end of the document, even when there is a TOC in the HTML, and that NCX-generated TOC takes the focus of the TOC guide element.

If you generate the Mobipocket book from an OPF file instead of a directly from the HTML, and in the OPF specify a //guide/reference of @type="toc", then calibre won't generate an HTML TOC from the NCX file and will use the provided TOC guide reference in the Mobipocket output.

I have also noticed some differences in how calibre interprets and displays some basic formatting, like line heights and heading font sizes.

Line-height I'm a little confused on, as I don't recall a way to control line-height in Mobipocket markup. Does mobigen do special processing for blocks with e.g. a line-height greater than 2x the default line-height?

Headers will definitely be a little different though -- instead of passing through <hn> tags, calibre just groks the (possibly default) CSS and produces pure-formatting output as-similar-as-possible to the supplied styling.

-Marshall

llasram
07-06-2009, 11:15 AM
Is this something that will allow ebook-convert's Mobipocket output to create navigation entries? The ones you use by adding <reference> tags under the <guide> section of the .opf file?

Create an OPF file, add //guide/reference tags, and convert the OPF file instead of the source HTML directly? That is supposed to work, although I don't have the code open in front of me ATM.

chorpler
07-06-2009, 11:38 AM
Create an OPF file, add //guide/reference tags, and convert the OPF file instead of the source HTML directly? That is supposed to work, although I don't have the code open in front of me ATM.

That's what I'm talking about -- I do all my conversions that way, because you get much better control over the final output if you work from the OPF file manually. mobigen reads all the //guide/reference tags in the OPF file and creates the corresponding //head/guide/reference entries in the Mobipocket markup in the output file, such as converting the OPF file's entries:


<guide>
<reference type="title-page" title="Title Page" href="generic_file.xhtml" />
<reference type="toc" title="Table of Contents" href="generic_file.xhtml#toc" />
<reference type="copyright-page" title="Copyright Page" href="generic_file.xhtml#copyright" />
</guide>


into the following in the Mobipocket markup in the .mobi file:


<reference title="Title Page" type="title-page" filepos=0000000681 /><reference title="Table of Contents" type="toc" filepos=0000002434 /><reference title="Copyright Page" type="copyright-page" filepos=0000001140 />


But with ebook-convert, the //guide/reference tags seem to be ignored if they aren't of type toc, because the only //head/guide/reference entity is Table of Contents.

Edited: Hmm, I've actually been misinterpreting it. I just noticed that the //head/guide/reference entry that ebook-convert creates is to the automatically generated Table of Contents link at the end of the file, rather than to the existing Table of Contents link in the OPF file. So it's really completely ignoring the //guide/reference tags in the source OPF.

Edited again:: I just noticed that calibre 0.5.14's oeb2mobi command does, in fact, translate the //guide/reference tags properly. So the problem must be with ebook-convert not realizing it should read and use those tags instead of generating its own Table of Contents. Or maybe there's a way to disable Table of Contents generation that I haven't figured out? I tried using the --chapter=/ option to disable chapter detection, but that didn't work.

llasram
07-06-2009, 05:52 PM
That's what I'm talking about -- I do all my conversions that way, because you get much better control over the final output if you work from the OPF file manually.

As you noticed, that support has accidentally gone away ATM in 0.6 due to some internal changes. I'll see if I can make the changes necessary to get it working again.

chorpler
07-06-2009, 06:35 PM
As you noticed, that support has accidentally gone away ATM in 0.6 due to some internal changes. I'll see if I can make the changes necessary to get it working again.

Awesome. I was trying to look at it myself but I'm having major trouble getting a Calibre development environment set up -- the VMWare machine won't load for me and I can't install some of the necessary tools because Visual Studio 2008 won't install because some weird Windows error is making it impossible to install the .NET 3.5 framework. I'm going to just set up a virtual machine and run it from there.

But thanks, you'll probably do a much better job of it than I could, since as I understand it you wrote the Mobipocket output in the first place, right? :)

chorpler
07-06-2009, 11:52 PM
Does calibre always add an <mbp:pagebreak/> tag after an horizontal line tag? Both oeb2mobi and ebook-convert seem to add the <mbp:pagebreak/> tag after every <hr> or <hr /> tag in the source file, even when the CSS says:

hr { page-break-after: avoid; }

Is there a way to control this behavior?

GeoffC
07-07-2009, 10:44 AM
sorry if this has been covered elsewhere, but i'm still trying to get to grips with book generation.

book file written manually in xhtml editor (SciTE).
result tested to almost perfection in Mozilla, one bug in ie....But ...
on conversion through Calibre to Mobi output ....

a) I've generated my own TOC (with links) on page 1 - is it possible to disable the auto-generated TOC [ I guess not from what I've read ].
b) horizontal lines separating sections have been grouped at the foot of the book on conversion!
c) copyright symbol converts to S (or similar).


edit : comparing output using Mobi Creator ...
horizontal lines ignored totally.
ignores <pre></pre> tags that calibre accepts.

any thoughts on solutions/where I am in error ?

kovidgoyal
07-07-2009, 12:14 PM
a) It will be possible to suppress the auto generated TOC in the next beta
b) llasram will have to help you with that
c) How are you specifying the symbol in the source HTML?

GeoffC
07-07-2009, 04:06 PM
a) It will be possible to suppress the auto generated TOC in the next beta
b) llasram will have to help you with that
c) How are you specifying the symbol in the source HTML?


sorry for the delay in replying -
c) the copyright symbol is one that originated from Coffeecup editor ...
(I transferred to Scite because the coffeecup ouput was complicated and it kept 'putting' its own version over mine ....)

kovidgoyal
07-07-2009, 04:08 PM
can you locate the symbol in the source html file generated by coffeecup and paste it here (or just post an extract from the file containing the section that has the symbol as a attachment)

chorpler
07-07-2009, 06:00 PM
sorry for the delay in replying -
c) the copyright symbol is one that originated from Coffeecup editor ...
(I transferred to Scite because the coffeecup ouput was complicated and it kept 'putting' its own version over mine ....)

Try using &copy; instead of the original copyright symbol, in the HTML file. That will generate the proper symbol in Mobipocket.

chorpler
07-07-2009, 07:04 PM
Hmm, neither 0.5.14's oeb2mobi nor 0.6.0b10's ebook-convert seem to properly scale images from source HTML files, with either the deprecated "width" attribute or using CSS, as in:

<img style='width: 200px' ...>

mobigen will respect the "width" attribute, but not the CSS; it seems to just stick the "width" attribute and value in the Mobipocket markup directly. But calibre seems to actually take the width of the image, translate it into "em" units, and put that value in for the "width" attribute in the corresponding <img> tag in the Mobipocket markup.

kovidgoyal
07-07-2009, 07:10 PM
ebook-convert won't scale the images. But it should translate the width or css width to a Mobipocket width attribute. I know it does this for EPUB, perhaps llasram can tell us why it doesn't do this for MOBI?

chorpler
07-07-2009, 07:13 PM
Er, yeah, I didn't mean scale as in physically resize, I just meant translate the width settting. I definitely don't want it to rescale the actual image before storing it in the file; that's the main problem with mobigen, that it forces you to rescale big images.

GeoffC
07-08-2009, 03:44 AM
Try using &copy; instead of the original copyright symbol, in the HTML file. That will generate the proper symbol in Mobipocket.

interesting - I used &copy in the original write in coffeecup and the auto system changed it to the symbol © ; but I'll put that back into the code and see if calibre handles it...

GeoffC
07-08-2009, 06:57 AM
mmm : &copy is recognised by mobicreator as copyright symbol.
Calibre treats as text....

GeoffC
07-08-2009, 09:12 AM
It looks as though calibre thinks my toc is a 'front page', if I add a front page during the build process my toc is ignored.

if it would help Kovid, I attach the file I am using .... (changed to a .txt in order to upload).

kovidgoyal
07-08-2009, 11:03 AM
The correct form for the entity is &copy; (note the trailing semi-colon)

GeoffC
07-08-2009, 11:04 AM
The correct form for the entity is &copy; (note the trailing semi-colon)


ah !

ie and firefox be damned .... !!!


thanks Kovid


edit : Yep - Calibre recognises it .... Thanks .....
looks like I'll have to re-code for the other issues ...

itimpi
07-08-2009, 11:50 PM
The XHTML/HTML standards specify the trailing semi-colon for all character entities even if certain browsers handle it being missing.

GeoffC
07-10-2009, 05:59 AM
The XHTML/HTML standards specify the trailing semi-colon for all character entities even if certain browsers handle it being missing.


thanks , as mentioned earlier I used &copy (i'm sure with the ; ) in coding on coffeecup - but it automatically changed it to the symbol which was then carried over into the new editor ....

kovidgoyal
07-10-2009, 03:27 PM
@GeoffC regarding your problem of the ruled lines being moved to the top, there was a recent bug fix in the calibre MOBI output that may have fixed this. Try using the latest calibre 0.6 beta (but be warned that it's a beta)

Amalthia
07-10-2009, 06:58 PM
last night I was creating a mobi file and some of the images would show up but not others. I found that for the images that did appear there was no space in the image name, after I renamed the missing images to a name that didn't have spaces they worked in mobi. What I'm wondering is why did that happen?

LRF and epub taking the exact same HTML zip file was able to display all the images. Is this a weakness in the mobi format or a bug in Calibre?

kovidgoyal
07-11-2009, 12:06 AM
A bug in calibre. Open a ticket and attach the source files

Ralob
07-19-2009, 01:16 PM
The mobi conversion for the CyBook is brilliant. Fabulous job. However, while the mobipocket reader and the integrated Calibre viewer both read the mobi output files well, FBreader cannot seem to open them. In fact, it locks up and crashes whenever I try to open it with it. Not a big deal as I am getting my CSS stylesheet in calibre close to FBreader, but is it curious nonetheless. Any ideas?

kovidgoyal
07-19-2009, 01:29 PM
I don't use FBReader, so I can't really help you with that. You should try opening a bug report for on the FBReader bug tracker.

Ralob
07-19-2009, 01:31 PM
Will do. I was just unsure if I was the only one who had this ptoblem or not.

wallcraft
07-19-2009, 02:09 PM
However, while the mobipocket reader and the integrated Calibre viewer both read the mobi output files well, FBreader cannot seem to open them. In fact, it locks up and crashes whenever I try to open it with it. FBReader crashes on uncompressed Calibre MOBI output. Use any2mobi --compress or the 0.6.0 beta (which defaults to compressed).

Ralob
07-19-2009, 04:47 PM
FBReader crashes on uncompressed Calibre MOBI output. Use any2mobi --compress or the 0.6.0 beta (which defaults to compressed).

Brilliant! Thanks for the tip. It worked well. :)

kindleformatting
07-20-2009, 11:31 PM
I'm not sure if this is a bug report or something I am doing wrong. I have installed a couple of revisions of the 0.6 beta, and non of them let me use any2mobi. Is it broken in some way?

kovidgoyal
07-21-2009, 12:22 AM
any2mobi is replaced by ebook-convert in 0.6

dhiru
08-01-2009, 12:22 AM
dear kovid first thanks for such an excellent software it has changed the way i read news. normally i use iphone & irex iliad for reading especially the economis and business week. on iphone i am using kindle application to read mobi format. however since i upgraded to 6.0 version and later i am not getting section menu and main menu in feeds of the economist and Business week which causes little difficulty in reading on small device like iphone and therefore i have gone back to 5.14 version. any way to get them in 6.4 version.

thanks

kovidgoyal
08-01-2009, 02:44 AM
if you're downloading news in MOBI format and have set your output device to Kindle, the the MOBI files will no longer have an inline TOC as it uses the navigation UI of the Kindle for this. Change your output profile to cybook or illiad

dhiru
08-01-2009, 05:38 AM
tried cybook and iliad profile. section menu is appearing but main menu is still missing.

thanks

ectoplasm
08-22-2009, 11:06 AM
First, thanks to the author for this program.

I'm not sure if this is a bug or my misunderstanding. Trying to convert from epub (from Gutenberg) to mobi for use on my Kindle DX. I wanted to customize the paragraph indent. I found the "Remove spacing between paragraphs" option created too big an indent, so I turned it off and used CSS.

I'm using this CSS:
p {
text-indent:1.5em;
margin: 0;
}

The problem is, no matter what I enter for the text-indent value, the mobi output is always EM, and in whole numbers.

So if I use:
text-indent:1.3em mobi output is width="1em"
text-indent:1.5em mobi output is width="2em"
text-indent:3ex mobi output is width="2em"

If the mobi output would support fractions, such as 1.3em, then the problem is solved. My guess is it should also support whatever CSS and the device supports, so ex, cm, etc. should be allowed.
http://www.fonttester.com/help/css_length_units.html

My workaround is to do a search/replace on the mobi with a hex editor and replace 2em with 4ex, as the ex provides finer control. I can't replace with a fraction like 1.5 because the added characters corrupt the file.

kovidgoyal
08-22-2009, 12:12 PM
The MOBI output plugin converts all units to em for consistency. It tries to convert lengths keeping several constraints in mind, only one of which is the original length :) I don't recall if it supports fractions or not (I didn't write this plugin).

Jellby
08-22-2009, 06:05 PM
From the Mobipocket (http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=justification.htm) page:

The indentation of the first line of a paragraph can be forced by adding the width of a paragraph :
<p width="X"> (pixels), <p width="X%">,<p width="Xem"> or <p width="Xpt">
or
text-indent: X (%, em, pt, or nothing for pixels) with a style sheet.
X is an INTEGER and can be positive or negative for positive or negative indentation.

(and it's mostly the same for other lengths)

ectoplasm
08-22-2009, 06:27 PM
...text-indent: X (%, em, pt, or nothing for pixels) with a style sheet.
X is an INTEGER and can be positive or negative for positive or negative indentation.


PT or pixels would work, as they are much finer than EM, but as kovidgoyal said, they're all converted to EM integers, so unfortunately, there's no point in using anything other than EM integers.

Both the Calibre reader and my DX both support EX, even if it's not documented on the Mobipocket page. Of course you have to find a way to inject that into the mobi after it's created, to replace the EM.

dhiru
09-05-2009, 12:22 AM
if you're downloading news in MOBI format and have set your output device to Kindle, the the MOBI files will no longer have an inline TOC as it uses the navigation UI of the Kindle for this. Change your output profile to cybook or illiad

hi kovid i tried to change output profile but no success. then downloaded in epub format. epub downloaded with all section and main menus and when i converted to mobi format all menus were gone. kindly provide profile for devices other than kindle.
thanks

cinder23
10-16-2009, 07:55 AM
everything is perfect in calibre, setting chapters, editing metadata, covers
but after converting about 90 books to mobi i realised that atleast 70-80 had symbols, characters..mostly converted from lit

i'm converting them for kindle dx... is there any fix?

what do i put in the Input character encoding while converting? a newbie

please help

ziplizard
10-28-2009, 09:18 PM
I don't know if this is the right place to say this, but when I converted from html to mobi, the <strike> tag was stripped out instead of keeping the text striked out.

kovidgoyal
10-28-2009, 09:19 PM
IIRC MOBI doesn't support strikethough text

Jellby
10-29-2009, 09:26 AM
IIRC MOBI doesn't support strikethough text

It does support <s> and <strike>: http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=TagRef_OEB.htm

kovidgoyal
10-29-2009, 11:55 AM
OK opena ticket for it and I'll add it the enxt time I work on MOBI output.

ziplizard
10-31-2009, 12:12 AM
Okay. Thank you!