def render_to_pdf(template_src, context_dict):
 template = get_template(template_src)
 context = Context(context_dict)
 html = template.render(context)
 result = StringIO.StringIO()
 pdf = pisaDocument(StringIO.StringIO(html.encode('ISO-8859-1')), result)
 if (not pdf.err):
  return HttpResponse(result.getvalue(), mimetype='application/pdf')
 return HttpResponse(('We had some errors<pre>%s</pre>' % cgi.escape(html)))

def render_to_pdf ( template_src , context_dict ) : template = get_template ( template_src ) context = Context ( context_dict ) html = template . render ( context ) result = StringIO . StringIO ( ) pdf = pisaDocument ( StringIO . StringIO ( html . encode ( 'ISO-8859-1' ) ) , result ) if ( not pdf . err ) : return HttpResponse ( result . getvalue ( ) , mimetype = 'application/pdf' ) return HttpResponse ( ( 'We had some errors<pre>%s</pre>' % cgi . escape ( html ) ) )
renderiza el template con el contexto .