How to Create RTL Books for Kindle

Many of the books that I wanted to read on my Kindle(s), were in Arabic or Persian, and were also available freely online. These books were not of .mobi format, but were available as online books, in many html pages. I created a script that snatches these pages, stitches them together and forms a huge HTML file (one for each book).

The problem was that these books would not display/sync properly on my kindles. I have a Paperwhite, and a Fire, and wanted them both to fully support the generated book in RTL, and also support the same book (not two different versions of it), so that it synchs properly.

Unfortunately the solution that I came up with does not show the book under “Books” tab in Kindle Fire. Basically, to achieve that, we need two different versions of the book on the Paperwhite (.mobi) and the Fire (.azw3), and that would mean that they won’t sync properly.

The most important part of the solution was to use the proper HTML template for the book. The following is the HTML template that needs to be used for the book. I was using “rtl” attribute towards the HTML tag instead of BODY tag:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>

<style type="text/css">
p {text-align: right; margin-right: .5em;}
</style>
</head>

<body dir="rtl">
</body>
</html>

You can also download this template here: Kindle RTL Template.

Put the entire Kindle book between the BODY tags in the above HTML template, save with UTF-8 encoding. The next step would be to convert this to .mobi format. My personal choice for that is the “kinglegen” app. It is a terminal app that you run, with the following syntax:

$ kindlegen mybook.html -verbose -o mybook.mobi

It will inform you of any issues or warnings, and generate a basic mobi file. You can also use Calibre, if you don’t like CLI (terminal) applications, to convert the HTML into mobi, or use Amazon’s send to device tools.

The next step is sending the book to devices. Using send to kindle, send the book to all your Fire devices, and to the Kindle library, but not to Paperwhite devices. Paperwhite devices will automatically see the book sent to the library, and can download it from there. This allows your Paperwhite copy to be synchronized with the Fire copy. (Both have the sync menu as well).

Finally, if syncing is not important for you and you want the book to appear under Books in Kindle Fire, convert it to AZW3 format with Calibre, and use Calibre to send it to device by connecting it via USB cable. You can have both mobi and azw3 formats that way.

Note: If syncing is not available on your fire when you download the book, delete it, close Kindle and Docs apps, rerun Docs, go to Send-To-Kindle tab, and click the book there. Once it downloads, it should sync properly.

Download a sample book that I generate for testing purposes: Realism – Motahari Kindle book

5 comments On How to Create RTL Books for Kindle

  • I am badly in need of an Arabic Quran on my Kindle, with Muhammad Asad’s translation – or Pickthall’s. Could you please provide me with a solution to the query?

  • Thank you so much! you r a life saver :D

  • Hi there
    Thank you for this solution. it really nice.
    But is there any HTML books resource?

    I have a problem with reading and sending Persian web pages on kindle.
    Can you save your solution in a Chrome extension? we select the desired text and send it in this format to kindle. or at least save the web page in this format and then apply the kindlegen manually!
    Thank you in advance

  • Hi ?
    I was trying to publish persian books on Kindle Store but amazon fails to support persian as a language fir Kindle. I was thing to make a website to provide persian books for folks

    Do you think that would be valuable?

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar