I'm using the wkhtml2pdf libary in my Laravel application. On my local environment this works perfectly. My PDF is correctly generated. In my .env file I have:
WKHTML2PDF_BIN_FILE=wkhtmltopdf-amd64
But on my scaleway server I have the following error:
My software supports armhf. So I couldn't install the amd/64-bit versions. I've installed wkhtmltopdf on my server like this:
sudo apt install wkhtmltopd
But now it's not working online. I think my config is wrong (the link to the bin file). But how can I know and set the correct link to my WKHTML2PDF_BIN_FILE?
UPDATE:
When I enter the following commmand:
sudo find / -name "wkhtmltopdf*"
Then I get the following results:
/var/lib/dpkg/info/wkhtmltopdf.md5sums
/var/lib/dpkg/info/wkhtmltopdf.list
/var/www/mydomain.com/html/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-i386
/var/www/mydomain.com/html/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-amd64
/var/www/mydomain.com/html/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-0.12.1-OS-X.i386
/usr/share/doc/wkhtmltopdf
/usr/share/man/man1/wkhtmltopdf.1.gz
/usr/bin/wkhtmltopdf
I've tried to change the WKHTML2PDF_BIN_FILE=wkhtmltopdf-amd64
to WKHTML2PDF_BIN_FILE=/usr/bin/wkhtmltopdf
but that results in:
How can I fix this?
UPDATE 2:
I've added this to my config:
WKHTML2PDF_BIN_PATH=/usr/bin/
WKHTML2PDF_BIN_FILE=wkhtmltopdf
But then I'm getting the error QXcbConnection: Could not connect to display. I've read in this topic that I should be able to run it with xvfb-run wkhtmltopdf. But where should I add this in the library?
If you check the code of the library in this block of code it looks for the binary filename and the binary file path, which are two seperate things.
So maybe you have to add two env params instead of one:
WKHTML2PDF_BIN_PATH=/usr/bin/
WKHTML2PDF_BIN_FILE=wkhtmltopdf