<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ok, so here's the macro and the script to go with it ( as suggested by
my only replier earlier with a little tweaking on my part):<br>
<br>
<br>
This is based on code found at
<a class="moz-txt-link-freetext" href="http://www.oooforum.org/forum/viewtopic.phtml?t=3772">http://www.oooforum.org/forum/viewtopic.phtml?t=3772</a> with a little
tweaking on my part.  To add more file types to be able to convert you
would need to tweak the File2PDF Subroutine and then add the requisite
Functions that went with the tweak (if needed).<br>
<br>
 I put the following in my
~/.openoffice.org2.0/user/basic/Standard/Module1.xba file.<br>
<br>
<br>
<br>
<br>
<b>Sub File2PDF( cFile )<br>
<br>
   &apos; Set output file extension based on lower-case<br>
   &apos; version of input extension.<br>
   Select Case LCase(Right(cFile,3))<br>
     Case &quot;ppt&quot;         &apos; PowerPoint file.<br>
       PptToPDF(cFile)<br>
     Case &quot;doc&quot;         &apos; Word file.<br>
       DocToPDF(cFile)<br>
     Case &quot;xls&quot;         &apos; Excel file.<br>
       XlsToPDF(cFile)<br>
    End Select<br>
<br>
End Sub<br>
<br>
<br>
Function PptToPDF( cFile )<br>
    cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Open the document.<br>
   &apos; Just blindly assume that the document is of a type that
OOo will<br>
   &apos;  correctly recognize and open -- without specifying an
import filter.<br>
   oPpt = StarDesktop.loadComponentFromURL( cURL,
&quot;_blank&quot;, 0, Array(_<br>
            MakePropertyValue( &quot;Hidden&quot;, True ),_<br>
            ) )<br>
<br>
<br>
   cFile = Left( cFile, Len( cFile ) - 4 ) + &quot;.pdf&quot;<br>
   cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Save the document using a filter.<br>
   oPpt.storeToURL( cURL, Array(_<br>
            MakePropertyValue( &quot;FilterName&quot;,
&quot;draw_pdf_Export&quot; ),_<br>
            )<br>
<br>
   oPpt.close( True )<br>
End Function<br>
<br>
Function XlsToPDF( cFile )<br>
    cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Open the document.<br>
   &apos; Just blindly assume that the document is of a type that
OOo will<br>
   &apos;  correctly recognize and open -- without specifying an
import filter.<br>
   oXls = StarDesktop.loadComponentFromURL( cURL,
&quot;_blank&quot;, 0, Array(_<br>
            MakePropertyValue( &quot;Hidden&quot;, True ),_<br>
            ) )<br>
<br>
<br>
   cFile = Left( cFile, Len( cFile ) - 4 ) + &quot;.pdf&quot;<br>
   cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Save the document using a filter.<br>
   oXls.storeToURL( cURL, Array(_<br>
            MakePropertyValue( &quot;FilterName&quot;,
&quot;calc_pdf_Export&quot; ),_<br>
            )<br>
<br>
   oXls.close( True )<br>
End Function<br>
<br>
Function DocToPDF( cFile )<br>
   cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Open the document.<br>
   &apos; Just blindly assume that the document is of a type that
OOo will<br>
   &apos;  correctly recognize and open -- without specifying an
import filter.<br>
<br>
   oDoc = StarDesktop.loadComponentFromURL( cURL,
&quot;_blank&quot;, 0, Array(_<br>
            MakePropertyValue( &quot;Hidden&quot;, True ),_<br>
            ) )<br>
<br>
<br>
   cFile = Left( cFile, Len( cFile ) - 4 ) + &quot;.pdf&quot;<br>
   cURL = ConvertToURL( cFile )<br>
<br>
   &apos; Save the document using a filter.<br>
   oDoc.storeToURL( cURL, Array(_<br>
            MakePropertyValue( &quot;FilterName&quot;,
&quot;writer_pdf_Export&quot; ),_<br>
            )<br>
<br>
   oDoc.close( True )<br>
End Function<br>
<br>
<br>
Function MakePropertyValue( Optional cName As String, Optional uValue )
As com.sun.star.beans.PropertyValue<br>
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue<br>
   If Not IsMissing( cName ) Then<br>
      oPropertyValue.Name = cName<br>
   EndIf<br>
   If Not IsMissing( uValue ) Then<br>
      oPropertyValue.Value = uValue<br>
   EndIf<br>
   MakePropertyValue() = oPropertyValue<br>
End Function</b><br>
<br>
<br>
<br>
<br>
To make it even easier I then created a script called file2pdf that
does the following:<br>
<br>
<br>
<b>#!/bin/bash<br>
<br>
<br>
if [ -z "$1" ]<br>
    then<br>
    echo "Usage: $0 <file>"<br>
    exit -1<br>
fi<br>
<br>
DISPLAY=:0<br>
export DISPLAY<br>
<br>
<br>
DOC=$1<br>
DOC_dir=`dirname $DOC`<br>
<br>
if [ "$DOC_dir" = "." ] ; then<br>
 DOC=`pwd`/$DOC<br>
fi<br>
<br>
<br>
/usr/lib/openoffice.org/program/soffice -invisible
"macro:///Standard.Module1.File2PDF($DOC)"<br>
<br>
exit $?<br>
</b><br>
<br>
So then I just run my file2pdf script and pass it the file name (either
fully path qualified or not).<br>
<br>
<br>
Enjoy.<br>
<br>
Kevin<br>
<br>
<br>
Kevin Martin wrote:
<blockquote cite="mid:4847FD98.9020702@ameritech.net" type="cite">Ok,
so it was actually "openoffice converting files to pdf..." but what the
heck.
  <br>
  <br>
And I've got it working.  Finally found a macro that would do most of
the work and I tweaked it to be "smart" about the conversion process. 
So now it works.  If anybody wants the macro, I'll send them the macro
file.  Basically what I do is 'soffice -invisible
"macro:///......FileToPDF(/<pathtofile>)"' and, based on the
extension of the file (.doc, .xls, .ppt) the macro calls the necessary
oo function to do the conversion and save the pdf file back to the same
directory as the original file.  FWIW, there was no need to setup a
dummy X server since I'm running an X server anyway.
  <br>
  <br>
Thanks.
  <br>
  <br>
Kevin
  <br>
  <br>
</blockquote>
</body>
</html>