Unable to generate PDF or Office Word Thumbnails

I have Nextcloud running on a headless Ubuntu Server 20.04, but I am having issues with getting previews to work.

I have configured the config file as shown below. I have also installed LibreOffice to the following directory: /usr/bin/libreoffice. Additionally, I have successfully set up an OnlyOffice server so the documents aer successfully opening, but still, previews don’t work. Previews are working for other things such as movies, pictures, etc.

‘enable_previews’ => true,

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

‘preview_office_cl_parameters’ =>
’ --headless --nologo --nofirststartwizard --invisible --norestore '.
‘–convert-to png --outdir /var/nextcloud/libreoffice’,

‘enabledPreviewProviders’ => array(
‘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\Movie’,
‘OC\Preview\MSOfficeDoc’,
‘OC\Preview\MSOffice2003’,
‘OC\Preview\MSOffice2007’,
‘OC\Preview\OpenDocument’,
‘OC\Preview\StarOffice’,
‘OC\Preview\Illustrator’,
‘OC\Preview\PDF’,
‘OC\Preview\Photoshop’,
‘OC\Preview\Postscript’,
‘OC\Preview\SVG’,
‘OC\Preview\TIFF’,
‘OC\Preview\Font’

),

Any assistance you might be able to provide would be incredibly helpful.

Thanks!

Enable verbose logging and check what is being logged when the system tries to generate a preview. The preview generation command is being executed by the web server user, e.g. www-data, and therefore you have to make sure that this user has the correct access rights to get the job done.

FYI, you know that enabling previews for office documents is a security nightmare, right?!