openoffice command line printing...

Phil Meyer pmeyer at themeyerfarm.com
Tue Jun 3 19:33:06 UTC 2008


Kevin Martin wrote:
> What I'm trying to do is convert a bunch of Excel files to PDF.  I can 
> open the Excel files in oocalc and export to PDF but I've been reading 
> that you can do this same thing by using Cups-PDF and "soffice -pt 
> "Cups-PDF" file.xls' and it will fire up oocalc and, essentially, use 
> the Cups-PDF "printer" to save the file out as a .pdf file.  Well, 
> that's not working for me.  I never get an output file when I run the 
> command from the command line and I can't figure out why.  I'm running 
> on Fedora 8 with the latest openoffice, cups, cups-pdf rpms for that 
> platform.  Can somebody else try on their end and see if it works for 
> them?  FWIW, "soffice -p file.xls" doesn't print my file to the 
> default printer either.
>
> Thanks.
>
> Kevin
>

There are several tricks to this.
First, to do it remotely, or from an associated command line, you need 
to fun a fake X server and set the display to that.

Second, you need to set up a macro to do exactly what you want when 
evoked, and that includes writing of the output.

I cannot include the macro here because I did not write it.

We use:

Xvfb -pixdepths 8 24 -fbdir /usr/tmp

Here is a script (which I wrote) we use on a web based tool to convert 
MS files:

#!/bin/bash

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 $?


Good Luck!




More information about the fedora-list mailing list