Home » Questions » Computers [ Ask a new question ]

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

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

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.

Asked by: Guest | Views: 564
Total answers/comments: 2
Guest [Entry]

"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"
Guest [Entry]

"$oowriter --convert-to pdf --invisible name.odt

That's all. If your CLI is graphic, you can ommit the ""--invisible"" option.Tested on opensuse 12.3."