[reportlab-users] how to: set image as a background and how to get page number in "onPage" function

Park park at zes-thailand.com
Mon Dec 1 20:22:40 EST 2008


hi,

I have a problem with setting an image as a background. Has reportlab
any functions support on that? Do u have any ideas about that?

Also, for the page number, with this code:
---------------------------------------------------------------------------

doc.addPageTemplates([PageTemplate(id='OneCol',frames=frameT,onPage=foot2), PageTemplate(id='TwoCol',frames=[f1,f2],onPage=foot2)])


def foot2(canvas,doc):
canvas.saveState()
canvas.setFont('Times-Roman',9)
canvas.drawString(inch, 0.75 * inch, "Page %d" % doc.page)
a = canvas.getPageNumber()
print "**************"
print "Page Number = " + str(a)
canvas.restoreState()

----------------------------------------------------------------------------

how can I match page number with the contents cuz i wanna do table of
contents and I dun have any idea about that. Can i add more 'story'
variable into 'foot2' function cuz I'll match the contents with page
number there.

Thx,
Big


PS: English is not my mother languages.



More information about the reportlab-users mailing list