xhmlt2pdf
is not going to work with all the websites, for one, it is not working for yahoo.com
. But the reason it is not working here is you are not providing the actual HTML file to pisa
but rather providing the URL, you want to fetch the HTML first, for example using urllib2
:
url=urllib2.urlopen('http://sheldonbrown.com/web_sample1.html')
srchtml=url.read()
pisa.showLogging()
convertHtmlToPdf(srchtml, outputFilename)
And it will work. That is a very simple sample HTML.