Hintergrundinformationen
Ich habe den folgenden Python-Code, den ich verwenden möchte, um eine PDF-Datei zu generieren. Es verwendet die pdfkit library.Wie wird eine Fußzeile über der Fußzeile mit der pdfkit-Bibliothek in Python angezeigt?
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))
Das resultierende PDF ist wie folgt. Alles, was ich brauche, ist einfach eine Zeile darüber ist eine Fußzeile.
Nach der folgenden Website, kann ich eine Fußzeile über dem Fußzeile fügen Sie das Attribut footer-line
aber ich bin nicht zu verstehen, die Syntax, wie es in Python zu implementieren
die Frage in Kürze
Wie modifiziere ich das options
Attribut footer-line
aufzunehmen?
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
}