Rss Feed Tweeter button Facebook button Technorati button Reddit button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button

A Waage Blog

Ruby, Rails, Life

OpenOffice Headless Mode Installation Word doc to pdf conversion

with 7 comments

How to set up OpenOffice to run in headless mode on Fedora 9

What we wanted was a system set up to convert any OpenOffice document to PDF. Most importantly, we needed to convert Word .doc files to .pdf, but in fact, any OpenOffice file types (.xls, .odt, .txt, .rtf, etc) will work, as long as you install the proper packages / dependencies!

Also important:
We will be starting OpenOffice in headless mode, which means no GUI. This should be started on boot up, and should just run in the background.

You don’t need to install all the OpenOffice packages if you don’t need them. We are mainly concerned with Word docs, so OoWriter is a must. We are running in headless mode, which means we don’t have a GUI to openoffice. So we can leave out a bunch of unnecessary packages.

- Here’s what we have installed:  1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 0.5-2.fc9 installed

If you need to convert Excel spreadsheets, ppt Powerpoint presentations to pdf, you will need to install the corresponding package (ie.,, etc.)

After you have these packages installed, be sure you have the soffice command. By default it is here:

Next, try to start up the service with this command:

$ /usr/lib64/ -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard &

#Note: the ampersand (&) allows the command to run in background so you get your shell back.
You can specify whichever port you would like. The -nofirststartwizard flag does exactly that.

Next step is to find a script (client) that can interact with this OpenOffice service.
A few options are:
1. dag’s unoconv (Available from yum)
2. PyODConverter – a cool Python script to do conversions
3. Write your own!

We chose to use PyODConverter. It’s simple to use:

$ example.doc example.pdf

Lastly, I mentioned that we want this soffice to start up everytime we reboot.

Simply add the line to your /etc/rc.d/rc.local

# Start up openoffice for fax conversion
$ /usr/lib64/ -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard

And there you have it. Hope that helps somebody. Happy Conversions!

Hint: If you are getting strange unintelligible errors about “URL seems to be an unsupported one”, it may be that you have not installed a necessary openoffice package. That’s how I discovered I needed OoWriter …

Written by Andrew Waage

September 17th, 2009 at 2:30 pm

7 Responses to 'OpenOffice Headless Mode Installation Word doc to pdf conversion'

Subscribe to comments with RSS or TrackBack to 'OpenOffice Headless Mode Installation Word doc to pdf conversion'.

  1. Have you used this inside rails?

    Chris P.

    22 Apr 10 at 11:49 am

  2. @chrisp Not directly – although you could call it from any Ruby / Rails script. Are you having problems using it w/ Rails ?


    22 Apr 10 at 1:36 pm

  3. Hi. Do you know what happens with concurrent requests for conversion? Does OO handle that, or would I have to manage the conversion queue myself?

    Thanks for the post.

    P.S. Is there a way to do this on Windoze as well using OO?


    27 Aug 12 at 9:12 pm

  4. @warwick – it’s been so long since I wrote this, but I believe you will have to manage the conversion queue yourself. I also have not tried with Windows, but as long as headless mode is supported, I would imagine it would work. Good luck!

    Andrew Waage

    28 Sep 12 at 11:52 am

  5. I’m unable to use the PyODConverter for conversions every time I try to execute it from the terminal I get a syntax error from the python file I downloaded on the very first line. I have a feeling it has something to do with the interpretation of the script but i’m not sure.

    As far as I can tell I have done no Editing to the original file I have downloaded @

    Kindly help me out


    7 Oct 12 at 7:56 am

  6. The error Just in case you need to see what it gives me

    ./ example.doc example.pdf
    ./ line 1: syntax error near unexpected token `newline’
    ./ line 1: `’


    7 Oct 12 at 7:57 am

  7. @Nick, it looks like the script doesn’t have the hashbang at the top that specifies to use the python interpreter.

    You might want to try running it like this:

    $> python example.doc example.pdf

    If you’re not familiar w/ the #! syntax (Hashbang), see this link for more info:

    Hope that helps!

    Andrew Waage

    7 Oct 12 at 11:44 am

Leave a Reply