Posted on Wed 07 August 2019

Lonely Planet on Kindle - The Cheap Way

Lonely Planet guidebooks are nice to get a quick overview of a place, or find some things worth seeing and doing around where you are traveling. However, lobbing around an extra half a kilo or more isn't great.

I'm already carrying my e-reader, so wouldn't it be great if I could just save the relevant sections there?

However, while they do sell an official Kindle edition, I prefer using the paperback versions when planning my trip. So instead of buying it twice, I simple scanned the relevant pages at the office, then cropped them into a single paged pdf with a short bash script:

#!/bin/bash

set -x

IN="yogyakarta"
PAGES=10

LEFT=-150
RIGHT=0
TOP=-15
BOTTOM=-55
MIDDLE=-340

pdfcrop --margins "$LEFT $TOP $MIDDLE $BOTTOM" $IN.pdf ${IN}_odd.pdf
pdfcrop --margins "$(($LEFT + $MIDDLE)) $TOP 0 $BOTTOM" $IN.pdf ${IN}_even.pdf

pdftk O=${IN}_odd.pdf E=${IN}_even.pdf cat $(i=1; while [ $i -le $PAGES ]; do echo O$i E$i; i=$(($i+1)); done) output ${IN}_single.pdf

rm ${IN}_odd.pdf
rm ${IN}_even.pdf

Based on Command line tool to crop PDF filescache and Split pages in pdfcache.

Category: misc

Tags: travel, programming

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .