[reportlab-users] headers and footers

Bryan belred at gmail.com
Mon Sep 15 13:55:56 EDT 2008


i'm having a really hard time finding information and an example of
how to add headers and footers using reportlab. i've read the
documentation and searched google for days now and i still have no
clue what to do. i would prefer to use the platypus way of coding if
i can. can someone please show me a working hello world example of
headers and footers?

this is what i have so far which isn't much.

---

frame = Frame(x1=0*inch, y1=0*inch, width=7.6*inch, height=10.9*inch)

mainPage = PageTemplate(frames=frame)

section_style = ParagraphStyle('Bullet',
fontName='Times-Bold',
fontSize=12,
leading=30,
leftIndent=85,
firstLineIndent=40,
alignment=TA_LEFT,
bulletFontName='Times-Bold',
bulletFontSize=12,
bulletIndent=85)

paragraph_style = ParagraphStyle('Normal',
fontName='Times-Roman',
fontSize=12,
leading=30,
leftIndent=85,
firstLineIndent=40,
alignment=TA_JUSTIFY)

story = []


section = '<bullet>I.</bullet>INTRODUCTION'
paragraph = 'Paragraph...'

story.append(Paragraph(section, section_style))
story.append(Paragraph(paragraph, paragraph_style))
story.append(Paragraph(paragraph, paragraph_style))

buf = StringIO()
BaseDocTemplate(buf, pagesize=portrait(letter),
pageTemplates=mainPage, leftMargin=72,
title='Title', author='Author', showBoundary=0).build(story)

open('report.pdf', 'wb').write(buf.getvalue())


thanks,

bryan


More information about the reportlab-users mailing list