Arrright!

This goes to the OOo.general group (where the thing started) as well as to the OOo.scripting one, where it is probably better placed.

I've done a python script that will call the OOBasic PDF export script and convert all odp and odt files within one directory and its subdirectories to pdf, then delete the original.


What did not work was the part where I tried to specify pdf conversion options in the basic script (appended in the comments of the python script).
Here's the part of the basic script that does the conversion:
<code>
   oDoc.storeToURL( cURL, Array(_
            MakePropertyValue( "FilterName", "writer_pdf_Export" ),))
</code>
I expected to be able to influence the options by doing something like
<code>
   oDoc.storeToURL( cURL, Array(_
            MakePropertyValue( "FilterName", "writer_pdf_Export" ), _
            MakePropertyValue( "ReduceImageResolution", TRUE ),))
</code>
, but that seems to be wrong, the parameters are ignored.
In the example from http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#Filter_data_demo only one single array of parameters is passed to the pdf export filter, but either there is something wrong with the example or I didn't quite get it. The workaround is to start OOo export anything using the options you'd like to have and then run the script, it will use those.


Anyways, you can spread the script, use it, enhance it, whatever. Would be nice if you posted the results here or link to them.


Limitations of the script: kommas in filenames are not treated correctly by ConvertToURL() (I had to rename some files), spaces seem to be no problem. The only way the script makes a distiction between directories and files is by searching for a "." in the name. This worked for me because my files were all generated on windows by a windows user. Some more thinking and/or python knowledge is required to make it work in the general case.


Have fun,

 Zak


P.S.: The script worked for me on SuSe 11.1, using Python 2.6 and OOo 3.1.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to