某些网页wkhtmltopdf会截断PDF中的第一行:
线条的高度与其他线条相同:
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
width: 100%;
}
.row {
position: relative;
clear: both;
}
.field {
font-family: "Times New Roman";
font-size: 10pt;
background-color: transparent;
overflow: hidden;
word-break: break-all;
z-index: 2;
}
</head><body>
....
<div class='row'><div class='field' style='left:0.13cm;width:3.37cm;height:0.47cm;text-align:right;color:#000080;'>POS sale 136287</div>
</div>
<div class='row'><div class='field' style='left:3.68cm;width:1.82cm;height:0.47cm;'>30.01.2016</div>
</div>
<div class='row'><div class='field' style='left:5.55cm;width:4.45cm;height:0.47cm;'> Jaeostja </div>
</div>
<div class='row'><div class='field' style='left:10.03cm;width:2.53cm;height:0.47cm;text-align:right;'>0,15</div>
</div>
<div class='row'></div><div class='row'><div class='field' style='left:15.05cm;width:2.47cm;height:0.47cm;text-align:right;'>-26730,47</div>
...
要重现的完整html位于
https://github.com/wkhtmltopdf/wkhtmltopdf/files/491556/partialline2.zip
结果pdf位于https://github.com/wkhtmltopdf/wkhtmltopdf/files/491558/result.zip
如何用pdf显示整行?
我尝试添加
page-break-inside: avoid !important;
margin: 4px 0 4px 0; /* to keep the page break from cutting too close to the text in the div */
到avoid page break inside row of table
中描述的行和字段类但问题仍然存在。