[reportlab-users] Add Logo JPG

Brandon Rich brich at caseta.com
Fri Feb 15 11:03:13 EST 2008


I am trying to add a JPG file as a logo to my first page only. I
currently have this code that outlines what the first page looks like,
but can't seem to add the JPG on. Im not sure if this is where it needs
to be added, or if I need to go in another direction. Can someone help
with what needs to be done to add this picture? I currently have set
the picture up in a constants file and named it LOGO_PICTURE.

Thanks

def firstPage( self, canvas, doc ):

canvas.saveState()
#Header

canvas.setFont(PAGE_FONT, FONT_SIZE_SIXTEEN)
canvas.drawCentredString( PAGE_WIDTH/TWO,
PAGE_HEIGHT-(QUARTER_INCH), LETTER_TITLE)
canvas.line(HALF_INCH, PAGE_HEIGHT-(QUARTER_INCH),
PAGE_WIDTH-(HALF_INCH), PAGE_HEIGHT-(QUARTER_INCH) )
canvas.setFont(PAGE_FONT, FONT_SIZE_EIGHT)
canvas.drawCentredString( PAGE_WIDTH/TWO,
PAGE_HEIGHT-(HALF_INCH), LETTERS_ADDRESS)
#Footer
canvas.setFont(PAGE_FONT, FONT_SIZE_NINE)
canvas.drawString(HALF_INCH, THREE_QUARTER_INCH, FIRST_PAGE)
canvas.restoreState()




More information about the reportlab-users mailing list