There are a lot of different ways of generating pdfs from a django webpage in python2. The most clean, probably, is pisa and reportlab. These do not work for python3 though.
So far, the only method I've had success with is to render the template, write it to a file, and then use wkhtmltopdf via subprocess.popen. This works alright, but it doesn't load any of my static files, such as css and images.
Are there any proper solutions? can wkhtmltopdf read my staticfiles from the command line, in some way, or is there a library like pisa/reportlab, which supports python3?
I haven't been able to finde such a library
You could use Weasyprint. You could easily render directly.
You could do something like that:
To render your Django view to HTML, you could simply use the shortcut
render_to_string(self.template_name, context, context_instance=RequestContext(self.request))
Be aware, when using This with a Synchronous Webserver/WSGI Server ALL requests will be blocked until the PDF is rendered. So consider using an ASYNC Worker.