Re: [reportlab-users] Reduce thickness of the rectangle

1,410 views
Skip to first unread message

Ramas Sami

unread,
May 28, 2014, 8:26:58 AM5/28/14
to Robin Becker ReportLab
Hi all,

Is it possible to reduce the thickness of rectangle border?

rect(x, y, width, height, stroke=1, fill=0)
draws a rectangle with lower left corner at (x,y) and width and height as given.

Please help me to fix it, if there are any other ways to achieve it.

Thanks

Best Regards
--Ramas

Robin Becker

unread,
May 28, 2014, 8:42:05 AM5/28/14
to reportlab-users
On 28/05/2014 13:26, Ramas Sami wrote:
> Hi all,
> Is it possible to reduce the thickness of rectangle border?
> rect(x, y, width, height, stroke=1, fill=0)draws a rectangle with lower left corner at (x,y) and width and height as given.
> Please help me to fix it, if there are any other ways to achieve it.
>
> Thanks
>
> Best Regards--Ramas
.........
you need to set the linewidth on your canvas.

canv.saveState()
canv.setLineWidth(0.1)
canv.setStrokeColor((1,0,0))
canv.rect(x, y, width, height, stroke=1, fill=0)
canv.restoreState()


so the canvas only has one lineWidth / strokeColor which is why we have to save
and restore the state etc etc
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Ramas Sami

unread,
May 28, 2014, 11:43:51 AM5/28/14
to Robin Becker ReportLab
Thanks Robin,

It worked great! Thanks for the time and reply.

Best Regards
--Ramas



> Date: Wed, 28 May 2014 13:42:01 +0100
> From: ro...@reportlab.com
> To: reportl...@lists2.reportlab.com
> Subject: Re: [reportlab-users] Reduce thickness of the rectangle
Reply all
Reply to author
Forward
0 new messages