#1 install
#step1:install wkhtmltopdf
#https://github.com/KnpLabs/snappy#wkhtmltopdf-binary-as-composer-dependencies
composer require h4cc/wkhtmltopdf-amd64 0.12.x
#step2:install laravel-snappy
composer require barryvdh/laravel-snappy
#step3:publish config file
php artisan vendor:publish --provider="Barryvdh\Snappy\ServiceProvider"
#step4:
sudo cp vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 /usr/local/bin/
sudo chmod +x /usr/local/bin/wkhtmltopdf-amd64
#step5: edit config file
'binary' => env('WKHTML_PDF_BINARY', '/usr/local/bin/wkhtmltopdf-amd64'),
#2 errors
QSslSocket: cannot resolve CRYPTO_num_locks QSslSocket: cannot resolve...
sudo apt-get install libssl1.0-dev
Page 1 of 1 Done Exit with code 1 due to network error: ContentNotFoundError " stdout: "" command: /usr/local/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy5ef98e3f80f987.70578050.html' '/tmp/knp_snappy5ef98e3f80ff33.97751263.pdf'.
不要带js文件
中文乱码
# step 下载simsun.ttc字体 http://www.font5.com.cn/zitixiazai/1/150.html
cp public/fonts/simsun.ttc /usr/share/fonts/truetype/