How can i enable preview for office documents?

Thank you @anon99252149

I have added

6 => 'OC\\Preview\\Movie',
7 => 'OC\\Preview\\OpenDocument',
8 => 'OC\\Preview\\Font',

to config.php.
After executing

occ preview:pre-generate

nothing happens.

Therefore i executed

occ preview:generate-all

again.

But neither Open Office documents nor movies (i.e. nextcloud,mp4 of skeleton folder) are working.

Only TTF files does work with preview app.

You have to install FFmpeg or avconv on your server to use movie preview.

Yes, of course!
Thank you.
:slight_smile:

Now just the initial question is open:

How can i enable previews for OpenOffice documents?

7 => 'OC\\Preview\\OpenDocument',

is obviously not enough. What is missing?

A Documents app or an installed OpenOffice/LibreOffice instance on the server.

I have the docker container with collabora installed, is there a way to tell the docker container to create the preview pictures?

Setting Collabora is a whole new question. It is a whole collaboration suite and it needs more configuration. It is not only for previewing documents, Collabora opens them for editing online.

Look for this specific question in the forum search engine. There are some good answers.
In my experience, running on Debian 8.0, I had to set the docker container to use device mapper instead of aufs.

Hi,

I did this. LibreOffice is installed. Paths in the config are set. However whenever I click an OpenDocument or Microsoft Document still nextcloud is only downloading the file. What am I missing?

The office app, like Collabora.

Hi, I would like to know the answer to this too…I’m in exactly the same position, been at it for a couple of days searching here and google but just can’t work it out…
At the very least can someone PLEASE explain how to go about debugging the Preview Generator app itself, because nothing is being logged inside Nextcloud Settings -> “logging”

NB: I,m very new to all this, but surely you shouldn’t need something like Collabora to use the Preview Generator as Sanook suggested?

regards
J

call it with parameter -vvv

Collabora is not necesarry just for preview generator. For that purpose you need Libreoffice installed on the server.

HI
" Throw an eye on this installation guide: https://www.allerstorfer.at/nextcloud-install-preview-generator/ "
That is the exact link I am following and it does not work for me, all MS Office files and .odt files begin to download instead of previewing. Note the initial install has .odt (Open document format) that file is what I’m also testing. PDF files also end up downloading… The videos play back just fine as well as .txt, image files i.e the usual formats any modern browser can handle.

The NextCloud Application launches after booting, I can access the command line at that point. And I usually then open a Firefox browser and apply the host URL to reach the Application GUI.

As I mentioned I’m a newbie at this, I don’t understand the reference call it with -vvv,
What exactly would I type at the command line if Nextcloud is already running, please give an example?

regards
J

This is a screenshot of an example of a preview of an office document:

preview

If it want to download after clicking it, you don’t have Collabora installed

https://apps.nextcloud.com/apps/richdocuments

Everything is explained in the mentioned link above.

Hi

  1. I cannot find any mention “-vvv” when you visit this page link you suggested
    https://apps.nextcloud.com/apps/richdocuments.

  2. The image on that page is suggesting that I need Collabora, but my question is about previewing a file not editing it, with just Nextcloud and the Preview Generator.

  3. I’ll repeat my earlier question in case you missed it…
    " NB: I,m very new to all this, but surely you shouldn’t need something like Collabora to use the Preview Generator as Sanook suggested? "

  4. If you are absolutely sure that if you only want to PREVIEW files (.doc, .xls, .odt etc) in the browser without the need to edit, that you have to install an application like Collabora… in order to get the Preview Generator working… Then I won’t be using the application until a quick and simple preview plugin capability becomes available.

The reason for preview and not download has many benefits and is necessary for many reasons…
a) Reduce the bandwidth used time taken to work- some hosts you pay extra for bandwidth usage, so if I have uploaded hundreds of files, some with different versions and weeks later, I want to check which file has a typo mistake I will then be forced to download each and every one before I find the file. Then I must make the change and then upload the file again.
Way too time-consuming.
b) Bloated setup - What if all I want is Nexcloud-PreviewGenerator and I want to contribute to the community about how I use Nextcloud… I wouldn’t want to if it weren’t quick and easy to install and re-install.
If I want a document manager, I could just use something like Wordpress with plugins and it would be downloadable just the same and just as easy to install-but like Nextcloud it has no Preview capability of its own.
However, The point is that I want to use Nexcloud!

So please be clear - does Nextcloud require an App like Collabora or Not just to preview files (.odt, .xls, .docx etc) ? :slight_smile:

  1. If not, all I want to do is get a working Nextcloud Plugin version of any type of “Preview generator” for only previewing (Microsoft and OpenDocument formats).

To that end, will some clever person please build an easy and quick installer PLUGIN for Nextcloud that allows previewing of these files, so I can begin moving away from storing files on Google and Microsoft… Pretty please :slight_smile:
Ps: I’m on Nextcloud version 13.0.5
regards
J

1 Like

Did this ever get resolved?
I would really like to have a document (docx, xlsx, and pptx) preview function by default when a user click on the file - read-only, full document (not just first page) - and an option (right click?) to open in editing mode with something like OnlyOffice. Plus of course the usual option to download.

ie I want the user to have to make a conscious choice to edit the file, but to be able to view it easily.

How can I achieve this?

Yes, everything is explained in the link mentioned above.

Do you mean this link: https://apps.nextcloud.com/apps/richdocuments ?

That is simply about Collabora which is a full collaborative editing solution for up to 20 simultaneous users (like OnlyOffice but much less good looking with a very old school layout and an intrusive default formatting pane obscuring comments in the file).
What is needed is a Read Only solution (not an editor) that can work for hundreds of users simultaneously wanting to read documents - maybe 100 all looking at the same document plus another 100 looking at 100 different documents.
Most of the users would have read/write rights in the folder where the document is but they merely want to view.
If they want to edit then OnlyOffice (or Collabora) is an option for up to 20 of them, which is fine.

It is reading of docs (and spreadsheets & presentations) which is required as a default when a user clicks a file. No editing. Like with the PDF preview app.

A workaround is to always have users save/upload their files in PDF as well as DOCX format so that someone wanting to read clicks the pdf file and someone wanting to edit downloads the docx, edits offline and reuploads the docx and a fresh pdf - cumbersome.

@ananse did you ever find a solution

No, that one here: https://www.allerstorfer.at/nextcloud-install-preview-generator/

Ah, maybe I misunderstood. I thought that app just generated preview images up to 1024x1024px - so for a document just the first page.
Does it actually generate a full page preview of every page? Is it generating an image file, in which case there would be no searching within the text? or does it actually create a pdf or something which enables the whole doc to be read?

I first installed nextcloud-20.0.11-1.v7.noarch via yum onto a system running ClearOS 7.9.1 (based on CentOS 7.9 which is based on RHEL 7.9). After setting up Nextcloud and uploading some XLS, XLSX, PPT, PPTX, DOC, DOCX, ODS, ODP, ODT files I tried to view them in the Nextcloud iPadOS app but I got an error:
Error
Failed to open the requested file.

I installed LibreOffice via yum. There were heaps of LibreOffice rpms when I used yum search libreoffice, I first tried:
yum install libreoffice-calc libreoffice-impress libreoffice-writer

After testing again and getting the same error I next tried:
yum install libreoffice

As a result of those two commands the following libreoffice packages were installed:
libreoffice-5.3.6.1-25.el7_9.x86_64
libreoffice-base-5.3.6.1-25.el7_9.x86_64
libreoffice-calc-5.3.6.1-25.el7_9.x86_64
libreoffice-core-5.3.6.1-25.el7_9.x86_64
libreoffice-data-5.3.6.1-25.el7_9.noarch
libreoffice-draw-5.3.6.1-25.el7_9.x86_64
libreoffice-emailmerge-5.3.6.1-25.el7_9.x86_64
libreoffice-graphicfilter-5.3.6.1-25.el7_9.x86_64
libreoffice-gtk2-5.3.6.1-25.el7_9.x86_64
libreoffice-gtk3-5.3.6.1-25.el7_9.x86_64
libreoffice-impress-5.3.6.1-25.el7_9.x86_64
libreoffice-langpack-en-5.3.6.1-25.el7_9.x86_64
libreoffice-math-5.3.6.1-25.el7_9.x86_64
libreoffice-opensymbol-fonts-5.3.6.1-25.el7_9.noarch
libreoffice-pdfimport-5.3.6.1-25.el7_9.x86_64
libreoffice-pyuno-5.3.6.1-25.el7_9.x86_64
libreoffice-ure-5.3.6.1-25.el7_9.x86_64
libreoffice-ure-common-5.3.6.1-25.el7_9.noarch
libreoffice-writer-5.3.6.1-25.el7_9.x86_64
libreoffice-x11-5.3.6.1-25.el7_9.x86_64

After testing again and getting the same error I next tried editing the /etc/nextcloud/config.php file and adding the following:

  'enable_previews' => true,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enabledPreviewProviders' => [
        'OC\Preview\PNG',
        'OC\Preview\JPEG',
        'OC\Preview\GIF',
        'OC\Preview\HEIC',
        'OC\Preview\BMP',
        'OC\Preview\XBitmap',
        'OC\Preview\MP3',
        'OC\Preview\TXT',
        'OC\Preview\MarkDown',
        'OC\Preview\OpenDocument',
        'OC\Preview\Krita',
        'OC\Preview\MSOffice2003',
        'OC\Preview\MSOffice2007',
        'OC\Preview\MSOfficeDoc',
  ],

After still getting the error I tried editing the /etc/nextcloud/config.php file and adding the following:

  'preview_office_cl_parameters' =>
        ' --headless --nologo --nofirststartwizard --invisible --norestore '.
        '--convert-to png --outdir ',

But I’m still unable to preview office documents in the Nextcloud app. I can preview PDF files. What am I missing?

I am having the same problem after upgrading to Nextcloud 24. Did you ever resolve this?