pdf converter

Phil Meyer pmeyer at themeyerfarm.com
Tue Oct 28 17:19:09 UTC 2008


Adil Drissi wrote:
> Hi,
>
> Is there any tool to convert openoffice documents to pdf?
>
>   

If you are asking  'Is there a way to convert office documents to pdf on 
the command line using open office', then yes, there is.

However it is not easy. 
It requires a macro for the user doing the conversion.
It requires an X session, even in non display (invisible) mode, so you 
may need to run it against the fake X server on headless systems.
Finally, it requires a specially crafted command line.

Here is a sample script, in which we run the fake X server on a headless 
system, so it is display 0.

---

#!/bin/bash
# doc2pdf -- convert office type documents to PDF

if [ -z "$1" ]
    then
    echo "Usage: $0 <file.doc>"
    exit -1
fi

DISPLAY=:0
export DISPLAY

# macro is in: ~/.openoffice.org2.0/user/basic/Standard/Module1.xba

DOC=$1
                                                                               

/usr/bin/oowriter -invisible 
"macro:///Standard.Module1.ConvertWordToPDF($DOC)"

exit $?

---

Here is the sample macro file:  Its kinda large, so I have it as a link 
if you are interested.

http://themeyerfarm.com/palm/Module1.xba


Good Luck!





More information about the fedora-list mailing list