[reportlab-users] Absolute coordinates of rendered flowables?

Dinu Gherman gherman at darwin.in-berlin.de
Tue Mar 4 12:54:50 EST 2008


Robin Becker:


> well OK you need to provide the drawOn method to eliminate any

> translation provided by the default behaviour. So I suspect your

> drawOn needs to look like this

>

> def drawOn(self, canv, x, y, _sW=0):

> try:

> self.canv = canv

> self.draw()

> finally:

> del self.canv

>

> but this won't be sufficient if any other part of the process has

> modified the canvas transformation. In that case you probably need

> to reset the transformation in drawOn ie try doing

>

>

> def drawOn(self, canv, x, y, _sW=0):

> self.canv = canv

> self.canv.saveState()

> self.resetTransforms()

> try:

> self.draw()

> finally:

> del self.canv

> self.canv.restoreState()

>

> so in this last version you're using the default user space


That does the job! I wasn't aware I was expected to overwrite
the drawOn method.

Thanks!

Dinu



More information about the reportlab-users mailing list