[reportlab-users] FW: linkAnnotate and linkRect, relative to transforms : Bug Report for trunk?

Ian Sparks Ian.Sparks at etrials.com
Thu Apr 12 09:28:05 EDT 2007


This one didn't get through last time I sent it... So here goes again.



I use linkRect() a lot and I also do a lot of scaling and translating.
When I updated to trunk all my linkRects were off by a considerable
margin from where I expected them to be. Today I finally tracked down
the issue. It's the parameter "relative" that linkRect now takes. Here's
an example program that shows the problem. I think the fix is to make
the default relative value for a linkRect be = 1/True.



Basically, a linkRect() with relative = True will obey the
scaling/translations (which is what I want!) but linkAbsolute I think is
meant to be a link related to the default page and so passes relative=0
to linkRect().



Can we have :



def linkRect(self, contents, destinationname, Rect=None,
addtopage=1, name=None, relative=1,

thickness=0, color=None, dashArray=None, **kw):



In canvas.py please? Alternatively I'll have to change all my calls to
linkRect().



Finally. I thought scaling and transforms were supposed to be additive?
My last example I scale by 50% then move 5 inches up. Doesn't look like
anything is scaled anymore?



Test prog :



from reportlab.pdfgen import canvas

from reportlab.lib.units import inch, cm

from reportlab.lib import colors



def makePage(canv,title):

canv.drawString(1*inch,3*inch,title)

canv.linkAbsolute("test1", "t1",(inch, inch, 6*inch,
2*inch),Border='[1 1 1]')

canv.linkRect('test2','t1',[50,50,100,100],Border='[1 1
1]',relative=1)

canv.showPage()



if __name__ == '__main__':



canv = canvas.Canvas('test.pdf')

canv.bookmarkPage('t1')

canv.setFont('Courier',20)



#Test page

makePage(canv,'Normal')



#Make 50% smaller

canv.scale(0.5,0.5)

makePage(canv,'50% Scaled')



#Move origin up 5 inches

canv.translate(0,5*inch)

makePage(canv,'Scaled and moved 5 inches up')



canv.save()




-----------------------------------------
Disclaimer:

This e-mail communication and any attachments may contain
confidential and privileged information and is for use by the
designated addressee(s) named above only. If you are not the
intended addressee, you are hereby notified that you have received
this communication in error and that any use or reproduction of
this email or its contents is strictly prohibited and may be
unlawful. If you have received this communication in error, please
notify us immediately by replying to this message and deleting it
from your computer.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070412/2fa7967a/attachment-0001.htm>


More information about the reportlab-users mailing list