13 October 2008

I love OOo (and how to convert odf to pdf on the command line)

In continuation of Khairil's meme for foss.my, "I love OOo!"

OpenOffice.org has been my only office suite for the past 5 years (or more?) and its extremely flexible.

Just today I learnt something new: a certain govt agency needed files in PDF because their "IT Department" just haven't gotten round to install OpenOffice.org in their machines. Its quite a few files, and I didn't fancy doing it manually.

So a quick google brought up two options: Use the Macro language, which involved copy and pasting some Basic code, or using unoconv which is a command line python script, by dag wieers. I prefer the command line, so I apt-get installed it.
#sudo apt-get install unoconv
And then running it may get you this error:
# unoconv -f pdf TC4-*.od?
Error: Unable to connect or start own listener. Aborting. javaldx: Could not find a Java Runtime Environment!
The reason is because you need to have OpenOffice.org running in the background (or in a remote server) first. Launch soffice, and run the command line again, and everything will succeed quietly.

Isn't it wonderful that a UI app can be used to convert files from the command line? Isn't it great that it can be driven from the command line with the wierd wildcards (*s and ?s). Isn't it just awesome?


Sign up to foss.my, Malaysia's premier community driven, community focused conference for Free and Open Source Software. Be there and be square. 8-9 Nov 2008

yk