wkhtmltopdf reported an error: Exit with code 1 due to network error: HostNotFoundError

8,676 views
Skip to first unread message

shailesh patil

unread,
Jan 19, 2021, 3:47:48 AM1/19/21
to wkhtmltopdf General
Hi Team,

I have issue with wkhtmltopdf tool while downlaoding pdf report form MobSF tool.
wkhtmltopdf version- 0.12.5 
os- windows server

WE get below error while downloading pdf report from mobsf tool

[ERROR] 19/Jan/2021 14:07:19 - Error Generating PDF Report
Traceback (most recent call last):
  File "D:\Software installation\Mobile-Security-Framework-MobSF-3.0.5\StaticAnalyzer\views\shared_func.py", line 197, in pdf
    pdf_dat = pdfkit.from_string(html, False, options=options)
  File "d:\software installation\mobile-security-framework-mobsf-3.0.5\venv\lib\site-packages\pdfkit\api.py", line 72, in from_string
    return r.to_pdf(output_path)
  File "d:\software installation\mobile-security-framework-mobsf-3.0.5\venv\lib\site-packages\pdfkit\pdfkit.py", line 156, in to_pdf
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError


[ERROR] 19/Jan/2021 14:07:19 - Internal Server Error: /PDF/

shailesh patil

unread,
Jan 19, 2021, 9:34:24 AM1/19/21
to wkhtmltop...@googlegroups.com
Hi TEam,

Please help.

Thanks,
Shailesh

--
===================================================
You received this message because you are subscribed to the "wkhtmltopdf General" group.
To post to this group, send email to wkhtmltop...@googlegroups.com
To unsubscribe from this group, send email to wkhtmltopdf-gen...@googlegroups.com
 
For more options, visit this group at
http://groups.google.com/group/wkhtmltopdf-general?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "wkhtmltopdf General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wkhtmltopdf-gen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wkhtmltopdf-general/e80b3053-ba99-4091-ae36-bcf930b66303n%40googlegroups.com.

George Reynolds

unread,
Jan 19, 2021, 9:39:41 AM1/19/21
to wkhtmltop...@googlegroups.com
Hi

What web host or URL are you trying to download from? Failing that what code are you using to call pdfkit?

Do you require a proxy for your internet connection?

I'm afraid I'm not part of a formal  team we are just people who use the tool in the community like yourselves.

Thanks



shailesh patil

unread,
Jan 20, 2021, 8:58:00 AM1/20/21
to wkhtmltop...@googlegroups.com
Hi gorge,

We are using mobsf tool to generate report. It will automatically call wkhtmltopdf

If you required code in pdfkit library then i will provide

Thanks, 
shailesh

George Reynolds

unread,
Jan 20, 2021, 9:47:51 AM1/20/21
to wkhtmltop...@googlegroups.com
Hi

Can I ask - has this ever worked?

I've looked into this a bit more - the source code for MobSF and Wkhtmltopdf

It looks like MobSF gets this error back from pdfkit and gives up trying to create a PDF.

Internal Server Error: /PDF/

I know very little about MobSF but see 3.0.5 is the first version they added PDF reports  and since they have a few higher version releases. It doesn't change the command it sends to pdfkit however.

There is  a newer version of wkhtmltopdf which curiously mentions that they disabled local file access by default - 0.12.6 - do you know what version of wkhtmltopdf you're using - is it definitely 0.12.5?

From my understanding this would result in the error you're seeing and you'd need to update the source for MobSF to fix it ... or wait for them to release a fix. 



Thanks 
George 





Can I ask - is this issue new or has this feature ever worked?






shailesh patil

unread,
Jan 21, 2021, 11:13:13 PM1/21/21
to wkhtmltop...@googlegroups.com
Hi George ;

I have updated mobsf to a newer version but am still  stuck on the same issue.
can i need to change the wkhtmltopdf version to lower?

Thanks,
Shailesh

George Reynolds

unread,
Jan 22, 2021, 12:10:20 AM1/22/21
to wkhtmltop...@googlegroups.com
Hi

Try using wkhtmltopdf 0.12.5 or lower for now 

If that doesn't work:
It appears to be adding a proxy option in the code so as I mentioned before - do you have a network proxy?

I'm not sure about another suggestion if that doesn't work.


Thanks 


Reply all
Reply to author
Forward
0 new messages