Please I am trying to use snappy for the first time to allow the user download PDF from my site. I previously used DomPDF but found it not suitable for the current situation. I first installed wkhtmltopdf, then I installed snappy using composer which installed it to c/users/computer-name/vendor (I am very new to composer). I copied the vendor folder to my project directory.
I added the code below;
require __DIR__ . '/vendor/autoload.php';
use Knp\Snappy\Pdf;
$snappy = new Pdf('/usr/local/bin/wkhtmltopdf');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="file.pdf"');
echo $snappy->getOutput('http://www.github.com');
as shown here: https://github.com/knplabs/snappy The PDF downloads but does not open. Chrome says "Failed to load PDF document". When I open the PDF with notepad, I see the error;
Fatal error: Uncaught RuntimeException: The exit status code '1' says something went wrong: stderr: "The system cannot find the path specified. " stdout: "" command: /usr/local/bin/wkhtmltopdf --lowquality "https://www.google.com/" "C:\Users\CHIDIE~1\AppData\Local\Temp\knp_snappy5e42659b757116.59025588.pdf". in C:\xampp\htdocs\corporatecareer\templates\vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php:381
Please help. What are my missing. I know I am doing something wrong.
Thanks.