headless OOo

OOo needs a display to run. The only way to run it without a real one is to substitute a Xvfb for a real display. There is a -headless command line option but it doesn’t do much useful for us. There is also -invisible to avoid any visual window and dialogs to be created but a display is nevertheless still required.

On the other hand we have a vcl plug architecture which allows swapping in different toolkit backends, so it’s not a big leap to put in a headless backend which just defaults to some things sufficiently good enough to not need to open a display connection but to still find local fonts. Useful for me for headless build system side tests, useful for others for web server backend document conversion.

And actually looking at the -headless option I see that this is what this is intended to do, i.e. to open a vclplug backend called svp which doesn’t exist for OOo. That does sort of imply that one exists for StarOffice [flawed differentiator thinking(?)].

Anyway, I’ve cooked up a quick and dirty pastefest headless patch to introduce a libvclplug_svp backend which works sufficiently well for me to get OOo to load and save documents to other formats (including pdf) from the commandline without a DISPLAY. e.g.

unset DISPLAY
/usr/lib/openoffice.org/program/soffice.bin -headless "-accept=socket,host=localhost,port=2002;urp;"

and run a command uno program against it to load and save documents to other formats including .pdf. Needs some work to remove cut and paste foo and investigation if the rest of the stubs need to be filled out.

3 Responses to “headless OOo”

  1. Mark Tolmacs says:

    Thank you for this patch! I think many of us, web developers and system administrators will benefit from this work as it makes life much easier(without X on our server). Thanks again!

  2. This sounds very interesting, but I can’t reproduce your example :
    $ unset DISPLAY
    $ /usr/lib/openoffice/program/soffice.bin -headless
    “-accept=socket,host=localhost,port=2002;urp;”
    /usr/lib/openoffice/program/soffice.bin X11 error: Can’t open display:
    Set DISPLAY environment variable, use -display option
    or check permissions of your X-Server
    (See “man X” resp. “man xhost” for details)

    OOo version : 2.4.0, more precisely
    Debian package openoffice.org-core 1:2.4.0-3+b1

    Do I need to compile my own version ?
    Is there a mean to know if my the binary has headless enabled ?

  3. Sorry for my previous post, I found the answer myself.
    (for Debian) you need to also install the package : openoffice.org-headless

Leave a Reply