Php Ignited/Laravel pdf-白色死亡屏幕-无法生成pdf
这可能是一个非常简单的,但我无法让它工作 我想从刀片视图生成PDF 为此,我通过composer安装了:Php Ignited/Laravel pdf-白色死亡屏幕-无法生成pdf,php,pdf,laravel,wkhtmltopdf,Php,Pdf,Laravel,Wkhtmltopdf,这可能是一个非常简单的,但我无法让它工作 我想从刀片视图生成PDF 为此,我通过composer安装了: "ignited/laravel-pdf": "1.*", "h4cc/wkhtmltopdf-i386": "*", "h4cc/wkhtmltopdf-amd64": "*" 我已按照以下方式设置了我的服务提供商和门面: 'Ignited\Pdf\PdfServiceProvider', 'PDF' => 'Igni
"ignited/laravel-pdf": "1.*",
"h4cc/wkhtmltopdf-i386": "*",
"h4cc/wkhtmltopdf-amd64": "*"
我已按照以下方式设置了我的服务提供商和门面:
'Ignited\Pdf\PdfServiceProvider',
'PDF' => 'Ignited\Pdf\Facades\Pdf'
public function getPDF($id)
{
$pdf = PDF::make();
$pdf->addPage('<html><head></head><body><b>Hello World</b></body></html>');
$pdf->send();
}
我已经发布了配置设置并尝试了这两种配置
return array(
# Uncomment for 32-bit systems
'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386'
# Uncomment for 64-bit systems
#'bin' => base_path() . '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
# Add any global Wkhtmltopdf options here
#'no-outline',
#'margin-top' => 0,
#'margin-right' => 0,
#'margin-bottom' => 0,
#'margin-left' => 0,
);
我的控制器如下:
'Ignited\Pdf\PdfServiceProvider',
'PDF' => 'Ignited\Pdf\Facades\Pdf'
public function getPDF($id)
{
$pdf = PDF::make();
$pdf->addPage('<html><head></head><body><b>Hello World</b></body></html>');
$pdf->send();
}
公共函数getPDF($id)
{
$pdf=pdf::make();
$pdf->addPage(“Hello World”);
$pdf->send();
}
但当我访问该页面时,我只看到一个白色屏幕
一旦我最终有Hello World出现,我希望能够将一个视图传递给它以呈现为PDF格式
我的想法是,laravel pdf根本没有做任何事情,就像我在$pdf->send()
之后,当我在浏览器中访问该页面时,我只得到string(8)“hellooo”
有什么想法吗?或者我是超级蠢?你为什么不在app/routes.php文件中试试这个呢
Route::get('pdfhello', function() {
$pdf = PDF::make();
$html = View::make('hello');
$pdf->addPage($html);
$pdf->send('hola.pdf');
});
重要提示:app/view/hello.php中的以下行似乎抛出了死亡的白色屏幕
@导入url(//fonts.googleapis.com/css?family=Lato:700)
可能是一些CSS指令,可能是一些blade指令,导致无法创建pdf文件。是否运行了composer安装和composer转储自动加载?此外,WSOD通常是由于文件系统写入权限问题造成的