[reportlab-users] multiple frames on one page

Robin Becker robin at reportlab.com
Fri Aug 21 08:19:42 EDT 2009


Arkadi Colson wrote:

> Hi all,

>

> I'm having a problem with frames and pagetemplates. As you can see in

> the code below I would like to have 2 frames on the first page but only

> one frame(the first one:Fcover) is showing. Because the complete file is

> quite big I only included parts of the code. I hope this is ok for

> trying to locate the problem.

>

.......
Not sure what's wrong if anything with your code. It's too comlex/incomplete to
get any idea of where things are going wrong.

Did you start from a working example?

This code


##########################################################
class ssDocTemplate(BaseDocTemplate):
_invalidInitArgs = ('pageTemplates',)

def __init__(self, filename, **kw):
frame1 =
Frame(85*mm,30*mm,125*mm,55*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover',showBoundary=1)
frame2 =
Frame(10*mm,20*mm,100*mm,50*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover2',showBoundary=1)

self.allowSplitting = 0
self.showBoundary = 1
apply(BaseDocTemplate.__init__, (self, filename), kw)
template = PageTemplate('normal', [frame1, frame2], ssOnPage)
self.addPageTemplates(template)

normalStyle = ParagraphStyle(name = 'normal')

story=[].append
BLAHS=('STARTUP','COMPUTERS','BLAH','BUZZWORD','STARTREK','PRINTING','PYTHON')
for x in xrange(20):
story(Paragraph(randomText('chomsky'),normalStyle))
story(Paragraph(randomText(BLAHS[x%len(BLAHS)]),normalStyle))
story=story.__self__

doc = ssDocTemplate('test_ssDocTemplate.pdf')
doc.multiBuild(story)
##########################################################

appears to work and you can see that the frames are actually overlapping.
--
Robin Becker


More information about the reportlab-users mailing list