0
背景情報
次のPythonコードを使用して、pdfファイルを生成します。それは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))
結果のPDFは次のとおりです。私が必要とするのは、これ以上の行はフッターだけです。
は、以下のサイトにによると、私は属性footer-line
を使用してフッターの上にフッタ行を追加することができますが、私は、Python
でそれを実装する方法の構文を理解していませんよ
ブリーフ
での質問はどのようfooter-line
を含めるようにoptions
属性を変更しますか?
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
}