[reportlab-users] Layout Help

Tim Roberts timr at probo.com
Tue Feb 26 16:25:28 EST 2008


Rob McCulley wrote:

>

> Hi all,

>

>

>

> I’m a bit of a reportlab newb. I’ve used it for awhile, but only for

> one specific task, and outside of that, I know very little.

>

>

>

> I need a little help in setting up my document layout. I’ve attached

> a .png file showing essentially what I’m trying to create. One large

> map document (the map will be a .png image), and then a legend and

> title block in the bottom left.

>

>

>

> The map image is the same size as the page, so the I need the lower

> left corner of the map to be covered by the legend and the title

> block. How do I do this? My initial thought was to use tables, but

> the map area of the document is non-rectangular. Here is what I have

> so far:

>

>

>

> if os.path.isfile(outfile):

>

> os.remove(outfile)

>

> c1 = Canvas(outfile)

>

> mapsize = (24*inch,36*inch)

>

> c1.setPageSize(mapsize)

>

> mapimage = Image(mappath,width=23*inch,height=34*inch)

>

> data = [[mapimage]]

>

> t1 = RLTable(data)

>

> t1.setStyle(TableStyle([(‘BOX’,(0,0),(-1,-1),1,colors.black),

>

>

> (‘ALIGN’,(0,0),(-1,-1),’CENTER’),

>

>

> (‘VALIGN’,(0,0),(-1,-1),’MIDDLE’)]))

>

> p1 = [t1]

>

> f1 = Frame(0.25*inch,0.25*inch,23.5*inch,35.5*inch,showBoundary=1)

>

> f1.addFromList(p1,c1)

>

> c1.showPage()

>

>

>

> I’ve already created two other table elements, one for the legend and

> one for the title block, and then it dawned on me, that I don’t have

> clue how to draw these two tables on top of the map table. Can I do this?

>


Don't use tables at all. This is not an application where a flowable
helps you. Just place the three components directly at their
appropriate positions. Put the image down first, then lay the legend
and title block over the top of it.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list