Friday, April 27, 2012

Word for Mac can't generate linked TOCs for Kindle

I've been trying to document the simplest way to create an ebook with a tool that most folks already own. The tool I've chosen, Microsoft Word, is a bloated, impossibly complicated piece of software that for some inexplicable reason, is used by a huge proportion of the populace. Feel free to enlighten me about its virtues in the comments.

Anyways, I want to call your attention to one particularly important failing of Microsoft Word for Macintosh: it will only create linked or active TOCs if the TOC contains page numbers. It's really important to include linked TOCS in ebooks, and particularly in Kindle books since most of Kindle devices don't have device-generated or navigational tables of contents, but it doesn't make sense to include page numbers (since they don't make any sense in a digital landscape).

Note that Microsoft Word for Windows is happy to automatically generate a useful TOC, sans page numbers, for an ebook.

Table of Contents

Simply uncheck Show page numbers and then check Use hyperlinks instead of page numbers.

Now look at the corresponding dialog box in the latest version of Word for Macintosh:

Table of Contents

You can hide the page numbers, but you can't convert them to hyperlinks, and I assure you, after much testing (and confirmation from @ljndawson), that without page numbers, no page links will be created. The TOC is there, but will take you nowhere in the converted ebook.

Kindle Fire Previewer - testerTOC7

It makes Word for Mac a much less powerful tool for creating ebooks. Of course, there are solutions (like manually creating bookmarks for each TOC entry), but it's nothing like a one-button solution (!).

Why should anyone care about how Word creates TOCs? Because Word (.doc or .docx) is the one styled format that can be read and converted automatically into Kindle format (using KDP, Send to Kindle, and by emailing the document to a Kindle device). More on that soon.

Wednesday, April 25, 2012

Using Amazon's Send to Kindle to transfer ebooks and documents to Kindle

Amazon has just released the Send to Kindle app for Macintosh. It already exists for PCs. This is an app that facilitates getting documents in various formats—Word (.doc and .docx), text (.txt), RTF (.rtf), images (.jpeg, .gif, .png, .bmp) and PDF (.pdf)—to your Kindle.

Once you've downloaded and installed Send to Kindle, you can activate the app in several different ways. First, you can right-click a document in the Finder and choose the Send to Kindle option near the bottom of the menu.

From Finder

You can choose Send to Kindle from the Printer menu in any program that has one (here's Word):

Print - Send to Kindle

Finally, you can click the Send to Kindle icon on the dock or drag a document to the Send to Kindle icon directly.

Dock

Whichever method you choose, you'll see the Send to Kindle's window in which you can specify a new title for the document and choose which Kindle you want to send the document to. You will also specify whether you want to use free Wifi or incur extra charges by using Amazon's Whispernet service.

Send to Kindle

If you check "Archive document in your Kindle Library" (which is on by default), your document will be available in the Kindle cloud, and thus to all of your Kindle devices. You can even deselect a device and send your document only to the cloud.

Format

Notice at the bottom of the window that you'll be advised about which format your document will be converted to. If you right-click or drag and drop, Send to Kindle will convert Word, text, and RTF to Kindle format, and preliminary testing seems to indicate that it uses the same KindleGen algorithms that are used by Kindle Previewer and KDP. If you right-click or drag and drop a PDF file, you'll have the option (in the aptly named Options panel) to convert the PDF to Kindle format. I tested some simple documents, and it seemed to work quite well.

Send to Kindle - Options-1

If you use the print option, it will always send the document as a PDF, and the PDF cannot be converted to Kindle format. Note that the PDF document will be much larger than the Kindle version.

Send to Kindle - Options

All in all, the Send to Kindle app looks like a useful tool for getting documents into your Kindle. The Send to Kindle documentation has a few more details.





Monday, April 9, 2012

Unpacking a Kindle/Mobi file

Converting an ebook of whatever format to a Kindle/mobi file adds a level of abstraction that always leaves me with this gnawing uncertainty: did anything change under there? Is this what I really want? This may be due to general OCD, but I think it started with Microsoft Word's early attempts to guess what I wanted and automatically change my text for me, causing all manner of consternation and mistrust, as its guesses were often incorrect. Course it doesn't help that Kindle devices don't all display an ebook the same way.

As you might've guessed, I don't trust Kindle Previewer (or the KindleGen that it invokes) either... who knows what it does during conversion!? Indeed, when a feature in an ebook I'm creating doesn't come out right, knowing exactly what KindleGen is doing with my files can be very helpful for cross-platform development.

Thankfully, there are a bunch of folks over at MobileRead who have developed an open source tool for unpacking Mobi files and looking at their innards. It's called Mobi Unpack and the latest version (047) can be found there.

But what do you do with it once you've found it? Double-clicking didn't work at first for me:

doubleclick MU

And I had no idea what application I should associate it with. I used a rather convoluted system starting with Terminal, navigating to the MU folder, then typing python Mobi_Unpack_v047.pyw, which works, but it seemed like there should be a better way.

One of the Mobi Unpack developers told me I needed a thing called Python Launcher. You can find it in /System/Library/Frameworks/Python.framework/versions/2.5/Resources. It comes with your Mac. Who knew? :)

I dragged Mobi_Unpack_v047.pyw on top of the Python Launcher, and now it's permanently associated: when I double-click, it opens right up.

Mobi ebook Unpack Tool

Once Mobi Unpack is open, use the top field and Browse button to choose the Mobi file that you want to unpack. Use the second field and Browse button to choose the folder you want to unpack the Mobi file into.

I don't check any of the other options.

Then click Start to unpack your Mobi file.

Mobi Unpack creates a mobi8 folder, which presumably is the KF8 version as well as a mobi7 folder which presumably is what old Kindles get. You can explore the files inside (XHTML, CSS, content.opf, etc.) to see how KindleGen (via Kindle Previewer or whatever) is creating your Mobi file.

Unpacked Mobi

The mobi8 folder even contains an EPUB file. I thought this might be useful if you were starting with a Mobi file and wanted to convert to EPUB, but unfortunately, at least in my testing (in which I did not generate the Mobi file from an EPUB file), the EPUB did not validate.

Wednesday, April 4, 2012

Sideloading ebooks with Dropbox

Whether you create ebooks for a living or just read them, getting books onto your reading device—or devices!—of choice is not always as easy as it should be. Sure, Amazon has its Whispersync that shuttles files straight to your Kindle apps and iBooks will get books to your iPhone/iPad or iPod touch, but what if you buy a book from an independent author (like me :), or download one of Cory Doctorow's books, or create your own and want to see what they look like? The answer is sideloading, the term for getting ebooks to your reader without a store's help.

The most basic way to sideload is to hook your ereader up to your computer via the USB cable. Most ereaders (but not iOS ones) will appear on your desktop just like any other external drive.

Kindle-disk

nook-disk

Just drag your ebook file (in the appropriate format, of course) to the Documents folder on the ereader (actually NOOK is not very picky about where you place it), then eject your disk, and you can find the new ebook installed. (Nook and Kindle Fire put your sideloaded books in the My Files/Docs area, respectively.)

On iOS (iPhone/iPad/iPod touch), the process is a fair bit more laborious. You're supposed to use iTunes, as I describe in EPUB Straight to the Point, either syncing manually or automatically. But it takes longer than it should. Apple offers a little app called Book Proofer to folks through its iTunes Connect program that lets you edit a book on your computer as you simultaneously preview it on your iPad or iPhone, but it's not public, and it's not foolproof.

It turns out DropBox is a brilliant alternative to all of this. Dropbox lets you create a folder on your computer that is automatically copied to the "cloud". That means that you can access it from any other computer or even reading device.

(If you don't already have a Dropbox account, you can follow this link to get one and you and I will both get 500Mb additional free disk space.)

To sideload a ebook with Dropbox, first copy the ebook to your Dropbox folder. (If you don't know where the folder is, you can use the Dropbox menu at the top of your screen to open it: dropboxmenu, or just find it yourself, generally right in your home folder.

Dropbox

Then, on your iOS device, download the Dropbox app, launch it, and sign in.

Select the ebook that you want to sideload from the Dropbox menu. It will start to load.

sideloading ebook to iOS

Dropbox can view some file formats right in the app itself, but not EPUB or mobi. So when it gets done copying the file, it will tell you it doesn't know what to do with it. Thankfully, all you have to do is click the "Away" icon in the upper right corner of the screen, and Dropbox will offer to transfer the file to an app that can view it, like iBooks in this case. Bravo, just what we wanted.

dropbox to iBooks

Once you choose iBooks in the menu, iBooks will open automatically and show you your book. It's really lovely:

in iBooks

Dropbox will work on iOS for both EPUB and Kindle/mobi:

dropbox to Kindle

This is pretty interesting, considering that before Dropbox there was no way to test a Kindle book on an iOS device before selling it through Amazon. you had to use iTunes to copy mobi files to the Kindle app on iOS. (Connect device, choose Apps, go down to the bottom of the screen, click Kindle, click Add…, choose your mobi file, then sync. Thanks, Dan Rodney—see comments—though I still think iTunes is a slow solution.) The closestAnother alternative was using the Kindle Previewer app.

I thought Dropbox might even be the answer to the conundrum that you can create a Kindle book with audio and video, but there is no way to test it, because there is no way to get the AV book to Kindle app for iOS which (ironically) is the only Kindle app that supports audio and video! — you can only see it *after* it is published to Amazon, which, sadly, still does not allow independent authors and publishers to sell books with audio and video.

Alas, I have not been able to get this to work. I can get the audio/video Kindle books to the Kindle app on iOS, but the audio and video do not play. I haven't finished poking at it yet, though. I'll keep you posted.

Note that some ebookstores make changes to books as they deliver them. That is, a sideloaded book is not always identical to its purchased cousin, though in my mind, it sure should be. In particular, I've heard complaints about NOOK and Kobo, and I'm wondering if Amazon doesn't bake something special into its AV books for iOS as well. More on that another day.


Monday, April 2, 2012

Free Foreign Language Versions of my books

Book Translations

My books have been translated into a lot of languages, and often times (though unfortunately not always), they send me copies. I like to keep at least one of each, but I have a few extras around if anyone's interested. All you have to do is send me (via Paypal, for example) the shipping costs. First dibs for subscribers :)

Here's what I have:

Japanese
Perl & CGI for the World Wide Web, 2nd Edition

Italian:
XML for the World Wide Web, 1st edition
Crea una pagina Web con HTML
Pubblica un blog con Blogger, 1st edition

Spanish
HTML, XHTML, y CSS, Fifth edition

French
HTML4 avec XHTML & CSS
Creer un blog avec Blogger

Chinese
HTML, XHTML and CSS, 6th edition

Dutch
HTML XHTML CSS, 6th edition

Swedish
Blogg med Blogger, 1st edition


More of my books