Replies: 4   Views: 5206
Blank pdf from created *.docx files (v3.7 pro)
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 Ian Bibo  · 09-07-2014 - 02:50

Hello Everyone, A bit of background first: our site has moved servers, under the previous set-up, everything worked well, both *.docx and *.pdf files were created. Our new set-up is essentially the same, but running in a virtual machine environment on a Microsoft Server, (I believe). Running the check.php, gives the OK for everything, and here is some of the information for the set-up: PHP_VERSION: 5.4.30 PHP_OS: Linux PHP_UNAME: Linux 2.6.32-431.17.1.el6.x86_64 #1 SMP Fri Apr 11 17:27:00 EDT 2014 x86_64 CODE: SERVER_NAME: SERVER_SOFTWARE: Apache SERVER_ADDR: SERVER_PROTOCOL: HTTP/1.1 HTTP_HOST: HTTP_X_FORWARDED_FOR: PHP_SELF: /phpdocx/check.php XSLTProcessor: 1 ZipArchive: 1 DomDocument: 1 SimpleXMLElement: 1 Tidy: 1 IS_WRITABLE DEFAULT TEMP: 1 On our new server, the generation of *.docx is not a problem, I can add dynamic information with 'addTemplateVariable' and images (addTemplateImage) also and create a *.docx with no issues. Yet, when converting that file to a PDF, only the image is present, no text at all. The sever is running Centos 6.5. For testing purposes, SELinux is switched off. When trying to create a PDF from a link, the error log shows: sh: line 1: 30743 Aborted /var/www/html/portal/phpdocx/classes/../lib/OdfConverter/64/OdfConverter /I /var/www/html/portal/phpdocx_temp/tempDocX_53bc8dc533a5b.docx /O /var/www/html/portal/phpdocx_temp/tempOdt_53bc8dc535815.odt > /dev/null 2>&1 When running the same script from the command line, we get: [root@server] [/var/www/html/portal/phpdocx/classes]# /var/www/html/portal/phpdocx/classes/../lib/OdfConverter/64/OdfConverter /I /var/www/html/portal/phpdocx_temp/tempDocX_53bc8dc533a5b.docx /O /var/www/html/portal/phpdocx_temp/tempOdt_53bc8dc535815.odt [INFO][/var/www/html/portal/phpdocx_temp/tempDocX_53bc8dc533a5b.docx] Converting tempDocX_53bc8dc533a5b.docx into tempOdt_53bc8dc535815.odt Conversion succeeded [INFO][/var/www/html/portal/phpdocx_temp/tempDocX_53bc8dc533a5b.docx] Total conversion time: 00:00:02.2271800 Done. Any ideas on what might be the problem? (If any other / further information is required, please let me know.) Thanks in advance, Ian.

Posted by admin  · 09-07-2014 - 06:25

Hello Ian, Please run the included example, advanced/Transform.php in the 3.7 version, using the CLI mode and enabling the debug option in the method transformDocx. And post the output. Are you using LibreOffice or OpenOffice on your new server? Which version? Regards.

Posted by Ian Bibo  · 09-07-2014 - 23:36

Hello, From the advanced/Transform.php script, the following method was used: $docx->transformDocx('example_text.docx', 'example_text.pdf', null, array('odfconverter' => false, 'debug' => true )); The output was: [root@server] [/var/www/html/portal/phpdocx/examples/advanced]# php Transform.php PHP Warning: log4php: Configuration failed. Error loading configuration file: Comment not terminated Using default configuration. in /var/www/html/portal/phpdocx/lib/log4php/configurators/LoggerConfiguratorDefault.php on line 475 INFO - Create a temp file to use as initial ZIP file. DOCX is a ZIP file. INFO - Set language. INFO - Enable compatibility mode. INFO - Add text to word document. INFO - Set DOCX name to: example_text. INFO - DOCX is a new file, not a template. INFO - Remove existing template tags. INFO - Add word/document.xml content to DOCX file. INFO - Close ZIP file INFO - Copy DOCX file using a new name. Jul 10, 2014 8:51:34 AM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection connect INFO: connected Jul 10, 2014 8:51:36 AM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection disposing INFO: disconnected The two files, 'example_text.docx' and 'example_text.pdf' are created. The *.docx has the text added from the script. The *.pdf file is blank. We are using Apache OpenOffice v4.1.0 64-bit. Thank you for your help, Ian.

Posted by admin  · 10-07-2014 - 07:48

Hello, Please contact us: We'd like to check your server. Regards.

Posted by Ian Bibo  · 15-07-2014 - 05:00

Hello Everyone, This is now fixed - we overlooked installing some of the dependencies. The server runs RHEL 6, and we needed to install: perl-Archive-Zip perl-XML-LibXSLT Thank you for your assistance along the way. Regards, Ian.