Am 28.12.2009, 03:07 Uhr, schrieb Ariel Constenla-Haile
<[email protected]>:
Hi,
no, for OOo API questions the best place is the API mailing list
[email protected]
Ok ... can we move this thread there somehow?
I was reluctant to post on a developer list, because everything I'll ever
be developing is one script or two.
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_da
ta_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.
nothing's wrong with the example, so you didn't quite get it.
I accept that. wasn't really sure about what I'm doing here, so advice is
appreciated.
Re-read the Java code.
Hmm... Java is one of the languages I don't really know, but after
re-reading it the (n+1)th time, I think I understand the error I made.
what the export function expects is this:
filename,
array(PV("FilterName",filtername),PV("aFilterData",array(PV(option1,value),PV(option2,value)...)
)
while I tried to do this:
filename,
array(PV("FilterName",filtername),PV("FilterData",array(PV(option1,value),PV(option2,value)...
)))
the above probably isn't formally correct (sorry, I never learned this
stuff properly), but I hope it's understandable.
Try the Python code attached (needs to start OOo in listening mode,
instructions at the top of the file).
Thank you, Ariel.
It surely would have been more elegant not to mix python and OObasic (and
system calls), but learning a new API which follows principles unkown to
me is quite painful (did I mention I'm just a casual programmer?).
Do I understand the code right? You can either call
xPDFConfig.setPropertyValues() and later xPDFConfig.commitChanges() or
specify the export options in the actual exporter call after putting them
in aMediaDescriptor. If I use xPDFConfig, I won't have to set those
options everytime I call the pdf export.
Unluckily, I don't have time now to play with the python script, but I'll
keep it in a safe place for when I need it next.
From a user's point of view: As a not-experienced-yet-enthusiastic python
user I feel that the way of specifying the export options is a bit
roundabout. There is quite probably a good reason for that (which I may or
may not be able to understand), but I'd like to see something that just
goes "OO.currentDoc.export(filename, filtername, [properties : values])".
That would remove the need for arrays within arrays of things I need to go
and call a separate routine for.
Meaning: The UNO API sure is powerful, but it just as sure is confusing to
the uninitiated.
Cheers,
Zak
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]