How to convert an OpenOffice document to PDF from the Linux command line

command lineopenofficepdf

I have students who, when asked for PDF, sometimes hand me an OpenOffice document or spreadsheet. file(1) can identify these documents, but I've been unable to discover how to convert them to PDF using the command line. (The man page for ooffice(1) lists an option to print a document but not to convert to PDF.) Google is unhelpful, except for giving me the uneasy feeling that this can't be done without a nifty script in a language I don't know against an API whose documentation I can't find.

Can anyone help me solve the problem of converting an OpenDocument to PDF using only the Unix command line?

Best Answer

I think the most straightforward way would be to setup a pdf printer on your box and then just:

ooffice -pt pdfprinter studentwhodoesntfollowdirectionswell.odt

Edit: Just found a post on the Ubuntu forums with someone who arrived at the same solution I suggested (with handy dandy instructions). printing to pdf from command line [SOLVED]

Edit 2: I just came across unoconv which is a python script that uses OOo's UNO bindings. So I just wanted to update this answer

Related Question