django - pisa : adding images to PDF output -


I am using a standard example from the Web to convert a DjangoView / Template into PDF.

Is there an easy way to include images in the template (either a URL or a reference to the server) so that they will be shown on the PDF?

import from django.http import from httppps django.template.loader import render_to_string import imported import.contact django.conf import settings from django.template import. Pisa Imported as StringIO Import CGI Import OS DEM DM_Manthelli (Request, Year, Month): Pasteed as PISA in Pisa form: HTML = render_to_string ('report / dmmonthly.html', {'pagesize': 'A4',}, context_instance = RequestContext (Request)) Results = StringIO StringIO () pdf = pisa.pisaDocument (StringIO.StringIO (html.encode ("UTF-8")), dest = results, link_callback = fetch_resources) Otherwise pdf.err: return HttpResponse (Result.getvalue (), mimetype = 'application / pdf') httprespacespection ('Greillance took your PDF!% S'% cgi.escape (html)) DIFT Fatch_Resons (Yuri, Reliance): Path = OS path.Joint (settings.MEDIA_ROOT, uri.replace


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -