[reportlab-users] Is it possible to insert mailto address in paragraphs

183 views
Skip to first unread message

Alain Aupeix

unread,
Nov 3, 2016, 6:02:40 AM11/3/16
to ReportLab users
Hi, I use reportlab, and platypus Paragraph

Is-it possible to insert mailto address in paragraph and how ?

I have tried with <link>, but it fails

Thanks

A+

--
------------------------------------------------------------------------
Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/
------------------------------------------------------------------------
U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-21 05:54) |
Hw.Gui 2.19-6 (2625)
------------------------------------------------------------------------
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
https://pairlist2.pair.net/mailman/listinfo/reportlab-users

Robin Becker

unread,
Nov 3, 2016, 6:19:49 AM11/3/16
to reportlab-users
On 03/11/2016 10:02, Alain Aupeix wrote:
> Hi, I use reportlab, and platypus Paragraph
>
> Is-it possible to insert mailto address in paragraph and how ?
>
> I have tried with <link>, but it fails
>
Hi Alain,

I just added this to our test_platypus_paragraphs.py test and it seems to work.

> This should be a mailto link <a href="mailto:reportl...@lists2.reportlab.com"><font color="blue">reportlab-users at lists2.reportlab.com</font></a>.
--
Robin Becker

Alain Aupeix

unread,
Nov 7, 2016, 3:48:40 AM11/7/16
to reportlab-users
Le 03/11/2016 à 11:19, Robin Becker a écrit :
> On 03/11/2016 10:02, Alain Aupeix wrote:
>> Hi, I use reportlab, and platypus Paragraph
>>
>> Is-it possible to insert mailto address in paragraph and how ?
>>
>> I have tried with <link>, but it fails
>>
> Hi Alain,
>
> I just added this to our test_platypus_paragraphs.py test and it seems
> to work.
>
>> This should be a mailto link <a
>> href="mailto:reportl...@lists2.reportlab.com"><font
>> color="blue">reportlab-users at lists2.reportlab.com</font></a>.
Hi, thanks for the answer, it works fine.
I can't explain why I failed ...

Another question about links, always with same libraries.
I generate pdf of emails, and I insert links for the attachments which
are saved in the same folder than the pdf.
I success when I give the complete path, but when I just givr the
filename, if it doesn't fail when creating the pdf, the reader (evince)
failed to open it, saying it doesn't found it.

That works:

cline="Pièce jointe (cliquable): "+'<link
href="file://'+path+"/"+filename+'">'+filename+"</link>"

That fails:

cline="Pièce jointe (cliquable): "+'<link
href="file://'+filename+'">'+filename+"</link>"
Is-it a bug of reportlab, evince or a system feature ?
Is there another way to do it ?

It seems to be not very important, but my pdf and attachments are
located in folders which are synchronized between computers and users
using syncthing, and for users which aren't the creator of the pdf, the
file links won't then work.

Thanks
A+

--
------------------------------------------------------------------------
Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/
------------------------------------------------------------------------
U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-21 05:54) |
Hw.Gui 2.19-6 (2625)
------------------------------------------------------------------------

Andy Robinson

unread,
Nov 7, 2016, 4:12:55 AM11/7/16
to reportlab-users
On 7 November 2016 at 08:48, Alain Aupeix <alain....@wanadoo.fr> wrote:
> cline="Pièce jointe (cliquable): "+'<link
> href="file://'+filename+'">'+filename+"</link>"
> Is-it a bug of reportlab, evince or a system feature ?
> Is there another way to do it ?

Hi Alain,

My first reaction is that we just implement the PDF specification, and
how PDF viewers behave is beyond our control. Have you tried this in
any other PDF viewers on other platforms? Also, what happens when
you make a tiny HTML page with these styles of links and click them?
Does file://filename.ext work without a full path?

- Andy

Robin Becker

unread,
Nov 7, 2016, 4:41:28 AM11/7/16
to reportlab-users
On 07/11/2016 08:48, Alain Aupeix wrote:
> Le 03/11/2016 à 11:19, Robin Becker a écrit :
>> On 03/11/2016 10:02, Alain Aupeix wrote:
>>> Hi, I use reportlab, and platypus Paragraph
>.........paragraphs.py test and it seems to work.

>>
>>> This should be a mailto link <a
>>> href="mailto:reportl...@lists2.reportlab.com"><font
>>> color="blue">reportlab-users at lists2.reportlab.com</font></a>.
> Hi, thanks for the answer, it works fine.
> I can't explain why I failed ...
>
> Another question about links, always with same libraries.
> I generate pdf of emails, and I insert links for the attachments which are saved
> in the same folder than the pdf.
> I success when I give the complete path, but when I just givr the filename, if
> it doesn't fail when creating the pdf, the reader (evince) failed to open it,
> saying it doesn't found it.
>
> That works:
>.......
Hi Alain,

I tried various versions of the file: link with or without the // etc etc. All
were seen as links by Acrobat reader, but none resulted in it opening a file in
my browser. The only successes I had were absolute paths. On windows the
successful links always asked two permissions, one from acrobat reader and then
another from windows. The unsuccessful attempst always asked just one question
(from acrobat reader). I suspect it may be impossible to get the relative links
to work.
--
Robin Becker

Alain Aupeix

unread,
Nov 7, 2016, 4:58:06 AM11/7/16
to reportlab-users
Le 07/11/2016 à 10:12, Andy Robinson a écrit :
> On 7 November 2016 at 08:48, Alain Aupeix <alain....@wanadoo.fr> wrote:
>> cline="Pièce jointe (cliquable): "+'<link
>> href="file://'+filename+'">'+filename+"</link>"
>> Is-it a bug of reportlab, evince or a system feature ?
>> Is there another way to do it ?
> Hi Alain,
>
> My first reaction is that we just implement the PDF specification, and
> how PDF viewers behave is beyond our control.
I understand ...

> Have you tried this in any other PDF viewers on other platforms?
I also tried with Acrobat Reader for Linux, no error here, but it
doesn't open the attachment.
No try under Windows, as my tool is dedicated to Linux, and I have no
more Windows.

> Also, what happens when
> you make a tiny HTML page with these styles of links and click them?
> Does file://filename.ext work without a full path?
Yes, and I must say that filename variable in my code embedded file
extension.

I have tried another thing : open it with LibreOffice Draw, and I have
created a document link, it works, but the tooltip when opening show a
complete path. When I move the pdf and the attachment in another path,
it doesn't work anymore an I have the error.

So, I think it's not possible to just indicate the filename.

Thanks
A+
--
------------------------------------------------------------------------
Alain Aupeix
http://jujuland.pagesperso-orange.fr/
http://pissobi-lacassagne.pagesperso-orange.fr/
------------------------------------------------------------------------
U.buntu 12.04 | G.ramps 3.4.9-1 | H.arbour 3.2.0dev (2016-10-21 05:54) |
Hw.Gui 2.19-6 (2625)
------------------------------------------------------------------------

Alain Aupeix

unread,
Nov 7, 2016, 6:35:29 AM11/7/16
to reportlab-users
Le 07/11/2016 à 10:58, Alain Aupeix a écrit :
> Le 07/11/2016 à 10:12, Andy Robinson a écrit :
>
> So, I think it's not possible to just indicate the filename.
I agree, all my tests reports such impossibility, but I have found a way
to do it.

Creating the pdf doesn't change, imbedding the complete path, but adding
a symbolic link to the user folder does the trick.

My user folder is alain
My tool allows to create file links having another user name in the
path, I tested it

alain@Gramps-JujuLand:/home$ sudo ln -s -T alain gadel

Opening the attachment works like a charm :)

In fact, in real use where I want to deploy it, I have 2 computers, with
one user for the first, and two users for the second computer.

SyncThing syncs the same folder for each user : Documents, so, on the
first computer, I must create two symbolic links : gadel and
anne-sophie, and on the second computer a link named jacques.

So each pdf attachment linked in each pdf created by one user will be
openable by each other user.

If I use my feature to replace the user folder name in the inifile of
the two users of the second computer, replacing their user names by
jacques, I only need to create a link named jacques on the second computer.

Obviously, it only works if pathes (except user name) are identical.

A+

Reply all
Reply to author
Forward
0 new messages