# urlpara.py from reportlab.platypus import Paragraph class UrlParagraph(Paragraph): "A clickable non-splittable paragraph." def __init__(self, text, style, url, bulletText=None, frags=None): "Set text color to blue and memorize URL." self.url = url format = '%s' text = format % text # Now, business as usual. apply(Paragraph.__init__, (self, text, style, bulletText, frags)) def split(self): "Don't allow vertical splitting." return [] def draw(self): "Make the consumed area a clickable URL." Paragraph.draw(self) rect = (0, 0, self.width, self.height) self.canv.linkURL(self.url, rect, relative=1, thickness=0)