[reportlab-users] ActionFlowable usage
reportlab-users@reportlab.com
reportlab-users@reportlab.com
Wed, 12 Mar 2003 16:43:17 +0100 (CET)
Hi
I am discovering the excellent platypus and pdf package.
I wanted to print a dictionnary like header where the header is
the first word of the text printed on the page, and used
for this an ActionFlowable object, since as I understood onpage
hooks passed to pageTemplates cannot be datadriven.
it works but the documents prints everything on a single page
instead of moving forward.
here is what I did:
-----------------------------------------------
class report(BaseDocTemplate):
def handle_pageBegin(self,text=''):
self._handle_pageBegin()
self.canv.saveState()
my stuff print text
self.canv.restoreState()
then from time to time I add a
ActionFlowable(action=('pageBegin',text to print))
to the list of flowables
at the end I call
report().build(list of flowables)
if I do not append an ActionFlowable, everything prints fine
except of course my datadriven header.
If I inserts the ActionFlowables, everything prints fine
including my datadriven header, but all one a single page.
I insert the Action Flowable everytime I want to ensure the
header of the next page will be text passed to Actionflowable
constructor.
but it fails.... though I call the superclass pageBegin before
adding my stuff
anybody knows why ? or how to achieve data driven header ?
thanks
pascal