我正在使用此php wkhtmltopdf库来生成pdf。我还没有使用最新版本,但似乎没有对此问题进行任何改进。
使用整页背景图片,我遇到了以下问题:
问题:
page/pages
格式)截图:
PHP:
$pdf_options = array(
'binPath' => 'wkhtmltopdf-amd64',
'encoding' => 'UTF-8',
'dpi' => 96,
'margin-top' => '0mm',
'margin-right' => '0mm',
'margin-bottom' => '0mm',
'margin-left' => '0mm',
'footer-html' => $tmpDir.'/footer.html',
'header-spacing' => 0,
'footer-spacing' => -20,
'no-outline'
);
$page_options = array(
'disable-smart-shrinking'
);
$pdf = new WkHtmlToPdf($pdf_options);
$pdf->setPageOptions($page_options);
$pdf->addPage($tmpDir.'/body.html');
$renderPdf = $pdf->send();
页脚分页:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function pagination()
{
var vars = {};
var x = document.location.search.substring(1).split('&');
for (var i in x)
{
var z = x[i].split('=', 2);
vars[z[0]] = unescape(z[1]);
}
var x = ['frompage','topage','page','webpage','section','subsection','subsubsection'];
for (var i in x)
{
var y = document.getElementsByClassName(x[i]);
for (var j = 0; j < y.length; ++j)
{
y[j].textContent = vars[x[i]];
}
}
}
</script>
</head>
<body onload="pagination()">
<div id="pagination">
<span class="page"></span>/<span class="topage"></span>
</div>
</body>
</html>