Please do *not* start a new question by replying to an old one as this
causes several problems:
1. most email software will correctly think that your email is a
response to the email you are "replying" to, and will indicate
this by displaying your email as a child of the original email
2. because of this, people not interested in the original email may
ignore your question
3. people may think that the original email has a reply(yours) so
that they do not have to give it a reply
So in conclusion, more people will read your email if it looks like the
start of a new thread rather than the reply to an old one.
On Tue, 2006-04-04 at 14:34 +0800, Francis Jones wrote:
> Hi All,
>
> I have a lot of OOo documents that I want to convert into PDF.
>
> They are all in a directory, and I would like OOo to cycle through all
> the .odt files in that directory and then create .pdf files (with the
> same root name).
>
> I used to be able to do this, using 1.9.x I think.
>
> There are a number of tutorials out there which show how to do this, and
> this is what I had followed previously. e.g., DannyB on oooforum had a
> macro that worked, and you can find a similar one in Andrew Pitonyak's
> macro document. There's also a really nice gui document created by
> Laurent GOdard (http://oooconv.free.fr/batchconv/batchconv_fr.html)
> which does exactly what I want.
>
> But... in every case, I get an error, even with the macros that used to
> work.
>
>
> Here is the typical code:
>
> > Sub ConvertWordToPDF( cFile )
> > cURL = ConvertToURL( cFile )
> >
> > ' Open the document.
> > ' Just blindly assume that the document is of a type that OOo will
> > ' correctly recognize and open -- without specifying an import filter.
> > oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(_
> > MakePropertyValue( "Hidden", True ),_
> > ) )
> >
> >
> > cFile = Left( cFile, Len( cFile ) - 4 ) + ".pdf"
> > cURL = ConvertToURL( cFile )
> >
> > ' Save the document using a filter.
> > oDoc.storeToURL( cURL, Array(_
> > MakePropertyValue( "FilterName", "writer_pdf_Export" ),_
> > )
> >
> > oDoc.close( True )
> > End Sub
> >
> >
> > Function MakePropertyValue( Optional cName As String, Optional uValue ) As
> > com.sun.star.beans.PropertyValue
> > Dim oPropertyValue As New com.sun.star.beans.PropertyValue
> > If Not IsMissing( cName ) Then
> > oPropertyValue.Name = cName
> > EndIf
> > If Not IsMissing( uValue ) Then
> > oPropertyValue.Value = uValue
> > EndIf
> > MakePropertyValue() = oPropertyValue
> > End Function
>
> This always seems to fail with storeToURL() failing, saying that the URL
> is of an unsupported form.
>
> But the URLs for the incoming and outgoing files seem OK: something like
>
> file:///C:/tmp/convOO/UW/file.odt
>
> is an example of the incoming file. The outgoing file would be the same
> except suffixed with .pdf instead of .odt
>
> There seems to be something I'm missing here. Can anybody help, or
> point out a resource for doing this?
>
> By the Way: All of these macros which I lifted seem to have had their
> genesis in OOo 1.1 . Does anybody know if perhaps something has changed
> in 2.0.2 that breaks things?
>
This question is better suited to the [email protected] list. You
should ask there. Off the top of my head, though, I think you are using
the wrong call and there is better choice than storeToURL.
--
PLEASE KEEP MESSAGES ON THE LIST.
OpenOffice.org Documentation Co-Lead
http://documentation.openoffice.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]