Here are the quick work around to convert.odc/.ppt to image or pdf file.
We need the following packages installed on the server,
a. openoffice
b. imagemagick
c. Java
Installing openoffice
#yum install openoffice.org*
#yum install ImageMagick*
How to verify imagemagick is installed and working
[root@rc-170 ~]# convert logo: logo.gif
[root@rc-170 ~]# convert –version
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
Downloading jodconverter from sourceforge
#wget http://downloads.sourceforge.net/project/jodconverter/JODConverter/2.2.2/jodconverter-2.2.2.zip?use_mirror=nchc
#unzip jodconverter-2.2.2.zip
#mv jodconverter-2.2.2 /usr/local/jodconverter/ ( optional)
Verify the java installed
[root@rc-170 ~]# java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
Now we need to run openoffice as a service. So we can create a init script for this. A sample scripts can be download from here
#vi /etc/init.d/openofficed
#!/bin/bash
OOo_HOME=/usr/lib64/openoffice.org
SOFFICE_PATH=$OOo_HOME/program/soffice
PIDFILE=$OOo_HOME/openoffice-server.pid
case “$1″ in
start)
if [ -f $PIDFILE ]; then
echo “OpenOffice headless server has already started.”
exit
fi
echo “Starting OpenOffice headless server”
$SOFFICE_PATH -headless -accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo “Stopping OpenOffice headless server.”
killall -9 soffice && killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo “Openoffice headless server is not running, foo.”
exit
;;
*)
echo “Usage: $0 {start|stop}”
exit 1
esac
exit 0
In this script I found the open office installation for was different according to the OS architecture. Since my OS is 64 bit it will be “/usr/lib64/openoffice.org” else it is “/usr/lib/openoffice.org” on Linux box.
[root@s15351481 ~]# vi /etc/rc.local then add the line “/etc/init.d/opeofficd start”
# java -jar /usr/local/jodconverter/lib/jodconverter-cli-2.2.2.jar document.ppt mam.pdf
You may use to call it from php using the “exec” funcation.
exec(‘java -jar /usr/local/jodconverter/lib/jodconverter-cli-2.2.2.jar/lib/jodconverter-cli-2.2.2.jar document.doc mam.pdf’);
This program will support for the following conversions,
1. DOC —> PDF
2. DOC —> ODT
3. DOC —> RTF
4. XLS —> PDF
5. XLS –> ODS
6. XLS –> CSV
7. PPT –> PDF
8. PPT —> ODP
9. PPT —> SWF
10. ODT –> PDF
11. ODT —> DOC
12. ODT —> RTF
13. ODS —> PDF
14. ODS —> XLS
15. ODS —> CSV
16.ODP —> PDF
17. ODP —> PPT
18. ODP —> SWF
How do I solve this error ?
[root@rc-040 installation]# /usr/lib/openoffice.org/program/soffice “-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager” -nologo -headless -nofirststartwizard
/usr/lib/openoffice.org/program/soffice.bin X11 error: Can’t open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See “man X” resp. “man xhost” for details)
[root@rc-040 installation]#
I started the vnc and server and execute the service script.
/etc/init.d/openofficed start