[reportlab-users] Url in index.pdf

andrew mercer andrew at sundayta.com
Fri Feb 18 10:42:49 EST 2005


Robin Becker wrote:

> andrew mercer wrote:
> 
>> Hi,
>>
>> 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?

Yes it does thanks.

Simple when you know how...

Thanks Again A

Andrew
-- 



More information about the reportlab-users mailing list