here is my code, I use python and flask:
pdf = pdfkit.from_url(url, False, options=options)
return send_file(one_file, attachment_filename=file_name,
as_attachment=True, mimetype="application/pdf")
size of the pdf file is too large, it's too long to send to user, so I want change the quality of pdf. I use:
options = {'lowquality': True}
but error:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/yangle/ksxing/exam/view/exams_mongo.py", line 1537, in export_result_pdf
pdf = pdfkit.from_url(url, False, options=options)
File "/usr/lib/python2.7/site-packages/pdfkit/api.py", line 24, in from_url
return r.to_pdf(output_path)
File "/usr/lib/python2.7/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)
Error: Failed loading page http://true (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: HostNotFoundError ] 55%
how to do this?thank you