【发布时间】:2017-11-26 20:00:32
【问题描述】:
在我的 html 中,页脚不会在 pdf 中呈现...
<!DOCTYPE html>
<html>
<head>
<style>
footer{
background:#ccc;
position:absolute;
bottom:0;
width:100%;
padding-top:50px;
}
</style>
</head>
<body>
<footer>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
<p> test </p>
</footer>
</body>
</html>
不指定位置时有效...
要生成 pdf,我使用 pdfkit 和 python:
pdfkit.from_file(content_url, 'out.pdf', {
'--footer-html': footer_url,
'--footer-spacing': '10'
})
这是我在 content_url 中使用的内容
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p> content </p>
</body>
</html>
有什么帮助吗?
【问题讨论】:
-
给更多的代码,我们不能只用这个。
-
感谢回答,已编辑
-
您是否尝试过不同的定位,例如相对?并使用其他工具生成 pdf?这可能是pdfkit的一个错误,但我对pdfkit一无所知。这是您拥有的所有 html/css 吗?如果你遗漏了一些可能是相关的......
-
是的,无论我怎么做都无法定位页脚...我会尝试直接在 CLI 中使用 wkhtmltopdf 生成并随时通知您
标签: html css pdf wkhtmltopdf