Wednesday, 27 January 2021

Different headers for different pages - Weasyprint PDF Generation

I am using Weasyprint library (version - 52.2) in Python to generate PDF. The following documents helps to add common header/footer for all the pages in the pdf.

https://weasyprint.readthedocs.io/en/stable/tips-tricks.html https://gist.github.com/nathandem/63f410d501d200cfa5613b38aaf74c44

The code calculates the height of header, footer ,and body and then it adjusts the margin based on the header's height.

However, my use-case is slightly different. I have no header for Page 1 and need to add a common header for the subsequent pages. Is there a way to change the margin for the first Page alone?



from Different headers for different pages - Weasyprint PDF Generation

No comments:

Post a Comment