Reputation: 69
I am using ReportLab to generate a pdf. I have a one-row table t. I need add it at the beginning of each page. How I can do it?
Thanks
Upvotes: 1
Views: 150
Reputation: 570
You can use the onFirstPage
and onLaterPages
keyword arguments to the DocTemplate.build
function for this.
They are called during layout before the pages are drawn. You can pass any function with the following signature:
def myOnFirstPage(canvas, document):
...
def myOnLaterPages(canvas, document):
...
Use them with
doc = SimpleDocTemplate('file.pdf')
doc.build(story, onFirstPage=myOnFirstPage, onLaterPages=myOnLaterPages)
Upvotes: 1