Skip to content

Converting ODF documents to PDF with WebODF

Thursday, 24 February 2011  |  Oever

It is quite common that one wants to send ODF files to people that lack the software to display ODF. One workaround is to convert the ODF to PDF. Most office suites that support ODF can export to PDF. To compare how different office suites do this conversion one can use the website OfficeShots. This website offers the ability to perform this conversion in many office suites at once and to compare the results.

WebODF wants to play with the grown-ups. So I have extended WebODF with the ability to convert from ODF to PDF. Here is a small script that shows how to do this conversion for a file /home/user/file.odt:

# compile WebODF
git clone http://git.gitorious.org/odfkit/webodf.git
mkdir build
cd build
cmake ../webodf
make
cd ../webodf/webodf
# perform a conversion
FILE=/home/user/file.odt
cp "$FILE" .
FILE=`basename "$FILE"`
../../build/programs/qtjsruntime/qtjsruntime --export-pdf render.pdf "odf.html#$FILE"
ls render.pdf