by Izertis

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.

Includes a 30 day guarantee
Try it Now

By clicking you consent to share your profile with the developer

#1859 - Install PDF functions

Closed Installation created by mpeet1 8 years ago

Hi, I've downloaded/uploaded the CDE components to my webserver as instructed and changed the config setting to point to that folder. The Generate PDF button appears but when I attempt to create a PDF i get a blank file. I have found the following in my server log files, any assistance greatly appreciated:

Server RHEL 6 PHP 5.4.45 Apache 2.2.15 Sugar 7.5.20 Pro

Jan 12 13:10:28 caster httpd: PHP Warning: filesize(): stat failed for /data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-26184603-6d7c-7fe6-bb8a-56946ed478a1.pdf in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 586 Jan 12 13:10:28 caster httpd: PHP Warning: readfile(/data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-26184603-6d7c-7fe6-bb8a-56946ed478a1.pdf): failed to open stream: No such file or directory in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 591 Jan 12 13:24:05 caster httpd: PHP Warning: filesize(): stat failed for /data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-f12a1655-2de2-d870-21d4-569471255bc5.pdf in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 586 Jan 12 13:24:05 caster httpd: PHP Warning: readfile(/data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-f12a1655-2de2-d870-21d4-569471255bc5.pdf): failed to open stream: No such file or directory in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 591 Jan 12 13:26:18 caster httpd: PHP Warning: filesize(): stat failed for /data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-90c46b21-8640-0e4f-a25e-56947200629b.pdf in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 586 Jan 12 13:26:18 caster httpd: PHP Warning: readfile(/data/web-data/cde-libreoffice-pdf/cde-root/home/GEN-90c46b21-8640-0e4f-a25e-56947200629b.pdf): failed to open stream: No such file or directory in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 591

  1. dharma member avatar

    Izertis Provider

    8 years ago

    Hi Marty,

    If you are installing the CDE component in this server instead Libreoffice is because your RHEL server is not a virtualised server (remember the 453 case). Is it MMR working well in this installation?, i mean, you can generate DOC documents correctly, can you?

    Please review that the CDE directory has the correct permissions in order the Apache server can access to the cde files.

    Regards,

    Anabel

  2. mpeet1 member avatar

    mpeet1

    8 years ago

    ARGGHHH apologies for that post, I thought our network guys had migrated to a non-virtual setup, wrong. My bad. So, to implement the PDF functionality we should install Libre Office to the virtual server and I should configure the LibreOffice working directory to point to the installation directory, yes?

    Thanks for your time and patience, apols for the mixup

    • dharma member avatar

      Izertis Provider

      8 years ago

      Yes, that is. And don't worry.

      Regards,

      Anabel

    • mpeet1 member avatar

      mpeet1

      8 years ago

      Hey Anabel, installed LibreOffice to /usr/lib64/libreoffice (default with package manager) I put that into the Libreoffice working directory setting in the Admin -> Mail Merge Reports config setting, ran a quick repair and rebuild and.............. the Generate PDF button/function is NOT available, any thoughts?

  3. mpeet1 member avatar

    mpeet1

    8 years ago

    Hey Anabel, read your documentation, option 1 entered the following path in the LibreOffice exe/binary path /usr/lib64/libreoffice/program/soffice

    Confirmed that the following generated the Generate PDF button, attempted to create, results were blank PDFs.. tested the Word document generation and it worked perfectly. Checked my server logs and found the following:

    Jan 14 13:46:43 caster httpd: PHP Warning: filesize(): stat failed for /data/web-data/sugar-production/document_templates/GEN-2e5bbc83-9e1e-b96c-e15f-56971a5a0e52.pdf in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 586 Jan 14 13:46:43 caster httpd: PHP Warning: readfile(/data/web-data/sugar-production/document_templates/GEN-2e5bbc83-9e1e-b96c-e15f-56971a5a0e52.pdf): failed to open stream: No such file or directory in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/G

    I checked the data/web-data/document_templates folder, it exists and has 755 rights for the apache owner and group

    Thanks for any help you can give me

    • dharma member avatar

      Izertis Provider

      8 years ago

      Hi Marty,

      Did you write the 'LibreOffice working directory' into the MMR configuration window? Also, you have to leave empty the 'LibreOffice cde" path.

      We had problems installing LibreOffice in Azure some weeks ago, into a Linux CentOs x64. Finally we got it:

      • Install LibreOffice headless:

        yum install libreoffice-headless.x86_64

      • Install Microsoft standar fonts

        wget -O msttcore-fonts-installer-2.6-1.noarch.rpm

        yum install curl cabextract xorg-x11-font-utils fontconfig

        yum localinstall msttcore-fonts-installer-2.6-1.noarch.rpm

      • It was neccesary to install the next to solve a Libreoffice bug

        yum install libreoffice-writer

      • To configure MMR in admin window: 'LibreOffice exe/binary path' (path to the libreoffice binary) 'LibreOffice cde path' (to leave empty) 'LibreOffice working directory' (e.i. '/tmp')

      We obtain it form http://diegolamonica.info/how-to-make-libreoffice-headless-to-work-on-centos-6-3/

      Important: the first time that we run MMR after a LibreOffice installation, MMR fails, but MMR started wording from the second time ...... we don't know why

      Hope this help you,

      Regards,

      Anabel

  4. rdouglas member avatar

    rdouglas

    8 years ago

    Hey Anabel, did the headless installation and still getting blank PDF's. We have tested the installation from the command line and it DOES convert DOCX/ODT files etc to PDF, however, does NOT from the Generate PDF button

    We get the following errors:

    Jan 19 09:57:42 caster httpd: PHP Warning: filesize(): stat failed for /data/web-data/sugar-production/document_templates/GEN-5e6c6df9-bf3e-9692-94cd-569d7b145716.pdf in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/Generate_Document.php on line 586 Jan 19 09:57:42 caster httpd: PHP Warning: readfile(/data/web-data/sugar-production/document_templates/GEN-5e6c6df9-bf3e-9692-94cd-569d7b145716.pdf): failed to open stream: No such file or directory in /data/web-data/sugar-production/modules/DHA_PlantillasDocumentos/G

    The pdf document specified is definitely NOT in the documents template folder...

    My working directory is /tmp CDE path is EMPTY binary/exe path is /usr/lib64/libreoffice/program/soffice

    Cheers

  5. dharma member avatar

    Izertis Provider

    8 years ago

    Hi Rob,

    We think that you have some permission problems in your system.... or you have the "exec" function inactive ¿?

    Please, download the zip TestPDF.zip from the next link: http://we.tl/Vf2HAE6ROO (it is a "wetransfer.com" link). That zip has to files: testPDF.php and testPDF.docx

    You must to copy that 2 files into the root directory of SugarCRM (where the config.php file is), then you must to run the testPDF.php file. To run the file, if your URL is, by example, http://url-instalation.com, you have to run http://url-instalation.com/testPDF.php

    This script will create a file called testPDF.pdf in the root directory of your instalation, and you will see in the screen the LibreOffice output.

    If the testPDF.pdf file is not created, please send us the LibreOffice output.

    Regards,

    Anabel

    • rdouglas member avatar

      rdouglas

      8 years ago

      Hey Anabel, process returns the following:

      "/usr/lib64/libreoffice/program/soffice" --headless --nologo --nofirststartwizard --convert-to pdf "testPDF.docx" --outdir "." Done !!! ... generated pdf in /data/web-data/sugar-production/testPDF.docx

      OUTPUT: Array ( )

      RETURN STATUS: 77

      however, as you mentioned, the PDF if NOT created, or at least I can't find it...

      Cheers

    • rdouglas member avatar

      rdouglas

      8 years ago

      Hey Anabel, I've just found the following errors in my /etc/httpd/logs/error_log, thought they might be of some use?

      [Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx [Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx [Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx [Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx

      [Wed Jan 20 10:21:25 2016] [notice] child pid 24500 exit signal Segmentation fault (11) :1: parser error : Document is empty ^ :1: parser error : Document is empty

    • rdouglas member avatar

      rdouglas

      8 years ago

      Our system admin has sorted the rights problem for your test script, it now generates the PDF and returns the following (see below) HOWEVER the process using your button STILL creates a blank pdf file, error in the etc/http/logs/error_log is as follow:

      mkstemp("/var/www/.execoooG4zS5F") failed: Permission denied :1: parser error : Document is empty

      "/usr/bin/libreoffice" --headless --nologo --nofirststartwizard --convert-to pdf "testPDF.docx" --outdir "." Done !!! ... generated pdf in /data/web-data/sugar-production/testPDF.docx

      OUTPUT: Array ( [0] => convert /data/web-data/sugar-production/testPDF.docx -> /data/web-data/sugar-production//testPDF.pdf using writer_pdf_Export [1] => Overwriting: /data/web-data/sugar-production//testPDF.pdf )

      RETURN STATUS: 0

  6. rdouglas member avatar

    rdouglas

    8 years ago

    UPDATE: got rid of the permissions error, still have the Document is empty error

    :1: parser error : Document is empty

  7. dharma member avatar

    Izertis Provider

    8 years ago

    Hi Rob,

    We think that you have problems with the mkstemp function.... but our plugin does not use this function.

    Your system admin must review it... It seems that mkstemp function is trying to create a temp file in a directory without permission...

    Please, look for solutions in google... by example look for: "mkstemp "--convert-to" Permission denied"

    The temp dir that MMR plugin uses is defined into $sugar_config['DHA_templates_dir']: please, don't change this directory. If you want you can review the GenerarInforme function into the modules/DHA_PlantillasDocumentos/Generate_Document.php file.....

    Regards,

    Anabel

  8. rdouglas member avatar

    rdouglas

    8 years ago

    Hey Anabel, what ever the problem was, it has gone away!!!! PDF's are generating and they look great, one more question? One of the areas we are using your component is for PDF Invoices/Quotes. We'd like to be able to generate a more meaningful file name from the default GEN-[SugarID].pdf that is currently the case, is there a helper file or some other facility that will allow us to create a dynamic generated name based on underlying fields in the record?

    Thanks for your time and patience

    • dharma member avatar

      Izertis Provider

      8 years ago

      Hey Rob,

      We will be able to add that functionality to the new version of the plugin, it is an interesting functionality that we don’t have now….. But the dynamic file name will be obtained from a new event in the calculated fields (ie by programming). We would add an example of how to use it in the file custom/modules/Opportunities/DHA_DocumentTemplatesCalculatedFields.php

      Regards,

      Anabel pdt. I am happy that the problem was gone away!!

  9. rdouglas member avatar

    rdouglas

    7 years ago

    Hi, I've just tried to use the Attach to Email function and have been presented with the 'There is no action by that name' The name of the action is ComposeGeneratedDocumentEmail, i'm assuming it should be in a login hook or entrypoint somewhere? Could you tell me where the file that contains the function is located and where/how I can replace it?

    Thanks for your time and patience

  10. rdouglas member avatar

    rdouglas

    7 years ago

    RE the above, sorted. Found the ComposeGeneratedDocumentEmail file and replaced in the custom/modules/Emails folder, all good now

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating
  • "The single biggest downfall of the community edition of SugarCRM or SuiteCRM is the lack of creating a report form a custom module for a single event...." - ian

    Read More Reviews