【发布时间】:2014-01-10 07:57:26
【问题描述】:
我正在使用 dompdf 0.6.0 生成一个 pdf 文档,并且遇到了一个奇怪的问题,即最后创建了一个空白页面。我的(简化的)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>
前三页看起来很神奇,但最后有一个空白页。我读过 dompdf 对嵌套和合规性等很挑剔,但是 html 非常干净并且可以签出。
【问题讨论】: