[reportlab-users] Keeping track of page breaks in tables

Andy Robinson andy at reportlab.com
Thu May 7 05:18:35 EDT 2009


2009/5/7 Robin Becker <robin at reportlab.com>:

> Is it actually the best strategy though? The reportlab doctemplate provides

> hooks to let you know when pages have changed so in the RL world you just

> slurp in the page from the PDF before allowing the rest of the story to be

> handled.


It's easy to have doctemplate hooks so you know the page numbers, but
if you need to know when a table begins and ends rendering then you
might want to write a custom 'notification flowable' and put one in
the story before and after your table. This would consume no space
and would just look at the canvas and record the page number. Or,
you could put it in the first and last table cells. Not tested but
something like....

class NotificationFlowable(Flowable):
def wrap(self, availWidth, availHeight):
return 0, 0
def draw(self, canv):
tellDinu(canv.pageNumber)

- Andy


More information about the reportlab-users mailing list