Hi,
I'm new to pisa.
I want to return as a response pdf file - created using html (only
text, no images) with a watermark which I have as another pdf file.
Text formatting works fine, but I can't add the watermark. I've tried
following:
in html template:
<html xmlns:pdf="">
<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8"/>
<style type="text/css">
@page {
background-image: url("../site_media/img/
watermark.pdf");
margin-left: 3cm;
margin-right: 3cm;
margin-top: 5cm;
margin-bottom: 4cm;
}
</style>
(...)
in views.py:
(...)
template = get_template('report.html')
data.update({'pagesize' : 'A4'})
context = Context(data)
html = template.render(context)
result = StringIO.StringIO()
pdf =
pisa.pisaDocument(StringIO.StringIO( html.encode("ISO-8859-13")),
result, encoding="ISO-8859-13")
response = http.HttpResponse(result.getvalue(),
mimetype='application/pdf')
import re
response['Content-Disposition'] = 'attachment; filename=' +
re.sub(r'\s', '',
inquiry.name) + '_raport.pdf'
return response