🌐 AI搜索 & 代理 主页
Skip to content

Background color missing on last page when using tocpagebreak #2159

@tptome

Description

@tptome

Guidelines

Description of the bug

I'm generating a PDF where a background-color is applied to the <body>, a TOC is created using tocpagebreak, and a colored <div> is added to each page. On the last page, the background color of <div> is missing. The previous pages work fine.

mPDF version

8.2.8

PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)

PHP 8.3, Apache

Reproducible PHP+CSS+HTML snippet suffering by the error

$html = "
<!DOCTYPE html>
<html>
    <body style='background-color: gray;'>
		<tocpagebreak>
		<tocentry content='Test1'>
		<div style='background-color: red;'>Test1</div>
		<pagebreak>
		<tocentry content='Test2'>
		<div style='background-color: red;'>Test2</div>
		<pagebreak>
		<tocentry content='Test3'>
		<div style='background-color: red;'>Test3</div>
    </body>
</html>";

$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML($html);
$mpdf->Output();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions