Mpdf: CSS `rem` unit seems to be broken in 7.0

Created on 24 Nov 2017  路  4Comments  路  Source: mpdf/mpdf

Hello,

I'm updating my application to be compatible with PHP7.2 (from 5.6), so I had to update to mpdf 7.
By doing this, I think I discovered a bug with the CSS rem unit.

Here's an example which works in 6.1.4 but doesn't in 7.0.2 (or 7.0) :

// 6.1.4
$mpdf = new \mPDF('utf-8', 'A4-L');
$mpdf->WriteHTML($html);
$mpdf->Output($file, 'F');

// 7.0
$mpdf = new Mpdf([
    'mode' => 'utf-8',
    'format' => 'A4-L'
]);
$mpdf->WriteHTML($html);
$mpdf->Output($file, Destination::FILE);

And the corresponding HTML :

<!doctype html>
<html lang="en">
    <body style="font-size: 14px;">
        <div>
            Hello world
        </div>

        <div style="font-size: 2rem;">
            Hello world
            <div style="font-size: 2rem;">
                Hello world
            </div>
        </div>
    </body>
</html>

In 6.1.4, the result is good with the last two "Hello world" twice as big as the first one.
But in 7.0, all three are the same size (14px).
If I replace rem to em in 7.0, the third is twice as big as the second, which is twice as big as the first.

I don't see in the docs that rem support has been droped in 7.0, so I think it's a bug. What do you think ?
Thank's by advance ;-)

bufix

Most helpful comment

I'm having the same issue.

All 4 comments

the same problem here

I'm having the same issue.

Having the same issue. It's been 9 months.

Fixed in v7.1.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

applibs picture applibs  路  4Comments

chaptan picture chaptan  路  4Comments

azbatuk picture azbatuk  路  4Comments

huglester picture huglester  路  5Comments

BernhardBaumrock picture BernhardBaumrock  路  3Comments