Forum


Replies: 3   Views: 55
Docx to pdf conversion on windows server with libreoffice

Posted by skilltran  · 14-10-2020 - 16:45

I'm trying to get Docx to Pdf converson working on a Windows 2016 server with LibreOffice. Running check-conversionplugin.php gives me the error 'Unable to read libreoffice main executable in the path. Please check the correct path has been added in config/phpdocxconfig.ini' 

:LibreOffice is installed on version 6.4.6 and working. The path I am using is: path = '"C:\Program Files\LibreOffice\program\soffice.exe"' Taking this path and putting it into file explorer opens LibreOffice like you would expect. No idea what's going on.

Thank you

Posted by admin  · 14-10-2020 - 16:56

Hello,

check-conversionplugin.php uses is_readable (https://www.php.net/manual/en/function.is-readable.php) from PHP to check if it can access the main soffice exec.

Please check your server logs and follow the steps explained on https://www.phpdocx.com/documentation/conversion-plugin/debugging-libreoffice to debug it. We recommend you to test it using PHP CLI, to check if the problem comes from the path or the web server that is blocking PHP to read external or executable files.

Regards.

Posted by skilltran  · 16-10-2020 - 19:05

Ok, I got the path issue fixed. Now I'm having an issue with finding the 'config folder of the user's HOME directory' like it says in the link you sent. I have no idea where that is suppoed to be on windows. The project I am working on is usualy run on an apache server, and on there the pdf conversion is working. I can't find the config folder on the apache server either, but It works there. Converting to docx works on the windows machine, just not the converson into pdf. The error I get is this:

rename(C:\OBWeb\reportcache/SkillTRAN-0d13d705af68dd09d5d46c4618630bfe.pdf,C:\OBWeb\reportcache\SkillTRAN-0d13d705af68dd09d5d46c4618630bfe.pdf): The system cannot find the file specified. (code: 2) in C:\OBWeb\rpcl\phpdocx\classes\TransformDocAdvLibreOffice.php

Posted by admin  · 17-10-2020 - 07:20

Hello,

The rename error appears when the conversion can't be done, it's a generic error. The .config folder is available only in Linux OS (https://wiki.documentfoundation.org/UserProfile/en)

On https://www.phpdocx.com/documentation/conversion-plugin/common-problems-and-possible-errors you can read specific issues for each OS. As requested in our previous reply, please follow the steps explained on https://www.phpdocx.com/documentation/conversion-plugin/debugging-libreoffice (1st and 2nd in your case), are you able to do the conversion running LibreOffice directly as the first step details? does it work using PHP CLI mode? If the transformation can be done using the previous approaches (calling LibreOffice and PHP CLI), the problem comes from some missing permission or setup, what web server are you using?

Regards.