2016-01-24

I tried using pdfkit library and wkhtmltopdf to convert a given url into pdf. It worked fine on many websites but failed on many too..It gives the same error whether i use it on terminal or on IDLE

I am working on windows 8 64 bit version currently

my code :

output :

Traceback (most recent call last):

File "C:\Users\MOHIT GARG\Desktop\New folder (2)\temp.py", line 13,
in

pdfkit.from_url('http://www.geeksforgeeks.org','yout.pdf')

File "C:\Python27\lib\site-packages\pdfkit\api.py", line 24, in
from_url
return r.to_pdf(output_path)

File "C:\Python27\lib\site-packages\pdfkit\pdfkit.py", line 116, in
to_pdf
raise IOError('wkhtmltopdf reported an error:\n' + stderr.decode('utf-8'))

IOError: wkhtmltopdf reported an error: Loading pages (1/6)

[> ] 0%
[======> ] 10%
[===========> ] 19%
[============> ] 20%
[=============> ] 22%
[==============> ] 24%
[===============> ] 25%
[===============> ] 26%
[==================> ] 30%
[==================> ] 31%
[====================> ] 34%
[=====================> ] 36%
[======================> ] 37%
[========================> ] 40%
[========================> ] 41%
[========================> ] 41%
[========================> ] 41%
[========================> ] 41%
[========================> ] 41%
[===========================> ] 45%
[============================> ] 47%
[============================> ] 48%
[=================================> ] 55%
[=====================================> ] 63%
[======================================> ] 64%
[========================================> ] 68%
[========================================> ] 68%
[==========================================> ] 71%
[============================================> ] 74%
[============================================> ] 74%
[=============================================> ] 75%
[=============================================> ] 75%
[=============================================> ] 75%
[==============================================> ] 78%
[================================================> ] 81%
[=================================================> ] 83%
[=================================================> ] 83%
[=================================================> ] 83%
[===================================================> ] 85%
[===================================================> ] 85%
[===================================================> ] 85%
[===================================================> ] 85%
[===================================================> ] 85%
[===================================================> ] 86%
[===================================================> ] 86%
[===================================================> ] 86%
[===================================================> ] 86%
[===================================================> ] 86%
[====================================================> ] 87%
[====================================================> ] 87%
[====================================================> ] 87%
[====================================================> ] 87%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[====================================================> ] 88%
[=====================================================> ] 89%
[=====================================================> ] 89%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[======================================================> ] 90%
[============================================================] 100%
Counting pages (2/6)

[============================================================] Object
1 of 1 Resolving links (4/6)

[============================================================] Object
1 of 1 Loading headers and footers (5/6)

Printing pages (6/6)

[> ]
Preparing [=========>

] Page 1 of 6 [===================>

] Page 2 of 6 [==============================>

] Page 3 of 6 [=======================================>

] Page 4 of 6 [=================================================>

] Page 5 of 6
[============================================================] Page 6
of 6 Done

Exit with code 1 due to network error: ProtocolUnknownError

It gives the pdf but the pdf is not correctly formated, there are many errors..
I don't know how to resolve this error, please help !!

Show more