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. --------------------------------------------------------------------------- -- http://mail.python.org/mailman/listinfo/python-list