OpenOffice UNO export PDF help needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sells, Fred

    #1

    OpenOffice UNO export PDF help needed

    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(XTextD ocument doc, String stringUrl) {
    String stringConvertTy pe ="PDF Creator";// args[ 1 ];
    PropertyValue propertyvalueHi dden[] = new PropertyValue[ 0 ];
    XStorable xstorable =( XStorable ) UnoRuntime.quer yInterface(
    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_Exp ort";
    //propertyvalue[ 1 ].Value = "impress_pdf_Ex port"; //also tried
    "PDF Creator"
    xstorable.store ToURL( 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.
    ---------------------------------------------------------------------------
  • Michele Petrazzo

    #2
    Re: OpenOffice UNO export PDF help needed

    Sells, Fred wrote:[color=blue]
    > 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,[/color]

    Have you tried the ooextract.py found on:


    Here work well and generate a pdf file.

    See also this for more info about generate pdf:


    Michele

    Comment

    Working...