KnpLabs / snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Home Page:https://knplabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation: wkhtmltoimage-amd64 not found

CitizenBeta opened this issue · comments

Hi, I tried a ton of things and still not able to get it to work:

I installed via composer:

https://github.com/h4cc/wkhtmltopdf-amd64

Here's my controller code:

$snappy = new Pdf('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="file.pdf"');
echo $snappy->getOutput('localhost/schedule');

I get this error:

[2023-09-02 21:54:47] local.ERROR: The exit status code '127' says something went wrong:
stderr: "sh: 1: vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64: not found

Any ideas?

I swear to god I worked on this for like 20 minutes, and as soon as I posted the issue, I thought of needing to use base_path. For anyone else who googles this here ya go:

$snappy = new Pdf(base_path() . '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64');