1
votes

I'm getting an error (see below) and have looked through the many answers here but still have no idea how to get this to work:

ERROR "The exit status code '134' says something went wrong: stderr: "QXcbConnection: Could not connect to display Aborted (core dumped) " stdout: "" command: /usr/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy595ac8ce820719.82188465.html' 'TEST_874041855595ac8ce809a93.09267749.pdf'"

SERVER I'm using a DigitalOcean Ubuntu 16.04 droplet with PHP 7.1 and Laravel 5.4 with Snappy and wkhtmltopdf version 12.4 64bit (everything works fine on my local Windows machine BTW), but I get the above error on the server. Here's my code:

CODE $rendered_output = new Pdf('/usr/bin/wkhtmltopdf'); $rendered_output->generateFromHtml(view('pdf')),'file.pdf');

INSTALLATION I installed wkhtmltopdf and updated the server using these commands: sudo apt-get update sudo apt-get install wkhtmltopdf

HELP Has anyone got any ideas how I can fix this please (even if it means using a different DO server and some other distro)? Thank you in advance.

1

1 Answers

1
votes

I fixed this by doing two things:

  1. I installed xvfb on the server: sudo apt-get install xvfb

  2. I called xvfb: $snappy = new Pdf('/usr/bin/xvfb-run /usr/bin/wkhtmltopdf');