basdegroot / phpwkhtmltopdflaravel
phpwkhtmltopdf 包的包装器
v1.0.1
2017-11-15 12:21 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-29 04:03:33 UTC
README
此包装器将包含 mikehaertl/phpwkhtmltopdf 库。它将使用laravel的配置函数,并且可以通过.env文件进行配置。所有mikehaertl库函数均可用。https://github.com/mikehaertl/phpwkhtmltopdf
安装
通过 composer 安装此包
composer require basdegroot/phpwkhtmltopdflaravel
配置
可以通过.env文件或通过将配置文件发布到您的项目中来配置应用程序。
发布
php artisan vendor:publish
.env 变量
WKHTMLTOPDF_BINARY = Path to the binary of the WkHtmlToPdf library. Default is 'wkhmltopdf'
WKHTMLTOPDF_INGORE_WARNINGS = Whether to ignore any errors if a PDF file was still created. Default is false
WKHTMLTOPDF_TMP_DIR = Path to tmp directory. Defaults to the PHP temp dir.
响应
该类有一个方法,返回一个包含PDF内容和正确头部的Laravel响应对象
use Basdegroot\PhpwkhtmltopdfLaravel\Pdf;
$pdf = new Pdf('http://www.google.nl');
return $pdf->response();
// or with a filename
return $pdf->response('filename');
Pdf对象扩展了 \mikehaertl\wkhtmlto\Pdf,因此其他所有方法仍然可用。
变更日志
请参阅 CHANGELOG 了解最近更改的信息。