Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page break inside: 'avoid' can cause table background to be copied to previous page #570

Open
RyanDwyer opened this issue Nov 28, 2017 · 1 comment · May be fixed by #604
Open

Page break inside: 'avoid' can cause table background to be copied to previous page #570

RyanDwyer opened this issue Nov 28, 2017 · 1 comment · May be fixed by #604

Comments

@RyanDwyer
Copy link

I found this bug / would like to have this new functionality

When you have markup like this:

<table>...</table>

<div style="page-break-inside:avoid">
    <table bgcolor="red">...</table>
</div>

...and mPDF decides to move the page break div to a new page, the previous page will contain the background color of the table which was moved to the new page.

The first table is required for this bug to present itself.

This is mPDF and PHP version and environment (fpm/cli etc) I am using

mPDF 7.0.2
PHP 7.0.25

This is a PHP code snippet I use

<?php
require 'vendor/autoload.php';

$mpdf = new Mpdf\Mpdf;

$before = str_repeat('<p>Before</p>', 20);
$after = str_repeat('<p>After</p>', 10);

$html = <<<HTML
    $before

    <table>
        <tr>
            <td>Normal table cell</td>
        </tr>
    </table>

    <div style="page-break-inside:avoid">
        <table>
            <tr>
                <td bgcolor="red">Red table cell</td>
            </tr>
        </table>

        $after
    </div>
HTML;

$mpdf->writeHtml($html);
$mpdf->output();

Example of incorrect rendering

image

@JoseCorralesN
Copy link

Why this solution is not added yet to main branch? it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants