Django and Reportlab Question

Posted by Hellnar on Stack Overflow See other posts from Stack Overflow or by Hellnar
Published on 2010-03-18T01:19:10Z Indexed on 2010/03/18 1:21 UTC
Read the original article Hit count: 537

Filed under:
|
|
|

Hello,

I have written this small Django view to return pdf.

@login_required
def code_view(request,myid):
    try:
        deal = Deal.objects.get(id=myid)
    except:
        raise Http404
    header = deal.header
    code = deal.code
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=code.pdf'
    p = canvas.Canvas(response)
    p.drawString(10, 800, header)
    p.drawString(10, 700, code)
    p.showPage()
    p.save()
    return response

And my questions:

  • Utf-8 characters are not shown correctly within the pdf.
  • How can I include an image ?
  • How can I include a very basic html such as:

.

<ul>
    <li>List One</li>
    <li>List Two</li>
    <li>List Three</li>
</ul>

© Stack Overflow or respective owner

Related posts about django

Related posts about reportlab