Unable to create PDF Report, error with Mpdf

Situation
We’re unable to create PDF for our patient’s report. When I click Download PDF, a new blank Unknown tab was created and that was it, no PDF file to download. I believe this is different from this PDF bug reported here.

I have these 4 lines in the custom_report.php file at line 60, but the problem persists. According to the log, the problem is in the patient_report.php file.

$config_mpdf['margin_top'] = $config_mpdf['margin_top'] * 1.5;                                                                                                                                         
$config_mpdf['margin_bottom'] = $config_mpdf['margin_bottom'] * 1.5;                                                                                                                                   
$config_mpdf['margin_header'] = $GLOBALS['pdf_top_margin'];                                                                                                                                            
$config_mpdf['margin_footer'] =  $GLOBALS['pdf_bottom_margin'];

OpenEMR Version
I’m using OpenEMR version 7.0.2 (2)

Browser:
I’m using: Firefox

Operating System
I’m using: Debian

Search
Did you search the forum for similar questions?
Yes

Logs

PHP Fatal error: Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void in /var/www/html/openemr/vendor/mpdf/psr-log-aware-trait/src/MpdfPsrLogAwareTrait.php on line 15, referer: https://XXX/interface/patient_file/report/patient_report.php
PHP Fatal error: Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void in /var/www/html/openemr/vendor/mpdf/psr-log-aware-trait/src/MpdfPsrLogAwareTrait.php on line 15, referer: https://XXX/interface/patient_file/report/patient_report.php

Updated: My PHP version is PHP 8.3.12.

1 Like

I’ve recreated this issue. I did not see it in my testing but after completely installing back to v6.1.0 and upgrading to patch 2 I now see the error! So I apologize to every one for missing in patch and I’m looking into for a fix, I hope soon.

1 Like

Hi @ninjatx @Goddard or any faxsms module users,
I’m going to publish an addendum patch to patch 2 with a fix to enclude this issue and any others I find today.
However, if you want a manual fix quickly you can delete this directory interface/modules/custom_modules/oe-module-faxsms/vendor/psr and log out and back in.

Please be careful to only delete the psr directory.

Again I apologize for missing this issue in patch.

3 Likes

The fix works great for me. Thank you very much for your swift response and solution!

1 Like

Absolute life-saver! Massive Thank You!

1 Like

Thanks to Jerry, I found and fixed this 10 minutes after staff reported the error.

1 Like

Hello and thanks for the reply. I was already on patch 2 still having the issue. I have updgraded to patch 3 and have the same error. I deleted or renamed the psr folder of the fax module and still have the issue. I will disable more modules when clinic is done and report back. It seems there is something else that prevents PDF download of reports from the patient dashboard. I can print the report but pdf download yields the error provided.

Fatal error : Declaration of Mpdf\PsrHttpMessageShim\Request::getRequestTarget() must be compatible with Psr\Http\Message\RequestInterface::getRequestTarget(): string in /var/www/xxxx/openemr/vendor/mpdf/psr-http-message-shim/src/Request.php on line 69

Removal of the psr directory did fix the miscellanious, blank forms, pdf file generation however.

Ok I fixed this one after figuring it out. I have the two way Text module installed and it has the psr folder in the vendor directory. I removed that one and the download reports works now. Im unsure if this affects the 2 way Texting but will report back.

Todd

@juggernautsei Is this your module? If so take note for future installs and patching. If not, sorry.

@sjpadgett , this is not a module issue. This is an issue with the reports page from the patient dashboard. I fixed mine by downgrading the Mpdf package to 8.1.0.

@juggernautsei Core is trying to use your psr note Todds fix by removing the psr directory in your module. Same happened to me. I didn’t use core ringcentral composer install was because I needed to patch rc client so I could get rc out in a patch. Will remove in next release.
Recommend you try using existing core dependencies where you can.
I can look over your module to see if possible if you want.
I think the why previous Mpdf works is because of the shim requirements are relaxed compared to current Mpdf. Too me, downgrading version will eventually need to be addressed.
Anyway, you still need to address doing a fix for all your other users and easiest way to me is to fix the same way I did for faxsms like Todd.
Still, glad we have the capability with your module, thanks.

I missed that. I will check it out and see. I have been adding a bunch of features and refactoring the code in that module. I have not released an updated version of that module.

I removed the PSR and the system still works. So, the PSR is not needed but I am with you as to why the core is trying to use the module PSR. I started this module back in v6.x.x. I created so that it had it own internal routing and namespace. I did that because of a comment that Stephen Neilson made about polluting the global namespace. He made that comment before creating the bridge for the module to join the global namespace. I am refactoring the module to join the global namespace and work with in the new framework of the modules eco system.

Adding the feature to text the appointment to the patient when it is entered on the calendar. The patient can reply with confirmed. The calendar will be updated with the confirmed status.

The monthly SMS balance messages are going out now (This is a separate module from the SMS). I was trying to have that module to be able to use either SMS module that is in the system. And there is more to come.

Cool. Meantime I’m trying to figure out why core acts in this way and not use core psr.

I had this blank page issue from time to time when i tried to print a report.
Asked OpenAI and it helped me solve the issue.
Each time it was the permission sissue.
now i have added the lines in crontab so each document and file created each day has the correct permissions.

*/55 * * * * find /var/www/html/open72/sites/default/documents -type f -exec chmod 755 {} \;
*/54 * * * *  sudo chown -R www-data:www-data /var/www/html/
*/53 * * * * sudo chown -R www-data:www-data /var/www/html/openemr/sites/default/documents
*/52 * * * *   sudo chmod -R 755 /var/www/html/openemr/sites/default/documents

You can try this too. Each time after the patch or file upgrade sometimes this error occured , Now it doesnt …