pdf converter

Kevin Martin kevintm at ameritech.net
Wed Oct 29 14:05:28 UTC 2008



Phil Meyer wrote:
> 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!
>
>
FWIW, if you look in the archives for this you'll find a script and
macro that was posted a while back by me that looks alot like this
script but that handles not passing the full path to the file.  I also
have an updated macro that will convert doc, xls, and ppt files.  If
you're interested, take a peek back at the archives and you should find it.

Kevin




More information about the fedora-list mailing list