PHP upgrade to Ver 8.0 breaks mPDF

Ubuntu Server 18.04 LTS
SuiteCRM 7.12.8
PHP 7.4 → 8.0

Updated PHP from 7.4 to 8.0 using ppa:ondrej/php. After the PHP upgrade the Legacy mPDF engine option was no longer available in the PDF Settings dropdown menu in the Admin panel and all PDF templates were broken. I’m guessing the version of mPDF on my system is not compatible with PHP 8.0 but am at a loss on a way forward. Any suggestions?

Switching PHP back to 7.4 fixed the issues but I need to resolve as PHP 7.4 is no longer maintained.

There was a mPDF deprecation in SuiteCRM recently, not related to PHP version…

Thanks for your reply.

If it isn’t related to the PHP version do you know why the mPDF Engine is available when using PHP7.4 but not visible under PHP8.0?

If there was a mPDF deprecation does that mean SuiteCRM is moving away from mPDF going forward? Should we be reformatting all of our PDF templates to be compatible with the TCPDF Engine? TCPDFs incompatibility with HTML and CSS makes reformatting a nightmare…

I don’t understand why the PHP change is relevant. Maybe it’s just the fact that the deprecation changed some code and introduced a bug? I don’t know.

Try searching for that PR on Github, I think there is a “manual override” that let’s you keep using mPDF…

I’m looking for the “manual override” to let us use mPDF, but can’t find it. Can anyone point me in the right direction? (using 7.12.8)

You guys are using old versions…

Is this PR already included in your version?

I’m using a current SuiteCRM version (7.12 ESR) from November 2022 and the mPDF comparability issue with PHP 8.0 is not resolved. If I switch from PHP 7.4 to PHP 8.0 the mPDF engine is no longer available using the drop down menu in the Admin panel.

Exactly which 7.12.x?

And is that PR in your installation or not?

I have fresh (bitnami) installs of 7.12.8 and 8.2.1
Neither have an option for mPDF from the Admin panel.
They are fresh installs, but I don’t know how to tell if they have the PR, other than manually checking some of the code, which does look like it includes the PR.

Version 7.12.8 ESR

PHP 7.4 provides the mPDF dropdown. Switching to PHP 8.0 and mPDF is no longer an option using the dropdown.

This could be a clue. With PHP 8.0, does any error appear in one of the two logs when that screen is being built? The screen that shows the dropdown.

I don’t see any errors.
I just loaded a fresh 7.12.5 with PHP 7.4.28, but don’t have mPDF in the dropdown.
Does mPDF have to be installed or allowed somewhere before it will show up on the Admin/PDFSettings dropdown?

Hello @CRMSigns
I went back and installed a fresh stack with 7.12.1 and PHP 7.4 and still don’t see mPDF as an option.
Is your 7.12.8 ESR a fresh stack? Did you make any changes other than downgrading to PHP 7.4?

Has anyone else seen mPDF as an option?

I’ve now tried four different versions… Not sure what I’m doing wrong.

@pgr Do you have access to the admin panel of the online demo ( Is mPDF available there?

I think it is expected that mPDF is deprecated, it doesn’t appear. But I think it’s still there and can probably be re-enabled.

Try examining the changes in that PR. I see there seems to be a config setting:

        'pdf' => [
            'defaultEngine' => 'TCPDFEngine'

And check the logic that selects the engine (TCPDFEngine/MPDFEngine) in PDFWrapper.php

mPDF is only available if you upgrade an older version of SuiteCRM to 7.12.
It is not installed on fresh install.

1 Like

To validate what you’ve said here, yes the code is written that way:

The highlighted text pulls out the mPDF option from the available PDF Engines if PHP version is 8.0+

I’m not sure if that’s because of dependency issues or other tests that proved instability or vulnerabilities with the mPDF engine with PHP8+, but this was written into the code in the commit that @pgr shared, “Implement TCPDFEngine”.

I don’t know all the details of this, but I would say that it will be quite some work to get mPDF working on the newer versions - it probably involves using a newer mPDF version than the one that the SuiteCRM code is ready for.

I would advise (if you don’t want to sponsor me to get my PowerReplacer sponsorware) that you invest in fixing any TCPDF problems that you have, instead.

This might help.

It should be possible to get TCPDF (the current only option for PDF templates rendering) to work fine and produce nice-looking PDFs…

1 Like

Excellent, thanks for the added info!

So it seems the decision to deprecate mPDF was likely based on newer technical requirements for PHP8+ being incorporated into the processing of PDF output within SuiteCRM. As an open-source product, I can see how it makes sense to maintain focus on one engine instead of spreading compatibility efforts among many.

1 Like