मुझे Google पर मिलने वाले हर समाधान की कोशिश करने के बावजूद छवियों को प्रदर्शित नहीं किया जा सका। लेकिन इस फ़ज मेरे लिए काम किया पीसा की कमांड लाइन संस्करण के रूप में छवियों को प्रदर्शित करता ठीक:
from tempfile import mkstemp
# write html to a temporary file
# can used NamedTemporaryFile if using python 2.6+
fid, fname = mkstemp(dir='/tmp')
f = open(fname, 'w+b')
f.write(html)
f.close()
# now create pdf from the html
cmd = 'xhtml2pdf "%s"' % fname
os.system(cmd)
os.unlink(fname)
# get the content of the pdf
filename = fname+'.pdf'
pdf = open(filename, 'r')
content = pdf.read()
pdf.close()
os.unlink(pdf.name)
# return content
response = HttpResponse(content, mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=draft.pdf'
यह काम किया, जहां छवियों कोई URL या पूर्ण पथ नाम, उदाहरण के लिए किया था।
<img src="/home/django/project/site_media/css/output/images/logo.jpg" />
<img src="http://www.mysite.com/css/output/images/logo.jpg" />
लिंक मृत - यह है: http://20seven.org/journal/2008/11/11/pdf- जनरेशन-with-pisa-in-django/ – Gady