Skip to content

Accidentally Proper Kindle PDF Document Conversion

Example of standard PDF 'conversion' I’ve discovered a strange undocumented* ‘feature’ of the Amazon Kindle document Delivery system. As it stands, if you send a document to username@free.kindle.com or @kindle.com, the document is sent onto your device at its convenience. Generally this is fine, but for most documents that people actually use (PDFs) this can be a pain as the service says it does not support PDF reflow, and on a smaller than A4/Letter screen, lovely documents end up looking like this…

That, well, sucks. The only useful way to use it without serious eyestrain (seriously? thats why I bought the damned thing) is to zoom into the top half of the page and work in landscape. Not useful.

*UPDATE: As Tanya points out below, this is documented, and the only thing that needs done to perform this style of conversion is the ‘Convert’ subject line, but I quite like the command line style… :P

This has carried on for months now and as I find myself sitting on the command line more and more often I was getting irked by always having to pop over to chrome and drag some files to send myself a document, so I did what any geek would do; replace it with a small shell script. There are lots of tutorials out there for how to do this so I’m gonna try not to repeat them too much.

sudo apt-get install sendemail

sudo vim /usr/bin/sendkindle

#!/bin/bash
# Depends on package sendemail
$FROMEMAIL=#An email address connected to your kindle account
$USERNAME=#Your kindle username
$USER=#Gmail username in this case, but if you are an apps user, remember to include the full email address, or just $FROMEMAIL
$PASSWORD=#I dont think I have to explain this

 

sendemail -f $FROMEMAIL -t $USERNAME@free.kindle.com -u "Convert" -m "Sent automatically by sendemail." -s smtp.gmail.com:587 -xu $USER -xp $PASSWORD -a "$1" -o tls=yes

The -otls=yes is important as most tutorials that talk about using Gmail either neglect to mention it or deal with much more advanced configurations than this.

Anyway, back to the matter at hand; you want to send a pdf.

sendkindle myawesomedocument.pdf

Give it a bit to upload the file, then check your kindle.

Note: This is the same document as was shown before, the formatting is not perfect but is a hell of a lot easier on the eyes, AND supports the full range of kindle text features (fonts, text to speech, etc).

I’ve tested this with a few PDF’s aswell as a few power point files (absolutly garbled layout but the text is still picked up), and I suspect this is all due to the much simpler way that sendemail deals with MIME-types. But I don’t want to question the magic too much…

{ 7 } Comments

  1. ubuntudroid | 2011/06/17 at 19:02 | Permalink

    Thanks for this great read! :) However, I found a little issue in your script:

    You have to remove the $ in front of your variable declarations, else they won’t be recognized as variables ($ is only used if you *use* a variable, not for declarations – though I think you now that, as you made the script run, probably a typo…)

    You should also mention, that (at least when using a Ubuntu derivate) one should enable the execution bit using sudo chmod +x sendkindle or the appropriate checkbox from the properties panel.

    I also created a nautilus script from your script, which takes the currently selected file and uploads it to your Kindle. It is simply a thing of moving the script to ~/.gnome2/nautilus-scripts and adding NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; exit 0; to the end of your script.

    Additionally one should mention, that if you don’t want the PDF to be converted into Amazon’s portable format, one should remove the -u "Convert" from your code – thus one may simply create two script versions for different kinds of files to be uploaded, as sometimes Amazon’s conversion doesn’t really work successfully, e.g. on articles with two columnes.

  2. ubuntudroid | 2011/06/17 at 19:09 | Permalink

    Ah, and I forgot to mention: I also had to install two additional packages to get this to work, namely libnet-ssleay-perl and libio-socket-ssl-perl which provide the necessary TLS support.

  3. Bolster | 2011/06/28 at 10:12 | Permalink

    Thanks for the second-eyes; the difficulty with writing blog posts one a different machine to what I usually work on is the lack of `history`and my faulty memory!

    You are correct in both points, but I didn’t know about the subject-line/convert point.

    Thanks again.

  4. DonalDuck | 2011/07/27 at 12:27 | Permalink

    Could you explain more exactly what you did? (Because I’m new at this stuff and I´d really like my kindle to do that.) So could you do something like step by step and what programs are needed (hope they’re free, so that they can be downloaded).

    Thanks in advance,
    DonalDuck

  5. Bolster | 2011/07/27 at 14:47 | Permalink

    This is a Linux/Mac solution, I am not clear on the Windows side of whether this would work, as it was discovered by accident, and we don’t know what exactly is ‘triggering’ the conversion behaviour. Its been suggested that simply having ‘Convert’ as the subject would work. Experiment and report back!

    Of course, if all else fails you could look at Cygwin or Ubuntu. (Google is your friend)

  6. Tanya | 2011/09/27 at 14:51 | Permalink

    Hi,

    thanks for the idea. I have installed the sendemail software and after the tweaks mentioned by ubuntudroid, it reallyworked. So thanks to you both.

    Anyway I decided to check WHY it is working. It turns out that this feature is actually already documented by Amazon:

    Option to Convert PDF Files to Kindle Format
    If you prefer to have your personal PDF documents converted to the Kindle format so you can take advantage of Kindle functionality such as variable font size, annotation, Text-to-Speech, etc., type “Convert” in the subject of the e-mail when you submit your personal document to your @kindle.com address.
    cited from here: http://www.amazon.com/gp/help/customer/display.html?nodeId=200375630.

    So to wrap it up: you do not need the complicated setup – neither additionally installed software, nor your password in clear text on the file system. It is enough to just send a mail with attached PDF and subject “Convert”. I already tested it and it works like a charm :) Hope this helps someone else.

    Best regards,
    Tanya

  7. Bolster | 2011/10/17 at 11:35 | Permalink

    *Like*

    Thanks Tanya

Post a Comment

Your email is never published nor shared. Required fields are marked *