How to convert files from OOo formats to other formats via the command line
Autor:
Michal P.
| Sekcia:
Dev Resources
| Dátum: 2006-04-18
When publishing to website, it is sometimes desired to have these files published in different formats, eg sxw and pdf format. We will show you how to do this from command line using openoffice and oooconv library.
Neccessary elements:
- openoffice.org set up and running
- macro from oooconv website installed in main part (not only in file) in Standard.Module2
- convert.sh script installed
usage is then easy:
convert.sh PDF test.sxw or convert.sh PDF *.sxw
convert.sh script:
#!/bin/sh
#
# convert.sh
#
# Developed by Michal Palenik
# Copyright (c) 2006 Platon Group, http://platon.sk/
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# Changelog:
# 2006-04-18 - created
#
# $Platon$
# readme
# usage basename to_what(PDF,MSXP,...) what(file)
# download macro from http://oooconv.free.fr/oooconv/oooconv_en.html
# and save it as Standard.Module2 (global) under user you will convert it under
# beware: it is _very_ time consuming operation
#
# todo: switch to OOo2, more cpu effectivenes, less display
to=$1;
eval "unset $1;";
for i in $*
do if [ "$i" != "$to" ]
then echo "converting $i";
ooffice -minimized -headless "macro:///Standard.Module2.Exporte("$PWD/$i","$to","")"
else echo "not converting $i"
fi;
done;
|