Monthly Archives: August 2010

Converting Word documents to PDF with OpenOffice and Python

The problem

A word document (plain old .doc, not 2007) should be received by e-mail, fed to a script, turned into a PDF and published on a website.

At my disposal

My server running Debian ‘Lenny’, which does not have a display of any kind.

How hard can it be?

Harder than it should have been, as ever. Here are my steps:

# aptitude install python-uno xvfb openoffice.org-java-common openoffice.org-writer unoconv

You’ll note the inclusion of Xvfb there, because it turns out that “headless” mode in OpenOffice isn’t really headless at all. Sigh. Also sigh some more at the broken dependencies of the unoconv Debian package.

Now we can write our script to do the actual conversion. Shame it took twice as long as it should have…

India diary, day 1

In June/July 2010 I spent ten days travelling in Rajasthan, India with friends; this is my diary of the trip (full list of entries here).

Saturday 26 July

Landed at Indira Gandhi International Airport at 9.30AM local time. Walked out of the terminal into searing heat (over 40 degrees in the shade) and a medley of noise and traffic. Dodged our way through the traffic and found our taxi waiting. Saw our bags strapped to the roof and set off into the traffic. As we’d been warned, the only similarity between British driving and Indian is that both countries drive on the left – in India the horn means “get out of my way please, I want to pass” and flashing your lights means “I’m not going to stop, so get out of the way or I’ll ram you”. In the city, people, animals and motorbikes all compete for road space with the cars and lorries, there are no traffic lights to speak of, and the smallest gap is made to be squeezed through.

On the main highway – this first day we’re driving from Dheli to K’s grandparents’ house in Jaipur, approximately 200 miles to the south-east – the sheer volume of traffic and the two-lane road limits progress to a maximum of 50mph. Drove past Debenhams and M&S on the way out of Dheli; wondering just how westernized this country is…

Stopped for lunch at India’s answer to the motorway services, about 1pm. Stepped out of our air-conditioned taxi into searing, dusty mid-day heat and ran for cover in the building, which had just enough air conditioning and fans to reduce the temperature from ‘horrifically hot’ to ‘bearable’. Ate a nice samosa with a coke, then back to the car.

Arrived in Jaipur at about 4.30pm, glad to get out of the car. The drive down wasn’t particularly inspiring; mostly motorway.

Met K’s grandparents – great people, made us feel really welcome – settled into our hotel and had a really nice meal with them before going to bed (or trying to; despite the air conditioning, still pretty warm!).

Editor’s note: more to follow soon, with photos!