salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

SuiteCRM 7.14.3 PDF Template Landscape orientation is ignored when using the Legacy MPDF Engine #10376

Closed CommuniG8 closed 1 month ago

CommuniG8 commented 3 months ago

If the Admin PDF Settings is set to use the Legacy MPDF Engine and a PDF Template with Orientation Landscape checked is used, the PDF is generated as Portrait, as if Orientation had been set to Portrait. The orientation works correctly using the TCPDF Engine.

Expected Behavior

The PDF should be generated in Landscape orientation when Orientation Landscape is checked in the PDF Template.

Actual Behavior

The PDF is generated in Portrait orientation regardless of the Orientation setting in the PDF Template.

Steps to Reproduce

  1. In Admin PDF Settings, set the Engine to MPDF
  2. Generate a PDF (from any module that supports this) where the Template has Orientation Landscape
  3. The generated PDF is in Portrait orientation

Context

We have a number of PDF templates with enough columns to need a Landscape Orientation. We cant use the new TCPDF Engine due to the current issues with formatting a large number of columns.

Your Environment

serhiisamko091184 commented 3 months ago

Hello @CommuniG8!

Thanks for raising this issue!

Regards, Serhii

gemartin21 commented 3 months ago

Hi @CommuniG8 ,

Thank you for highlighting this issue.

Support for mPDF lib had been dropped in version 7.12, due to MPDF's License no longer being compliant with AGPL3. Although mPDF is not removed on upgrades and we still left an option to fallback to it.

As custom work you could try to add an extension using a newer version of mPDF that is compatible with php 8. However we cannot include that in the core product due to the already referred license issues.

The team will be focusing of fixing the issue with TCPDF in a later release of SuiteCRM.

In the meantime, we will close this issue for the reasons mentioned above.

CommuniG8 commented 3 months ago

That is a pity as it means, currently, SuiteCRM has no means at all to produce a correctly formatted PDF in Landscape orientation.

pgorod commented 3 months ago

@CommuniG8 are you using the same mpdf.php that was part of SuiteCRM before this change (5.7.1, see here)? Or are you using a newer version? If it's different, you need to check if the constructor of the mPDF class was changed. The 'orientation' is one of the positional parameters passed into it.

The calling code is here, I believe.

CommuniG8 commented 3 months ago

@pgorod mpdf.php is 5.71 but without the constructor change. I changed the function, as in the link you gave, but it makes no difference.

chris001 commented 3 months ago

The newest version of mpdf supports php 8: https://github.com/mpdf/mpdf

pgorod commented 3 months ago

Ideally, someone who uses this should upgrade mpdf, adapt SuiteCRM to that new version, and make a PR here with those changes.

Then we would close that PR without merging (due to the licensing problems), but we could point people there is they want to use mpdf.