python 3.x - How to convert HTML to PDF with python3 -
how convert html pdf python3? write code webview pyqt5,and want convert html in webview pdf,what should do?
i have tried use html2pdf,but seem support python2.x , have tried install wkhtmltox-0.12.2.2_msvc2013-win64.exe , pdfkit,and use example code.
import pdfkit pdfkit.from_url('http://google.com', 'out.pdf') pdfkit.from_file('test.html', 'out.pdf') pdfkit.from_string('hello!', 'out.pdf')
but failed.and error following.
traceback (most recent call last): file "e:\python34\lib\site-packages\pdfkit\configuration.py", line 21, in __init__ open(self.wkhtmltopdf) f: filenotfounderror: [errno 2] no such file or directory: b'' during handling of above exception, exception occurred: traceback (most recent call last): file "<pyshell#2>", line 1, in <module> pdfkit.from_url('http://google.com', 'out.pdf') file "e:\python34\lib\site-packages\pdfkit\api.py", line 22, in from_url configuration=configuration) file "e:\python34\lib\site-packages\pdfkit\pdfkit.py", line 38, in __init__ self.configuration = (configuration() if configuration none file "e:\python34\lib\site-packages\pdfkit\configuration.py", line 27, in __init__ 'https://github.com/jazzcore/python-pdfkit/wiki/installing-wkhtmltopdf' % self.wkhtmltopdf) oserror: no wkhtmltopdf executable found: "b''" if file exists please check process can read it. otherwise please install wkhtmltopdf - https://github.com/jazzcore/python-pdfkit/wiki/installing-wkhtmltopdf
but failed.so should do? system window7 x64 ,python's version 3.4
'set path'
means add **.exe
system environment variable $path$
. example, add d:\program files\wkhtmltopdf\bin
$path$
.
Comments
Post a Comment