Create documents in docx, xlsx (MS Office Word and Excel), odt, ods (LibreOffice and OpenOffice) and pdf format without MS Office or others plugins installed from any module and subpanel using templates.
#1459 - Ubuntu: PDF generations fails
Server: Ubuntu Server 16 SuiteCRM 7.8.10 Mail-Marge-Reports extension: 2.5.1 (paid version) LibreOffice cde path: /var/www/html/crm-test/cde-libreoffice-pdf/libreoffice.cde LibreOffice working directory: /var/www/html/crm-test/cde-libreoffice-pdf/cde-root/tmp (Apache user may write) HOME variable: /root
I am trying to create a PDF document from an uploaded docx-template.
It works to create a DOCX file from the template. It does NOT work to create a PDF file from the same record and using the same template.
suitecrm.log shows: Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - Path env before: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - Path env after: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - file_name: /var/www/html/crm-test/cde-libreoffice-pdf/cde-root/home/GEN-6d8633c9-4011-aeed-ed60-5bb520f7f1ff.docx Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - file_name_sandbox: GEN-6d8633c9-4011-aeed-ed60-5bb520f7f1ff.docx Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - file_name_pdf: /var/www/html/crm-test/cde-libreoffice-pdf/cde-root/home/GEN-6d8633c9-4011-aeed-ed60-5bb520f7f1ff.pdf Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - pdf_command: /var/www/html/crm-test/cde-libreoffice-pdf/libreoffice.cde --headless --nologo --nofirststartwizard --convert-to pdf /home/GEN-6d8633c9-4011-aeed-ed60-5bb520f7f1ff.docx --outdir /home Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - pdf_command - return_output: Array ( )
Wed Oct 3 22:01:41 2018 [27791][1][DEBUG] PDF - pdf_command - return_var: 127
I find it surprising that the PDF generating command seems to insist on using /home (Apache user does not have write permission to this directory) instead of the configured LibreOffice working directory. On the other hand, this behaviour seems to be hardcoded in /var/www/html/crm-test/modules/DHA_PlantillasDocumentos/Generate_Document.php: $pdf_command = $sugar_config['DHA_OpenOffice_cde'].' --headless --nologo --nofirststartwizard --convert-to pdf /home/'.$file_name_sandbox.' --outdir /home'; exec($pdf_command, $return_output, $return_var);
Why? And what can be done to overcome the problem?
Regards, Wolf
6 years ago
Sorry, Mail-Merge-Reports version should be 2.5.12 Premium.
6 years ago
Oh, well...
I manually changed that command to: $pdf_command = $sugar_config['DHA_OpenOffice_cde'].' --headless --nologo --nofirststartwizard --convert-to pdf /var/www/html/crm-test/cde-libreoffice-pdf/cde-root/home/'.$file_name_sandbox.' --outdir /var/www/html/crm-test/cde-libreoffice-pdf/cde-root/home';
Unfortunately, it didn't help. Generated PDF file is still empty (0 bytes).
Any pointers? I need to get this working until 12th of October... :-(
6 years ago
Further update: The issue is not that pressing anymore. I managed to get PDF generation going by installing the full LibreOffice Package from the Ubuntu repositories.
I do think, however, that 750 MB of storage space is a bit much for pure PDF generation. Besides I fundamentally dislike to install a fat application like LibreOffice on a server.
I believe now that the LibreOffice-CDE package is incompatible with the operating system. For future Linux users of your extension, I believe the limitations of the CDE option should be more clearly explained.
Regards, Wolf
6 years ago
Hi Wolf,
Cde package will no longer receive support, and will be removed from MMR in future versions. Please review the answer to the case https://store.suitecrm.com/support/mail-merge-reports/1461. There you can find instructions for the installation of LibreOffice headless (it's a lite installation of LibreOffice to be able to generate pdf).
"LibreOffice working directory" parameter is used only for "LibreOffice exe/binary path", not for "LibreOffice cde path".
Regards
6 years ago
Review also this case https://store.suitecrm.com/support/mail-merge-reports/1443. We have not testet already MMR with LibreOffice 6.0, but probably will work.