[reportlab-users] Help with BaseDocTemplate class

Adrián Ribao Martinez aribao at gmail.com
Fri Apr 3 08:22:35 EDT 2009


Hello, I have subclass of BaseDocTemplate named MyDocTemplate. I'm using it to overwrite the afterFlowable method.

Before doing this, I used the SimpleDocTemplate, so I was able to use onLaterPages and onFirstPage arguments.

Now I can't, and I need to achieve the same results using BaseDocTemplate.

So far I have:

class MyDocTemplate(BaseDocTemplate):
def __init__(self, filename, **kw):
self.allowSplitting = 0
apply(BaseDocTemplate.__init__, (self, filename), kw)
first_template = PageTemplate(id='First',frames=[Frame(2.5*cm, 2.0*cm, 17*cm, 25*cm, id='F2')], onPage=FirstPage)
template = PageTemplate(id='Normal',frames=[Frame(2.5*cm, 2.0*cm, 17*cm, 25*cm, id='F1')], onPage=Page)
self.addPageTemplates([first_template, template])

def afterFlowable(self, flowable):
...

What should I do to insert the FirstPage as first page? I want to get the same results as I got with SimpleDocTemplate.

Thank you!

--
Adrián Ribao Martínez


More information about the reportlab-users mailing list