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?

HouseMD
  • 243
  • 2
  • 11
  • Would this help you run it without x: http://stackoverflow.com/a/12483745/694325 ? Installing openSSL might help with the https issues (so I hear, haven't tested). – Joel Peltonen Oct 09 '12 at 06: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 '12 at 11:02
  • http://stackoverflow.com/questions/4986632/run-wkhtmltopdf-on-centos-5-5-32bit 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 '12 at 20:52

5 Answers5

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

JonoB
  • 5,801
  • 17
  • 55
  • 77
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.

Capsule
  • 6,118
  • 1
  • 20
  • 27
  • 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 '14 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 ...."

ROunofF
  • 717
  • 5
  • 19
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.

Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
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.

Henry
  • 39
  • 2