Download the latest version of wkhtlmtopdf from https://wkhtmltopdf.org/downloads.html

Run

composer require barryvdh/laravel-snappy

Copy wkhtmltopdf and mkhtmltoimage binaries to usr/local/bin with

cp vendor/h4cc/wkhtmltoimage-amd64/bin/wkhtmltoimage-amd64 /usr/local/bin/ cp vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 /usr/local/bin/

Change permissions with

chmod +x /usr/local/bin/wkhtmltoimage-amd64 chmod +x /usr/local/bin/wkhtmltopdf-amd64

Ensure you add setOption to

$doc = Pdf::loadHtml($view)->setOption("enable-local-file-access", true)->setPaper('a4')->setOrientation('landscape')->download
($hours->user->name.' - '
        .$week.'.pdf');
Last modified: 02/11/2020

Comments

Write a Reply or Comment

Your email address will not be published.