wkhtmltopdf segfaults

旧时模样 提交于 2019-12-21 07:59:08

问题


I am trying to put wkhtmltopdf onto a virtualbox'ed ubuntu 12.04 64bit server. So far no luck. The package from the repositories wants to have xserver running and the static version:

wkhtmltopdf google.com tesss.pdf
Loading pages (1/6)
QSslSocket: cannot resolve SSLv2_client_method               ] 10%
QSslSocket: cannot resolve SSLv2_server_method
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Printing pages (6/6)
QPixmap: Cannot create a QPixmap when no GUI is being used===] Page 1 of 1
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
Segmentation fault

Any ideas how could I approach this?


回答1:


http://code.google.com/p/wkhtmltopdf/issues/detail?id=730

Basically, it got fixed around a year ago, but has still not been released. What a mess :(

Try using 0.10.0_rc2 version instead, which worked perfectly for me




回答2:


The QPixmap errors are not causing the segmentation fault. In fact, adding the --disable-javascript option solves the issue. You will still get the warnings but the PDF is generated correctly. HTH.




回答3:


binary used: wkhtmltopdf 0.11.0 rc1 linux i386

I have seen the segmentation faults when converting pages having Google Maps JS API embedded. In those cases an output file having 0 byte size was generated. Did not find any solution to get this version running by different command line arguments to wkhtmltopdf.

Finally switched to Google Maps Static API in order to prevent the heavy JS work, which seems to cause the problem. This just embeds the map as a static image, which looks quite well when printing if you supply scale=2 as an option.




回答4:


I had a similar issue (segfault) and found out I had a ulimit -v (virtual memory) limit set when executing wkhtmltopdf from apache. Everything was running fine from command line when using the same command.

I was able to fit it by prepending the command with ulimit like this: "ulimit -v 1073741824; wkhtmltopdf --page-size Letter ...."



来源:https://stackoverflow.com/questions/12761786/wkhtmltopdf-segfaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!