0
背景信息
我有以下我想用来生成PDF文件的Python代码。它使用pdfkit library。如何使用python中的pdfkit库在页脚上方显示页脚行?
import pdfkit # import python module
if __name__=="__main__":
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
}
##this is the path of the whkhtmltopdf.exe in order for the library to
##work on a Windows OS
path_wkthmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
pdfkit.from_url('http://google.com', 'Report.pdf',options=options,configuration=config))
根据以下站点,我可以使用属性footer-line
添加一个页脚行页脚之上,但我不理解如何实现它在Python
语法
简要
问题如何修改options
属性包括: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-font-size':'7',
'footer-right': '[page] of [topage]',
'custom-header' : [
('Accept-Encoding', 'gzip')
],
'no-outline': None
}