Report PDF error (solved)

Situation
i cant download pdf reports

OpenEMR Version
I’m using OpenEMR version 7.0.2

Browser:
I’m using: firefox

Operating System
I’m using: linux, kde

Search
Did you search the forum for similar questions?
Yes, a lot, but nothing can help me

Logs

PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + float in /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php:6535\nStack trace:\n#0 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(16061): Mpdf\Mpdf->finishFlowingBlock()\n#1 /var/www/html/openemr/vendor/mpdf/mpdf/src/Tag/BlockTag.php(234): Mpdf\Mpdf->printbuffer()\n#2 /var/www/html/openemr/vendor/mpdf/mpdf/src/Tag.php(240): Mpdf\Tag\BlockTag->open()\n#3 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(13921): Mpdf\Tag->OpenTag()\n#4 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(12500): Mpdf\Mpdf->WriteHTML()\n#5 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(13447): Mpdf\Mpdf->_getHtmlHeight()\n#6 /var/www/html/openemr/interface/forms/LBF/printable.php(591): Mpdf\Mpdf->WriteHTML()\n#7 {main}\n thrown in /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php on line 6535, referer: http://localhost/openemr/interface/patient_file/encounter/forms.php

Someone can help me?

the 6535 line in the Mpdf.php file is:
$usey = $this->y + 0.002;

looks like we’ll need to bump that mpdf package version in composer.json to see if they’ve addressed that

you could put a band aid on it in your codebase for now and see if you can get by

$usey = floatval($this->y) + 0.002;

Hi stephen, thanks, i change $usey = $this->y + 0.002; to $usey = floatval($this->y) + 0.002;
i try again, and nothin, the new error log say:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php:6649\nStack trace:\n#0 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(16061): Mpdf\Mpdf->finishFlowingBlock()\n#1 /var/www/html/openemr/vendor/mpdf/mpdf/src/Tag/BlockTag.php(234): Mpdf\Mpdf->printbuffer()\n#2 /var/www/html/openemr/vendor/mpdf/mpdf/src/Tag.php(240): Mpdf\Tag\BlockTag->open()\n#3 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(13921): Mpdf\Tag->OpenTag()\n#4 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(12500): Mpdf\Mpdf->WriteHTML()\n#5 /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php(13447): Mpdf\Mpdf->_getHtmlHeight()\n#6 /var/www/html/openemr/interface/patient_file/report/custom_report.php(870): Mpdf\Mpdf->WriteHTML()\n#7 {main}\n thrown in /var/www/html/openemr/vendor/mpdf/mpdf/src/Mpdf.php on line 6649, referer: http://localhost/openemr/interface/patient_file/report/patient_report.php

and the 6649 line in mpdf.php say:
if (!$is_table && ($this->y + $check_h) > ($this->PageBreakTrigger + $buff) and ! $this->InFooter and $this->AcceptPageBreak()) {

I have and other pc with openemr 7.0.1, and the pdf download function works, this is a bug of the new 7.0.2? i try to use the pdf download fuction in the online demo 7.0.2, and doesnt works to.

it’s a bug, after this line in the custom_report script, insert these 4 lines

    $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'];  

will get this added to the next patch

1 Like

Perfect!!!, everything works, thank you very much

1 Like

i checked the file its already there and the error is still showing could you help me ?

Hi !
same situation on 7.0.2 just installed.
Works ok, on screen report but PDF download fails on blank page, no error log on screen

Any help ?

Greetings from PERU

hi , i just install openEMR again and its working

I hope in todays update/patch release this isssue is addressed.