[reportlab-users] Insert black background in doc header

Jim Steil jim at qlf.com
Mon Jun 4 11:50:17 EDT 2007


Robin Becker wrote:

> Jim Steil wrote:

>> Hi:

>>

>> I'm stumped on what is probably a very easy thing to do. I have a

>> document I have to create that has a black background on the header

>> of the document. It is approximately 1" high, starting at 1.5 inches

>> from the left border and running to about 1 inch from the right

>> border. The top is about an inch from the top border of the page. I

>> have a bunch of text to print in front of the black background, but

>> can't seem to figure out how to create the background. I see how I

>> can do it with tables, paragraphs and graphics, but they all require

>> a flowable (at least I think they do) to place them on. Can someone

>> help me out of my brain freeze by educating me on how I can get this

>> generated? I would like to build a graphic and place it there, but

>> don't know how to place it there. All of the samples I've seen in

>> the doc show how you can take a graphic and renderPDF.drawToFile, but

>> I want to specifically position it in my document.

>>

>> -Jim

> .......

> what framework are you using? If it's platypus then you can do drawing

> operations in the template onPage callback.

>

> That might be something like

>

> canv.saveState()

> canv.setFillColorRGB(0,0,0)

> canv.c.rect(inch,8*inch,6*inch,1*inch, fill=1)

> canv.restoreState()

>

Robin:

Thanks so much, that is exactly what I needed. Yes, I am using platypus.

Thanks Again!

-Jim


More information about the reportlab-users mailing list