wkhtmltopdf segfaults

2019-04-05 15:18发布

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?

4条回答
相关推荐>>
2楼-- · 2019-04-05 15:41

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 ...."

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-05 15:43

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.

查看更多
forever°为你锁心
4楼-- · 2019-04-05 15:47

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

查看更多
【Aperson】
5楼-- · 2019-04-05 15:52

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.

查看更多
登录 后发表回答