[reportlab-users] Scaling and Translation
Ashley Lloyd
ashleylloyd at hotmail.com
Wed Jul 6 03:47:26 EDT 2005
I know this is a very simple answer, but surely it would work ...
Couldn't you just set it up, setting a variable called, say, sizing (or
xsizing and ysizing if necessary), so having:
sizing=0.5
canv.scale(sizing,sizing) #Make all drawing operations half-size
canv.rect(0,9 * inch * 1/sizing,inch,inch) #Draw an inch-square box 9-inches
up the page.
Ok, initially that would mean changing every drawing operation, but when
making subsequent adjustments, you'd just have to assign sizing as
necessary.
HTH
Ashley
>From: "Ian Sparks" <Ian.Sparks at etrials.com>
>Reply-To: Support list for users of Reportlab software
><reportlab-users at reportlab.com>
>To: "Reportlab-Users (E-mail)" <reportlab-users at reportlab.com>
>Subject: [reportlab-users] Scaling and Translation
>Date: Tue, 5 Jul 2005 16:26:52 -0400
>
>
>
>I have a set drawing operations that render a complex shape. Ordinarily the
>shape wouldn't fit on the canvas page so I'm going to scale the shape.
>
>So :
>
>from reportlab.lib.units import inch
>from reportlab.pdfgen import canvas
>
>canv = canvas.Canvas("D:/PDFGen2/t.pdf")
>canv.scale(0.5,0.5) #Make all drawing operations half-size
>canv.rect(0,9 * inch,inch,inch) #Draw an inch-square box 9-inches up the
>page.
>canv.save()
>
>BUT! I want to maintain the position of the box at 9 inches from the bottom
>of the page even though I want it to draw half-size. The above code will
>draw it 4.5 inches from the top of the page.
>
>I can adjust to this :
>
>canv.rect(0,9 * inch * 2,inch,inch) #Draw an inch-square box (account for
>scaling)
>
>but that means touching every drawing operation.
>
>So My question : Is there a better, more global way to achieve this?
>
>
>
>_______________________________________________
>reportlab-users mailing list
>reportlab-users at reportlab.com
>http://two.pairlist.net/mailman/listinfo/reportlab-users
More information about the reportlab-users
mailing list