我正在构建一个项目,我需要将数据从模板(html)转换为pdf,我的问题是图像没有出现在pdf视图上。这是我的代码:
class GeneratePdf_month(TemplateView):
template_name = "polls/info_month.html"
def get(self, request, *args, **kwargs):
## do some....
data = {
'cliente': cliente,
}
pdf = render_to_pdf(self.template_name, data)
return HttpResponse(pdf, content_type='application/pdf')
## and this is my html template
<head>
{% load staticfiles %}
<title>Detail</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 10px;
}
</style>
</head>
<body>
<header>BlaBla<img src="{% static 'polls/images/image.png'%}"></header>
</body
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗?