Figure 2-5: Scaling and Translating: Saving and Restoring The State: and
Figure 2-5: Scaling and Translating: Saving and Restoring The State: and
Figure 2-5: Scaling and Translating: Saving and Restoring The State: and
NOTE Note: scaling shrinks or grows everything including line widths so using the canvas.scale method to render a
microscopic drawing in scaled microscopic units may produce a blob (because all line widths will get
expanded a huge amount). Also rendering an aircraft wing in meters scaled to centimeters may cause the lines
to shrink to the point where they disappear. For engineering or scientific purposes such as these scale and
translate the units externally before rendering them using the canvas.
Mirror image
It is interesting although perhaps not terribly useful to note that scale factors can be negative. For example
the following function
def mirror(canvas):
from reportlab.lib.units import inch
canvas.translate(5.5*inch, 0)
canvas.scale(-1.0, 1.0)
coords(canvas)
Page 20