Hi,
I'm the author of a pure Python module that is able to generate PDF
form HTML and CSS. You find more informations about it and a sample
integration in Django here:
http://www.htmltopdf.org
I think this could be interesting to be mentioned in your
documentation:
http://www.djangoproject.com/documentation/outputting_pdf/
As I do not use Django often, the sample may be not very complete. A
user of my tool send me this portion of code that should help you
integration pisa into your work:
#! /usr/bin/python
# -*- encoding: utf-8 -*-
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
import cStringIO as StringIO
from sx.pisa3 import pisaDocument
def html_to_pdf(content):
'''
Convert the html content to PDF
'''
result = StringIO.StringIO()
html = StringIO.StringIO(content.encode("ISO-8859-1"))
pdf = pisaDocument(html, result)
if not pdf.err:
return result.getvalue()
return pdf
def render_to_pdf(template_src, context_dict):
'''
Render the template with a context. Then send the response in pdf
format.
'''
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
return HttpResponse(html_to_pdf(html), 'application/pdf',
200,'application/pdf')
Hope this informations are helpful for you.
Regards,
Dirk