【发布时间】:2015-08-10 12:29:27
【问题描述】:
我正在尝试使用 laravel 5 和 https://github.com/elibyy/laravel-tcpdf 创建一个 pdf
当我的客户填写表格并单击提交时,我有一个 20 页的表格在 laravel Blade 中书写,我想为他生成 pdf 并保存
我尝试在我的控制器中这样做
public function createPDF()
{
$pdf = Input::get('pdf',null);
$company = Input::get('company',null);
$branch = Input::get('branch',null);
$sub_branch = Input::get('sub_branch',null);
$form_type = Input::get('form_type',null);
$form_name = Input::get('form_name',null);
$form_heb_name = Input::get('form_heb_name',null);
$sig_path=FormsController::getSignature_file();
$data=compact('company','branch','sub_branch','form_type','form_name','form_heb_name','sig_path');
Input::flash();
if ($pdf)
{
$pdf = new TCPDF();
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$pdf->writeHTML(view('forms.'.$company.'.'.$branch.'.'.$sub_branch.'.'.$form_type.'.'.$form_name, $data)->render());
$filename = storage_path().'/forms_pdf/10006/26/4718326/'.$form_name.'.pdf';
$pdf->output($filename, 'I');
return redirect('forms');
}
return view('forms.'.$company.'.'.$branch.'.'.$sub_branch.'.'.$form_type.'.'.$form_name , $data);
}
bat 它不起作用,它创建了 2 个所有字段相互重叠的 pdf 页面
如何解决?
另外,我想以无法编辑的方式保存 pdf 文件,我该怎么做?
谢谢。
【问题讨论】:
-
您找到解决方案了吗?
-
不是我使用的 tcpdf link