import pdfkit
pdfkit.from_url('http://www.sec.gov/Archives/edgar/data/1754581/000119312518361084/d620103df1.htm','/home/shenjianlin/out.pdf')
这个链接是打开的是 html,现在我通过程序转成 pdf 但是现在转换过程中报错了,大家有没有更好的方法,谢谢
Traceback (most recent call last):
File "timeout.py", line 3, in <module>
pdfkit.from_url('http://www.sec.gov/Archives/edgar/data/1754581/000119312518361084/d620103df1.htm','/home/shenjianlin/out.pdf')
File "/usr/lib/python3.4/site-packages/pdfkit/api.py", line 26, in from_url
return r.to_pdf(output_path)
File "/usr/lib/python3.4/site-packages/pdfkit/pdfkit.py", line 153, in to_pdf
'https://github.com/JazzCore/python-pdfkit/wiki/Using-wkhtmltopdf-without-X-server' % stderr)
OSError: wkhtmltopdf: cannot connect to X server
You will need to run wkhtmltopdf within a "virtual" X server.
Go to the link below for more information
https://github.com/JazzCore/python-pdfkit/wiki/Using-wkhtmltopdf-without-X-server
pdfkit.from_url('http://www.sec.gov/Archives/edgar/data/1754581/000119312518361084/d620103df1.htm','/home/shenjianlin/out.pdf')
这个链接是打开的是 html,现在我通过程序转成 pdf 但是现在转换过程中报错了,大家有没有更好的方法,谢谢
Traceback (most recent call last):
File "timeout.py", line 3, in <module>
pdfkit.from_url('http://www.sec.gov/Archives/edgar/data/1754581/000119312518361084/d620103df1.htm','/home/shenjianlin/out.pdf')
File "/usr/lib/python3.4/site-packages/pdfkit/api.py", line 26, in from_url
return r.to_pdf(output_path)
File "/usr/lib/python3.4/site-packages/pdfkit/pdfkit.py", line 153, in to_pdf
'https://github.com/JazzCore/python-pdfkit/wiki/Using-wkhtmltopdf-without-X-server' % stderr)
OSError: wkhtmltopdf: cannot connect to X server
You will need to run wkhtmltopdf within a "virtual" X server.
Go to the link below for more information
https://github.com/JazzCore/python-pdfkit/wiki/Using-wkhtmltopdf-without-X-server