Currently I am generating a pdf from a html template in django/python.
Here is a relevant snipit from my view
result = StringIO.StringIO()
html = render_to_string(template='some_ref/pdf.html', { dictionary passed to template},)
pdf = pisa.pisaDocument(StringIO.StringIO(html), dest=result)
return HttpResponse(result.getvalue(), content_type='application/pdf')
And my template is an html file that I would like to insert a hyperlink into. Something like
<td style="padding-left: 5px;">
<a href="/something_here/?referral_type={{ template_variable }}">{{ some_other_variable }}</a>
</td>
Actually, the pdf generates fine and the template variables are passed correctly and show in the pdf. What is inside the a
tag is highlighted in blue and underlined as if you could click on it, but when I try to click on it, the link is not followed. I have seen pdfs before with clickable links, so I believe it can be done.
Is there a way I can do this to make clickable hyperlinks on my pdf using pisa?
it works with the complete url: http protocol and domain
<a href="http://127.0.0.1:8000/something_here/?referral_type={{ template_variable }}">{{ some_other_variable }}</a>