Html 如何使用python中的pdfkit库在页脚上方显示页脚行? 背景信息
我想使用以下Python代码生成pdf文件。它使用 生成的PDF如下所示。我所需要的只是上面的一行,这是一个页脚。 根据下面的站点,我可以使用属性Html 如何使用python中的pdfkit库在页脚上方显示页脚行? 背景信息,html,python-2.7,wkhtmltopdf,python-pdfkit,Html,Python 2.7,Wkhtmltopdf,Python Pdfkit,我想使用以下Python代码生成pdf文件。它使用 生成的PDF如下所示。我所需要的只是上面的一行,这是一个页脚。 根据下面的站点,我可以使用属性footer line在页脚上方添加一行页脚,但我不了解如何在python中实现它的语法 这个问题很简单 如何修改选项属性以包含页脚行 options = { 'page-size': 'Letter', 'margin-top': '0.5in', 'margin-right': '0.75in'
footer line
在页脚上方添加一行页脚,但我不了解如何在python中实现它的语法
这个问题很简单
如何修改选项
属性以包含页脚行
options = {
'page-size': 'Letter',
'margin-top': '0.5in',
'margin-right': '0.75in',
'margin-bottom': '0.5in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'footer-left': "This is a footer",
'footer-font-size':'7',
'footer-right': '[page] of [topage]',
'custom-header' : [
('Accept-Encoding', 'gzip')
],
'no-outline': None
}
显然,您只需添加属性并向其传递一个空参数 因此,对于
选项
属性,您只需添加'footer-line':''
因此,它变成了以下内容
options = {
'page-size': 'Letter',
'margin-top': '0.5in',
'margin-right': '0.75in',
'margin-bottom': '0.5in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'footer-left': "This is a footer",
'footer-line':'',
'footer-font-size':'7',
'footer-right': '[page] of [topage]',
'custom-header' : [
('Accept-Encoding', 'gzip')
],
'no-outline': None
}
如果有更好的方法,请让我知道天哪,谢谢!!我尝试了“页脚行”:“True”和“页脚行”:True,它们不起作用。非常感谢。
options = {
'page-size': 'Letter',
'margin-top': '0.5in',
'margin-right': '0.75in',
'margin-bottom': '0.5in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'footer-left': "This is a footer",
'footer-line':'',
'footer-font-size':'7',
'footer-right': '[page] of [topage]',
'custom-header' : [
('Accept-Encoding', 'gzip')
],
'no-outline': None
}