I'm using a standard example from the web (http://www.20seven.org/journal/2008/11/pdf-generation-with-pisa-in-django.html) to convert a django view / template into a PDF.
Is there an "easy" way to include images (either from a url or a reference on the server) in the template so they will show on the PDF?
I could not get images to appear despite trying every solution I could find on google. But this fudge worked for me as the command line version of pisa displays images ok:
This worked where the images had either a url or the full path name, eg.
Following line of code in HTML and Django version=2.0 works for me.
You can convert the image to base64 too.
http://www.motobit.com/util/base64-decoder-encoder.asp
Converting to base64 you will never have problems with image links.
You could always add the images afterwards with IText/ISharp.
I got the images working. the code is as follows:
This was taken liberally from http://groups.google.com/group/xhtml2pdf/browse_thread/thread/4cf4e5e0f4c99f55