I need to convert a HTML+CSS+Javascript file to PDF from a Django View and therefor using Python.
I could use xhtml2pdf/PISA but it only supports HTML & CSS, not Javascript, which is required.
Another option would be py-wkhtmltox, but it's getting pretty old and I haven't been able to get it to work yet, I just get "ImportError: libwkhtmltox.so.0: cannot open shared object file: No such file or directory", not sure where to get that file other then just to out of the blue rename libwkhtmltox.so to libwkhtmltox.so.0, but then I just get:
Traceback (most recent call last):
File "pdf_test1.py", line 5, in <module>
pdf.set_object_setting('path', 'http://www.google.com')
File "wkhtmltox.pyx", line 118, in wkhtmltox.Pdf.__getattr__ (wkhtmltox.c:1228)
AttributeError: 'wkhtmltox._Pdf' object has no attribute 'set_object_setting'
Yet another option would be to use webkit ( http://bharatikunal.wordpress.com/2010/01/31/converting-html-to-pdf-with-python-and-qt/ ) but I can't execute "sys.exit(app.exec_())" from a Django view.
The only thing I can think of right now is to create a seperate webkit python script and os.system it from the django view, making "sys.exit(app.exec_())" possible and therefor the resultin PDF. But I'm open to other suggestions, seams a bit strange to use os.system from a django view.
Any ideas?