Forum


Replies: 4   Views: 4487
No output pdf with libreoffice
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by bloofi  · 08-04-2015 - 08:36

Hi, I'm using the corporate licence (version 4.5-ns). I have LibreOffice installed in /home/apache/LibreOffice-4.4.2/, i've set the method and path in phpdocxconfig.ini. I've also set the variable "temp_path" to /home/apache/phpdocx/tmp/ in this config file. When i run the sample_1.php (transformDocument) from CLI, it generates the PDF. Now, in my own application, i'm generating a docx from a template and store it in /home/apache/phpdocx/my_generated_docx.docx. Then, i'm calling transformDocument like this : $transform = new Phpdocx\Create\CreateDocx(); $transform->enableCompatibilityMode(); $transform->transformDocument("/home/apache/phpdocx/my_generated_docx.docx","/home/apache/phpdocx/my_generated_docx_result.pdf", null, array("debug"=> true)); When i run this code, it generates the docx file but it doesn't output the PDF (i also see a file like "documentXXXXXX" in the temp_path). I've added a debug line in TransformDocAdvLibreOffice.inc just before the passthru (line ~82) to see what command is actually executed : PhpdocxLogger::logger('EXECUTE : '.($libreOfficePath . ' --invisible --convert-to ' . $extension . ' ' . $docSource) , 'info'); which gives me something like this : /home/apache/LibreOffice-4.4.2/program/soffice --invisible --convert-to pdf /home/apache/phpdocx/my_generated_docx.docx and if i execute it myself in CLI, it does output the PDF correctly. So, i'm guessing it's a permission issue with apache (the server is running with apache user, and the CLI is in root) but i can't figure out which one. Do you have any ideas ? Here are some more details : - output log : [phpdocx_logger][INFO ] Importing styles from an external docx. [phpdocx_logger][INFO ] Set DOCX name to: /home/apache/phpdocx/my_generated_docx. [phpdocx_logger][INFO ] Set DOCX name to: /home/apache/phpdocx/my_generated_docx. [phpdocx_logger][INFO ] Remove existing template tags. [phpdocx_logger][INFO ] Add word/document.xml content to DOCX file. [phpdocx_logger][INFO ] Close ZIP file [phpdocx_logger][INFO ] Copy DOCX file using a new name. [phpdocx_logger][INFO ] Set language: fr-FR [phpdocx_logger][INFO ] Enable compatibility mode. [phpdocx_logger][INFO ] EXECUTE : /home/apache/LibreOffice-4.4.2/program/soffice --invisible --convert-to pdf /home/apache/phpdocx/my_generated_docx.docx - apache error log : [error] [client 192.168.30.15] PHP Warning: rename(/home/apache/phpdocx/my_generated_docx.pdf,/home/apache/phpdocx/my_generated_docx_result.pdf): No such file or directory in /var/www/my_application/phpdocx_ns/Classes/Phpdocx/Transform/TransformDocAdvLibreOffice.inc on line 92, referer: http://192.168.30.15/ (i guess it can't rename because it doesn't find the pdf because it's not generated)