Seafile Professional server supports previewing office/pdf documents online by converting them to HTML pages. You can follow the steps described on this page to use this feature. If you'd like to edit office files online, you can integrate Seafile with Microsoft Office Online server or LibreOffice online.

Install Libreoffice/UNO

Libreoffice 4.1+ and Python-uno library are needed to enable office files online preview.

On Ubuntu/Debian:

sudo apt-get install libreoffice libreoffice-script-provider-python

For older version of Ubuntu: sudo apt-get install libreoffice python-uno

On Centos/RHEL:

sudo yum install libreoffice libreoffice-headless libreoffice-pyuno

For other Linux distro: Installation of LibreOffice on Linux

Also, you may need to install fonts for your language, especially for Asians, otherwise the office/pdf document may not display correctly.

For example, Chinese users may wish to install the WenQuanYi series of truetype fonts:

# For ubuntu/debian
sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy

Install poppler-utils

The package poppler-utils is also required.

On Ubuntu/Debian:

sudo apt-get install poppler-utils

On CentOS/Red Hat:

sudo yum install poppler-utils

Enable Office Preview

  1. Open file seafevents.conf, in the OFFICE CONVERTER section:
    enabled = true
  2. After modifying and saving seafevents.conf, restart seafile server by ./ restart
  3. Open a doc/ppt/xls/pdf file on seahub, you should be about the previewing it in your browser.

Other Configurable Options

Here are full list of options you can fine tune:


## must be "true" to enable office/pdf file online preview
enabled = true

## How many libreoffice worker processes to run concurrenlty
workers = 1

## where to store the converted office/pdf files. Deafult is /tmp/.
outputdir = /tmp/

## how many pages are allowed to be previewed online. Default is 50 pages
max-pages = 50

## the max size of documents to allow to be previewed online, in MB. Default is 2 MB
## Preview a large file (for example >30M) online will freeze the browser.
max-size = 2

FAQ about Office/PDF document preview

  • Document preview doesn't work, where to find more information?

    You can check the log at logs/seafevents.log

  • My server is CentOS, and I see errors like "/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display", how could I fix it?

    This error indicates you have not installed the libreoffice-headless package. Install it by "sudo yum install libreoffice-headless".

  • How can I change max size and max pages of documents that can be previewed online ?

    1. Locate the OFFICE CONVERTER section in seafevents.conf.
    2. Append following lines to the section
      # the max size of documents to allow to be previewed online, in MB. Default is 2 MB
      max-size = 2
      # how many pages are allowed to be previewed online. Default is 50 pages
      max-pages = 50

Then, restart seafile server

cd /data/haiwen/seafile-server-latest/
./ restart
./ restart
  • Document preview doesn't work on my Ubuntu/Debian server, what can I do?

Current office online preview works with libreoffice 4.0-4.2. If the version of libreoffice installed by apt-get is too old or too new, you can solve this by:

  • Remove the installed libreoffice:
    sudo apt-get remove libreoffice* python-uno python3-uno
  • Download libreoffice packages from libreoffice official site

  • Install the downloaded pacakges:

    tar xf LibreOffice_4.1.6_Linux_x86-64_deb.tar.gz
    cd LibreOffice_4.1.6.2_Linux_x86-64_deb
    cd DEBS
    sudo dpkg -i *.deb
  • Restart your seafile server and try again. It should work now.

    ./ restart

results matching ""

    No results matching ""