如何使用 tcpdf laravel 5 加载刀片视图?

yog*_*evi 1 pdf-generation tcpdf laravel-5

我正在尝试使用 laravel 5 和https://github.com/elibyy/laravel-tcpdf创建 pdf

有没有办法加载视图并将数据传递给视图?

就像是

  $pdf = new TCPDF();  
  $pdf -> SetPrintHeader(false); 
  $pdf -> SetPrintFooter(false); 
  $pdf -> loadView('pdf.invoice',$data); // 
  $pdf -> Output(storage_path().'/pdf/file.pdf', 'I');
Run Code Online (Sandbox Code Playgroud)

谢谢。

Cha*_*ist 5

尝试使用

$pdf->writeHTML(view('your.view')->render());
Run Code Online (Sandbox Code Playgroud)

但是,writeHTML() 方法的功能是有限的,请参阅 TCPDF 文档。

http://www.tcpdf.org/doc/code/classTCPDF.html#ac3fdf25fcd36f1dce04f92187c621407