[reportlab-users] dashed text rectangles

Robin Becker robin at reportlab.com
Wed Feb 21 05:05:28 EST 2007


Something Special wrote:

> is there a good way doing this?

>

>

> ------------------------------------------------------------------------



### dashedrect.py
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.units import cm, mm, inch
c=Canvas('dashedrect.pdf')

c.saveState()
c.setLineWidth(1)
c.setDash(3,1)
c.setStrokeColor((0.8,0.8,0.8)) #greyish rgb

y=2.5*cm
x=2.5*cm
w=h=1*cm
for i in xrange(5):
if i==2:
c.setDash([],0) #continuous
c.setStrokeColor((0,0,0)) #black
c.rect(x+i*w,y,w,h,stroke=1,fill=0)
c.restoreState()
c.save()
--
Robin Becker


More information about the reportlab-users mailing list