[reportlab-users] Platypus headings

Saketh saketh.bhamidipati at gmail.com
Thu Dec 14 17:27:08 EST 2006


I am trying to create a page heading which is written onto each page.
However, I am having trouble drawing the header table before anything else
on the page. Instead of being a consistent header, everything except the
headers are drawn and then, on the final page, all of the headers are drawn
in sequence.

How can I draw the heading table at the top of each page?

Here is my attempt. (I have attached the module's full code, in case that is
necessary.)

def pageTemplate(self, canvas, doc):
PAGE_WIDTH, PAGE_HEIGHT = canvas._pagesize
canvas.saveState()
canvas.setFont('Times-Roman', 12)

# Draw page number
canvas.drawCentredString(PAGE_WIDTH / 2.0, inch / 2.0, "%d" %
doc.page)

# Create title paragraph
pTitle = Paragraph(self.title, 12, 0, style=styles["Normal"])
pHeader = Paragraph(self.roottext, style=styles["Normal"])

# Data for the header table
data = [(pTitle, pHeader)]

headertable = Table(data, colWidths=(4 * inch, 4 * inch),
style=self.headerstyle)

headertable.setStyle(self.headerstyle)
headertable.hAlign = 'LEFT'
self.story.append(t)

canvas.restoreState()

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20061214/fc358666/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: writer.py
Type: text/x-python
Size: 9534 bytes
Desc: not available
Url : http://two.pairlist.net/pipermail/reportlab-users/attachments/20061214/fc358666/attachment.py


More information about the reportlab-users mailing list