[reportlab-users] preserveAspectRatio problem

Johnson, Richard L richard.johnson at pnl.gov
Thu May 24 16:20:46 EDT 2007



>If that's a cut-and-paste of the error, then you have a typo

("Apsect").

I checked that first but I still got the same error (spelled correctly
this time).


>Which documentation? That keyword is not present anywhere in my copy

of ReportLab 2.0.

http://reportlab.org/os_documentation.html

Taken from the API Reference pdf.

def drawImage(self, image, x, y, width=None, height=None, mask=None,
preserveAspectRatio=False ...

New post version 2.0: drawImage can center the image in a box you
provide.
This saves developers from doing lots of math in their code. You can
define a box with x,y,width and height. If 'preserveAspectRatio'
is set, the image will be scaled up or down as needed in proportion to
fit entirely within the box. Unless the aspect ratio perfectly matches
the box, this will leave some space. So, the boxAnchor property defines
how the image should be anchored in the box, using imaginary points of
the compass. 'sw' for SouthWest is the default, but 'c' for center
will center it in the given box.


More information about the reportlab-users mailing list