I am generating pdf from html string using pdfkit and wkhtmltopdf in python. Everything is working fine. But I need to specify different page marging for first page and rest of the pages. Is there any options to do this? Below is my code.
html = template.BuildHTML().buildhtml(data)
headerHtml = HeaderTemplate.BuildHTML().buildhtml(data)
footerHtml = FooterTemplate.BuildHTML().buildhtml(data)
options = {
'page-size': 'A4',
'orientation': 'Portrait',
'dpi': '600',
'margin-top': '50',
'margin-right': '10',
'margin-bottom': '40',
'margin-left': '20',
'--encoding': 'utf-8',
'--header-spacing': '2',
'--footer-spacing': '5'
}
add_pdf_header(options, headerHtml)
add_pdf_footer(options, footerHtml)
pdfkit.from_string(html, PdfFilePath, options=options)