11

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?

3
  • Would this help you run it without x: stackoverflow.com/a/12483745/694325 ? Installing openSSL might help with the https issues (so I hear, haven't tested). Oct 9, 2012 at 6:03
  • Maybe, but since I am not using the wkhtmltopdf directly (using the php integration library) I might need to change the library to use the calling method described above
    – HouseMD
    Oct 10, 2012 at 11:02
  • stackoverflow.com/questions/4986632/… had similar problem and it was related to transfer errors, but I am using wget and extractin on the server. The same error appears on CentOS 5
    – HouseMD
    Oct 14, 2012 at 20:52

5 Answers 5

13

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

4
  • Yeah, I used the rc2 version too.
    – HouseMD
    Oct 27, 2012 at 12:53
  • You're correct, but after a quick inspection it looks like 0.10.0_rc2 doesn't do kerning where 0.11.0_rc1 does. Very disappointing.
    – aidan
    Feb 25, 2013 at 1:39
  • Where can I find this version source, I've tried with the 0.9.9 but seems not to support QT?
    – Mauro Dias
    Mar 20, 2013 at 17:08
  • 1
    This is still the best solution I found. About 10 months later.
    – Don Giulio
    Feb 5, 2014 at 14:44
6

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.

1
  • 1
    This fixed my issue, CentOS 6, Apache 2.22, PHP 5.4, wkhtmltopdf binary from wkhtmltopdf.org 0.12.1 (with patched Qt). Conversion worked fine with sudo -u apache wkhtmltopdf ... but Segfaulted when exec() from PHP. With --disable-javascript works there too. Thanks!
    – jaywink
    Jul 10, 2014 at 12:35
1

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

1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.