OpenOffice UNO export PDF help needed

S

Sells, Fred

I've geen googling for 3 days now, and cannot find out how to do this.

I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents. I'm
using windows, but will have to make it work under Linux for production.
I've been able to set the parameters and call the exportToPdf method, but
the exported file is not PDF but an .odt document, I can change suffix from
pdf to odt and double click on it and open it as openoffice. The project is
sort of a custom mail-merge, but there is little data used to produce a
lengthy contract and attachments. The whole thing needs to be done via a
cgi script or a servlet.

below is a java code snippet, submitted with apologies, I'm using that
rather than python because I found better examples and my java IDE helps me
out. I originally started out to do python, and will eventually shift back
to it once I get this working


public void writePDF(XTextDocument doc, String stringUrl) {
String stringConvertType ="PDF Creator";// args[ 1 ];
PropertyValue propertyvalueHidden[] = new PropertyValue[ 0 ];
XStorable xstorable =( XStorable ) UnoRuntime.queryInterface(
XStorable.class, doc );

// Preparing properties for converting the document
PropertyValue propertyvalue[] = new PropertyValue[ 2 ];
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "Overwrite";
propertyvalue[ 0 ].Value = new Boolean(true);
propertyvalue[ 1 ] = new PropertyValue();
propertyvalue[ 1 ].Name = "Filter";
propertyvalue[ 1 ].Value = "writer_pdf_Export";
//propertyvalue[ 1 ].Value = "impress_pdf_Export"; //also tried
"PDF Creator"
xstorable.storeToURL( stringUrl+".pdf", propertyvalue ); //also
tried storeAsUrl, same result

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
 
M

Michele Petrazzo

I've geen googling for 3 days now, and cannot find out how to do
this.

I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents.
I'm using windows, but will have to make it work under Linux for
production. I've been able to set the parameters and call the
exportToPdf method, but the exported file is not PDF but an .odt
document,

Have you tried the ooextract.py found on:
http://udk.openoffice.org/python/python-bridge.html

Here work well and generate a pdf file.

See also this for more info about generate pdf:
http://mithrandr.moria.org/blog/447.html

Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top