views:

4255

answers:

4

I have some documentation written in OpenOffice, now I would like to include some of it as PDF files in the final build deliveries. Now I would like to do this with the automated build script.

Is there a way to create a PDF file from OpenOffice with a command line command?

A: 

I think it is not possible. I tried it some months ago.

It has an API though. Java API was a real nightmare.

You can however create a macro in something similar to VBA ( I really never put that much of attention what it was ) And then run it from the command line.

Here's the complete reference. See if it helps you.

http://www.oooforum.org/forum/viewtopic.phtml?t=3772

OscarRyz
+8  A: 

Art of Solving has also a very good API to perform the conversion in java. Is a little slow but it is simple enough. This is how I use it.

        File inputFile = new File("C:\\oreyes\\hola.doc"); 
        File outputFile = new File("C:\\oreyes\\hola.pdf"); 
        OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
        try { 
            connection.connect(); 
        } catch(Exception e) {}

        DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
        converter.convert(inputFile, outputFile); 
        connection.disconnect();

You can create a jar with that and process it from the command line.

OscarRyz
+4  A: 

There is a great tool called "unoconv", it was in my Ubuntu repository. It converts ODF, .ods, ... to PDF and I think to other formats too.

I also could convert PowerPoint files to PDF.

worked like a charm, thanks!
Attila Lendvai
+1  A: 

There is anytopdf. Haven't tried it myself.

Quoting...

anytopdf is a perl script that converts OpenOffice.org, Microsoft Office (Word DOC, Excel XLS), RTF, HTML, and other openoffice.org readable file formats to the PDF format. It will automatically install the supporting 'AnyToPDF' OpenOffice.org Basic macro library in the current user's OpenOffice.org configuration if it's not already present.

Dedicated to peace, love, understanding and respect for all beings.

Archie