I'm generating a pdf document using dompdf 0.6.0, and have a strange issue where a blank page is being created at the end. My (simplified) html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>PDF</title>
<style type="text/css">
@page{ margin: 0;}
.page{
width: 612px;
height: 792px;
overflow: hidden;
font-family: Arial, Helvetica;
position: relative;
color: #545554;
page-break-after: always;
}
</style>
</head>
<body>
<div class="page" style="background-image: url(page1.jpg);">
...
</div>
<div class="page" style="background-image: url(page2.jpg);"></div>
<div class="page" style="background-image: url(page3.jpg); color: white;">
...
</div>
</body>
</html>
The first three pages look amazing, but there is a blank page at the end. I've read dompdf is picky about nesting and compliance and such, but the html is super clean and checks out.
</body>
and</html>
tags, but actually by the newline that comes after the closing</div>
tag. Putting both the</body>
and</html>
on the same line as the last</div>
will also work. – Seneschal