0
Saving HttpResponse object in a file
Hi,, I wrote a problem that converts a html page into pdf file using Django libraries. But Now I want to save that converted pdf object in a particular path as a pdf file. I don't know how to do? Please help me. def render_to_pdf(template_src, context_dict={}): template = get_template(template_src) html = template.render(context_dict) result = BytesIO() pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")),result) if not pdf.err: return HttpResponse(result.getvalue(), content_type="application/pdf") return None
1 Resposta
+ 1
Use iframe tags
Search about them they provide good pdf viewer options with download print functions