Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wkhtmltopdf segfaults

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?

like image 678
HouseMD Avatar asked Oct 06 '12 16:10

HouseMD


3 Answers

Upgrade to 0.12.6.

I know this is an old issue but for those still running into this, try upgrading to the latest version (0.12.6 at the time of writing). A lot of these issues have been fixed in the last few releases.

After that, try adjusting your ulimit on your machine as others have mentioned.

Then finally, if you are showing the current and total pages in your header or footer, see this answer for a good tip and solution.

like image 72
Joshua Pinter Avatar answered Oct 29 '22 22:10

Joshua Pinter


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

like image 33
JonoB Avatar answered Oct 29 '22 21:10

JonoB


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.

like image 35
Capsule Avatar answered Oct 29 '22 21:10

Capsule