[reportlab-users] Url in index.pdf
Robin Becker
robin at reportlab.com
Fri Feb 18 10:02:38 EST 2005
andrew mercer wrote:
> Hi,
>
> I have just started using reportlab but cannot see how to do the following:
>
> I need to create an index.pdf file listing basic information about a set
> of pdfs. One of the columns in the list will be a link to each pdf for
> each row. The url will be relative to where the index.pdf is created and
> run.
>
> This pdf will be used as an index on a cd to allow users to view each
> pdf by selecting the relevant link on in the 'index.pdf' file.
>
> The output needs to be.
>
.....
you need to create a paragraph that does paragraphing things and also knows how
to do the URL reference.
This is untested, but should be along the right lines
from reportlab.platypus.paragraph import Paragraph
class LinkParagraph(Paragraph):
def __init__(self, URL, text, style, bulletText = None, frags=None,
caseSensitive=1):
self._URL = URL
Paragraph.__init__(self, text, style,
bulletText = bulletText, frags=frags,
caseSensitive=caseSensitive)
def draw(self):
Paragraph.draw(self)
c = self.canv
c.linkURL(self._URL,(0,0,self.width,self.height),
relative=1,color=None,dashArray=None)
let us know if this is what you want and how/if it works?
--
Robin Becker
More information about the reportlab-users
mailing list