I am using pdfkit with python/django to convert rendered html to pdf. How can page numbers be added in the pdf liike page 1 of 4. I am converting html to string then passing it to from_string method of pdfkit.
To add to the above anwser
options = {
'margin-bottom': '0.75in',
'footer-right': '[page] of [topage]',
}
pdfkit.from_string('Hello World', 'out.pdf', options=options)
Will give the output 1 of 2
the following are the other variables can be substituted.
Adding options
should allow for creation of page numbers as follows:
options = {
'margin-bottom': '0.75in',
'footer-right': '[page]'
}
pdfkit.from_string('Hello World', 'out.pdf', options=options)
According to PDFKit's documentation you can use all of wkhtmltopdf's options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With