Help with Installing LibreOffice for use with Nextcloud PDF conversion

Nextcloud - 19.0.2

Hello Team,

I’m using the latest version of Nextcloud 19.0.2 and I’m testing an app that will allow for the automated conversion of Office Documents into PDF format. The notes on PDF conversion (Flow) are to install Libreoffice and update the config file to use the Libreoffice exectuable.

I’ve done some searching and found notes on Installing Libreoffice on Nethserver:

yum install libreoffice libreoffice-base libreoffice-core libreoffice-draw libreoffice-headless libreoffice-impress libreoffice-writer

Can anyone confirm if they’ve tried this PDF conversion Flow on Nethserver/Nextcloud and if installing Libreoffice as above would be all I need to do?

Thank you.

Did you try it? Do you have any problems?
At the moment I can’t test, but perhaps I can help with problems.

2 Likes

I tried it and it worked at least with txt and docx.

It’s enough to just install libreoffice, you don’t need to care about the dependencies:

yum install libreoffice

2 Likes

Hello @mrmarkuz,

Thank you for your helpful response. I’ve been delayed in trying this on my test nethserver. Couple of questions for you if I may.

As the topic suggests I’m trying to automate the creation of PDF documents from the workflow in Nextcloud where certain .docx files have a special tag on them. I’ve installed libreoffice on my test nethserver as per your suggestion. I confirmed the location of libreoffice using:

command -v libreoffice

being /usr/bin/libreoffice,

I updated my /usr/share/nextcloud/config/config.php file with the following line as per the PDF conversion documentation:

‘preview_libreoffice_path’ => ‘/usr/bin/libreoffice’,

To be safe I restarted my Nethserver.

I then configured a PDF Flow to look for Office Documents with my tag to create a PDF document.

I then went into a .docx document and made some changes to it and saved it. I expected the Flow to work but no PDF was created?

You mention you tried this and it worked for you? Did you try the PDF conversion from a .docx file and Nextcloud Flow converted it to a PDF for you?

Any advice on what I’m missing to get this working for me?

Thank you!

Hello @support_team,

I’m looking for direction on a post I found that may solve this problem for me in converting Office documents to PDF using Nextcloud PDF Flow. The following post:

Says the solution was as follows:

added a logline in Converter.php to print $exec and then manually run it as www-data user. The issue is not in the scope of this app nor in the scope of nextcloud.

The underyling problem is that libreoffice will be run with www-data user and it needs the directory ~/.cache/dconf/

Since the home-directory of www-data usually is /var/www which is owned by root, www-data can´t create the directory and libreoffice fails to convert.

So either:

sudo mkdir /var/www/.cache/dconf/
sudo chown -R www-data:www-data /var/www/.cache
sudo chown www-data:www-data /var/www

OR

change the home directory of www-data via passwd to somewhere else and create .cache/dconf/ there.

The first method probably has some security impacts whilest the second method probably has some stability impacts for software that relies on www-data home beeing /var/www

Could someone from support confirm which is the best or safest solution for me to proceed? Due to Nextcloud being on Nethserver are these instructions relevant or do they need to be modified to work with Nethserver?

Any advice you can provide would be greatly appreciated.

Thank you.

This wasn’t necessary in my test.

Yes, it worked.

Here are my flow pdf test settings:

I set the pdf flow in the global section and the personal section.

2 Likes

Thanks @mrmarkuz! You’ve led me in the right direction. Seems I need to have Flow configured in both Personal and Global to make it work?

It’s flakey though. I’m trying to create a PDF when an Office Document is created, uploaded, accessed or modified and has a specific tag assigned. Mostly our staff will be updating these documents (editing them) so I want a new PDF to be created and the old PDF to be deleted. Have you had any luck with that type of setup?

Thanks!

2 Likes

I stand corrected. It would appear that PDF conversion flow is working. I just need to be patient. Here’s the scoop:

As @mrmarkuz confirmed, installing libreoffice using:

yum install libreoffice

is what’s needed on Nethserver to allow Nextcloud to use it for the conversion.

No extra lines are required to be added in the config.php file after-all. And I was successful in creating a PDF conversion Flow rule in the global settings. In my testing I did not need a subsequent flow condition added to my personal flow.

It takes approximately 10+ minutes for the flow to execute but I was able to confirm that if I updated the Word document a new PDF would be created with the changes.

Awesome that this is working for us now! Thanks again for this forums help!!!

Is anyone aware of how to use Flow (maybe run script) to automatically copy these newly created PDF documents to another folder in Nextcloud? :slight_smile:

3 Likes