Kindle Formats, Calibre, Conversions and “The Last Ring-bearer”

I came across a book called “The Last Ring-bearer” (by Kirill Yeskov) recently, and decided it would make a nice addition to my Kindle collection. It’s not sold by Amazon so there’s no Kindle specific format – in fact it isn’t sold by anyone – at least not in Britain – so I needed to convert.

“The Last Ring-bearer” is a story based in the World of “Lord of the Rings”. It is written from the point of view of the Orcs as they battle against the forces of Gandalf as he attempts to banish the arts of Science and Technology; it takes place during the last battle for the Ring and continues into the aftermath. It’s been publishes in many different languages across Europe but has so far avoided Britain due to – probably justified – fears of litigation from the Tolkein estate.

However, it has recently been translated into English (by Yisroel Markov) from it’s original Russian and is available in PDF form. Unfortunately PDF’s are an extremely poor choice for an ebook conversion (and for any conversion actually, they are only meant for printing!).

I tried several methods to convert the PDF’s. First I used Amazons conversion by email: you simply send the PDF as an email attachment and it returns a converted file back, alos via email. This works in that it converts all the text, but it doesn’t appear formatted correctly: text can be in the wrong place, footnotes, headers, page numbers, contents etc. all appear mixed up in the main text. I also tried the PDF conversion in Calibre – an ebook management system I’ve been using for some time – but the same problems occurred. PDF’s are just not compatible with ebook formats.

After some time looking around, I did manage to track down a webpage version of the book which I also tried to convert in Calibre. Unfortunately, the conversion relies on the HTML (the underlying code) being in a good state which wasn’t true in this case and there where again some pretty awful formatting, plus none of the extras I mentioned earlier. However, it is easy to take the text from a webpage so I decided I’d put the formatting in myself.

I use OpenOffice to write my documents so I pasted the text in to a new one. It was a fairly simple procedure to detect the chapters (they all have the word “Chapter” or “Part” in!) and add a heading style to them. Then I pasted the book cover image to the first page. Now, Amazon also have a Microsoft Word Conversion by email, so I gave that a go. It was only slightly better than the PDF conversion. How disappointing. So I turned again to Calibre.

Calibre is able to take in the Original OpenOffice format and turn it into a mobi ebook format. This worked very nicely. With a few test runs I managed to get a nice front cover, the footnotes linking, a full table of contents with links and nicely formatted text (in most cases!). Here’s what I did:

  1. In OpenOffice:
    • Paste an image on the first page, this will be the Book cover (alternatively you can just add some text but an image would be nicer…!)
    • For pages with a small amount of text make sure it’s at (or very near) the top of the page then a page break immediatly after. This avoids lots of white space appearing after converting.
    • Find the Chapter headings and place a heading style on them, preferably in the same hierachy as they appear in the book, Calibre will then recognise them and create a table of contents.
    • Find the footnotes and turn them into proper footnotes by using “Insert->Footnote, EndNote” from the menu.
    • If you have the time, you could also add text-alignment, bold or italic to parts of the text that need it, this will all be preserved in the conversion.
    • You can also add a Table of Contents to the text of the book if you like, just select “Insert->Index Indexs and Tables->Indexs and Tables…”. I’d recommend using just the “entry text” wrapped in Hyperlinks for each level in the “Entries” tab, page numbers won’t mean anything once the conversion completes. (Note also that Calibre will create it’s own Table of contents embedded in the mobi format itself)
    • UPDATED: See below (Change background colors, and font colours)
  2. In Calibre:
    • Now import your OpenOffice document with “Add book”, once done select “Convert book”
    • Update the Title and author fields and any others you might like.
    • Select the “Use cover from source file” if you added some kind of front page to the original document.
    • You shouldn’t need to change anything else so just click OK.

Now just copy it to your Kindle and enjoy.

Update (Feb  20)

The previous mobi version had a white background colour on the text which was causing some issues when the page color was changed from the default (such as in the “Color Mode” of the Kindle App). This seems to be an issue between OpenOffice and Calibre to do with default background-color, I’ve made a bug entry on Calibre here. (And they’ve already fixed it for the next release – nice work!).

For now, when creating a document switch between a colour background then back to “No fill”, this seems to fix it in most cases although there are still some problems. I’ve created a new file with the background changes, see below. I also changed some of the “linking” text to text color black from the default blue.

For reference :

And don’t forget that you can have the original “Lord of the Rings” on your Kindle too, in just a few mouse clicks!

(Voted number one in a BBC poll of the top books of all time.)

51 Replies to “Kindle Formats, Calibre, Conversions and “The Last Ring-bearer””

  1. Loss of diacritics is sad, but I’m surprised you did ODT and mobi, but not EPUB! Either way, fantastic that you’re supporting access to this wild translation. Looking forward to finding a suitable version for mobile reading! Thanks again.

    1. One of the Kindle’s little annoyances is that it doesn’t recognise epub formats. (For some reason Amazon don’t want you to have access to these popular formats…)

      But look no further, another commenter has produced a epub version too. See Blau’s comment.

  2. Next time you may want to check Briss– http://sourceforge.net/projects/briss/. Cross platform PDF cropping utility. It does a good job of removing the hard line feeds and irrelevant headers and footers. The result is still a PDF, but the cropped version can be converted easily by Calibre with text that will re-flow to fit different sized screens. I haven’t paid attention to what it does to footnotes, so that could still be a dealbreaker in some circumstances.

      1. The following changes restore most of the missing diacritics in the ePub version.


        perl -pi -w -e 's/Barad- Dur/Barad-Dûr/g;' *.xhtml
        perl -pi -w -e 's/Barad-Dur/Barad-Dûr/g;' *.xhtml
        perl -pi -w -e 's/...'The World is Text,/...\‘The World is Text,/g;' *.xhtml
        perl -pi -w -e 's/'/\’/g;' *.xhtml
        perl -pi -w -e 's/\`/\‘/g;' *.xhtml
        perl -pi -w -e 's/ "/ “/g;' *.xhtml
        perl -pi -w -e 's/\("/\(“/g;' *.xhtml
        perl -pi -w -e 's/" /” /g;' *.xhtml
        perl -pi -w -e 's/"\n/”\n/g;' *.xhtml
        perl -pi -w -e 's/",/”,/g;' *.xhtml
        perl -pi -w -e 's/";/”;/g;' *.xhtml
        perl -pi -w -e 's/"\)/”\)/g;' *.xhtml
        perl -pi -w -e 's/N menor/Númenor/g;' *.xhtml
        perl -pi -w -e 's/N rnen/Núrnen/g;' *.xhtml
        perl -pi -w -e 's/Amon Sul/Amon Sûl/g;' *.xhtml
        perl -pi -w -e 's/Amon S l/Amon Sûl/g;' *.xhtml
        perl -pi -w -e 's/E:o/Éo/g;' *.xhtml
        perl -pi -w -e 's/Grima/Gríma/g;' *.xhtml
        perl -pi -w -e 's/alant r/alantír/g;' *.xhtml
        perl -pi -w -e 's/D nada/Dúnada/g;' *.xhtml
        perl -pi -w -e 's/D nedain/Dúnedain/g;' *.xhtml
        perl -pi -w -e 's/L rien/Lórien/g;' *.xhtml
        perl -pi -w -e 's/powers-that- be/powers-that-be/g;' *.xhtml
        perl -pi -w -e 's/An rien/Anórien/g;' *.xhtml
        perl -pi -w -e 's/azg l/azgûl/g;' *.xhtml
        perl -pi -w -e 's/Touch No!/Touché!/g;' *.xhtml
        perl -pi -w -e 's/lady- in-waiting/lady-in-waiting/g;' *.xhtml
        perl -pi -w -e 's/fianc No/fiancé/g;' *.xhtml
        perl -pi -w -e 's/prot Nog No/protégé/g;' *.xhtml
        perl -pi -w -e 's/step- three/step-three/g;' *.xhtml
        perl -pi -w -e 's/F Noanor/Fëanor/g;' *.xhtml
        perl -pi -w -e 's/Nomigr No/émigré/g;' *.xhtml
        perl -pi -w -e 's/m makil/mûmakil/g;' *.xhtml
        perl -pi -w -e 's/m mak /mûmak /g;' *.xhtml
        perl -pi -w -e 's/caf No/café/g;' *.xhtml
        perl -pi -w -e 's/d Noclass No/déclassé/g;' *.xhtml
        perl -pi -w -e 's/Khand- related/Khand-related/g;' *.xhtml
        perl -pi -w -e 's/Ephel D ath/Ephel Dúath/g;' *.xhtml
        perl -pi -w -e 's/E rendur/Eärendur/g;' *.xhtml
        perl -pi -w -e 's/L thien/Lúthien/g;' *.xhtml
        perl -pi -w -e 's/sans r proche/sans reproche/g;' *.xhtml
        perl -pi -w -e 's/Tzagan- Tzab/Tzagan-Tzab/g;' *.xhtml
        perl -pi -w -e 's/no- go/no-go/g;' *.xhtml
        perl -pi -w -e 's/twenty- seventh/twenty-seventh/g;' *.xhtml
        perl -pi -w -e 's/G- mandate/G-mandate/g;' *.xhtml
        perl -pi -w -e 's/to cal then Mountains/to call them Mountains/g;' *.xhtml
        perl -pi -w -e 's/And ril/Andúril/g;' *.xhtml
        perl -pi -w -e 's/werewolves-nin/werewolves -- nin/g;' *.xhtml
        perl -pi -w -e 's/counter- spy/counter-spy/g;' *.xhtml
        perl -pi -w -e 's/Sharya- Rana/Sharya-Rana/g;' *.xhtml

          1. I tried this epub version on my phone and all I got was a white screen when I tried to view the text. I used Aldiko 2.0 on an HTC Legend running Android 2.1

  3. The .mobi/Kindle version seems to have a permanent white background on all of the text disallowing use of the alternate color schemes (I use white on black because of light sensitivity).
    Would there be a way to undo this so it works with the color schemes?

      1. I’m using the official Kindle App on my Mac, but I’m seeing the same result on the official Kindle app on my iPhone.
        However the text on the iPhone app is not actually changed to white but a gray, so you can still make out the letters, but it’s still highlighted with white.
        The color theme options are a function of the kindle app (white, black & Sepia) on both the Mac and iPhone not. The white highlight is also seen in the Sepia theme.

        1. There’s some issues between OpenOffice and Calibre.

          It looks like Calibre is looking for a background colour for the text in the Document but if there isn’t anything set it chooses a white background.

          Interestingly when a file is created in OpenOffice it doesn’t set anything as the background colour – not even “No Colour” .

          You can fix this by manually selecting the text and choosing “No Fill”. I’ll try to get a new file up later today.

  4. Has anyone else had problems with the Kindle for Android (v2.0.4.103870164) failing to open the .MOBI format file that’s linked above? All I get is white bars where text should be. Calibre opens the .MOBI file just fine, and I’m trying to use Calibre to re-convert the document.

    1. Kate, see my comments above. It sounds like you’re using a white text on black background theme yes? Try it with the white background and black text and you should be able to read it.
      It does seem to be the .mobi file itself as I’m seeing it on both my Mac and iPhone (and you on your Android).
      I was going to try the same thing with Calibre as well. I’d be curious about your results.

  5. Came here looking for stuff on TwentyTen header rotation and stumbled across this, lovely stuff. I had the PDF version & wanted to read it on my Kindle – thanks for saving a lot of hassle on the conversion.

  6. Thanks. I was struggling to reformat The Last Ring-bearer” for my Kindle (the pdf type size was uncomfortably small) and luckily stumbled onto this website, which readily solved the problem. TBP

    1. The problem seems to be that the Perl expressions ‘educate’ (make curly) the single and double quotes inside the XML tags. Here’s some Perl that does the ‘right’ thing:

      perl -pi -w -e 's/Barad- Dur/Barad-Dûr/g;' *.html
      perl -pi -w -e 's/Barad-Dur/Barad-Dûr/g;' *.html
      perl -pi -w -e "s/\.\.\.'The World is Text,/...\‘The World is Text,/g;" *.html
      perl -pi -w -e 's/"\.\.\./“.../g;' *.html
      perl -pi -w -e "s/'/\’/g;" *.html
      perl -pi -w -e 's/\`/\‘/g;' *.html
      perl -pi -w -e 's/"(\W)/”$1/g;' *.html
      perl -pi -w -e 's/"/“/g;' *.html
      perl -pi -w -e 'while (s/(<[^>]*?)“/$1"/g) {}' *.html
      perl -pi -w -e 'while (s/(<[^>]*?)”/$1"/g) {}' *.html
      perl -pi -w -e 'while (s/(<[^>]*?)’/$1"/g) {}' *.html
      perl -pi -w -e 's/N menor/Númenor/g;' *.html
      perl -pi -w -e 's/N rnen/Núrnen/g;' *.html
      perl -pi -w -e 's/Amon Sul/Amon Sûl/g;' *.html
      perl -pi -w -e 's/Amon S l/Amon Sûl/g;' *.html
      perl -pi -w -e 's/E:o/Éo/g;' *.html
      perl -pi -w -e 's/Grima/Gríma/g;' *.html
      perl -pi -w -e 's/alant r/alantír/g;' *.html
      perl -pi -w -e 's/D nada/Dúnada/g;' *.html
      perl -pi -w -e 's/D nedain/Dúnedain/g;' *.html
      perl -pi -w -e 's/L rien/Lórien/g;' *.html
      perl -pi -w -e 's/powers-that- be/powers-that-be/g;' *.html
      perl -pi -w -e 's/An rien/Anórien/g;' *.html
      perl -pi -w -e 's/azg l/azgûl/g;' *.html
      perl -pi -w -e 's/Touch No!/Touché!/g;' *.html
      perl -pi -w -e 's/lady- in-waiting/lady-in-waiting/g;' *.html
      perl -pi -w -e 's/fianc No/fiancé/g;' *.html
      perl -pi -w -e 's/prot Nog No/protégé/g;' *.html
      perl -pi -w -e 's/step- three/step-three/g;' *.html
      perl -pi -w -e 's/F Noanor/Fëanor/g;' *.html
      perl -pi -w -e 's/Nomigr No/émigré/g;' *.html
      perl -pi -w -e 's/m makil/mûmakil/g;' *.html
      perl -pi -w -e 's/m mak /mûmak /g;' *.html
      perl -pi -w -e 's/caf No/café/g;' *.html
      perl -pi -w -e 's/d Noclass No/déclassé/g;' *.html
      perl -pi -w -e 's/Khand- related/Khand-related/g;' *.html
      perl -pi -w -e 's/Ephel D ath/Ephel Dúath/g;' *.html
      perl -pi -w -e 's/E rendur/Eärendur/g;' *.html
      perl -pi -w -e 's/L thien/Lúthien/g;' *.html
      perl -pi -w -e 's/sans r proche/sans reproche/g;' *.html
      perl -pi -w -e 's/Tzagan- Tzab/Tzagan-Tzab/g;' *.html
      perl -pi -w -e 's/no- go/no-go/g;' *.html
      perl -pi -w -e 's/twenty- seventh/twenty-seventh/g;' *.html
      perl -pi -w -e 's/G- mandate/G-mandate/g;' *.html
      perl -pi -w -e 's/to cal then Mountains/to call them Mountains/g;' *.html
      perl -pi -w -e 's/And ril/Andúril/g;' *.html
      perl -pi -w -e 's/werewolves-nin/werewolves -- nin/g;' *.html
      perl -pi -w -e 's/counter- spy/counter-spy/g;' *.html
      perl -pi -w -e 's/Sharya- Rana/Sharya-Rana/g;' *.html

      The resulting epub works in iBooks as far as I can tell. When I finish reading the book, I’ll try to remember to fix any further errors and repost.

      1. And, of course, lines 9-11 got mangled because they contain < and > characters.

        perl -pi -w -e 'while (s/(<[^>]*?)“/$1"/g) {}' *.html
        perl -pi -w -e 'while (s/(<[^>]*?)”/$1"/g) {}' *.html
        perl -pi -w -e 'while (s/(<[^>]*?)’/$1"/g) {}' *.html

        Mat > Updated for you in original.

        1. I get the following error when opening the ePub in iBooks on me iPad.

          This page contains the following errors:

          error on line 1 at column 14: String not started expecting ‘ or ”

          All pages are the same, blank but forbtheverror message.

  7. Hi — It looks as though you got the conversion pretty well figured out, and I want to thank you for your efforts. (THANKS!) I just wanted to ask — did it ever occur to you to contact the translator and ask him for a non-PDF file? He seems to support your conversion, considering he links to it from his site; perhaps he could have saved you some work.

    So… did you ever get the issues worked out on the diacriticals?

    1. I didn’t. But the purpose of this blog was to help with conversions in general, given available material. (I actually wasn’t aware the author had linked to my blog)

      The diachritics are not a problem usually, just in this specific case. I’ve updated the Kindle version with some of the improvements suggested in the comments. This version should be much more character complete.

  8. This sounds like a very interesting AU fic. Too bad I cannot find the actual file to read it!

    I always thought that Gandalf hated science and technology but now it’s finally been confirmed and I know longer feel so crazy.

  9. Hey, thanks for this MOBI conversion. I was attempting to read this in landscape (PDF) on my Paperwhite and it was terrible.

    Your conversion is great!

  10. Another method for converting PDFs might be this free converter tool kitpdf.com which lets users quickly make pdf to epub or mobi files. It doesn’t need to be installed, just upload files for results.

Leave a Reply to Matthew Wilcoxson Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.