[reportlab-users] newbie help

Robin Becker robin at reportlab.com
Thu Dec 6 15:21:45 EST 2007


Anil wrote:

> Those self.drawXXX() methods are accessible only from the

> BaseDocTemplate, so I need to subclass it and define those?

>

> I tried doing something like:

> http://python.pastebin.com/m62381e90

>

> But, when I try to draw that Rect(), it doesn't put it at the

> bottom-left of the page. Its putting it somewhere else on the

> document.

>

> Any ideas?

>

.......
it's not very clear from your posting whether you want to create a
flowable and use the doctemplate methods or just create a canvas and
draw on that directly.

The doctemplate classes use a list of flowables ie things which are
flowed onto the space allocated in a frame; when the draw method of a
flowable is called the framework has normally adjusted the drawing space
so that the origin is at the lower left corner of the space requested in
a call to the flowable's wrap method. That way the flowable doesn't have
to do its own coordinate transformations. It always assumes it's at the
origin. The framework lays out flowables starting at the top of the
frame and continuing until all vertical space is used up. The story then
automatically proceeds to the next frame (or page).

Creating a canvas and then using canvas method to draw on it is often
more suitable for simple projects which have a fixed layout.
--
Robin Becker


More information about the reportlab-users mailing list