![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
|
Maintaining layout in mobi books after de-drming them.
I just got a Kindle recently and purchased an ebook with no cover, which irritates me like hell. After jailbreaking it, I added in a cover through Calibre, while simultaneously (and necessarily) converting it from AZW to mobi format. However, I find I lose a lot of the formatting. Any idea if there's a particular way I should set Calibre up to avoid this? I've had a look at the calibre help guide but, to be honest, I'm a bit confused, so I'm hoping someone here might be able to tell me if there's any simple and easy way to stop the formatting/font size/indents/spacing etc from changing from the original Kindle file.
|
![]() |
![]() |
![]() |
#2 |
Wizzard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
|
Personally, I think you'd be better off using Mobiunpack to extract the HTML (it preserves the original formatting along with any opf and ncx info for chapter marks and start points and such), editing the opf to add in your cover image, and generating a new Mobi via KindleGen or similar. It takes only a couple of minutes and I find it's much simpler that way.
Mind you, there might be an easier way to do it via Calibre, though perhaps you'd get a better response asking in that forum. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
|
AT - I gave that a try, and it works fine, except there is no .opf file generated, and Kindlegen doesn't seem to show an option for either generating one (I think) or other way to include an image file. Does that mean Calibre is my only option?
|
![]() |
![]() |
![]() |
#5 |
Wizzard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
|
Huh. Normally Mobiunpack creates one with the same filename as the extracted html + .opf extension if the info is available, but maybe the book you're trying it on just has poor metadata.
ETA 2: I think your problem may be linked to the version of the script you could be using. Don't use the original version posted in the OP, but scroll down to pdurrant's modified version in post #5. That's the one that outputs the .opf and any pre-existing images, which you can then swap out. In any case, you can just copy/paste this to give yourself a rudimentary OPF to point KindleGen at: Code:
<?xml version="1.0" encoding="utf-8"?> <package unique-identifier="uid"> <metadata> <dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/"> <dc:Title>BOOK TITLE HERE</dc:Title> <dc:Language>en</dc:Language> <dc:Identifier id="uid">JUST MAKE UP A NUMBER</dc:Identifier> <dc:Creator>AUTHOR LASTNAME, FIRSTAME; COAUTHOR LAST, FIRST</dc:Creator> </dc-metadata> <x-metadata> <output encoding="utf-8"> </output> <EmbeddedCover>RELATIVE FILE LOCATION OF YOUR IMAGE/IMAGE.JPEG</EmbeddedCover> </x-metadata> </metadata> <manifest> <item id="item1" media-type="text/x-oeb1-document" href="LOCATIONOFYOUR.HTML"></item> </manifest> <spine> <itemref idref="item1"/> </spine> <tours> </tours> <guide> <reference title="Table of Contents" type="toc" href="LOCATIONOFYOUR.HTML#filepos740" /> <reference title="Start Here" type="start" href="LOCATIONOFYOUR.HTML#filepos2751" /> </guide> </package> For the #filepos bits, you'll have to dig into your extracted HTML and find the corresponding numbers for the parts just in front of the Table of Contents (if it exists) and where you want the book to start (dedication, prologue, etc.). If there aren't any such places, just edit out those <reference> items entirely. Then do kindlegen -c2 NAMEOF.OPF -o NAMEOFDESIRED.MOBI. You may want to add a -verbose and a -unicode for both troubleshooting and extra character support. -c2 gives you the tightest compression, though to cut down on bloat you may also want to run the KindleStrip script on it afterwards. Hope this helps. ETA: There's always the option of using MobiPerl, which apparently has a handy GUI version for Windows users, too. It can do a lot of things faster and easier and less intrusively to the output file than Calibre. I often use it to fix metadata on existing files I don't want to otherwise tweak. ETA 3: And it just occurred to me that you could probably use it to add/change the cover image and nothing else without having to go through all this dissasembly/reassembly stuff. ![]() Last edited by ATDrake; 12-13-2010 at 09:48 AM. Reason: Add MobiPerl links. Realized what the problem might be. D'oh! |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,713
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Quote:
You can get the latest version of MobiUnpack from: http://code.google.com/p/ebook-conve...downloads/list Just gab the zip archive and unzip it. You will find the gui version of the MobiUnpack.pyw tool. It will create an .opf file when unpacking a non-drm mobi file. |
|
![]() |
![]() |
![]() |
#7 |
Wizzard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
|
Awesomeness. And the PML tool even has an option for putting in chapter breaks.
Bookmarked, thank you! |
![]() |
![]() |
![]() |
#8 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 321
Karma: 432192
Join Date: Dec 2007
Location: Glasgow, Scotland
Device: Amazon Kindle Paperwhite
|
Hey AT - I'll have to admit I did rather struggle to make all this work. Your advice is excellent, unfortunately, although I have some familiarity with things like HTML, I'm a no-brainer when it comes to stuff on this level. I did follow your suggestions as closely as I could, but unfortunately they didn't pan out for me. Thank you, though, for taking the time to help me out.
What did work, however, was converting the cover-less books to Epub format in Calibre, having first included a cover image in the Metadata via Calibre's menu system. Instead of then converting the Epub back to Mobi in Calibre - which always produces terrible formatting issues - I instead navigated to the newly generated Epub file, and ran it through Kindlegen. This produced a perfectly formatted Mobi book, complete with cover. I'm guessing Kindlegen somehow strips out all the problematic formatting caused by Calibre. It works, anyway, and might be a little easier for people like myself who get a bit list in command-line land. Just to sum up for anyone else reading it with the same question in mind - add mobi book to Calibre, use Calibre to add a cover image, then use Calibre to convert the mobi to Epub, move that Epub file to Kindlegen, then run Kindlegen, generating new copy of Kindle book with added cover and otherwise identical to original. Last edited by garygibsonsf; 12-16-2010 at 11:16 AM. |
![]() |
![]() |
![]() |
#9 |
Wizzard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
|
Hey, glad you were able to find a solution that worked for you. Mobi format can be annoyingly tricky to work with.
Incidentally, a drag-and-drop way of generating Mobi from ePub is to use Amazon's Kindle Previewer app, which now incorporates KindleGen inside itself and auto-converts any ePubs you try to open with it. Might be easier for some than following even the relatively simple command-line instructions for KindleGen. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importing and maintaining title, author | AndrewKantor | Calibre | 19 | 08-25-2014 04:34 AM |
Maintaining scene breaks | wellington | Calibre | 6 | 07-18-2010 08:43 PM |
Does de-DRMing delete text to speech restrictions? | Sydney's Mom | Amazon Kindle | 4 | 03-06-2010 11:46 PM |
Maintaining original font sizes | garygibsonsf | Calibre | 3 | 05-07-2009 04:38 AM |
Remove books not deleting layout files | davef | Calibre | 1 | 03-05-2009 12:11 PM |